Skip to content

Commit c5bf1bc

Browse files
authored
fix!: Add field PerPage to OrganizationsListOptions (#3986)
BREAKING CHANGE: `OrganizationsListOptions` now contains only `PerPage` instead of `ListOptions`.
1 parent e5024aa commit c5bf1bc

File tree

5 files changed

+6
-111
lines changed

5 files changed

+6
-111
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ linters:
362362
- NotificationListOptions.Participating # TODO: Activities
363363
- NotificationListOptions.Since # TODO: Activities
364364
- OrganizationsListOptions.Since # TODO: Organizations
365+
- OrganizationsListOptions.PerPage # TODO: Organizations
365366
- ProjectV2ItemFieldValue.DataType # TODO: Projects
366367
- ProjectV2ItemFieldValue.Name # TODO: Projects
367368
- PullRequestListCommentsOptions.Direction # TODO: PullRequests

github/github-iterators.go

Lines changed: 0 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-iterators_test.go

Lines changed: 0 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/orgs.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,11 @@ func (p Plan) String() string {
153153
// OrganizationsListOptions specifies the optional parameters to the
154154
// OrganizationsService.ListAll method.
155155
type OrganizationsListOptions struct {
156-
// Since filters Organizations by ID.
156+
// An organization ID. Only return organizations with an ID greater than this ID.
157157
Since int64 `url:"since,omitempty"`
158158

159-
// Note: Pagination is powered exclusively by the Since parameter,
160-
// ListOptions.Page has no effect.
161-
// ListOptions.PerPage controls an undocumented GitHub API parameter.
162-
ListOptions
159+
// The number of results per page (max 100).
160+
PerPage int `url:"per_page,omitempty"`
163161
}
164162

165163
// ListAll lists all organizations, in the order that they were created on GitHub.

github/orgs_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,13 @@ func TestOrganizationsService_ListAll(t *testing.T) {
7171
t.Parallel()
7272
client, mux, _ := setup(t)
7373

74-
since := int64(1342004)
7574
mux.HandleFunc("/organizations", func(w http.ResponseWriter, r *http.Request) {
7675
testMethod(t, r, "GET")
77-
testFormValues(t, r, values{"since": "1342004"})
76+
testFormValues(t, r, values{"since": "1342004", "per_page": "30"})
7877
fmt.Fprint(w, `[{"id":4314092}]`)
7978
})
8079

81-
opt := &OrganizationsListOptions{Since: since}
80+
opt := &OrganizationsListOptions{Since: int64(1342004), PerPage: 30}
8281
ctx := t.Context()
8382
orgs, _, err := client.Organizations.ListAll(ctx, opt)
8483
if err != nil {

0 commit comments

Comments
 (0)