MCPcopy
hub / github.com/slackapi/node-slack-sdk / paginationOptionsForNextPage

Function paginationOptionsForNextPage

packages/web-api/src/WebClient.ts:808–823  ·  view source on GitHub ↗

* Determines an appropriate set of cursor pagination options for the next request to a paginated API method. * @param previousResult - the result of the last request, where the next cursor might be found. * @param pageSize - the maximum number of additional items to fetch in the next request.

(
  previousResult: WebAPICallResult | undefined, pageSize: number,
)

Source from the content-addressed store, hash-verified

806 * @param pageSize - the maximum number of additional items to fetch in the next request.
807 */
808function paginationOptionsForNextPage(
809 previousResult: WebAPICallResult | undefined, pageSize: number,
810): methods.CursorPaginationEnabled | undefined {
811 if (
812 previousResult !== undefined &&
813 previousResult.response_metadata !== undefined &&
814 previousResult.response_metadata.next_cursor !== undefined &&
815 previousResult.response_metadata.next_cursor !== ''
816 ) {
817 return {
818 limit: pageSize,
819 cursor: previousResult.response_metadata.next_cursor as string,
820 };
821 }
822 return;
823}
824
825/**
826 * Extract the amount of time (in seconds) the platform has recommended this client wait before sending another request

Callers 1

generatePagesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected