UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

48 lines 2.32 kB
// 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"; export class SubscriptionChanges extends APIResource { /** * This endpoint returns a subscription change given an identifier. * * A subscription change is created by including * `Create-Pending-Subscription-Change: True` in the header of a subscription * mutation API call (e.g. * [create subscription endpoint](/api-reference/subscription/create-subscription), * [schedule plan change endpoint](/api-reference/subscription/schedule-plan-change), * ...). The subscription change will be referenced by the * `pending_subscription_change` field in the response. */ retrieve(subscriptionChangeID, options) { return this._client.get(path `/subscription_changes/${subscriptionChangeID}`, options); } /** * This endpoint returns a list of pending subscription changes for a customer. Use * the [Fetch Subscription Change](fetch-subscription-change) endpoint to retrieve * the expected subscription state after the pending change is applied. */ list(query = {}, options) { return this._client.getAPIList('/subscription_changes', (Page), { query, ...options, }); } /** * Apply a subscription change to perform the intended action. If a positive amount * is passed with a request to this endpoint, any eligible invoices that were * created will be issued immediately if they only contain in-advance fees. */ apply(subscriptionChangeID, body = {}, options) { return this._client.post(path `/subscription_changes/${subscriptionChangeID}/apply`, { body, ...options }); } /** * Cancel a subscription change. The change can no longer be applied. A * subscription can only have one "pending" change at a time - use this endpoint to * cancel an existing change before creating a new one. */ cancel(subscriptionChangeID, options) { return this._client.post(path `/subscription_changes/${subscriptionChangeID}/cancel`, options); } } //# sourceMappingURL=subscription-changes.mjs.map