Get the next, previous, first or last page of results
gh_next(gh_response, .token = NULL, .send_headers = NULL)
gh_prev(gh_response, .token = NULL, .send_headers = NULL)
gh_first(gh_response, .token = NULL, .send_headers = NULL)
gh_last(gh_response, .token = NULL, .send_headers = NULL)
An object returned by a gh()
call.
Authentication token. Defaults to gh_token()
.
Named character vector of header field values
(except Authorization
, which is handled via .token
). This can be
used to override or augment the default User-Agent
header:
"https://github.com/r-lib/gh"
.
Answer from the API.
Note that these are not always defined. E.g. if the first page was queried (the default), then there are no first and previous pages defined. If there is no next page, then there is no next page defined, etc.
If the requested page does not exist, an error is thrown.
The .limit
argument to gh()
supports fetching more than
one page.
x <- gh("/users")
vapply(x, "[[", character(1), "login")
#> [1] "mojombo" "defunkt" "pjhyett" "wycats" "ezmobius"
#> [6] "ivey" "evanphx" "vanpelt" "wayneeseguin" "brynary"
#> [11] "kevinclark" "technoweenie" "macournoyer" "takeo" "caged"
#> [16] "topfunky" "anotherjesse" "roland" "lukas" "fanvsfan"
#> [21] "tomtt" "railsjitsu" "nitay" "kevwil" "KirinDave"
#> [26] "jamesgolick" "atmos" "errfree" "mojodna" "bmizerany"
x2 <- gh_next(x)
vapply(x2, "[[", character(1), "login")
#> [1] "jnewland" "joshknowles" "hornbeck" "jwhitmire" "elbowdonkey"
#> [6] "reinh" "knzai" "bs" "rsanheim" "schacon"
#> [11] "uggedal" "bruce" "sam" "mmower" "abhay"
#> [16] "rabble" "benburkert" "indirect" "fearoffish" "ry"
#> [21] "engineyard" "jsierles" "tweibley" "peimei" "brixen"
#> [26] "tmornini" "outerim" "daksis" "sr" "lifo"