Skip to content

Commit

Permalink
plurals
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Oct 27, 2023
1 parent 8de209b commit c61e453
Show file tree
Hide file tree
Showing 33 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/releases/$ID/assets"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/releases"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Affiliation', 'Since', 'Before'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Affiliation', 'Since', 'Before'

if ($PSBoundParameters.ContainsKey('Affiliation')) {
$body['affiliation'] = $Affiliation -join ','
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner'

$inputObject = @{
APIEndpoint = "/orgs/$Owner/repos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Username'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Username'

$inputObject = @{
APIEndpoint = "/users/$Username/repos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'username'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'username'

$inputObject = @{
APIEndpoint = "/users/$Username/followers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'username'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'username'

$inputObject = @{
APIEndpoint = "/users/$Username/following"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'username'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'username'

$inputObject = @{
APIEndpoint = "/users/$Username/gpg_keys"
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub/private/Users/Keys/Get-GitHubUserKeyForUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'username'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'username'

$inputObject = @{
APIEndpoint = "/users/$Username/keys"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'username'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'username'

$inputObject = @{
APIEndpoint = "/users/$Username/ssh_signing_keys"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
filter Remove-HashtableEntries {
filter Remove-HashtableEntry {
<#
.SYNOPSIS
Remove entries from a hashtable.
Expand All @@ -14,7 +14,7 @@
'Key4' = 'Value4'
'Key5' = ''
}
$Hashtable | Remove-HashtableEntries -NullOrEmptyValues
$Hashtable | Remove-HashtableEntry -NullOrEmptyValues
Remove keys with null or empty values
#>
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub/public/API/Invoke-GitHubAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
'X-GitHub-Api-Version' = $Version
}

Remove-HashTableEntries -Hashtable $headers -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $headers -NullOrEmptyValues

if (-not $URI) {
$URI = ("$ApiBaseUri/" -replace '/$', '') + ("/$ApiEndpoint" -replace '^/', '')
Expand Down Expand Up @@ -133,7 +133,7 @@
OutFile = $DownloadFilePath
}

$APICall | Remove-HashTableEntries -NullOrEmptyValues
$APICall | Remove-HashtableEntry -NullOrEmptyValues

if ($Body) {
# Use body to create the query string for certain situations
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub/public/Config/Set-GitHubConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
$updateSecretMetadata = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable
Write-Verbose "updateSecretMetadata : $($updateSecretMetadata | Out-String)"
Write-Verbose "updateSecretMetadataType : $($updateSecretMetadata.GetType())"
Remove-HashTableEntries -Hashtable $updateSecretMetadata -KeepTypes $keepTypes -RemoveNames $removeKeys
Remove-HashtableEntry -Hashtable $updateSecretMetadata -KeepTypes $keepTypes -RemoveNames $removeKeys
Write-Verbose "updateSecretMetadata : $($updateSecretMetadata | Out-String)"

$newSecretMetadata = Join-Object -Main $newSecretMetadata -Overrides $updateSecretMetadata -AsHashtable
Expand Down Expand Up @@ -147,7 +147,7 @@
$updateSecretMetadata = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable
Write-Verbose "updateSecretMetadata : $($updateSecretMetadata | Out-String)"
Write-Verbose "updateSecretMetadataType : $($updateSecretMetadata.GetType())"
Remove-HashTableEntries -Hashtable $updateSecretMetadata -KeepTypes $keepTypes -RemoveNames $removeKeys
Remove-HashtableEntry -Hashtable $updateSecretMetadata -KeepTypes $keepTypes -RemoveNames $removeKeys
Write-Verbose "updateSecretMetadata : $($updateSecretMetadata | Out-String)"

$newSecretMetadata = Join-Object -Main $newSecretMetadata -Overrides $updateSecretMetadata -AsHashtable
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub/public/Organization/Set-GitHubOrganization.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashTableEntries -Hashtable $body -RemoveNames 'organization_name'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'organization_name'

$inputObject = @{
APIEndpoint = "/orgs/$OrganizationName"
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub/public/Releases/Assets/Add-GitHubReleaseAsset.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID', 'FilePath'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID', 'FilePath'

$body['name'] = $Name
$body['label'] = $Label

Remove-HashtableEntries -Hashtable $body -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues

$release = Get-GitHubRelease -Owner $Owner -Repo $Repo -ID $ID
$uploadURI = $release.upload_url -replace '{\?name,label}', "?name=$($Name)&label=$($Label)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID"
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub/public/Releases/Releases/New-GitHubRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@
)

$requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'GenerateReleaseNotes', 'Draft', 'Prerelease'
Remove-HashtableEntry -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'GenerateReleaseNotes', 'Draft', 'Prerelease'
$requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{
generate_release_notes = $GenerateReleaseNotes.IsPresent
draft = $Draft.IsPresent
prerelease = $Prerelease.IsPresent
}
Remove-HashtableEntries -Hashtable $requestBody -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $requestBody -NullOrEmptyValues

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/releases"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/releases/generate-notes"
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub/public/Releases/Releases/Set-GitHubRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
)

$requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'Draft', 'Prerelease'
Remove-HashtableEntry -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'Draft', 'Prerelease'
$requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{
draft = $Draft.IsPresent ? $Draft : $false
prerelease = $Prerelease.IsPresent ? $Prerelease : $false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
Since = $Since
Before = $Before
}
Remove-HashTableEntries -Hashtable $params -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues
Get-GitHubMyRepositories @params
}
'MyRepos_Aff-Vis' {
Expand All @@ -182,22 +182,22 @@
Since = $Since
Before = $Before
}
Remove-HashTableEntries -Hashtable $params -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues
Get-GitHubMyRepositories @params
}
'ByName' {
$params = @{
Owner = $Owner
Repo = $Repo
}
Remove-HashTableEntries -Hashtable $params -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues
Get-GitHubRepositoryByName @params
}
'ListByID' {
$params = @{
Since = $SinceID
}
Remove-HashTableEntries -Hashtable $params -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues
Get-GitHubRepositoryListByID @params
}
'ListByOrg' {
Expand All @@ -208,7 +208,7 @@
Direction = $Direction
PerPage = $PerPage
}
Remove-HashTableEntries -Hashtable $params -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues
Get-GitHubRepositoryListByOrg @params
}
'ListByUser' {
Expand All @@ -219,7 +219,7 @@
Direction = $Direction
PerPage = $PerPage
}
Remove-HashTableEntries -Hashtable $params -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues
Get-GitHubRepositoryListByUser @params
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/activity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner','Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner','Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/codeowners/errors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/contributors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/tags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/teams"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner','Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner','Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/topics"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner','Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner','Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/transfer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner' -RemoveTypes 'SwitchParameter'

$body['private'] = $Visibility -eq 'private'
$body['has_issues'] = $HasIssues.IsPresent ? $HasIssues : $false
Expand All @@ -241,7 +241,7 @@
$body['allow_auto_merge'] = $AllowAutoMerge.IsPresent ? $AllowAutoMerge : $false
$body['delete_branch_on_merge'] = $DeleteBranchOnMerge.IsPresent ? $DeleteBranchOnMerge : $false

Remove-HashtableEntries -Hashtable $body -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues

$inputObject = @{
APIEndpoint = "/orgs/$Owner/repos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
}

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'visibility' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'visibility' -RemoveTypes 'SwitchParameter'

$body['private'] = $Visibility -eq 'private'
$body['has_issues'] = $HasIssues.IsPresent ? $HasIssues : $false
Expand All @@ -236,7 +236,7 @@
$body['allow_auto_merge'] = $AllowAutoMerge.IsPresent ? $AllowAutoMerge : $false
$body['delete_branch_on_merge'] = $DeleteBranchOnMerge.IsPresent ? $DeleteBranchOnMerge : $false

Remove-HashtableEntries -Hashtable $body -NullOrEmptyValues
Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues

$inputObject = @{
APIEndpoint = '/user/repos'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntries -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$body.names = $body.names | ForEach-Object { $_.ToLower() }

Expand Down

0 comments on commit c61e453

Please sign in to comment.