cloudflare
Version:
The official TypeScript library for the Cloudflare API
51 lines • 1.96 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseCancelReason = /* @__PURE__ */ (() => {
class BaseCancelReason extends APIResource {
/**
* Records a cancellation reason for an account subscription.
*
* @example
* ```ts
* const cancelReason =
* await client.accounts.subscriptions.cancelReason.create(
* '506e3185e9c882d175a2d0cb0093d9f2',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
create(subscriptionIdentifier, params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/subscriptions/${subscriptionIdentifier}/cancel-reason`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Gets the cancellation reason for an account subscription.
*
* @example
* ```ts
* const cancelReason =
* await client.accounts.subscriptions.cancelReason.get(
* '506e3185e9c882d175a2d0cb0093d9f2',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(subscriptionIdentifier, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/subscriptions/${subscriptionIdentifier}/cancel-reason`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseCancelReason._key = Object.freeze([
'accounts',
'subscriptions',
'cancelReason',
]);
return BaseCancelReason;
})();
export class CancelReason extends BaseCancelReason {
}
//# sourceMappingURL=cancel-reason.mjs.map