/got-links

download multiple pages of results from a paged endpoint

Primary LanguageJavaScript

got-links

CircleCI Greenkeeper badge

Download multiple pages of results from an API that supports the Link header.

example

var result = gotLinks({
  got: ghGot,
  url: 'search/repositories',
  options: {
    query: {
      q: 'happiness'
    },
    token: process.env.GITHUB_TOKEN
  },
  maxPages: 3,
  reducer(memo, response) {
    return memo.concat(response.body.items);
  }
});

Used in