3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-24 11:09:33 +01:00
setup-node/node_modules/octokit-pagination-methods
2019-08-05 15:18:52 -04:00
..
lib new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
.travis.yml new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
CODE_OF_CONDUCT.md new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
index.js new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
LICENSE new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
package.json new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
README.md new toolkit and scoped registries 2019-08-05 15:18:52 -04:00
test.js new toolkit and scoped registries 2019-08-05 15:18:52 -04:00

octokit-pagination-methods

Legacy Octokit pagination methods from v15

Build Status Coverage Status Greenkeeper badge

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.

LICENSE

MIT