UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

36 lines 1.1 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { AbstractPage } from "./core.mjs"; export class Page extends AbstractPage { constructor(client, response, body, options) { super(client, response, body, options); this.data = body.data || []; this.pagination_metadata = body.pagination_metadata; } getPaginatedItems() { return this.data ?? []; } // @deprecated Please use `nextPageInfo()` instead nextPageParams() { const info = this.nextPageInfo(); if (!info) return null; if ('params' in info) return info.params; const params = Object.fromEntries(info.url.searchParams); if (!Object.keys(params).length) return null; return params; } nextPageInfo() { const cursor = this.pagination_metadata.next_cursor; if (!cursor) { return null; } return { params: { cursor, }, }; } } //# sourceMappingURL=pagination.mjs.map