This library is currently in preview.
Provides utility interfaces and an async iterator class to simplify handling paginated API responses.
The exported interfaces and classes include:
- CursorPagedResponse: Represents a paginated API response using cursor-based pagination.
- LinkPagedResponse: PRepresents a paginated API response using link-based pagination.
- NumberPagedResponse: Represents a paginated API response using explicit page numbers.
- OffsetPagedResponse: Represents a paginated API response using offset-based pagination.
- PagedData: An AsyncIterable class that supports both item-wise and page-wise iteration over paginated API responses. It dynamically determines and applies the most suitable pagination strategy from the provided options, ensuring compatibility with various pagination formats.
This library is used by JavaScript SDKs generated by the APIMatic Code Generator.
Builds
The following environments are supported:
- Node.js v14+ and v16+
- Bundlers like Rollup or Webpack
- Web browsers
To support multiple environments, we export various builds:
Common.js | Import like this: require('@apimatic/pagination') . |
ES Module | Import like this: import { /* your imports */ } from '@apimatic/pagination' . |
Browsers | *Use script: https://unpkg.com/@apimatic/pagination@VERSION/umd/schema.js |
Modern Browsers (supports ESM and uses modern JS) | *Use script: https://unpkg.com/@apimatic/pagination@VERSION/umd/schema.esm.js |
* Don't forget to replace VERSION with the version number.
Note: We discourage importing files or modules directly from the package. These are likely to change in the future and should not be considered stable.