UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

40 lines 1.22 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.Page = void 0; const core_1 = require("./core.js"); class Page extends core_1.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, }, }; } } exports.Page = Page; //# sourceMappingURL=pagination.js.map