Skip to content

Improve documentation for nextPage() fuctions #1206

@patrickarlt

Description

@patrickarlt

Description

We should update the docs for the various method that support nextPage() function. This means:

We should also document the pattern to paginate thorough resuts to get all results which generally looks like this:

function async getAllResults (response) {
 let allItems = lastResponse.results;

  // Keep getting the next page until there are no more pages.
  while (lastResponse.nextPage) {
    lastResponse = await lastResponse.nextPage();
    allItems = allItems.concat(lastResponse.results);
  }

  return allItems;
}

const allResults = await searchItems(options).then(getAllResults)

Link to page

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomers and beginners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions