Skip to content

Commit

Permalink
Change typenames: GitHub.Gist/GistDetail -> GistHub.GistSummary/Gist
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardWolosky committed Jul 20, 2020
1 parent 2fd0540 commit bbef392
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 61 deletions.
16 changes: 16 additions & 0 deletions GitHubGistComments.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ filter Get-GitHubGistComment
If not supplied here, the DefaultNoStatus configuration property value will be used.
.INPUTS
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistComment
Expand Down Expand Up @@ -145,7 +149,11 @@ filter Remove-GitHubGistComment
If not supplied here, the DefaultNoStatus configuration property value will be used.
.INPUTS
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistFork
GitHub.GistSummary
.EXAMPLE
Remove-GitHubGist -Gist 6cad326836d38bd3a7ae -Comment 12324567
Expand Down Expand Up @@ -250,7 +258,11 @@ filter New-GitHubGistComment
If not supplied here, the DefaultNoStatus configuration property value will be used.
.INPUTS
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistComment
Expand Down Expand Up @@ -341,7 +353,11 @@ filter Set-GitHubGistComment
If not supplied here, the DefaultNoStatus configuration property value will be used.
.INPUTS
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistComment
Expand Down
73 changes: 37 additions & 36 deletions GitHubGists.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
@{
GitHubGistTypeName = 'GitHub.Gist'
GitHubGistCommitTypeName = 'GitHub.GistCommit'
GitHubGistDetailTypeName = 'GitHub.GistDetail'
GitHubGistForkTypeName = 'GitHub.GistFork'
GitHubGistSummaryTypeName = 'GitHub.GistSummary'
}.GetEnumerator() | ForEach-Object {
Set-Variable -Scope Script -Option ReadOnly -Name $_.Key -Value $_.Value
}
Expand Down Expand Up @@ -69,14 +69,14 @@ filter Get-GitHubGist
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.Gist
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.EXAMPLE
Get-GitHubGist -Starred
Expand All @@ -98,8 +98,8 @@ filter Get-GitHubGist
PositionalBinding = $false)]
[OutputType({$script:GitHubGistTypeName})]
[OutputType({$script:GitHubGistCommitTypeName})]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistForkTypeName})]
[OutputType({$script:GitHubGistSummaryTypeName})]
param(
[Parameter(
Mandatory,
Expand Down Expand Up @@ -167,7 +167,7 @@ filter Get-GitHubGist

$uriFragment = [String]::Empty
$description = [String]::Empty
$outputType = $script:GitHubGistTypeName
$outputType = $script:GitHubGistSummaryTypeName

if ($PSCmdlet.ParameterSetName -in ('Id', 'Download'))
{
Expand All @@ -186,7 +186,7 @@ filter Get-GitHubGist

$uriFragment = "gists/$Gist/$Sha"
$description = "Getting gist $Gist with specified Sha"
$outputType = $script:GitHubGistDetailTypeName
$outputType = $script:GitHubGistTypeName
}
elseif ($Forks)
{
Expand All @@ -204,7 +204,7 @@ filter Get-GitHubGist
{
$uriFragment = "gists/$Gist"
$description = "Getting gist $Gist"
$outputType = $script:GitHubGistDetailTypeName
$outputType = $script:GitHubGistTypeName
}
}
elseif ($PSCmdlet.ParameterSetName -eq 'User')
Expand All @@ -213,12 +213,12 @@ filter Get-GitHubGist

$uriFragment = "users/$UserName/gists"
$description = "Getting public gists for $UserName"
$outputType = $script:GitHubGistTypeName
$outputType = $script:GitHubGistSummaryTypeName
}
elseif ($PSCmdlet.ParameterSetName -eq 'Current')
{
$telemetryProperties['CurrentUser'] = $true
$outputType = $script:GitHubGistTypeName
$outputType = $script:GitHubGistSummaryTypeName

if ((Test-GitHubAuthenticationConfigured) -or (-not [String]::IsNullOrEmpty($AccessToken)))
{
Expand Down Expand Up @@ -250,7 +250,7 @@ filter Get-GitHubGist
elseif ($PSCmdlet.ParameterSetName -eq 'Public')
{
$telemetryProperties['Public'] = $true
$outputType = $script:GitHubGistTypeName
$outputType = $script:GitHubGistSummaryTypeName

$uriFragment = "gists/public"
$description = 'Getting public gists'
Expand Down Expand Up @@ -456,8 +456,8 @@ filter Remove-GitHubGist
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.EXAMPLE
Remove-GitHubGist -Gist 6cad326836d38bd3a7ae
Expand Down Expand Up @@ -551,11 +551,11 @@ filter Copy-GitHubGist
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.Gist
GitHub.GistSummary
.EXAMPLE
Copy-GitHubGist -Gist 6cad326836d38bd3a7ae
Expand All @@ -571,7 +571,7 @@ filter Copy-GitHubGist
[CmdletBinding(
SupportsShouldProcess,
PositionalBinding = $false)]
[OutputType({$script:GitHubGistTypeName})]
[OutputType({$script:GitHubGistSummaryTypeName})]
[Alias('Fork-GitHubGist')]
param(
[Parameter(
Expand Down Expand Up @@ -605,7 +605,8 @@ filter Copy-GitHubGist
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -BoundParameters $PSBoundParameters -Name NoStatus -ConfigValueName DefaultNoStatus)
}

return (Invoke-GHRestMethod @params | Add-GitHubGistAdditionalProperties)
return (Invoke-GHRestMethod @params |
Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistSummaryTypeName)
}

filter Set-GitHubGistStar
Expand Down Expand Up @@ -640,8 +641,8 @@ filter Set-GitHubGistStar
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.EXAMPLE
Set-GitHubGistStar -Gist 6cad326836d38bd3a7ae -Star
Expand Down Expand Up @@ -720,8 +721,8 @@ filter Add-GitHubGistStar
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.EXAMPLE
Add-GitHubGistStar -Gist 6cad326836d38bd3a7ae
Expand Down Expand Up @@ -801,8 +802,8 @@ filter Remove-GitHubGistStar
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.EXAMPLE
Remove-GitHubGistStar -Gist 6cad326836d38bd3a7ae
Expand Down Expand Up @@ -884,8 +885,8 @@ filter Test-GitHubGistStar
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
Boolean indicating if the gist was both found and determined to be starred.
Expand Down Expand Up @@ -1002,7 +1003,7 @@ filter New-GitHubGist
SupportsShouldProcess,
DefaultParameterSetName='FileRef',
PositionalBinding = $false)]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistTypeName})]
param(
[Parameter(
Mandatory,
Expand Down Expand Up @@ -1107,7 +1108,7 @@ filter New-GitHubGist
}

return (Invoke-GHRestMethod @params |
Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistDetailTypeName)
Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistTypeName)
}
}

