From 560ac0a4648cfe33ea47f0144b144e5aa4a7189c Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Fri, 22 Sep 2017 17:19:53 -0700 Subject: [PATCH 01/11] Introduce Get-GitHubIssue The initial implementation covers all forms of the issues query: - "/issues" - "/user/issues" - "/orgs/{org}/issues" - "repos/{owner}/{repo}/issues" ... but it does not yet support limiting the results by state, label, filter, etc. --- Functions/Public/Get-GitHubIssue.ps1 | 82 ++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Functions/Public/Get-GitHubIssue.ps1 diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 new file mode 100644 index 0000000..8c2bcba --- /dev/null +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -0,0 +1,82 @@ +function Get-GitHubIssue { + <# + .SYNOPSIS + Gets GitHub issues. + + .DESCRIPTION + This command retrieves GitHub issues either for the authenticated user or from + a specified repository. + + .Parameter All + Retrieve "all issues assigned to the authenticated user across all visible + repositories including owned repositories, member repositories, and organization + repositories" (https://developer.github.com/v3/issues/). + + .PARAMETER ForUser + Retrieve issues assigned to the authenticated user in those repos owned by + the authenticated user, or of which the authenticated user is a member. + + .PARAMETER Organization + Retrieve issues assigned to the authenticated user in repos belonging to the + specified organization. + + .PARAMETER Owner + The GitHub username of the account or organization that owns the GitHub repository + specified in the -Repository parameter. + + .PARAMETER Repository + Retrieve all open issues from the GitHub repository with the specified name, + owned by the GitHub user specified by -Owner. + + .EXAMPLE + # Retrieve all issues for the authenticated user, including issues from + # owned, member, and organization repositories: + Get-GitHubIssue -All + + .EXAMPLE + # Retrieve issues for the authenticated user, including only issues from + # owned and member repositories. + Get-GitHubIssue -ForUser + + .EXAMPLE + # Retrieve issues assigned to the authenticated user in repos owned by + # the organization ExampleOrg: + Get-GitHubIssue -Organization ExampleOrg + + .EXAMPLE + # Retrieve all issues in the repository Mary/WebApps: + Get-GitHubIssue -Owner Mary -Repository WebApps + + #> + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = 'All')] + [switch] $All + , [Parameter(Mandatory = $true, ParameterSetName = 'ForUser')] + [switch] $ForUser + , [Parameter(Mandatory = $true, ParameterSetName = 'Organization')] + [string] $Organization + , [Parameter(Mandatory = $true, ParameterSetName = 'Repository')] + [Alias('User')] + [string] $Owner + , [Parameter(Mandatory = $true, ParameterSetName = 'Repository')] + [string] $Repository + ) + + if ($Repository) { + $RestMethod = 'repos/{0}/{1}/issues' -f $Owner, $Repository + } elseif ($Organization) { + $RestMethod = 'orgs/{0}/issues' -f $Organization + } elseif ($ForUser) { + $RestMethod = 'user/issues' + } else { + $RestMethod = 'issues' + } + + $apiCall = @{ + Method = 'Get'; + RestMethod = $RestMethod + } + + Invoke-GitHubApi @apiCall +} \ No newline at end of file From adebd4a502d205c2d3d8975fb8168122ebf5b11a Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 06:59:20 -0700 Subject: [PATCH 02/11] Get-GitHubIssues: Support state query parameter --- Functions/Public/Get-GitHubIssue.ps1 | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 8c2bcba..3088175 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -28,25 +28,33 @@ function Get-GitHubIssue { Retrieve all open issues from the GitHub repository with the specified name, owned by the GitHub user specified by -Owner. + .PARAMETER State + Limit the results to issues with the specified state. Valid values: open, + closed, all. If not specified, the REST API returns only open issues. + .EXAMPLE - # Retrieve all issues for the authenticated user, including issues from + # Retrieve all open issues for the authenticated user, including issues from # owned, member, and organization repositories: Get-GitHubIssue -All .EXAMPLE - # Retrieve issues for the authenticated user, including only issues from + # Retrieve open issues for the authenticated user, including only issues from # owned and member repositories. Get-GitHubIssue -ForUser .EXAMPLE - # Retrieve issues assigned to the authenticated user in repos owned by + # Retrieve open issues assigned to the authenticated user in repos owned by # the organization ExampleOrg: Get-GitHubIssue -Organization ExampleOrg .EXAMPLE - # Retrieve all issues in the repository Mary/WebApps: + # Retrieve all open issues in the repository Mary/WebApps: Get-GitHubIssue -Owner Mary -Repository WebApps + .EXAMPLE + # Retrieve all issues (both open and closed) in the repository Mary/WebApps: + Get-GitHubIssue -Owner Mary -Repository WebApps -State all + #> [CmdletBinding()] param ( @@ -61,6 +69,9 @@ function Get-GitHubIssue { [string] $Owner , [Parameter(Mandatory = $true, ParameterSetName = 'Repository')] [string] $Repository + , [Parameter()] + [ValidateSet('open', 'closed', 'all')] + [string] $State ) if ($Repository) { @@ -73,6 +84,15 @@ function Get-GitHubIssue { $RestMethod = 'issues' } + $queryParameters = @() + if ($State) { + $queryParameters += "state=$State" + } + + if ($queryParameters) { + $RestMethod += "?" + $queryParameters -join "&" + } + $apiCall = @{ Method = 'Get'; RestMethod = $RestMethod From 6108a8591bdd2a76670c28635dd9952f9fb586e6 Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 07:20:43 -0700 Subject: [PATCH 03/11] Get-GitHubIssues: support labels query parameter --- Functions/Public/Get-GitHubIssue.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 3088175..8d8b89a 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -32,6 +32,10 @@ function Get-GitHubIssue { Limit the results to issues with the specified state. Valid values: open, closed, all. If not specified, the REST API returns only open issues. + .PARAMETER Labels + Limit the results to issues with all of of the specified, comma-separated + list of labels. + .EXAMPLE # Retrieve all open issues for the authenticated user, including issues from # owned, member, and organization repositories: @@ -72,6 +76,8 @@ function Get-GitHubIssue { , [Parameter()] [ValidateSet('open', 'closed', 'all')] [string] $State + , [Parameter()] + [string[]] $Labels ) if ($Repository) { @@ -89,8 +95,12 @@ function Get-GitHubIssue { $queryParameters += "state=$State" } + if ($Labels) { + $queryParameters += "labels=" + ($Labels -join ',') + } + if ($queryParameters) { - $RestMethod += "?" + $queryParameters -join "&" + $RestMethod += "?" + ($queryParameters -join '&') } $apiCall = @{ From 9435ef7caa038bd72b90b49ded2cf8cf36dc7f9f Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 07:28:46 -0700 Subject: [PATCH 04/11] Get-GitHubIssues: support sort query parameter --- Functions/Public/Get-GitHubIssue.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 8d8b89a..43e17a6 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -30,12 +30,16 @@ function Get-GitHubIssue { .PARAMETER State Limit the results to issues with the specified state. Valid values: open, - closed, all. If not specified, the REST API returns only open issues. + closed, all. Default: open. .PARAMETER Labels Limit the results to issues with all of of the specified, comma-separated list of labels. + .PARAMETER Sort + What to sort results by. Valid values: created, updated, comments. + Default: created. + .EXAMPLE # Retrieve all open issues for the authenticated user, including issues from # owned, member, and organization repositories: @@ -78,6 +82,9 @@ function Get-GitHubIssue { [string] $State , [Parameter()] [string[]] $Labels + , [Parameter()] + [ValidateSet('created', 'updated', 'comments')] + [string] $Sort ) if ($Repository) { @@ -99,6 +106,10 @@ function Get-GitHubIssue { $queryParameters += "labels=" + ($Labels -join ',') } + if ($Sort) { + $queryParameters += "sort=$Sort" + } + if ($queryParameters) { $RestMethod += "?" + ($queryParameters -join '&') } From 38ad05660f60483902a6c20ec9d249d85dcf1588 Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 07:37:50 -0700 Subject: [PATCH 05/11] Get-GitHubIssues: support direction query parameter --- Functions/Public/Get-GitHubIssue.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 43e17a6..19f9333 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -40,6 +40,9 @@ function Get-GitHubIssue { What to sort results by. Valid values: created, updated, comments. Default: created. + .PARAMETER Direction + The direction to sort. Valid values: asc, desc. Default: desc + .EXAMPLE # Retrieve all open issues for the authenticated user, including issues from # owned, member, and organization repositories: @@ -85,6 +88,9 @@ function Get-GitHubIssue { , [Parameter()] [ValidateSet('created', 'updated', 'comments')] [string] $Sort + , [Parameter()] + [ValidateSet('asc', 'desc')] + [string] $Direction ) if ($Repository) { @@ -110,6 +116,10 @@ function Get-GitHubIssue { $queryParameters += "sort=$Sort" } + if ($Direction) { + $queryParameters += "direction=$Direction" + } + if ($queryParameters) { $RestMethod += "?" + ($queryParameters -join '&') } From 81a5a61e8a2bd6c566ccf6863845421967dc965f Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 08:51:15 -0700 Subject: [PATCH 06/11] Get-GitHubIssue: support since query parameter --- Functions/Public/Get-GitHubIssue.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 19f9333..74d7baf 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -43,6 +43,10 @@ function Get-GitHubIssue { .PARAMETER Direction The direction to sort. Valid values: asc, desc. Default: desc + .PARAMETER Since + Limit the results to issues updated at or after the specified time. The time + is specified in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ + .EXAMPLE # Retrieve all open issues for the authenticated user, including issues from # owned, member, and organization repositories: @@ -91,6 +95,8 @@ function Get-GitHubIssue { , [Parameter()] [ValidateSet('asc', 'desc')] [string] $Direction + , [Parameter()] + [string] $Since ) if ($Repository) { @@ -120,6 +126,10 @@ function Get-GitHubIssue { $queryParameters += "direction=$Direction" } + if ($Since) { + $queryParameters += "since=$Since" + } + if ($queryParameters) { $RestMethod += "?" + ($queryParameters -join '&') } From 338fc3a0400eda02ecd07e9ae625015e4e1da378 Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 09:03:50 -0700 Subject: [PATCH 07/11] Get-GitHubIssue: support filter query parameter --- Functions/Public/Get-GitHubIssue.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 74d7baf..e73c8aa 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -28,6 +28,15 @@ function Get-GitHubIssue { Retrieve all open issues from the GitHub repository with the specified name, owned by the GitHub user specified by -Owner. + .PARAMETER Filter + Indicates which sorts of issues to return. Valid values: + * assigned: Issues assigned to the authenticated user. + * created: Issues created by the authenticated user. + * mentioned: Issues mentioning the authenticated user. + * subscribed: Issues for which the authenticated user has subscribed to updates. + * all: All issues the authenticated user can see, regardless of participation or creation. + Default: assigned + .PARAMETER State Limit the results to issues with the specified state. Valid values: open, closed, all. Default: open. @@ -84,6 +93,9 @@ function Get-GitHubIssue { [string] $Owner , [Parameter(Mandatory = $true, ParameterSetName = 'Repository')] [string] $Repository + , [Parameter()] + [ValidateSet('assigned', 'created', 'mentioned', 'subscribed', 'all')] + [string] $Filter , [Parameter()] [ValidateSet('open', 'closed', 'all')] [string] $State @@ -110,6 +122,10 @@ function Get-GitHubIssue { } $queryParameters = @() + if ($Filter) { + $queryParameters += "filter=$Filter" + } + if ($State) { $queryParameters += "state=$State" } From 872bf58bb1c8e48a57ce788a2f7154d7212b11b5 Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 10:53:40 -0700 Subject: [PATCH 08/11] Get-GitHubIssues: support pagination --- Functions/Public/Get-GitHubIssue.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index e73c8aa..685fc3a 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -28,6 +28,14 @@ function Get-GitHubIssue { Retrieve all open issues from the GitHub repository with the specified name, owned by the GitHub user specified by -Owner. + .PARAMETER Page + The page number of the results to return. Default: 1 + Note: The GitHub documentation of pagination warns to always rely on the + links provided in the response headers, rather than attempting to construct + the page URLs by hand. Unfortunately, as of PowerShell 5.1, Invoke-RestApi + does not provide access to the response headers. + https://developer.github.com/v3/guides/traversing-with-pagination/ + .PARAMETER Filter Indicates which sorts of issues to return. Valid values: * assigned: Issues assigned to the authenticated user. @@ -93,6 +101,8 @@ function Get-GitHubIssue { [string] $Owner , [Parameter(Mandatory = $true, ParameterSetName = 'Repository')] [string] $Repository + , [Parameter()] + [int] $Page , [Parameter()] [ValidateSet('assigned', 'created', 'mentioned', 'subscribed', 'all')] [string] $Filter @@ -122,6 +132,10 @@ function Get-GitHubIssue { } $queryParameters = @() + if ($Page) { + $queryParameters += "page=$Page" + } + if ($Filter) { $queryParameters += "filter=$Filter" } From 4b394bccf44a934a34ee599a08e4e93d6cc58285 Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 11:31:53 -0700 Subject: [PATCH 09/11] Get-GitHubIssue: support retrieving single issue --- 0 | Bin 0 -> 10 bytes Functions/Public/Get-GitHubIssue.ps1 | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 0 diff --git a/0 b/0 new file mode 100644 index 0000000000000000000000000000000000000000..6213b1bf258836fca4d234ea59784a33d831bfc4 GIT binary patch literal 10 RcmezW&xFBP0($@e literal 0 HcmV?d00001 diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 685fc3a..63b4809 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -28,6 +28,10 @@ function Get-GitHubIssue { Retrieve all open issues from the GitHub repository with the specified name, owned by the GitHub user specified by -Owner. + .PARAMETER Number + Retrieve the single issue with the specified number from the repo specified + by -Owner and -Repository. + .PARAMETER Page The page number of the results to return. Default: 1 Note: The GitHub documentation of pagination warns to always rely on the @@ -101,7 +105,11 @@ function Get-GitHubIssue { [string] $Owner , [Parameter(Mandatory = $true, ParameterSetName = 'Repository')] [string] $Repository + , [Parameter(Mandatory = $false, ParameterSetName = 'Repository')] + [ValidateRange(1, [int]::MaxValue)] + [int] $Number , [Parameter()] + [ValidateRange(1, [int]::MaxValue)] [int] $Page , [Parameter()] [ValidateSet('assigned', 'created', 'mentioned', 'subscribed', 'all')] @@ -123,6 +131,9 @@ function Get-GitHubIssue { if ($Repository) { $RestMethod = 'repos/{0}/{1}/issues' -f $Owner, $Repository + if ($Number -gt 0) { + $RestMethod += ("/{0}" -f $Number) + } } elseif ($Organization) { $RestMethod = 'orgs/{0}/issues' -f $Organization } elseif ($ForUser) { From 37fa0d0c88d54371d2834a7e2eb7c22d0cb7ee70 Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 13:33:58 -0700 Subject: [PATCH 10/11] Implement Get-GitHubComment --- Functions/Public/Get-GitHubComment.ps1 | 129 +++++++++++++++++++++++++ Functions/Public/Get-GitHubIssue.ps1 | 16 +-- 2 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 Functions/Public/Get-GitHubComment.ps1 diff --git a/Functions/Public/Get-GitHubComment.ps1 b/Functions/Public/Get-GitHubComment.ps1 new file mode 100644 index 0000000..a92c133 --- /dev/null +++ b/Functions/Public/Get-GitHubComment.ps1 @@ -0,0 +1,129 @@ +function Get-GitHubComment { + <# + .SYNOPSIS + Gets GitHub issue comments. + + .DESCRIPTION + Gets a single comment, or all comments on an issue, or all comments in a + repository, subject to filtering parameters. + + .PARAMETER Owner + The GitHub username of the account or organization that owns the GitHub repository + specified in the -Repository parameter. + + .PARAMETER Repository + The name of the GitHub repository containing the issue. + + .PARAMETER All + Retrieve all comments in the GitHub repository specified by the -Owner and + -Repository parameters. + + .PARAMETER IssueNumber + The number of the issue to retrieve. + + .PARAMETER CommentId + The id of the comment to retrieve. Requires -Issue to be present. + + .PARAMETER Page + The page number of the results to return. Default: 1 + Note: The GitHub documentation of pagination warns to always rely on the + links provided in the response headers, rather than attempting to construct + the page URLs by hand. Unfortunately, as of PowerShell 5.1, Invoke-RestApi + does not provide access to the response headers. + https://developer.github.com/v3/guides/traversing-with-pagination/ + + .PARAMETER Sort + What to sort results by. Valid values: created, updated. + Default: created. + + .PARAMETER Direction + The direction to sort. Valid values: asc, desc. Default: desc + + .PARAMETER Since + Limit the results to issues updated at or after the specified time. The time + is specified in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ + + .EXAMPLE + # Retrieve all comments in the repository Mary/WebApps: + Get-GitHubComment -Owner Mary -Repository WebApps -All + + .EXAMPLE + # Retrieve all comments on Issue #42 in the repository Mary/WebApps: + Get-GitHubComment -Owner Mary -Repository WebApps -Issue 42 + + .EXAMPLE + # Retrieve all comments in the repository Mary/WebApps in 2017 or later. + Get-GitHubComment -Owner Mary -Repository WebApps -Since 2017-01-01T00:00:00Z + + .EXAMPLE + # Retrieve comment #3 on Issue #42 in the repository Mary/WebApps: + Get-GitHubComment -Owner Mary -Repository WebApps -Issue 42 -Comment 3 + + #> + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true)] + [Alias('User')] + [string] $Owner + , [Parameter(Mandatory = $true)] + [string] $Repository + , [Parameter(Mandatory = $true, ParameterSetName = 'InRepo')] + [switch] $All + , [Parameter(Mandatory = $true, ParameterSetName = 'InIssue')] + [ValidateRange(1, [int]::MaxValue)] + [int] $IssueNumber + , [Parameter(Mandatory = $true, ParameterSetName = 'Single')] + [ValidateRange(1, [int]::MaxValue)] + [int] $CommentId + , [Parameter(Mandatory = $false, ParameterSetName = 'InRepo')] + [Parameter(Mandatory = $false, ParameterSetName = 'InIssue')] + [ValidateRange(1, [int]::MaxValue)] + [int] $Page + , [Parameter(Mandatory = $false, ParameterSetName = 'InRepo')] + [ValidateSet('created', 'updated')] + [string] $Sort + , [Parameter(Mandatory = $false, ParameterSetName = 'InRepo')] + [ValidateSet('asc', 'desc')] + [string] $Direction + , [Parameter(Mandatory = $false, ParameterSetName = 'InRepo')] + [Parameter(Mandatory = $false, ParameterSetName = 'InIssue')] + [string] $Since + ) + + $restMethod = 'repos/{0}/{1}/issues' -f $Owner, $Repository + if ($All) { + $restMethod += '/comments' + } elseif ($IssueNumber) { + $restMethod += '/{0}/comments' -f $IssueNumber + } elseif ($CommentId) { + $restMethod += '/comments/{0}' -f $CommentId + } + + $queryParameters = @() + if ($Page) { + $queryParameters += "page=$Page" + } + + if ($Sort) { + $queryParameters += "sort=$Sort" + } + + if ($Direction) { + $queryParameters += "direction=$Direction" + } + + if ($Since) { + $queryParameters += "since=$Since" + } + + if ($queryParameters) { + $restMethod += "?" + ($queryParameters -join '&') + } + + $apiCall = @{ + Method = 'Get'; + RestMethod = $restMethod + } + + Invoke-GitHubApi @apiCall +} \ No newline at end of file diff --git a/Functions/Public/Get-GitHubIssue.ps1 b/Functions/Public/Get-GitHubIssue.ps1 index 63b4809..1e098c2 100644 --- a/Functions/Public/Get-GitHubIssue.ps1 +++ b/Functions/Public/Get-GitHubIssue.ps1 @@ -7,7 +7,7 @@ function Get-GitHubIssue { This command retrieves GitHub issues either for the authenticated user or from a specified repository. - .Parameter All + .PARAMETER All Retrieve "all issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories" (https://developer.github.com/v3/issues/). @@ -130,16 +130,16 @@ function Get-GitHubIssue { ) if ($Repository) { - $RestMethod = 'repos/{0}/{1}/issues' -f $Owner, $Repository + $restMethod = 'repos/{0}/{1}/issues' -f $Owner, $Repository if ($Number -gt 0) { - $RestMethod += ("/{0}" -f $Number) + $restMethod += ("/{0}" -f $Number) } } elseif ($Organization) { - $RestMethod = 'orgs/{0}/issues' -f $Organization + $restMethod = 'orgs/{0}/issues' -f $Organization } elseif ($ForUser) { - $RestMethod = 'user/issues' + $restMethod = 'user/issues' } else { - $RestMethod = 'issues' + $restMethod = 'issues' } $queryParameters = @() @@ -172,12 +172,12 @@ function Get-GitHubIssue { } if ($queryParameters) { - $RestMethod += "?" + ($queryParameters -join '&') + $restMethod += "?" + ($queryParameters -join '&') } $apiCall = @{ Method = 'Get'; - RestMethod = $RestMethod + RestMethod = $restMethod } Invoke-GitHubApi @apiCall From 81097dfa058a57ea540c0f492e3888e45bcebbab Mon Sep 17 00:00:00 2001 From: Larry Golding Date: Sat, 23 Sep 2017 13:38:21 -0700 Subject: [PATCH 11/11] Update module manifest --- PSGitHub.psd1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PSGitHub.psd1 b/PSGitHub.psd1 index 18cb75d..b2301e3 100644 --- a/PSGitHub.psd1 +++ b/PSGitHub.psd1 @@ -73,6 +73,10 @@ FunctionsToExport = @( 'Get-GitHubMilestone', 'Get-GitHubAssignee', 'Test-GitHubAssignee', + 'Get-GitHubIssue', + + ### GitHub Comment commands + 'Get-GitHubComment', ### GitHub Release commands 'Get-GitHubRelease',