How to use the getNextPage function from @octokit/rest
Find comprehensive JavaScript @octokit/rest.getNextPage code examples handpicked from public code repositorys.
GitHub: ValeraS/automation
36 37 38 39 40 41 42 43 44 45
let done = false; // will be true when lastPR is seen in paginated results let response = await method(methodProps); let { data } = response; data = prFilter(data, firstPR, lastPR, prPropsToGet); while (octokit.hasNextPage(response) && !done ) { response = await octokit.getNextPage(response); let dataFiltered = prFilter(response.data, firstPR, lastPR, prPropsToGet); data = data.concat(dataFiltered); } return data;
9
0
2
GitHub: mapbox/secret-shield
10 11 12 13 14 15 16 17 18 19
function getRemanding(response, resolve, reject) { if (!octokit.hasNextPage(response)) { return resolve(repos); } octokit.getNextPage(response).then((response) => { repos = repos.concat(parseRepos(response)); getRemanding(response, resolve, reject); }).catch((err) => { return reject(err);
13
34
74
30 31 32 33 34 35 36 37 38 39
function paginate(method) { return method({ org: organisation, type: 'public', per_page: 100 }) .then(response => { let data = response.data while (octokit.hasNextPage(response)) { return octokit.getNextPage(response).then(response => data.concat(response.data)) } return data }) }
2
0
2
42 43 44 45 46 47 48 49 50 51
type: 'all', per_page:100 }) var { data } = response; while (octokit.hasNextPage(response)) { response = await octokit.getNextPage(response) data = data.concat(response.data) } return data
0
1
4
@octokit/rest.Octokit is the most popular function in @octokit/rest (61 examples)