Package Exports
- octokit-pagination-methods
- octokit-pagination-methods/lib/get-next-page
- octokit-pagination-methods/lib/has-next-page
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (octokit-pagination-methods) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
octokit-pagination-methods
Legacy Octokit pagination methods from v15
Several pagination methods such as octokit.hasNextPage()
and octokit.getNextPage()
have been removed from @octokit/request
in v16.0.0 in favor of octokit.paginate()
. This plugin brings back the methods to ease the upgrade to v16.
Usage
const Octokit = require('@octokit/rest')
.plugin('octokit-pagination-methods')
const octokit = new Octokit()
octokit.issues.getForRepo()
.then(async response => {
// returns true/false
octokit.hasNextPage(response)
octokit.hasPreviousPage(response)
octokit.hasFirstPage(response)
octokit.hasLastPage(response)
// fetch other pages
const nextPage = await octokit.getNextPage(response)
const previousPage = await octokit.getPreviousPage(response)
const firstPage = await octokit.getFirstPage(response)
const lastPage = await octokit.getLastPage(response)
})
Credit
These methods have originally been created for node-github
by @mikedeboer
while working at Cloud9 IDE, Inc. It was adopted and renamed by GitHub in 2017.