The page data type.
Fetches a page by zero-based index.
Called for each non-nullish page (may be out-of-order).
Resolves when all pages are fetched.
All pages are fetched in parallel with no concurrency limit; consider using
rateLimited to wrap the fetcher. If a page reports a higher num_pages,
additional pages are fetched automatically.
await forEachPage(
async (i) => ({ num_pages: 5, page: await fetchUsers(i) }),
(users, i) => console.log(`Page ${i}:`, users),
);
fetchPages for an async generator alternative.
Fetches multiple pages in parallel and invokes a callback for each non-nullish page.