How to use the paginate function from @octokit/rest

Find comprehensive JavaScript @octokit/rest.paginate code examples handpicked from public code repositorys.

19
20
21
22
23
24
25
26
27
for (const repository of res.data) {
  const opt = octokit.repos.listHooks.endpoint.merge({
    owner: repository.owner.login,
    repo: repository.name,
  })
  for await (const res of octokit.paginate.iterator(opt)) {
    if (res.status !== 200) {
      process.exit(-1)
    }
fork icon2
star icon31
watch icon5

+ 3 other calls in file

30
31
32
33
34
35
36
37
38
39
  Object.assign(queryObject, queryProperties)
}

try {
  const options = method.endpoint.merge(queryObject)
  const data = await octokit.paginate(
    options,
    (response) => {
      return (method === octokit.search.issues) ? response.data.items : response.data
    }
fork icon1
star icon3
watch icon1