UNPKG

packaged

Version:

[![NPM version][npm-image]](https://npmjs.org/package/packaged) [![NPM downloads][downloads-image]](https://npmjs.org/package/packaged) [![Build Status][github-actions-publish-npm-package]](https://github.com/DManavi/packaged/actions/workflows/publish_npm

61 lines 1.67 kB
declare const PAGINATION_TYPES: readonly ["cursor", "offset"]; export type PaginationType = (typeof PAGINATION_TYPES)[number]; type PaginationRequestBase = { /** * The type of pagination to use */ type: PaginationType; /** * The number of items to return per page * @example 10 */ limit?: number; }; export type CursorBasedPaginationRequest = PaginationRequestBase & { type: 'cursor'; /** * The cursor for the next page of results * Not required for the first page * @example "eyJ2IjoxLCJwIjoxLCJzIjoxfQ==" */ cursor?: string; }; export type OffsetBasedPaginationRequest = PaginationRequestBase & { type: 'offset'; /** * The offset for the next page of results * @example 0 */ offset?: number; }; export type PaginationRequest = CursorBasedPaginationRequest | OffsetBasedPaginationRequest; type PaginationResponseBase = { /** * The type of pagination used */ type: PaginationType; /** * The total number of items available * @example 100 */ totalItems: number; /** * The total number of pages available * @example 10 */ totalPages: number; }; export type CursorBasedPaginationResponse = PaginationResponseBase & { type: 'cursor'; /** * The cursor for the next page of results * @example "eyJ2IjoxLCJwIjoxLCJzIjoxfQ==" */ cursor?: string; }; export type OffsetBasedPaginationResponse = PaginationResponseBase & { type: 'offset'; }; export type PaginationResponse = CursorBasedPaginationResponse | OffsetBasedPaginationResponse; export {}; //# sourceMappingURL=pagination.d.ts.map