@@ -98,12 +98,12 @@ function Get-GitHubIssue
98
98
If not supplied here, the DefaultNoStatus configuration property value will be used.
99
99
100
100
. EXAMPLE
101
- Get-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -State open
101
+ Get-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -State Open
102
102
103
103
Gets all the currently open issues in the PowerShell\PowerShellForGitHub repository.
104
104
105
105
. EXAMPLE
106
- Get-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -State all -Assignee Octocat
106
+ Get-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -State All -Assignee Octocat
107
107
108
108
Gets every issue in the PowerShell\PowerShellForGitHub repository that is assigned to Octocat.
109
109
#>
@@ -125,35 +125,35 @@ function Get-GitHubIssue
125
125
126
126
[string ] $OrganizationName ,
127
127
128
- [ValidateSet (' all ' , ' ownedAndMember ' )]
129
- [string ] $RepositoryType = ' all ' ,
128
+ [ValidateSet (' All ' , ' OwnedAndMember ' )]
129
+ [string ] $RepositoryType = ' All ' ,
130
130
131
131
[int ] $Issue ,
132
132
133
133
[switch ] $IgnorePullRequests ,
134
134
135
- [ValidateSet (' assigned ' , ' created ' , ' mentioned ' , ' subscribed ' , ' all ' )]
136
- [string ] $Filter = ' assigned ' ,
135
+ [ValidateSet (' Assigned ' , ' Created ' , ' Mentioned ' , ' Subscribed ' , ' All ' )]
136
+ [string ] $Filter = ' Assigned ' ,
137
137
138
- [ValidateSet (' open ' , ' closed ' , ' all ' )]
139
- [string ] $State = ' open ' ,
138
+ [ValidateSet (' Open ' , ' Closed ' , ' All ' )]
139
+ [string ] $State = ' Open ' ,
140
140
141
141
[string []] $Label ,
142
142
143
- [ValidateSet (' created ' , ' updated ' , ' comments ' )]
144
- [string ] $Sort = ' created ' ,
143
+ [ValidateSet (' Created ' , ' Updated ' , ' Comments ' )]
144
+ [string ] $Sort = ' Created ' ,
145
145
146
- [ValidateSet (' asc ' , ' desc ' )]
147
- [string ] $Direction = ' desc ' ,
146
+ [ValidateSet (' Ascending ' , ' Descending ' )]
147
+ [string ] $Direction = ' Descending ' ,
148
148
149
149
[DateTime ] $Since ,
150
150
151
- [ValidateSet (' specific ' , ' all ' , ' none ' )]
151
+ [ValidateSet (' Specific ' , ' All ' , ' None ' )]
152
152
[string ] $MilestoneType ,
153
153
154
154
[string ] $Milestone ,
155
155
156
- [ValidateSet (' specific ' , ' all ' , ' none ' )]
156
+ [ValidateSet (' Specific ' , ' All ' , ' None ' )]
157
157
[string ] $AssigneeType ,
158
158
159
159
[string ] $Assignee ,
@@ -203,12 +203,12 @@ function Get-GitHubIssue
203
203
$uriFragment = " /orgs/$OrganizationName /issues"
204
204
$description = " Getting issues for $OrganizationName "
205
205
}
206
- elseif ($RepositoryType -eq ' all ' )
206
+ elseif ($RepositoryType -eq ' All ' )
207
207
{
208
208
$uriFragment = " /issues"
209
209
$description = " Getting issues across owned, member and org repositories"
210
210
}
211
- elseif ($RepositoryType -eq ' ownedAndMember ' )
211
+ elseif ($RepositoryType -eq ' OwnedAndMember ' )
212
212
{
213
213
$uriFragment = " /user/issues"
214
214
$description = " Getting issues across owned and member repositories"
@@ -218,11 +218,16 @@ function Get-GitHubIssue
218
218
throw " Parameter set not supported."
219
219
}
220
220
221
+ $directionConverter = @ {
222
+ ' Ascending' = ' asc'
223
+ ' Descending' = ' desc'
224
+ }
225
+
221
226
$getParams = @ (
222
- " filter=$Filter " ,
223
- " state=$State " ,
224
- " sort=$Sort " ,
225
- " direction=$Direction "
227
+ " filter=$ ( $ Filter.ToLower () ) " ,
228
+ " state=$ ( $ State.ToLower () ) " ,
229
+ " sort=$ ( $ Sort.ToLower () ) " ,
230
+ " direction=$ ( $directionConverter [ $ Direction] ) "
226
231
)
227
232
228
233
if ($PSBoundParameters.ContainsKey (' Label' ))
@@ -242,11 +247,11 @@ function Get-GitHubIssue
242
247
243
248
if ($PSBoundParameters.ContainsKey (' MilestoneType' ))
244
249
{
245
- if ($MilestoneType -eq ' all ' )
250
+ if ($MilestoneType -eq ' All ' )
246
251
{
247
252
$getParams += ' mentioned=*'
248
253
}
249
- elseif ($MilestoneType -eq ' none ' )
254
+ elseif ($MilestoneType -eq ' None ' )
250
255
{
251
256
$getParams += ' mentioned=none'
252
257
}
@@ -585,7 +590,7 @@ function Update-GitHubIssue
585
590
If not supplied here, the DefaultNoStatus configuration property value will be used.
586
591
587
592
. EXAMPLE
588
- Update-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -Issue 4 -Title 'Test Issue' -State closed
593
+ Update-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -Issue 4 -Title 'Test Issue' -State Closed
589
594
#>
590
595
[CmdletBinding (
591
596
SupportsShouldProcess ,
@@ -616,7 +621,7 @@ function Update-GitHubIssue
616
621
617
622
[string []] $Label ,
618
623
619
- [ValidateSet (' open ' , ' closed ' )]
624
+ [ValidateSet (' Open ' , ' Closed ' )]
620
625
[string ] $State ,
621
626
622
627
[string ] $AccessToken ,
@@ -641,7 +646,7 @@ function Update-GitHubIssue
641
646
if ($PSBoundParameters.ContainsKey (' Body' )) { $hashBody [' body' ] = $Body }
642
647
if ($PSBoundParameters.ContainsKey (' Assignee' )) { $hashBody [' assignees' ] = @ ($Assignee ) }
643
648
if ($PSBoundParameters.ContainsKey (' Label' )) { $hashBody [' labels' ] = @ ($Label ) }
644
- if ($PSBoundParameters.ContainsKey (' State' )) { $hashBody [' state' ] = $State }
649
+ if ($PSBoundParameters.ContainsKey (' State' )) { $hashBody [' state' ] = $State.ToLower () }
645
650
if ($PSBoundParameters.ContainsKey (' Milestone' ))
646
651
{
647
652
$hashBody [' milestone' ] = $Milestone
@@ -707,7 +712,7 @@ function Lock-GitHubIssue
707
712
If not supplied here, the DefaultNoStatus configuration property value will be used.
708
713
709
714
. EXAMPLE
710
- Lock-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -Issue 4 -Title 'Test Issue' -Reason spam
715
+ Lock-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -Issue 4 -Title 'Test Issue' -Reason Spam
711
716
#>
712
717
[CmdletBinding (
713
718
SupportsShouldProcess ,
@@ -728,7 +733,7 @@ function Lock-GitHubIssue
728
733
[Parameter (Mandatory )]
729
734
[int ] $Issue ,
730
735
731
- [ValidateSet (' off-topic ' , ' too heated ' , ' resolved ' , ' spam ' )]
736
+ [ValidateSet (' OffTopic ' , ' TooHeated ' , ' Resolved ' , ' Spam ' )]
732
737
[string ] $Reason ,
733
738
734
739
[string ] $AccessToken ,
@@ -753,8 +758,15 @@ function Lock-GitHubIssue
753
758
754
759
if ($PSBoundParameters.ContainsKey (' Reason' ))
755
760
{
761
+ $reasonConverter = @ {
762
+ ' OffTopic' = ' off-topic'
763
+ ' TooHeated' = ' too heated'
764
+ ' Resolved' = ' resolved'
765
+ ' Spam' = ' spam'
766
+ }
767
+
756
768
$telemetryProperties [' Reason' ] = $Reason
757
- $hashBody [' active_lock_reason' ] = $Reason
769
+ $hashBody [' active_lock_reason' ] = $reasonConverter [ $ Reason]
758
770
}
759
771
760
772
$params = @ {
0 commit comments