orb-billing
Version:
The official TypeScript library for the Orb API
33 lines • 1.61 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Subscriptions = void 0;
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
/**
* A coupon represents a reusable discount configuration that can be applied either as a fixed or percentage amount to an invoice or subscription. Coupons are activated using a redemption code, which applies the discount to a subscription or invoice. The duration of a coupon determines how long it remains available for use by end users.
*/
class Subscriptions extends resource_1.APIResource {
/**
* This endpoint returns a list of all subscriptions that have redeemed a given
* coupon as a [paginated](/api-reference/pagination) list, ordered starting from
* the most recently created subscription. For a full discussion of the
* subscription resource, see [Subscription](/core-concepts#subscription).
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const subscription of client.coupons.subscriptions.list(
* 'coupon_id',
* )) {
* // ...
* }
* ```
*/
list(couponID, query = {}, options) {
return this._client.getAPIList((0, path_1.path) `/coupons/${couponID}/subscriptions`, (pagination_1.Page), { query, ...options });
}
}
exports.Subscriptions = Subscriptions;
//# sourceMappingURL=subscriptions.js.map