UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

52 lines 2.55 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.SubscriptionChanges = void 0; const resource_1 = require("../core/resource.js"); const pagination_1 = require("../core/pagination.js"); const path_1 = require("../internal/utils/path.js"); class SubscriptionChanges extends resource_1.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((0, path_1.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', (pagination_1.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((0, path_1.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((0, path_1.path) `/subscription_changes/${subscriptionChangeID}/cancel`, options); } } exports.SubscriptionChanges = SubscriptionChanges; //# sourceMappingURL=subscription-changes.js.map