orb-billing
Version:
The official TypeScript library for the Orb API
81 lines • 3.73 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.TopUpListByExternalIDResponsesPage = exports.TopUpListResponsesPage = exports.TopUps = void 0;
const resource_1 = require("../../../resource.js");
const core_1 = require("../../../core.js");
const pagination_1 = require("../../../pagination.js");
/**
* The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
*/
class TopUps extends resource_1.APIResource {
/**
* This endpoint allows you to create a new top-up for a specified customer's
* balance. While this top-up is active, the customer's balance will added in
* increments of the specified amount whenever the balance reaches the specified
* threshold.
*
* If a top-up already exists for this customer in the same currency, the existing
* top-up will be replaced.
*/
create(customerId, body, options) {
return this._client.post(`/customers/${customerId}/credits/top_ups`, { body, ...options });
}
list(customerId, query = {}, options) {
if ((0, core_1.isRequestOptions)(query)) {
return this.list(customerId, {}, query);
}
return this._client.getAPIList(`/customers/${customerId}/credits/top_ups`, TopUpListResponsesPage, {
query,
...options,
});
}
/**
* This deactivates the top-up and voids any invoices associated with pending
* credit blocks purchased through the top-up.
*/
delete(customerId, topUpId, options) {
return this._client.delete(`/customers/${customerId}/credits/top_ups/${topUpId}`, {
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}
/**
* This endpoint allows you to create a new top-up for a specified customer's
* balance. While this top-up is active, the customer's balance will added in
* increments of the specified amount whenever the balance reaches the specified
* threshold.
*
* If a top-up already exists for this customer in the same currency, the existing
* top-up will be replaced.
*/
createByExternalId(externalCustomerId, body, options) {
return this._client.post(`/customers/external_customer_id/${externalCustomerId}/credits/top_ups`, {
body,
...options,
});
}
/**
* This deactivates the top-up and voids any invoices associated with pending
* credit blocks purchased through the top-up.
*/
deleteByExternalId(externalCustomerId, topUpId, options) {
return this._client.delete(`/customers/external_customer_id/${externalCustomerId}/credits/top_ups/${topUpId}`, { ...options, headers: { Accept: '*/*', ...options?.headers } });
}
listByExternalId(externalCustomerId, query = {}, options) {
if ((0, core_1.isRequestOptions)(query)) {
return this.listByExternalId(externalCustomerId, {}, query);
}
return this._client.getAPIList(`/customers/external_customer_id/${externalCustomerId}/credits/top_ups`, TopUpListByExternalIDResponsesPage, { query, ...options });
}
}
exports.TopUps = TopUps;
class TopUpListResponsesPage extends pagination_1.Page {
}
exports.TopUpListResponsesPage = TopUpListResponsesPage;
class TopUpListByExternalIDResponsesPage extends pagination_1.Page {
}
exports.TopUpListByExternalIDResponsesPage = TopUpListByExternalIDResponsesPage;
TopUps.TopUpListResponsesPage = TopUpListResponsesPage;
TopUps.TopUpListByExternalIDResponsesPage = TopUpListByExternalIDResponsesPage;
//# sourceMappingURL=top-ups.js.map