Skip to content
Merged
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
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ linters:
- UpdateRuleParameters.UpdateAllowsFetchAndMerge # TODO: Rules
- UploadOptions.Label # TODO: Repositories
- UploadOptions.Name # TODO: Repositories
- UserListOptions.Since # TODO: Users
exclusions:
rules:
- linters:
Expand Down
2 changes: 1 addition & 1 deletion github/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func ExampleUsersService_ListAll() {
if len(users) == 0 {
break
}
opts.Since = *users[len(users)-1].ID
opts.Since = users[len(users)-1].ID
// Process users...
}
}
Expand Down
16 changes: 16 additions & 0 deletions github/github-accessors.go

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

22 changes: 22 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.

31 changes: 0 additions & 31 deletions github/github-iterators.go

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

72 changes: 0 additions & 72 deletions github/github-iterators_test.go

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

10 changes: 3 additions & 7 deletions github/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,9 @@ func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *Hove
// UserListOptions specifies optional parameters to the UsersService.ListAll
// method.
type UserListOptions struct {
// ID of the last user seen
Since int64 `url:"since,omitempty"`

// Note: Pagination is powered exclusively by the Since parameter,
// ListOptions.Page has no effect.
// ListOptions.PerPage controls an undocumented GitHub API parameter.
ListOptions
// A user ID. Only return users with an ID greater than this ID.
Since *int64 `url:"since,omitempty"`
PerPage *int `url:"per_page,omitempty"`
}

// ListAll lists all GitHub users.
Expand Down
14 changes: 5 additions & 9 deletions github/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ func TestUsersService_ListAll(t *testing.T) {

mux.HandleFunc("/users", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{"since": "1", "page": "2"})
testFormValues(t, r, values{"since": "1", "per_page": "30"})
fmt.Fprint(w, `[{"id":2}]`)
})

opt := &UserListOptions{1, ListOptions{Page: 2}}
opt := &UserListOptions{Since: Ptr(int64(1)), PerPage: Ptr(30)}
ctx := t.Context()
users, _, err := client.Users.ListAll(ctx, opt)
if err != nil {
Expand Down Expand Up @@ -498,17 +498,13 @@ func TestUserListOptions_Marshal(t *testing.T) {
testJSONMarshal(t, &UserListOptions{}, "{}")

u := &UserListOptions{
Since: int64(1900),
ListOptions: ListOptions{
Page: int(1),
PerPage: int(10),
},
Since: Ptr(int64(1900)),
PerPage: Ptr(30),
}

want := `{
"since" : 1900,
"page": 1,
"perPage": 10
"perPage": 30
}`

testJSONMarshal(t, u, want)
Expand Down
Loading