Skip to content

🩹 [Patch]: Rename $inputObject variables to $apiParams in API calls #433

@MariusStorhaug

Description

@MariusStorhaug

Problem

Currently, in several PowerShell functions, the variable name $inputObject is used to represent a hashtable containing parameters for API requests. However, $inputObject typically implies pipeline input rather than API request parameters, making it confusing and misleading for developers maintaining the code.

Example of confusing usage:

$inputObject = @{
    Method      = 'DELETE'
    APIEndpoint = "/orgs/$Name"
    Context     = $Context
}

Invoke-GitHubAPI @inputObject

Proposed Solution

Rename all occurrences of $inputObject used specifically for API request parameter hashtables to $apiParams for clarity and better readability.

After rename, the above code should look like:

$apiParams = @{
    Method      = 'DELETE'
    APIEndpoint = "/orgs/$Name"
    Context     = $Context
}

Invoke-GitHubAPI @apiParams

Scope of Change

  • Change: All occurrences where $inputObject explicitly represents parameters passed to Invoke-GitHubAPI.
  • Do Not Change: Parameters named $InputObject intended for pipeline input objects (such as [Parameter(ValueFromPipeline)]).

Implementation

  • Find and review all scripts/functions that call Invoke-GitHubAPI.
  • Rename relevant $inputObject occurrences to $apiParams.
  • Ensure all unit tests pass after changes to confirm no unintended side effects.

Outcome

Improved code clarity and maintainability, reducing potential confusion for future development and maintenance.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions