@@ -173,18 +173,72 @@ func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptio
173
173
return s .listIssues (ctx , u , opts )
174
174
}
175
175
176
+ func (s * IssuesService ) listIssues (ctx context.Context , u string , opts * IssueListOptions ) ([]* Issue , * Response , error ) {
177
+ u , err := addOptions (u , opts )
178
+ if err != nil {
179
+ return nil , nil , err
180
+ }
181
+
182
+ req , err := s .client .NewRequest ("GET" , u , nil )
183
+ if err != nil {
184
+ return nil , nil , err
185
+ }
186
+
187
+ // TODO: remove custom Accept header when this API fully launch.
188
+ req .Header .Set ("Accept" , mediaTypeReactionsPreview )
189
+
190
+ var issues []* Issue
191
+ resp , err := s .client .Do (ctx , req , & issues )
192
+ if err != nil {
193
+ return nil , resp , err
194
+ }
195
+
196
+ return issues , resp , nil
197
+ }
198
+
199
+ // IssueListByOrgOptions specifies the optional parameters to the
200
+ // IssuesService.ListByOrg method.
201
+ type IssueListByOrgOptions struct {
202
+ // Filter specifies which issues to list. Possible values are: assigned,
203
+ // created, mentioned, subscribed, all. Default is "assigned".
204
+ Filter string `url:"filter,omitempty"`
205
+
206
+ // State filters issues based on their state. Possible values are: open,
207
+ // closed, all. Default is "open".
208
+ State string `url:"state,omitempty"`
209
+
210
+ // Labels filters issues based on their label.
211
+ Labels []string `url:"labels,comma,omitempty"`
212
+
213
+ // Can be the name of an issue type. If the string "*" is passed, issues with
214
+ // any type are accepted. If the string "none" is passed, issues without
215
+ // type are returned.
216
+ Type string `url:"type,omitempty"`
217
+
218
+ // Sort specifies how to sort issues. Possible values are: created, updated,
219
+ // and comments. Default value is "created".
220
+ Sort string `url:"sort,omitempty"`
221
+
222
+ // Direction in which to sort issues. Possible values are: asc, desc.
223
+ // Default is "desc".
224
+ Direction string `url:"direction,omitempty"`
225
+
226
+ // Since filters issues by time.
227
+ Since time.Time `url:"since,omitempty"`
228
+
229
+ // Add ListOptions so offset pagination with integer type "page" query parameter is accepted
230
+ // since ListCursorOptions accepts "page" as string only.
231
+ ListOptions
232
+ }
233
+
176
234
// ListByOrg fetches the issues in the specified organization for the
177
235
// authenticated user.
178
236
//
179
237
// GitHub API docs: https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user
180
238
//
181
239
//meta:operation GET /orgs/{org}/issues
182
- func (s * IssuesService ) ListByOrg (ctx context.Context , org string , opts * IssueListOptions ) ([]* Issue , * Response , error ) {
240
+ func (s * IssuesService ) ListByOrg (ctx context.Context , org string , opts * IssueListByOrgOptions ) ([]* Issue , * Response , error ) {
183
241
u := fmt .Sprintf ("orgs/%v/issues" , org )
184
- return s .listIssues (ctx , u , opts )
185
- }
186
-
187
- func (s * IssuesService ) listIssues (ctx context.Context , u string , opts * IssueListOptions ) ([]* Issue , * Response , error ) {
188
242
u , err := addOptions (u , opts )
189
243
if err != nil {
190
244
return nil , nil , err
@@ -195,7 +249,7 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis
195
249
return nil , nil , err
196
250
}
197
251
198
- // TODO: remove custom Accept header when this API fully launch .
252
+ // TODO: remove custom Accept header when this API fully launches .
199
253
req .Header .Set ("Accept" , mediaTypeReactionsPreview )
200
254
201
255
var issues []* Issue
@@ -224,6 +278,11 @@ type IssueListByRepoOptions struct {
224
278
// any assigned user.
225
279
Assignee string `url:"assignee,omitempty"`
226
280
281
+ // Can be the name of an issue type. If the string "*" is passed, issues with
282
+ // any type are accepted. If the string "none" is passed, issues without
283
+ // type are returned.
284
+ Type string `url:"type,omitempty"`
285
+
227
286
// Creator filters issues based on their creator.
228
287
Creator string `url:"creator,omitempty"`
229
288
0 commit comments