Skip to content

Packages  ›  trotsky  ›  StepBuilderList  ›  paginate

StepBuilderList.paginate() method

Handles pagination logic for retrieving records, fetching items in batches until the desired size is reached.

Signature:

typescript
paginate<T, R extends StepBuilderListResponse>(attribute: string, fn: (cursor: StepBuilderListOutputSchemaCursor) => Promise<R>): Promise<T>;

Parameters

Parameter

Type

Description

attribute

string

The attribute containing the paginated records.

fn

(cursor: StepBuilderListOutputSchemaCursor) => Promise<R>

The function to fetch paginated data, taking the current cursor as input.

Returns:

Promise<T>

A promise that resolves to an array of items after applying skip and take logic.