orb-billing
Version:
The official TypeScript library for the Orb API
29 lines • 1.42 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { Page } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
/**
* 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.
*/
export class Subscriptions extends 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(path `/coupons/${couponID}/subscriptions`, (Page), { query, ...options });
}
}
//# sourceMappingURL=subscriptions.mjs.map