From bbef392971d38b45caab2b5df7054081905ad521 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Sat, 18 Jul 2020 12:25:38 -0700 Subject: [PATCH] Change typenames: GitHub.Gist/GistDetail -> GistHub.GistSummary/Gist --- GitHubGistComments.ps1 | 16 ++++++++ GitHubGists.ps1 | 73 +++++++++++++++++++------------------ Tests/GitHubGists.tests.ps1 | 50 ++++++++++++------------- 3 files changed, 78 insertions(+), 61 deletions(-) diff --git a/GitHubGistComments.ps1 b/GitHubGistComments.ps1 index 283b10a3..b8d43b31 100644 --- a/GitHubGistComments.ps1 +++ b/GitHubGistComments.ps1 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/GitHubGists.ps1 b/GitHubGists.ps1 index 854c1354..d357bc49 100644 --- a/GitHubGists.ps1 +++ b/GitHubGists.ps1 @@ -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 } @@ -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 @@ -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, @@ -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')) { @@ -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) { @@ -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') @@ -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))) { @@ -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' @@ -456,8 +456,8 @@ filter Remove-GitHubGist GitHub.Gist GitHub.GistComment GitHub.GistCommit - GitHub.GistDetail GitHub.GistFork + GitHub.GistSummary .EXAMPLE Remove-GitHubGist -Gist 6cad326836d38bd3a7ae @@ -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 @@ -571,7 +571,7 @@ filter Copy-GitHubGist [CmdletBinding( SupportsShouldProcess, PositionalBinding = $false)] - [OutputType({$script:GitHubGistTypeName})] + [OutputType({$script:GitHubGistSummaryTypeName})] [Alias('Fork-GitHubGist')] param( [Parameter( @@ -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 @@ -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 @@ -720,8 +721,8 @@ filter Add-GitHubGistStar GitHub.Gist GitHub.GistComment GitHub.GistCommit - GitHub.GistDetail GitHub.GistFork + GitHub.GistSummary .EXAMPLE Add-GitHubGistStar -Gist 6cad326836d38bd3a7ae @@ -801,8 +802,8 @@ filter Remove-GitHubGistStar GitHub.Gist GitHub.GistComment GitHub.GistCommit - GitHub.GistDetail GitHub.GistFork + GitHub.GistSummary .EXAMPLE Remove-GitHubGistStar -Gist 6cad326836d38bd3a7ae @@ -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. @@ -1002,7 +1003,7 @@ filter New-GitHubGist SupportsShouldProcess, DefaultParameterSetName='FileRef', PositionalBinding = $false)] - [OutputType({$script:GitHubGistDetailTypeName})] + [OutputType({$script:GitHubGistTypeName})] param( [Parameter( Mandatory, @@ -1107,7 +1108,7 @@ filter New-GitHubGist } return (Invoke-GHRestMethod @params | - Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistDetailTypeName) + Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistTypeName) } } @@ -1159,8 +1160,8 @@ filter Set-GitHubGist GitHub.Gist GitHub.GistComment GitHub.GistCommit - GitHub.GistDetail GitHub.GistFork + GitHub.GistSummary .OUTPUTS GitHub.GistDetail @@ -1194,7 +1195,7 @@ filter Set-GitHubGist SupportsShouldProcess, DefaultParameterSetName='Content', PositionalBinding = $false)] - [OutputType({$script:GitHubGistDetailTypeName})] + [OutputType({$script:GitHubGistTypeName})] param( [Parameter( Mandatory, @@ -1311,7 +1312,7 @@ filter Set-GitHubGist try { return (Invoke-GHRestMethod @params | - Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistDetailTypeName) + Add-GitHubGistAdditionalProperties -TypeName $script:GitHubGistTypeName) } catch { @@ -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' @@ -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( @@ -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') @@ -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( @@ -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' @@ -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( @@ -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( @@ -1721,7 +1722,7 @@ filter Add-GitHubGistAdditionalProperties [PSCustomObject[]] $InputObject, [ValidateNotNullOrEmpty()] - [string] $TypeName = $script:GitHubGistTypeName + [string] $TypeName = $script:GitHubGistSummaryTypeName ) if ($TypeName -eq $script:GitHubGistCommitTypeName) diff --git a/Tests/GitHubGists.tests.ps1 b/Tests/GitHubGists.tests.ps1 index a1ac628e..bc59b974 100644 --- a/Tests/GitHubGists.tests.ps1 +++ b/Tests/GitHubGists.tests.ps1 @@ -128,7 +128,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' $gist.history[0].PSObject.TypeNames[0] | Should -Be 'GitHub.GistCommit' @@ -169,7 +169,7 @@ try } It 'Should have the expected type and additional properties' { - $firstGistCommit.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $firstGistCommit.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $firstGistCommit.GistId | Should -Be $firstGistCommit.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' $gist.history[0].PSObject.TypeNames[0] | Should -Be 'GitHub.GistCommit' @@ -232,7 +232,7 @@ try It 'Should have the expected type and additional properties' { foreach ($gist in $gists) { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistSummary' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -257,7 +257,7 @@ try It 'Should have the expected type and additional properties' { foreach ($gist in $gists) { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistSummary' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -472,7 +472,7 @@ try } It 'Should have the expected additional type and properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistSummary' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -496,7 +496,7 @@ try } It 'Should have the expected additional type and properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistSummary' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -595,7 +595,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -612,7 +612,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -659,7 +659,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -767,7 +767,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -829,7 +829,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -873,7 +873,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -885,7 +885,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -904,7 +904,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -916,7 +916,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -950,7 +950,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -964,7 +964,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -998,7 +998,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1012,7 +1012,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1046,7 +1046,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1060,7 +1060,7 @@ try } It 'Should have the expected type and additional properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1093,7 +1093,7 @@ try } It 'Should have the expected additional type and properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1117,7 +1117,7 @@ try } It 'Should have the expected additional type and properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1146,7 +1146,7 @@ try } It 'Should have the expected additional type and properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' } @@ -1168,7 +1168,7 @@ try } It 'Should have the expected additional type and properties' { - $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.GistDetail' + $gist.PSObject.TypeNames[0] | Should -Be 'GitHub.Gist' $gist.GistId | Should -Be $gist.id $gist.owner.PSObject.TypeNames[0] | Should -Be 'GitHub.User' }