UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

63 lines 3.02 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.Credits = void 0; const tslib_1 = require("../../../internal/tslib.js"); const resource_1 = require("../../../core/resource.js"); const LedgerAPI = tslib_1.__importStar(require("./ledger.js")); const ledger_1 = require("./ledger.js"); const TopUpsAPI = tslib_1.__importStar(require("./top-ups.js")); const top_ups_1 = require("./top-ups.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); /** * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb. */ class Credits extends resource_1.APIResource { constructor() { super(...arguments); this.ledger = new LedgerAPI.Ledger(this._client); this.topUps = new TopUpsAPI.TopUps(this._client); } /** * Returns a paginated list of unexpired, non-zero credit blocks for a customer. * * If `include_all_blocks` is set to `true`, all credit blocks (including expired * and depleted blocks) will be included in the response. * * Note that `currency` defaults to credits if not specified. To use a real world * currency, set `currency` to an ISO 4217 string. * * Results can be filtered by the block's `effective_date` using the * `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and * `effective_date[lte]` query parameters. This filters on when the credit block * becomes effective, which may differ from creation time for backdated credits. */ list(customerID, query = {}, options) { return this._client.getAPIList((0, path_1.path) `/customers/${customerID}/credits`, (pagination_1.Page), { query, ...options, }); } /** * Returns a paginated list of unexpired, non-zero credit blocks for a customer. * * If `include_all_blocks` is set to `true`, all credit blocks (including expired * and depleted blocks) will be included in the response. * * Note that `currency` defaults to credits if not specified. To use a real world * currency, set `currency` to an ISO 4217 string. * * Results can be filtered by the block's `effective_date` using the * `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and * `effective_date[lte]` query parameters. This filters on when the credit block * becomes effective, which may differ from creation time for backdated credits. */ listByExternalID(externalCustomerID, query = {}, options) { return this._client.getAPIList((0, path_1.path) `/customers/external_customer_id/${externalCustomerID}/credits`, (pagination_1.Page), { query, ...options }); } } exports.Credits = Credits; Credits.Ledger = ledger_1.Ledger; Credits.TopUps = top_ups_1.TopUps; //# sourceMappingURL=credits.js.map