Browse Source

document 'since' pagination for Users.ListAll

Fixes #278.

Change-Id: Ia1d0c1f6b395d493714d91e0f6e79dc2506f8fde
Glenn Lewis 10 years ago
parent
commit
71e65bb773
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      github/users.go

+ 16
- 0
github/users.go View File

@ -144,6 +144,22 @@ type UserListOptions struct {
// ListAll lists all GitHub users.
//
// To paginate through all users, populate 'Since' with the ID of the last user.
// Example (warning: this will quickly eat through your GitHub API quota!):
//
// opts := &github.UserListOptions{}
// for {
// users, _, err := client.Users.ListAll(opts)
// if err != nil {
// log.Fatalf("error listing users: %v", err)
// }
// if len(users) == 0 {
// break
// }
// opts.Since = *users[len(users)-1].ID
// // Process users...
// }
//
// GitHub API docs: http://developer.github.com/v3/users/#get-all-users
func (s *UsersService) ListAll(opt *UserListOptions) ([]User, *Response, error) {
u, err := addOptions("users", opt)


Loading…
Cancel
Save