diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 index 76d7c219..8dddbb07 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 @@ -18,13 +18,17 @@ filter Get-GitHubGitignoreByName { #> [CmdletBinding()] param ( + [Parameter(Mandatory)] + [string] $Name, + + # The context to run the command in. [Parameter()] - [ValidateNotNullOrEmpty()] - [string] $Name + [string] $Context ) process { $inputObject = @{ + Context = $Context APIEndpoint = "/gitignore/templates/$Name" Accept = 'application/vnd.github.raw+json' Method = 'GET' diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 index d4a7e3ab..8bb6075b 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 @@ -18,9 +18,14 @@ filter Get-GitHubGitignoreList { #> [OutputType([string[]])] [CmdletBinding()] - param () + param ( + # The context to run the command in. + [Parameter()] + [string] $Context + ) $inputObject = @{ + Context = $Context APIEndpoint = '/gitignore/templates' Method = 'GET' } @@ -28,5 +33,4 @@ filter Get-GitHubGitignoreList { Invoke-GitHubAPI @inputObject | ForEach-Object { Write-Output $_.Response } - } diff --git a/src/functions/private/License/Get-GitHubLicenseByName.ps1 b/src/functions/private/License/Get-GitHubLicenseByName.ps1 index b091d721..7c9de267 100644 --- a/src/functions/private/License/Get-GitHubLicenseByName.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseByName.ps1 @@ -20,14 +20,18 @@ filter Get-GitHubLicenseByName { [CmdletBinding()] param ( # The license keyword, license name, or license SPDX ID. For example, mit or mpl-2.0. - [Parameter()] - [ValidateNotNullOrEmpty()] + [Parameter(Mandatory)] [Alias('license')] - [string] $Name + [string] $Name, + + # The context to run the command in. + [Parameter()] + [string] $Context ) process { $inputObject = @{ + Context = $Context APIEndpoint = "/licenses/$Name" Accept = 'application/vnd.github+json' Method = 'GET' @@ -36,6 +40,5 @@ filter Get-GitHubLicenseByName { Invoke-GitHubAPI @inputObject | ForEach-Object { Write-Output $_.Response } - } } diff --git a/src/functions/private/License/Get-GitHubLicenseList.ps1 b/src/functions/private/License/Get-GitHubLicenseList.ps1 index 9caba426..ff60aad0 100644 --- a/src/functions/private/License/Get-GitHubLicenseList.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseList.ps1 @@ -19,9 +19,14 @@ filter Get-GitHubLicenseList { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] [OutputType([string[]])] [CmdletBinding()] - param () + param ( + # The context to run the command in. + [Parameter()] + [string] $Context + ) $inputObject = @{ + Context = $Context APIEndpoint = '/licenses' Method = 'GET' } diff --git a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 index 73a2912e..b1b0674d 100644 --- a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 +++ b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 @@ -21,15 +21,20 @@ filter Get-GitHubRepositoryLicense { [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter(Mandatory)] + [string] $Repo, + + # The context to run the command in. [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo) + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/license" Accept = 'application/vnd.github+json' Method = 'GET' diff --git a/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 index 4097f4bf..5bbbac89 100644 --- a/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 @@ -36,11 +36,15 @@ ValueFromPipeline, ValueFromPipelineByPropertyName )] - [Alias('login')] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$OrganizationName/blocks/$Username" Method = 'PUT' } diff --git a/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 index 4363c6bc..3f787e07 100644 --- a/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 @@ -27,7 +27,11 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $body = @{ @@ -35,6 +39,7 @@ } $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$OrganizationName/blocks" Method = 'GET' Body = $body diff --git a/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 index 7f44bdc3..36a296af 100644 --- a/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 @@ -35,10 +35,15 @@ Mandatory, ValueFromPipelineByPropertyName )] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$OrganizationName/blocks/$Username" Method = 'GET' } diff --git a/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 index 14637373..0beb1ecc 100644 --- a/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 @@ -36,10 +36,15 @@ ValueFromPipelineByPropertyName )] [Alias('login')] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$OrganizationName/blocks/$Username" Method = 'DELETE' } diff --git a/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 b/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 index 630a82bf..9fddb150 100644 --- a/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 @@ -29,7 +29,11 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $body = @{ @@ -38,6 +42,7 @@ } $inputObject = @{ + Context = $Context APIEndpoint = '/organizations' Method = 'GET' Body = $body diff --git a/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 b/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 index eeb37355..08e13e5c 100644 --- a/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 @@ -28,7 +28,11 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $body = @{ @@ -36,6 +40,7 @@ } $inputObject = @{ + Context = $Context APIEndpoint = '/user/orgs' Method = 'GET' Body = $body diff --git a/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 b/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 index 5b2a7868..a53b856b 100644 --- a/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 +++ b/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 @@ -34,11 +34,16 @@ [Alias('login')] [Alias('org')] [Alias('owner')] - [string] $OrganizationName + [string] $OrganizationName, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$OrganizationName" Method = 'GET' } diff --git a/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 b/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 index cd2ea411..ad0d28dc 100644 --- a/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 @@ -30,7 +30,11 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $body = @{ @@ -38,6 +42,7 @@ } $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/orgs" Method = 'GET' Body = $body diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 index e7387d5f..1f54e156 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 @@ -21,20 +21,25 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo), + [Parameter(Mandatory)] + [string] $Repo, # The unique identifier of the asset. [Parameter(Mandatory)] [Alias('asset_id')] - [string] $ID + [string] $ID, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" Method = 'GET' } diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 index ea8dd0bd..f477f998 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 @@ -18,12 +18,12 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo), + [Parameter(Mandatory)] + [string] $Repo, # The unique identifier of the release. [Parameter( @@ -36,13 +36,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/releases/$ID/assets" Method = 'GET' Body = $body diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 index 2ed5b014..a2d142a2 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 @@ -20,23 +20,29 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo), + [Parameter(Mandatory)] + [string] $Repo, # The number of results per page (max 100). [Parameter(ParameterSetName = 'AllUsers')] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/releases" Method = 'GET' Body = $body diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 index ae2cab2e..d122a66b 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 @@ -19,22 +19,25 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo), + [Parameter(Mandatory)] + [string] $Repo, # The unique identifier of the release. - [Parameter( - Mandatory - )] + [Parameter(Mandatory)] [Alias('release_id')] - [string] $ID + [string] $ID, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" Method = 'GET' } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 index db6b659f..ade33c48 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 @@ -18,22 +18,25 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo), + [Parameter(Mandatory)] + [string] $Repo, # The name of the tag to get a release from. - [Parameter( - Mandatory - )] + [Parameter(Mandatory)] [Alias('tag_name')] - [string] $Tag + [string] $Tag, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/releases/tags/$Tag" Method = 'GET' } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 index 013a812c..be539493 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 @@ -20,16 +20,20 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo) + [Parameter(Mandatory)] + [string] $Repo, + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/releases/latest" Method = 'GET' } @@ -37,5 +41,4 @@ Invoke-GitHubAPI @inputObject | ForEach-Object { Write-Output $_.Response } - } diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 index cdff8e23..35ee97b9 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 @@ -20,22 +20,27 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] + [Parameter(Mandatory)] [Alias('org')] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo), + [Parameter(Mandatory)] + [string] $Repo, # The unique identifier of the autolink. [Parameter(Mandatory)] [Alias('autolink_id')] [Alias('ID')] - [int] $AutolinkId + [int] $AutolinkId, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/autolinks/$AutolinkId" Method = 'GET' } diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 index 3edebc52..493affcb 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 @@ -20,16 +20,21 @@ [CmdletBinding()] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] + [Parameter(Mandatory)] [Alias('org')] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. + [Parameter(Mandatory)] + [string] $Repo, + + # The context to run the command in. [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo) + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/autolinks" Method = 'GET' } diff --git a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 index f8b3d881..b3c3445e 100644 --- a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 +++ b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 @@ -50,8 +50,8 @@ # The organization or person who will own the new repository. # To create a new repository in an organization, the authenticated user must be a member of the specified organization. - [Parameter()] - [string] $Organization = (Get-GitHubConfig -Name Owner), + [Parameter(Mandatory)] + [string] $Organization, # The name of the new repository. [Parameter()] @@ -60,34 +60,23 @@ # When forking from an existing repository, fork with only the default branch. [Parameter()] [Alias('default_branch_only')] - [switch] $DefaultBranchOnly + [switch] $DefaultBranchOnly, + + # The context to run the command in. + [Parameter()] + [string] $Context ) if ([string]::IsNullorEmpty($Name)) { - $Name = $ForkRepo + $Name = $Repo } - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' - } + $body = @{ + organization = $Organization + name = $Name + default_branch_only = $DefaultBranchOnly } - - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $body['default_branch_only'] = $DefaultBranchOnly - $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo/forks" Method = 'POST' Body = $body diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 index fa20d132..8affa9ff 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 @@ -105,22 +105,20 @@ # Only show repositories updated before the given time. [Parameter()] - [datetime] $Before + [datetime] $Before, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)]" - $paramDefaultValue = Get-Variable -Name $_.Key -ValueOnly -ErrorAction SilentlyContinue - if (-not $PSBoundParameters.ContainsKey($_.Key) -and ($null -ne $paramDefaultValue)) { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)] - Adding default value" - $PSBoundParameters[$_.Key] = $paramDefaultValue - } - Write-Verbose " - $($PSBoundParameters[$_.Key])" + $body = @{ + type = $Type + sort = $Sort + direction = $Direction + per_page = $PerPage } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Affiliation', 'Since', 'Before' - if ($PSBoundParameters.ContainsKey('Affiliation')) { $body['affiliation'] = $Affiliation -join ',' } @@ -132,6 +130,7 @@ } $inputObject = @{ + Context = $Context APIEndpoint = '/user/repos' Method = 'GET' body = $body diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 index b7f6c642..a051885e 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 @@ -23,16 +23,20 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # The name of the repository without the .git extension. The name is not case sensitive. - [Parameter()] - [string] $Repo = (Get-GitHubContextSetting -Name Repo) + [Parameter(Mandatory)] + [string] $Repo, + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$Owner/$Repo" Method = 'GET' } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 index ab269579..b014cbf8 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 @@ -25,22 +25,19 @@ param ( # A repository ID. Only return repositories with an ID greater than this ID. [Parameter()] - [int] $Since = 0 + [int] $Since = 0, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)]" - $paramDefaultValue = Get-Variable -Name $_.Key -ValueOnly -ErrorAction SilentlyContinue - if (-not $PSBoundParameters.ContainsKey($_.Key) -and ($null -ne $paramDefaultValue)) { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)] - Adding default value" - $PSBoundParameters[$_.Key] = $paramDefaultValue - } - Write-Verbose " - $($PSBoundParameters[$_.Key])" + $body = @{ + since = $Since } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - $inputObject = @{ + Context = $Context APIEndpoint = '/repositories' Method = 'GET' Body = $body diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 index 9e2f108a..30dff204 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 @@ -32,45 +32,44 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [Parameter(Mandatory)] + [string] $Owner, # Specifies the types of repositories you want returned. [Parameter()] - [validateSet('all', 'public', 'private', 'forks', 'sources', 'member')] - [string] $type = 'all', + [ValidateSet('all', 'public', 'private', 'forks', 'sources', 'member')] + [string] $Type = 'all', # The property to sort the results by. [Parameter()] - [validateSet('created', 'updated', 'pushed', 'full_name')] + [ValidateSet('created', 'updated', 'pushed', 'full_name')] [string] $Sort = 'created', # The order to sort by. # Default: asc when using full_name, otherwise desc. [Parameter()] - [validateSet('asc', 'desc')] + [ValidateSet('asc', 'desc')] [string] $Direction, # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)]" - $paramDefaultValue = Get-Variable -Name $_.Key -ValueOnly -ErrorAction SilentlyContinue - if (-not $PSBoundParameters.ContainsKey($_.Key) -and ($null -ne $paramDefaultValue)) { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)] - Adding default value" - $PSBoundParameters[$_.Key] = $paramDefaultValue - } - Write-Verbose " - $($PSBoundParameters[$_.Key])" + $body = @{ + sort = $Sort + type = $Type + direction = $Direction + per_page = $PerPage } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner' - $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$Owner/repos" Method = 'GET' Body = $body diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 index 2b00538b..02402701 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 @@ -56,23 +56,22 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)]" - $paramDefaultValue = Get-Variable -Name $_.Key -ValueOnly -ErrorAction SilentlyContinue - if (-not $PSBoundParameters.ContainsKey($_.Key) -and ($null -ne $paramDefaultValue)) { - Write-Verbose "Parameter: [$($_.Key)] = [$($_.Value)] - Adding default value" - $PSBoundParameters[$_.Key] = $paramDefaultValue - } - Write-Verbose " - $($PSBoundParameters[$_.Key])" + $body = @{ + sort = $Sort + type = $Type + direction = $Direction + per_page = $PerPage } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Username' - $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/repos" Method = 'GET' Body = $body diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 index e5a59dbc..7bc0f43c 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 @@ -50,9 +50,9 @@ # The organization or person who will own the new repository. # To create a new repository in an organization, the authenticated user must be a member of the specified organization. - [Parameter()] + [Parameter(Mandatory)] [Alias('org')] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [string] $Owner, # The name of the new repository. [Parameter(Mandatory)] @@ -70,28 +70,23 @@ # Either true to create a new private repository or false to create a new public one. [Parameter()] - [switch] $Private + [switch] $Private, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' - } + $body = @{ + owner = $Owner + name = $Name + description = $Description + include_all_branches = $IncludeAllBranches + private = $Private } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'TemplateOwner', 'TemplateRepo' -RemoveTypes 'SwitchParameter' - $inputObject = @{ + Context = $Context APIEndpoint = "/repos/$TemplateOwner/$TemplateRepo/generate" Method = 'POST' Body = $body diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 index 1f8c969c..c6bf7c4f 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 @@ -62,9 +62,9 @@ filter New-GitHubRepositoryOrg { [CmdletBinding(SupportsShouldProcess)] param ( # The account owner of the repository. The name is not case sensitive. - [Parameter()] + [Parameter(Mandatory)] [Alias('org')] - [string] $Owner = (Get-GitHubContextSetting -Name Owner), + [string] $Owner, # The name of the repository. [Parameter(Mandatory)] @@ -179,7 +179,11 @@ filter New-GitHubRepositoryOrg { [Parameter()] [ValidateSet('PR_BODY', 'PR_TITLE', 'BLANK')] [Alias('merge_commit_message')] - [string] $MergeCommitMessage + [string] $MergeCommitMessage, + + # The context to run the command in. + [Parameter()] + [string] $Context ) dynamicparam { @@ -246,6 +250,7 @@ filter New-GitHubRepositoryOrg { Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues $inputObject = @{ + Context = $Context APIEndpoint = "/orgs/$Owner/repos" Method = 'POST' Body = $body diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 index 907edfcc..f8c461ce 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 @@ -173,7 +173,11 @@ filter New-GitHubRepositoryUser { [Parameter()] [ValidateSet('PR_BODY', 'PR_TITLE', 'BLANK')] [Alias('merge_commit_message')] - [string] $MergeCommitMessage + [string] $MergeCommitMessage, + + # The context to run the command in. + [Parameter()] + [string] $Context ) dynamicparam { @@ -241,6 +245,7 @@ filter New-GitHubRepositoryUser { Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues $inputObject = @{ + Context = $Context APIEndpoint = '/user/repos' Method = 'POST' Body = $body diff --git a/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 b/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 index 5afca493..38b01fda 100644 --- a/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 @@ -25,10 +25,15 @@ ValueFromPipelineByPropertyName )] [Alias('login')] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/user/blocks/$Username" Method = 'PUT' } diff --git a/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 b/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 index f061a7e1..bfcc8324 100644 --- a/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 @@ -20,12 +20,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/blocks' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 b/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 index 5b7525e3..72f77307 100644 --- a/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 @@ -32,12 +32,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/user/blocks/$Username" Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 b/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 index 6192d8ea..b2cf08da 100644 --- a/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 @@ -25,10 +25,15 @@ ValueFromPipelineByPropertyName )] [Alias('login')] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/user/blocks/$Username" Method = 'DELETE' } diff --git a/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 b/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 index fe6b3739..655d9b1b 100644 --- a/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 +++ b/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 @@ -22,12 +22,18 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 - ) + [int] $PerPage = 30, - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + # The context to run the command in. + [Parameter()] + [string] $Context + ) + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/emails' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 b/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 index fe3cd4d5..0c2be9b0 100644 --- a/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 +++ b/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 @@ -24,12 +24,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/public_emails' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 index 9c7af7ce..08c493e5 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 @@ -30,13 +30,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'username' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/followers" Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 index 7f60cde6..f967759f 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 @@ -21,12 +21,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/following' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 index a6a75fad..b96f1fa5 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 @@ -30,13 +30,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'username' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/following" Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 index 8948c5e3..dcaca7a1 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 @@ -22,12 +22,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/followers' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 index 22be3366..5e679573 100644 --- a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 +++ b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 @@ -24,10 +24,15 @@ Mandatory, ValueFromPipelineByPropertyName )] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/user/following/$Username" Method = 'GET' } diff --git a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 index 2fe83681..08241175 100644 --- a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 +++ b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 @@ -30,10 +30,15 @@ Mandatory, ValueFromPipelineByPropertyName )] - [string] $Follows + [string] $Follows, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/following/$Follows" Method = 'GET' } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 index 458232ac..29c31285 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 @@ -28,13 +28,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'username' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/gpg_keys" Method = 'GET' Body = $body diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 index 55c9e609..f502df28 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 @@ -23,12 +23,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/gpg_keys' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 index 670d5eb2..bc7581bf 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 @@ -25,10 +25,15 @@ Mandatory )] [Alias('gpg_key_id')] - [string] $ID + [string] $ID, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/user/gpg_keys/$ID" Method = 'GET' } diff --git a/src/functions/private/Users/Get-GitHubAllUser.ps1 b/src/functions/private/Users/Get-GitHubAllUser.ps1 index 5e86f7a4..cb77f321 100644 --- a/src/functions/private/Users/Get-GitHubAllUser.ps1 +++ b/src/functions/private/Users/Get-GitHubAllUser.ps1 @@ -28,12 +28,20 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + since = $Since + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/users' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Get-GitHubMyUser.ps1 b/src/functions/private/Users/Get-GitHubMyUser.ps1 index 8bcf609f..d26a76bf 100644 --- a/src/functions/private/Users/Get-GitHubMyUser.ps1 +++ b/src/functions/private/Users/Get-GitHubMyUser.ps1 @@ -19,9 +19,14 @@ #> [OutputType([pscustomobject])] [CmdletBinding()] - param () + param( + # The context to run the command in. + [Parameter()] + [string] $Context + ) $inputObject = @{ + Context = $Context APIEndpoint = '/user' Method = 'GET' } diff --git a/src/functions/private/Users/Get-GitHubUserByName.ps1 b/src/functions/private/Users/Get-GitHubUserByName.ps1 index d60ca0d6..56bc23dc 100644 --- a/src/functions/private/Users/Get-GitHubUserByName.ps1 +++ b/src/functions/private/Users/Get-GitHubUserByName.ps1 @@ -36,10 +36,15 @@ ValueFromPipelineByPropertyName )] [Alias('login')] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username" Method = 'GET' } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 index 9f035a1e..9eaac15c 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 @@ -28,13 +28,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'username' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/keys" Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 index 3ab88f46..b2b45785 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 @@ -23,12 +23,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/keys' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 index 6db617b4..095a07dd 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 @@ -25,10 +25,15 @@ Mandatory )] [Alias('key_id')] - [string] $ID + [string] $ID, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/user/keys/$ID" Method = 'GET' } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 index 2573b342..c6ce732c 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 @@ -23,12 +23,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/ssh_signing_keys' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 index 5620df3e..cf3c4f7b 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 @@ -26,10 +26,15 @@ Mandatory )] [Alias('ssh_signing_key_id')] - [string] $ID + [string] $ID, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/user/ssh_signing_keys/$ID" Method = 'GET' } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 index 87f0590f..50b2c2e7 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 @@ -28,13 +28,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'username' + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/ssh_signing_keys" Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 b/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 index 569e706f..64fb34d1 100644 --- a/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 +++ b/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 @@ -21,12 +21,19 @@ # The number of results per page (max 100). [Parameter()] [ValidateRange(1, 100)] - [int] $PerPage = 30 + [int] $PerPage = 30, + + # The context to run the command in. + [Parameter()] + [string] $Context ) - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case + $body = @{ + per_page = $PerPage + } $inputObject = @{ + Context = $Context APIEndpoint = '/user/social_accounts' Method = 'GET' Body = $body diff --git a/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 b/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 index 12e0c421..5ac6f8aa 100644 --- a/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 +++ b/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 @@ -24,10 +24,15 @@ ValueFromPipelineByPropertyName )] [Alias('login')] - [string] $Username + [string] $Username, + + # The context to run the command in. + [Parameter()] + [string] $Context ) $inputObject = @{ + Context = $Context APIEndpoint = "/users/$Username/social_accounts" Method = 'GET' }