Skip to content

Commit

Permalink
Long line fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Oct 28, 2023
1 parent 846b9f9 commit a6bcd01
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 22 deletions.
6 changes: 4 additions & 2 deletions src/GitHub/private/Users/Get-GitHubMyUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
Get the authenticated user
.DESCRIPTION
If the authenticated user is authenticated with an OAuth token with the `user` scope, then the response lists public and private profile information.
If the authenticated user is authenticated through OAuth without the `user` scope, then the response lists only public profile information.
If the authenticated user is authenticated with an OAuth token with the `user` scope, then the response lists public
and private profile information.
If the authenticated user is authenticated through OAuth without the `user` scope, then the response lists only public
profile information.
.EXAMPLE
Get-GitHubMyUser
Expand Down
15 changes: 12 additions & 3 deletions src/GitHub/private/Users/Get-GitHubUserByName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@
.DESCRIPTION
Provides publicly available information about someone with a GitHub account.
GitHub Apps with the `Plan` user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "[Identifying and authorizing users for GitHub Apps](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)" for details about authentication. For an example response, see 'Response with GitHub plan information' below"
The `email` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be ΓÇ£publicΓÇ¥ which provides an email entry for this endpoint. If you do not set a public email address for `email`, then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/overview/resources-in-the-rest-api#authentication).
The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "[Emails API](https://docs.github.com/rest/users/emails)".
GitHub Apps with the `Plan` user permission can use this endpoint to retrieve information about a user's GitHub plan.
The GitHub App must be authenticated as a user. See
"[Identifying and authorizing users for GitHub Apps](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)"
for details about authentication. For an example response, see 'Response with GitHub plan information' below"
The `email` key in the following response is the publicly visible email address from your GitHub
[profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email
address to be ΓÇ£publicΓÇ¥ which provides an email entry for this endpoint. If you do not set a public email address for `email`,
then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub.
For more information, see [Authentication](https://docs.github.com/rest/overview/resources-in-the-rest-api#authentication).
The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly.
For more information, see "[Emails API](https://docs.github.com/rest/users/emails)".
.EXAMPLE
Get-GitHubUserByName -Username 'octocat'
Expand All @@ -18,6 +26,7 @@
https://docs.github.com/rest/users/users#get-a-user
#>
[OutputType([pscustomobject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[CmdletBinding()]
param (
# The handle for the GitHub user account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
.DESCRIPTION
Gets extended details for an SSH signing key.
You must authenticate with Basic Authentication, or you must authenticate with OAuth with at least `read:ssh_signing_key` scope. For more information, see "[Understanding scopes for OAuth apps](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/)."
You must authenticate with Basic Authentication, or you must authenticate with OAuth with at least `read:ssh_signing_key` scope.
For more information, see
"[Understanding scopes for OAuth apps](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/)."
.EXAMPLE
Get-GitHubUserMySigningKeyById -ID '1234567'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
'kebab-case' { ($words -join '-').ToLower() }
'snake_case' { ($words -join '_').ToLower() }
'PascalCase' { ($words | ForEach-Object { $_.Substring(0, 1).ToUpper() + $_.Substring(1).ToLower() }) -join '' }
'camelCase' { $words[0].toLower() + (($words | Select-Object -Skip 1 | ForEach-Object { $_.Substring(0, 1).ToUpper() + $_.Substring(1) }) -join '') }
'camelCase' {
$words[0].toLower() + (($words | Select-Object -Skip 1 | ForEach-Object { $_.Substring(0, 1).ToUpper() + $_.Substring(1) }) -join '')
}
'UPPER_SNAKE_CASE' { ($words -join '_').toUpper() }
'UPPER-KEBAB-CASE' { ($words -join '-').toUpper() }
}
Expand Down
10 changes: 7 additions & 3 deletions src/GitHub/private/Utilities/Hashtable/Join-Object.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
Merges two or more objects into a single object
.DESCRIPTION
Merges two or more objects into a single object. The first object is the main object, and the remaining objects are overrides. The overrides are applied in order, so the last object in the list will override any previous values.
Merges two or more objects into a single object.
The first object is the main object, and the remaining objects are overrides.
The overrides are applied in order, so the last object in the list will override any previous values.
.EXAMPLE
$main = [pscustomobject]@{a = 1; b = 2; c = 3}
Expand All @@ -16,7 +18,8 @@
- - - - -
7 8 3 6 9
Merges the three objects into a single object. The values from the last object override the values from the previous objects.
Merges the three objects into a single object.
The values from the last object override the values from the previous objects.
.EXAMPLE
$main = @{a = 1;b = 2}
Expand All @@ -29,7 +32,8 @@
b 2
c 4
Merges the two hashtables into a single hashtable. The values from the last hashtable override the values from the previous hashtables.
Merges the two hashtables into a single hashtable.
The values from the last hashtable override the values from the previous hashtables.
Using the alias 'Merge-Object' instead of 'Join-Object'.
.EXAMPLE
Expand Down
8 changes: 6 additions & 2 deletions src/GitHub/private/Utilities/Web/ConvertTo-QueryString.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@
}

$parameters = if ($AsURLEncoded) {
($InputObject.GetEnumerator() | ForEach-Object { "$([System.Web.HttpUtility]::UrlEncode($_.Key))=$([System.Web.HttpUtility]::UrlEncode($_.Value))" }) -join '&'
($InputObject.GetEnumerator() | ForEach-Object {
"$([System.Web.HttpUtility]::UrlEncode($_.Key))=$([System.Web.HttpUtility]::UrlEncode($_.Value))"
}) -join '&'
} else {
($InputObject.GetEnumerator() | ForEach-Object { "$([System.Uri]::EscapeDataString($_.Key))=$([System.Uri]::EscapeDataString($_.Value))" }) -join '&'
($InputObject.GetEnumerator() | ForEach-Object {
"$([System.Uri]::EscapeDataString($_.Key))=$([System.Uri]::EscapeDataString($_.Value))"
}) -join '&'
}

if ($parameters) {
Expand Down
32 changes: 22 additions & 10 deletions src/GitHub/public/Releases/Assets/Add-GitHubReleaseAsset.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,37 @@
Upload a release asset
.DESCRIPTION
This endpoint makes use of [a Hypermedia relation](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the `upload_url` returned in
the response of the [Create a release endpoint](https://docs.github.com/rest/releases/releases#create-a-release) to upload a release asset.
This endpoint makes use of [a Hypermedia relation](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia)
to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the
`upload_url` returned in
the response of the [Create a release endpoint](https://docs.github.com/rest/releases/releases#create-a-release) to upload
a release asset.
You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to this endpoint.
You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to
this endpoint.
Most libraries will set the required `Content-Length` header automatically. Use the required `Content-Type` header to provide the media type of the asset. For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example:
Most libraries will set the required `Content-Length` header automatically. Use the required `Content-Type` header to provide
the media type of the asset. For a list of media types, see
[Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example:
`application/zip`
GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example,
GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset
as the request body. Everything else about the endpoint is the same as the rest of the API. For example,
you'll still need to pass your authentication to be able to upload an asset.
When an upstream failure occurs, you will receive a `502 Bad Gateway` status. This may leave an empty asset with a state of `starter`. It can be safely deleted.
When an upstream failure occurs, you will receive a `502 Bad Gateway` status. This may leave an empty asset with a state
of `starter`. It can be safely deleted.
**Notes:**
* GitHub renames asset filenames that have special characters, non-alphanumeric characters, and leading or trailing periods. The "[List release assets](https://docs.github.com/rest/releases/assets#list-release-assets)"
endpoint lists the renamed filenames. For more information and help, contact [GitHub Support](https://support.github.com/contact?tags=dotcom-rest-api).
* To find the `release_id` query the [`GET /repos/{owner}/{repo}/releases/latest` endpoint](https://docs.github.com/rest/releases/releases#get-the-latest-release).
* If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete the old file before you can re-upload the new asset.
* GitHub renames asset filenames that have special characters, non-alphanumeric characters, and leading or trailing periods.
The "[List release assets](https://docs.github.com/rest/releases/assets#list-release-assets)"
endpoint lists the renamed filenames. For more information and help, contact
[GitHub Support](https://support.github.com/contact?tags=dotcom-rest-api).
* To find the `release_id` query the
[`GET /repos/{owner}/{repo}/releases/latest` endpoint](https://docs.github.com/rest/releases/releases#get-the-latest-release).
* If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete
the old file before you can re-upload the new asset.
.EXAMPLE
Add-GitHubReleaseAsset -Owner 'octocat' -Repo 'hello-world' -ID '7654321' -FilePath 'C:\Users\octocat\Downloads\hello-world.zip'
Expand Down

0 comments on commit a6bcd01

Please sign in to comment.