Skip to content

Commit 12288bd

Browse files
🩹 [Patch]: Rename $inputObject variables to $apiParams in API calls (#464)
This PR improves code clarity by renaming misleading variable names in API parameter hashtables throughout the codebase. - Fixes #433 ## Problem Previously, the variable `$inputObject` was used to represent hashtables 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:** ```powershell $inputObject = @{ Method = 'DELETE' APIEndpoint = "/orgs/$Name" Context = $Context } Invoke-GitHubAPI @InputObject ``` ## Solution Renamed all occurrences of `$inputObject` used specifically for API request parameter hashtables to `$apiParams` for clarity and better readability. **After the change:** ```powershell $apiParams = @{ Method = 'DELETE' APIEndpoint = "/orgs/$Name" Context = $Context } Invoke-GitHubAPI @apiParams ``` ## Changes Made - **Files Modified:** 211 files total - **REST API calls:** 202 files with `Invoke-GitHubAPI @inputObject` → `Invoke-GitHubAPI @apiParams` - **GraphQL calls:** 9 files with `Invoke-GitHubGraphQLQuery @inputObject` → `Invoke-GitHubGraphQLQuery @apiParams` - **Lines Changed:** 595 insertions, 595 deletions (pure variable renaming) ## Scope ✅ **Changed**: All occurrences where `$inputObject` explicitly represents parameters passed to `Invoke-GitHubAPI` or `Invoke-GitHubGraphQLQuery` ✅ **Preserved**: Parameters named `$InputObject` intended for pipeline input objects (such as `[Parameter(ValueFromPipeline)]`) ## Validation - All PowerShell syntax validation passes - Pipeline parameters correctly preserved (e.g., `[GitHubVariable[]] $InputObject` in `Remove-GitHubVariable`) - Zero remaining `$inputObject` variables used with API calls - No functional changes - pure variable renaming ## Outcome Improved code clarity and maintainability, reducing potential confusion for future development and maintenance by clearly distinguishing API parameter hashtables from pipeline input parameters. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> Co-authored-by: Marius Storhaug <marstor@hotmail.com>
1 parent c593843 commit 12288bd

File tree

215 files changed

+461
-461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+461
-461
lines changed

‎examples/Organizations/Organization.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$orgParam = @{
1+
$orgParam = @{
22
Enterprise = 'msx'
33
Name = 'Marius-Test7'
44
Owner = 'GitHub-Automation'

‎examples/Repositories/Set-GitHubRepository.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$params = @{
1+
$params = @{
22
Owner = 'octocat'
33
Name = 'Hello-World'
44
AllowSquashMergingWith = 'Pull request title and description'

‎src/classes/public/App/GitHubApp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class GitHubApp : GitHubNode {
1+
class GitHubApp : GitHubNode {
22
# The unique ID of the app
33
[System.Nullable[UInt64]] $ID
44

‎src/functions/private/Actions/Workflow Run/Get-GitHubWorkflowRunByRepo.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
filter Get-GitHubWorkflowRunByRepo {
1+
filter Get-GitHubWorkflowRunByRepo {
22
<#
33
.SYNOPSIS
44
List workflow runs for a repository.
@@ -108,15 +108,15 @@ filter Get-GitHubWorkflowRunByRepo {
108108
}
109109
$body | Remove-HashtableEntry -NullOrEmptyValues
110110

111-
$inputObject = @{
111+
$apiParams = @{
112112
Method = 'GET'
113113
APIEndpoint = "/repos/$Owner/$Repository/actions/runs"
114114
Body = $body
115115
PerPage = $PerPage
116116
Context = $Context
117117
}
118118

119-
Invoke-GitHubAPI @inputObject | ForEach-Object {
119+
Invoke-GitHubAPI @apiParams | ForEach-Object {
120120
$_.Response.workflow_runs | ForEach-Object {
121121
[GitHubWorkflowRun]::new($_)
122122
}

‎src/functions/private/Actions/Workflow Run/Get-GitHubWorkflowRunByWorkflow.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@
113113
}
114114
$body | Remove-HashtableEntry -NullOrEmptyValues
115115

116-
$inputObject = @{
116+
$apiParams = @{
117117
Context = $Context
118118
APIEndpoint = "/repos/$Owner/$Repository/actions/workflows/$ID/runs"
119119
Method = 'GET'
120120
PerPage = $PerPage
121121
Body = $body
122122
}
123123

124-
Invoke-GitHubAPI @inputObject | ForEach-Object {
124+
Invoke-GitHubAPI @apiParams | ForEach-Object {
125125
$_.Response.workflow_runs | ForEach-Object {
126126
[GitHubWorkflowRun]::new($_)
127127
}

‎src/functions/private/Apps/GitHub Apps/Get-GitHubAppBySlug.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
}
3636

3737
process {
38-
$inputObject = @{
38+
$apiParams = @{
3939
Method = 'GET'
4040
APIEndpoint = "/apps/$Slug"
4141
Context = $Context
4242
}
4343

44-
Invoke-GitHubAPI @inputObject | ForEach-Object {
44+
Invoke-GitHubAPI @apiParams | ForEach-Object {
4545
[GitHubApp]::new($_.Response)
4646
}
4747
}

‎src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
}
4444

4545
process {
46-
$inputObject = @{
46+
$apiParams = @{
4747
Method = 'GET'
4848
APIEndpoint = "/enterprises/$Enterprise/apps/installable_organizations"
4949
PerPage = $PerPage
5050
Context = $Context
5151
}
5252

53-
Invoke-GitHubAPI @inputObject | ForEach-Object {
53+
Invoke-GitHubAPI @apiParams | ForEach-Object {
5454
foreach ($organization in $_.Response) {
5555
[GitHubOrganization]::new($organization, $Context)
5656
}

‎src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallationForAuthenticatedApp.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
}
4040

4141
process {
42-
$inputObject = @{
42+
$apiParams = @{
4343
Method = 'GET'
4444
APIEndpoint = '/app/installations'
4545
PerPage = $PerPage
4646
Context = $Context
4747
}
4848

49-
Invoke-GitHubAPI @inputObject | ForEach-Object {
49+
Invoke-GitHubAPI @apiParams | ForEach-Object {
5050
foreach ($installation in $_.Response) {
5151
[GitHubAppInstallation]::new($installation)
5252
}

‎src/functions/private/Apps/GitHub Apps/Get-GitHubAuthenticatedApp.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
}
3636

3737
process {
38-
$inputObject = @{
38+
$apiParams = @{
3939
Method = 'GET'
4040
APIEndpoint = '/app'
4141
Context = $Context
4242
}
4343

44-
Invoke-GitHubAPI @inputObject | ForEach-Object {
44+
Invoke-GitHubAPI @apiParams | ForEach-Object {
4545
[GitHubApp]::new($_.Response)
4646
}
4747
}

‎src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
}
5454

5555
process {
56-
$inputObject = @{
56+
$apiParams = @{
5757
Method = 'GET'
5858
APIEndpoint = "/enterprises/$Enterprise/apps/organizations/$Organization/installations"
5959
PerPage = $PerPage
6060
Context = $Context
6161
}
6262

63-
Invoke-GitHubAPI @inputObject | ForEach-Object {
63+
Invoke-GitHubAPI @apiParams | ForEach-Object {
6464
foreach ($installation in $_.Response) {
6565
[GitHubAppInstallation]::new($installation, $Organization, 'Organization', $Context)
6666
}

0 commit comments

Comments
 (0)