Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,6 @@ linters:
- IssueListByRepoOptions.Sort # TODO: Issues
- IssueListByRepoOptions.Sort # TODO: Issues
- IssueListByRepoOptions.State # TODO: Issues
- IssueListOptions.Direction # TODO: Issues
- IssueListOptions.Filter # TODO: Issues
- IssueListOptions.Since # TODO: Issues
- IssueListOptions.Sort # TODO: Issues
- IssueListOptions.State # TODO: Issues
- IssueRequest.Assignees # TODO: Issues
- IssueRequest.Labels # TODO: Issues
- License.Conditions # TODO: Licenses
Expand Down
40 changes: 40 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions github/github-iterators.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,25 @@ type IssueRequest struct {
type IssueListOptions struct {
// Filter specifies which issues to list. Possible values are: assigned,
// created, mentioned, subscribed, all. Default is "assigned".
Filter string `url:"filter,omitempty"`
Filter *string `url:"filter,omitempty"`

// State filters issues based on their state. Possible values are: open,
// closed, all. Default is "open".
State string `url:"state,omitempty"`
State *string `url:"state,omitempty"`

// Labels filters issues based on their label.
Labels []string `url:"labels,comma,omitempty"`

// Sort specifies how to sort issues. Possible values are: created, updated,
// and comments. Default value is "created".
Sort string `url:"sort,omitempty"`
Sort *string `url:"sort,omitempty"`

// Direction in which to sort issues. Possible values are: asc, desc.
// Default is "desc".
Direction string `url:"direction,omitempty"`
Direction *string `url:"direction,omitempty"`

// Since filters issues by time.
Since time.Time `url:"since,omitempty"`
Since *time.Time `url:"since,omitempty"`

ListCursorOptions

Expand Down Expand Up @@ -245,11 +245,8 @@ type IssueListByRepoOptions struct {
// Since filters issues by time.
Since time.Time `url:"since,omitempty"`

// ListCursorOptions specifies the optional parameters for cursor pagination.
ListCursorOptions

// Add ListOptions so offset pagination with integer type "page" query parameter is accepted
// since ListCursorOptions accepts "page" as string only.
ListOptions
Comment on lines -249 to -252
Copy link
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove ListOptions. keep both (only for IssueListByRepoOptions)

}

// ListByRepo lists the issues for the specified repository.
Expand Down
39 changes: 21 additions & 18 deletions github/issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ func TestIssuesService_List_all(t *testing.T) {
"labels": "a,b",
"sort": "updated",
"direction": "asc",
"since": "2002-02-10T15:30:00Z",
"since": referenceTime.Format(time.RFC3339),
"page": "1",
"per_page": "2",
"before": "foo",
"after": "bar",
})
fmt.Fprint(w, `[{"number":1}]`)
})

opt := &IssueListOptions{
"all", "closed",
[]string{"a", "b"},
"updated", "asc",
time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC),
ListCursorOptions{Before: "foo", After: "bar"},
ListOptions{Page: 1, PerPage: 2},
Filter: Ptr("all"),
State: Ptr("closed"),
Labels: []string{"a", "b"},
Sort: Ptr("updated"),
Direction: Ptr("asc"),
Since: Ptr(referenceTime),
ListOptions: ListOptions{Page: 1, PerPage: 2},
}
ctx := t.Context()
issues, _, err := client.Issues.List(ctx, true, opt)
Expand Down Expand Up @@ -158,22 +157,26 @@ func TestIssuesService_ListByRepo(t *testing.T) {
"labels": "a,b",
"sort": "updated",
"direction": "asc",
"since": "2002-02-10T15:30:00Z",
"since": referenceTime.Format(time.RFC3339),
"per_page": "1",
"before": "foo",
"after": "bar",
})
fmt.Fprint(w, `[{"number":1}]`)
})

// IssueListByRepoOptions uses standard strings (not pointers) and ListCursorOptions
opt := &IssueListByRepoOptions{
"*", "closed", "a", "c", "m",
[]string{"a", "b"},
"updated", "asc",
time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC),
ListCursorOptions{PerPage: 1, Before: "foo", After: "bar"},
ListOptions{0, 0},
Milestone: "*",
State: "closed",
Assignee: "a",
Creator: "c",
Mentioned: "m",
Labels: []string{"a", "b"},
Sort: "updated",
Direction: "asc",
Since: referenceTime,
ListCursorOptions: ListCursorOptions{PerPage: 1},
}

ctx := t.Context()
issues, _, err := client.Issues.ListByRepo(ctx, "o", "r", opt)
if err != nil {
Expand Down
Loading