Expand Down Expand Up @@ -1159,8 +1160,8 @@ filter Set-GitHubGist
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistDetail
Expand Down Expand Up @@ -1194,7 +1195,7 @@ filter Set-GitHubGist
SupportsShouldProcess,
DefaultParameterSetName='Content',
PositionalBinding = $false)]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistTypeName})]
param(
[Parameter(
Mandatory,
Expand Down Expand Up @@ -1311,7 +1312,7 @@ filter Set-GitHubGist
try
{
return (Invoke-GHRestMethod @params |
Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistDetailTypeName)
Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistTypeName)
}
catch
{
Expand Down Expand Up @@ -1368,11 +1369,11 @@ function Set-GitHubGistFile
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistDetail
GitHub.Gist
.EXAMPLE
Set-GitHubGistFile -Gist 1234567 -Content 'Body of my file.' -FileName 'sample.txt'
Expand All @@ -1396,7 +1397,7 @@ function Set-GitHubGistFile
SupportsShouldProcess,
DefaultParameterSetName='Content',
PositionalBinding = $false)]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistTypeName})]
[Alias('Add-GitHubGistFile')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="This is a helper method for Set-GitHubGist which will handle ShouldProcess.")]
param(
Expand Down Expand Up @@ -1514,11 +1515,11 @@ function Remove-GitHubGistFile
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistDetail
GitHub.Gist
.EXAMPLE
Remove-GitHubGistFile -Gist 1234567 -FileName ('foo.txt')
Expand All @@ -1538,7 +1539,7 @@ function Remove-GitHubGistFile
[CmdletBinding(
SupportsShouldProcess,
PositionalBinding = $false)]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistTypeName})]
[Alias('Delete-GitHubGistFile')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="This is a helper method for Set-GitHubGist which will handle ShouldProcess.")]
param(
Expand Down Expand Up @@ -1631,11 +1632,11 @@ filter Rename-GitHubGistFile
GitHub.Gist
GitHub.GistComment
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
.OUTPUTS
GitHub.GistDetail
GitHub.Gist
.EXAMPLE
Rename-GitHubGistFile -Gist 1234567 -FileName 'foo.txt' -NewName 'bar.txt'
Expand All @@ -1645,7 +1646,7 @@ filter Rename-GitHubGistFile
[CmdletBinding(
SupportsShouldProcess,
PositionalBinding = $false)]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistTypeName})]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="This is a helper method for Set-GitHubGist which will handle ShouldProcess.")]
param(
[Parameter(
Expand Down Expand Up @@ -1704,13 +1705,13 @@ filter Add-GitHubGistAdditionalProperties
.OUTPUTS
GitHub.Gist
GitHub.GistCommit
GitHub.GistDetail
GitHub.GistFork
GitHub.GistSummary
#>
[CmdletBinding()]
[OutputType({$script:GitHubGistTypeName})]
[OutputType({$script:GitHubGistDetailTypeName})]
[OutputType({$script:GitHubGistFormTypeName})]
[OutputType({$script:GitHubGistSummaryTypeName})]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Internal helper that is definitely adding more than one property.")]
param(
[Parameter(
Expand All @@ -1721,7 +1722,7 @@ filter Add-GitHubGistAdditionalProperties
[PSCustomObject[]] $InputObject,

[ValidateNotNullOrEmpty()]
[string] $TypeName = $script:GitHubGistTypeName
[string] $TypeName = $script:GitHubGistSummaryTypeName
)

if ($TypeName -eq $script:GitHubGistCommitTypeName)
Expand Down
Loading

0 comments on commit bbef392

Please sign in to comment.