A function that fetches a single page given a start offset,
typically a bound client/resource method (e.g. (params) => bb.projects(params))
Optionalparams: PBase parameters passed to every page request (e.g. limit, filters)
for await (const project of paginate((params) => bb.projects(params), { limit: 50 })) {
console.log(project.key);
}
const prs = await bb.project('PROJ').repo('my-repo').pullRequests();
for await (const pr of paginate(
(params) => bb.project('PROJ').repo('my-repo').pullRequests(params),
{ state: 'OPEN' },
)) {
console.log(pr.id);
}
Lazily iterates over every item across all pages of a paginated Bitbucket endpoint, following
nextPageStartuntilisLastPageis reached.