From 3c771890bd500dbd9c25e887af028c5af0eb11a8 Mon Sep 17 00:00:00 2001 From: Maksim Zhylinski Date: Mon, 2 Jun 2014 22:02:32 +0300 Subject: [PATCH] Add pagination info to the README --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 0aa36b3..356efa6 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,25 @@ repos, _, err := client.Repositories.List("", nil) See the [goauth2 docs][] for complete instructions on using that library. +### Pagination ### + +All requests for resource collections (repos, pull requests, issues, etc) +support pagination. Pagination options are described in the +`github.ListOptions` struct and passed to the list methods directly or as an +embedded type of a more specific list options struct (for example +`github.PullRequestListOptions`). Pages information is available via +`github.Response` struct. + +```go +client := github.NewClient(nil) +opt := &github.RepositoryListByOrgOptions{ + Type: "public", + ListOptions: github.ListOptions{PerPage: 10, Page: 2}, +} +repos, resp, err := client.Repositories.ListByOrg("github", opt) +fmt.Println(resp.NextPage) // outputs 3 +``` + For complete usage of go-github, see the full [package docs][]. [GitHub API]: http://developer.github.com/v3/