Browse Source

add PerPage to ListOptions

Will Norris 12 years ago
committed by Will Norris
parent
commit
aed46a3eac
4 changed files with 6 additions and 3 deletions
  1. +3
    -0
      github/github.go
  2. +1
    -1
      github/orgs_test.go
  3. +1
    -1
      github/repos_hooks_test.go
  4. +1
    -1
      github/users_followers_test.go

+ 3
- 0
github/github.go View File

@ -66,6 +66,9 @@ type Client struct {
type ListOptions struct { type ListOptions struct {
// For paginated result sets, page of results to retrieve. // For paginated result sets, page of results to retrieve.
Page int Page int
// For paginated result sets, the number of results to include per page.
PerPage int
} }
// NewClient returns a new GitHub API client. If a nil httpClient is // NewClient returns a new GitHub API client. If a nil httpClient is


+ 1
- 1
github/orgs_test.go View File

@ -43,7 +43,7 @@ func TestOrganizationsService_List_specifiedUser(t *testing.T) {
fmt.Fprint(w, `[{"id":1},{"id":2}]`) fmt.Fprint(w, `[{"id":1},{"id":2}]`)
}) })
opt := &ListOptions{2}
opt := &ListOptions{Page: 2}
orgs, _, err := client.Organizations.List("u", opt) orgs, _, err := client.Organizations.List("u", opt)
if err != nil { if err != nil {
t.Errorf("Organizations.List returned error: %v", err) t.Errorf("Organizations.List returned error: %v", err)


+ 1
- 1
github/repos_hooks_test.go View File

@ -57,7 +57,7 @@ func TestRepositoriesService_ListHooks(t *testing.T) {
fmt.Fprint(w, `[{"id":1}, {"id":2}]`) fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
}) })
opt := &ListOptions{2}
opt := &ListOptions{Page: 2}
hooks, _, err := client.Repositories.ListHooks("o", "r", opt) hooks, _, err := client.Repositories.ListHooks("o", "r", opt)
if err != nil { if err != nil {


+ 1
- 1
github/users_followers_test.go View File

@ -67,7 +67,7 @@ func TestUsersService_ListFollowing_authenticatedUser(t *testing.T) {
fmt.Fprint(w, `[{"id":1}]`) fmt.Fprint(w, `[{"id":1}]`)
}) })
opts := &ListOptions{2}
opts := &ListOptions{Page: 2}
users, _, err := client.Users.ListFollowing("", opts) users, _, err := client.Users.ListFollowing("", opts)
if err != nil { if err != nil {
t.Errorf("Users.ListFollowing returned error: %v", err) t.Errorf("Users.ListFollowing returned error: %v", err)


Loading…
Cancel
Save