Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Oct 26, 2023
1 parent 610a819 commit 30cf03d
Show file tree
Hide file tree
Showing 29 changed files with 106 additions and 58 deletions.
4 changes: 2 additions & 2 deletions src/GitHub/data/Auth.psd1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@{
GitHubApp = @{
GitHubApp = @{
ClientID = 'Iv1.f26b61bc99e69405' # $script:Auth.GitHubApp.ClientID
}
OAuthApp = @{
OAuthApp = @{
ClientID = '7204ae9b0580f2cb8288' # $script:Auth.OAuthApp.ClientID
}
AccessTokenGracePeriodInHours = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
https://docs.github.com/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#device-flow
#>
[OutputType([void])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Is the CLI part of the module.')]
[CmdletBinding()]
param(
# The Client ID of the GitHub App.
Expand Down
20 changes: 10 additions & 10 deletions src/GitHub/private/Config/Initialize-SecretVault.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

function Initialize-SecretVault {
<#
.SYNOPSIS
Initialize a secret vault.
.SYNOPSIS
Initialize a secret vault.
.DESCRIPTION
Initialize a secret vault. If the vault does not exist, it will be created.
.DESCRIPTION
Initialize a secret vault. If the vault does not exist, it will be created.
.EXAMPLE
Initialize-SecretVault -Name 'SecretStore' -Type 'Microsoft.PowerShell.SecretStore'
.EXAMPLE
Initialize-SecretVault -Name 'SecretStore' -Type 'Microsoft.PowerShell.SecretStore'
Initializes a secret vault named 'SecretStore' using the 'Microsoft.PowerShell.SecretStore' module.
Initializes a secret vault named 'SecretStore' using the 'Microsoft.PowerShell.SecretStore' module.
.NOTES
For more information about secret vaults, see https://learn.microsoft.com/en-us/powershell/utility-modules/secretmanagement/overview?view=ps-modules
.NOTES
For more information about secret vaults, see
https://learn.microsoft.com/en-us/powershell/utility-modules/secretmanagement/overview?view=ps-modules
#>

[OutputType([void])]
[CmdletBinding()]
param (
Expand Down
6 changes: 4 additions & 2 deletions src/GitHub/private/Config/Reset-GitHubConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#>
[Alias('Reset-GHConfig')]
[OutputType([void])]
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param(
# Reset the GitHub configuration for a specific scope.
[Parameter()]
Expand Down Expand Up @@ -58,5 +58,7 @@
}
}
}
Set-GitHubConfig @Settings
if ($PSCmdlet.ShouldProcess("Module config", "Reset")) {
Set-GitHubConfig @Settings
}
}
3 changes: 2 additions & 1 deletion src/GitHub/private/Gitignore/Get-GitHubGitignoreList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ filter Get-GitHubGitignoreList {
Get all gitignore templates
.DESCRIPTION
List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user).
List all templates available to pass as an option when
[creating a repository](https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user).
.EXAMPLE
Get-GitHubGitignoreList
Expand Down
1 change: 1 addition & 0 deletions src/GitHub/private/License/Get-GitHubLicenseByName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ filter Get-GitHubLicenseByName {
https://docs.github.com/rest/licenses/licenses#get-a-license
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[CmdletBinding()]
param (
# The license keyword, license name, or license SPDX ID. For example, mit or mpl-2.0.
Expand Down
1 change: 1 addition & 0 deletions src/GitHub/private/License/Get-GitHubLicenseList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ filter Get-GitHubLicenseList {
https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[OutputType([string[]])]
[CmdletBinding()]
param ()
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub/private/License/Get-GitHubRepositoryLicense.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ filter Get-GitHubRepositoryLicense {

Invoke-GitHubAPI @inputObject | ForEach-Object {
$Response = $_.Response
$rawContent = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Response.content))
$rawContent = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Response.content))
$Response | Add-Member -NotePropertyName 'raw_content' -NotePropertyValue $rawContent -Force
$Response
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Block a user from an organization
.DESCRIPTION
Blocks the given user on behalf of the specified organization and returns a 204. If the organization cannot block the given user a 422 is returned.
Blocks the given user on behalf of the specified organization and returns a 204.
If the organization cannot block the given user a 422 is returned.
.EXAMPLE
Block-GitHubUserByOrganization -OrganizationName 'github' -Username 'octocat'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Check if a user is blocked by an organization
.DESCRIPTION
Returns a 204 if the given user is blocked by the given organization. Returns a 404 if the organization is not blocking the user, or if the user account has been identified as spam by GitHub.
Returns a 204 if the given user is blocked by the given organization.
Returns a 404 if the organization is not blocking the user, or if the user account has been identified as spam by GitHub.
.EXAMPLE
Test-GitHubBlockedUserByOrganization -OrganizationName 'PSModule' -Username 'octocat'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
.DESCRIPTION
Lists all organizations, in the order that they were created on GitHub.
**Note:** Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers) to get the URL for the next page of organizations.
**Note:** Pagination is powered exclusively by the `since` parameter.
Use the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers) to get the URL for the next page of organizations.
.EXAMPLE
Get-GitHubAllOrganization -Since 142951047
Expand All @@ -18,6 +19,7 @@
#>
[OutputType([pscustomobject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[CmdletBinding()]
param (
# A organization ID. Only return organizations with an ID greater than this ID.
Expand Down
6 changes: 5 additions & 1 deletion src/GitHub/private/Organization/Get-GitHubMyOrganization.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
**OAuth scope requirements**
This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with `read:org` scope, you can publicize your organization membership with `user` scope, etc.). Therefore, this API requires at least `user` or `read:org` scope. OAuth requests with insufficient scope receive a `403 Forbidden` response.
This only lists organizations that your authorization allows you to operate on
in some way (e.g., you can list teams with `read:org` scope, you can publicize your
organization membership with `user` scope, etc.). Therefore, this API requires at
least `user` or `read:org` scope. OAuth requests with insufficient scope receive a
`403 Forbidden` response.
.EXAMPLE
Get-GitHubMyOrganization
Expand Down
12 changes: 9 additions & 3 deletions src/GitHub/private/Organization/Get-GitHubOrganizationByName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
Get an organization
.DESCRIPTION
To see many of the organization response values, you need to be an authenticated organization owner with the `admin:org` scope. When the value of `two_factor_requirement_enabled` is `true`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://docs.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/).
GitHub Apps with the `Organization plan` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below."
To see many of the organization response values, you need to be an authenticated organization
owner with the `admin:org` scope. When the value of `two_factor_requirement_enabled` is `true`,
the organization requires all members, billing managers, and outside collaborators to enable
[two-factor authentication](https://docs.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/).
GitHub Apps with the `Organization plan` permission can use this endpoint to retrieve information
about an organization's GitHub plan. See
"[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)"
for details. For an example response, see 'Response with GitHub plan information' below."
.EXAMPLE
Get-GitHubOrganizationByName -OrganizationName 'github'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
List organizations for a user
.DESCRIPTION
List [public organization memberships](https://docs.github.com/articles/publicizing-or-concealing-organization-membership) for the specified user.
List [public organization memberships](https://docs.github.com/articles/publicizing-or-concealing-organization-membership)
for the specified user.
This method only lists _public_ memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the [List organizations for the authenticated user](https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user) API instead.
This method only lists _public_ memberships, regardless of authentication.
If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the
[List organizations for the authenticated user](https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user)
API instead.
.EXAMPLE
Get-GitHubUserOrganization -Username 'octocat'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
Get a release asset
.DESCRIPTION
To download the asset's binary content, set the `Accept` header of the request to [`application/octet-stream`](https://docs.github.com/rest/overview/media-types).
The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a `200` or `302` response.
To download the asset's binary content, set the `Accept` header of the request to
[`application/octet-stream`](https://docs.github.com/rest/overview/media-types).
The API will either redirect the client to the location, or stream it directly if
possible. API clients should handle both a `200` or `302` response.
.EXAMPLE
Get-GitHubReleaseAssetByID -Owner 'octocat' -Repo 'hello-world' -ID '1234567'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
.DESCRIPTION
Lists repositories that the authenticated user has explicit permission (`:read`, `:write`, or `:admin`) to access.
The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator,
and repositories that they can access through an organization membership.
The authenticated user has explicit permission to access repositories they own, repositories where
they are a collaborator, and repositories that they can access through an organization membership.
.EXAMPLE
Get-GitHubMyRepositories
Expand All @@ -19,11 +19,21 @@
Gets the private repositories for the authenticated user.
.EXAMPLE
Get-GitHubMyRepositories -Visibility 'public' -Affiliation 'owner','collaborator' -Sort 'created' -Direction 'asc' -PerPage 100 -Since (Get-Date).AddYears(-5) -Before (Get-Date).AddDays(-1)
$param = @{
Visibility = 'public'
Affiliation = 'owner','collaborator'
Sort = 'created'
Direction = 'asc'
PerPage = 100
Since = (Get-Date).AddYears(-5)
Before = (Get-Date).AddDays(-1)
}
Get-GitHubMyRepositories @param
Gets the public repositories for the authenticated user that are owned by the authenticated user or that the authenticated user has been added to as a collaborator.
The results are sorted by creation date in ascending order and the results are limited to 100 repositories.
The results are limited to repositories created between 5 years ago and 1 day ago.
Gets the public repositories for the authenticated user that are owned by the authenticated user
or that the authenticated user has been added to as a collaborator. The results are sorted by
creation date in ascending order and the results are limited to 100 repositories. The results
are limited to repositories created between 5 years ago and 1 day ago.
.EXAMPLE
Get-GitHubMyRepositories -Type 'forks'
Expand All @@ -45,8 +55,8 @@
#>
[CmdletBinding(DefaultParameterSetName = 'Type')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = 'Private function, not exposed to user.')]
param (

# Limit results to repositories with the specified visibility.
[Parameter(
ParameterSetName = 'Aff-Vis'
Expand All @@ -57,7 +67,8 @@
# Comma-separated list of values. Can include:
# - owner: Repositories that are owned by the authenticated user.
# - collaborator: Repositories that the user has been added to as a collaborator.
# - organization_member: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.
# - organization_member: Repositories that the user has access to through being a member of an organization.
# This includes every repository on every team that the user is on.
# Default: owner, collaborator, organization_member
[Parameter(
ParameterSetName = 'Aff-Vis'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case

$inputObject = @{
APIEndpoint = "/user/blocks"
APIEndpoint = '/user/blocks'
Method = 'GET'
Body = $body
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
Check if a user is blocked by the authenticated user
.DESCRIPTION
Returns a 204 if the given user is blocked by the authenticated user. Returns a 404 if the given user is not blocked by the authenticated user, or if the given user account has been identified as spam by GitHub.
Returns a 204 if the given user is blocked by the authenticated user.
Returns a 404 if the given user is not blocked by the authenticated user,
or if the given user account has been identified as spam by GitHub.
.EXAMPLE
Test-GitHubBlockedUserByUser -Username 'octocat'
Expand Down
5 changes: 3 additions & 2 deletions src/GitHub/private/Users/Emails/Get-GitHubUserAllEmail.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
List email addresses for the authenticated user
.DESCRIPTION
Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the `user:email` scope.
Lists all of your email addresses, and specifies which one is visible to the public.
This endpoint is accessible with the `user:email` scope.
.EXAMPLE
Get-GitHubUserAllEmail
Expand All @@ -27,7 +28,7 @@
$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case

$inputObject = @{
APIEndpoint = "/user/emails"
APIEndpoint = '/user/emails'
Method = 'GET'
Body = $body
}
Expand Down
7 changes: 5 additions & 2 deletions src/GitHub/private/Users/Emails/Get-GitHubUserPublicEmail.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
List public email addresses for the authenticated user
.DESCRIPTION
Lists your publicly visible email address, which you can set with the [Set primary email visibility for the authenticated user](https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user) endpoint. This endpoint is accessible with the `user:email` scope.
Lists your publicly visible email address, which you can set with the
[Set primary email visibility for the authenticated user](https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user)
endpoint. This endpoint is accessible with the `user:email` scope.
.EXAMPLE
Get-GitHubUserPublicEmail
Expand All @@ -16,6 +18,7 @@
#>
[OutputType([pscustomobject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Link to documentation.')]
[CmdletBinding()]
param (
# The number of results per page (max 100).
Expand All @@ -27,7 +30,7 @@
$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case

$inputObject = @{
APIEndpoint = "/user/public_emails"
APIEndpoint = '/user/public_emails'
Method = 'GET'
Body = $body
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#>
[OutputType([pscustomobject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = 'Private function, not exposed to user.')]
[CmdletBinding()]
param (
# The number of results per page (max 100).
Expand Down
3 changes: 2 additions & 1 deletion src/GitHub/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.DESCRIPTION
Lists the current user's GPG keys.
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key`
[scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
.EXAMPLE
Get-GitHubUserMyGpgKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.DESCRIPTION
View extended details for a single GPG key.
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key`
[scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
.EXAMPLE
Get-GitHubUserMyGpgKeyById -ID '1234567'
Expand Down
3 changes: 2 additions & 1 deletion src/GitHub/private/Users/Keys/Get-GitHubUserMyKey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.DESCRIPTION
Lists the public SSH keys for the authenticated user's GitHub account.
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:public_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:public_key`
[scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
.EXAMPLE
Get-GitHubUserMyKey
Expand Down
3 changes: 2 additions & 1 deletion src/GitHub/private/Users/Keys/Get-GitHubUserMyKeyById.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.DESCRIPTION
View extended details for a single public SSH key.
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:public_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
Requires that you are authenticated via Basic Auth or via OAuth with at least `read:public_key`
[scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).
.EXAMPLE
Get-GitHubUserMyKeyById -ID '1234567'
Expand Down
Loading

0 comments on commit 30cf03d

Please sign in to comment.