cloudflare
Version:
The official TypeScript library for the Cloudflare API
59 lines • 2.09 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 BaseSubscriptions = /* @__PURE__ */ (() => {
class BaseSubscriptions extends APIResource {
/**
* Create a zone subscription, either plan or add-ons.
*
* @example
* ```ts
* const subscription =
* await client.zones.subscriptions.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post(path `/zones/${zone_id}/subscription`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates zone subscriptions, either plan or add-ons.
*
* @example
* ```ts
* const subscription =
* await client.zones.subscriptions.update({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
update(params, options) {
const { zone_id, ...body } = params;
return this._client.put(path `/zones/${zone_id}/subscription`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists zone subscription details.
*
* @example
* ```ts
* const subscription = await client.zones.subscriptions.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { zone_id } = params;
return this._client.get(path `/zones/${zone_id}/subscription`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSubscriptions._key = Object.freeze([
'zones',
'subscriptions',
]);
return BaseSubscriptions;
})();
export class Subscriptions extends BaseSubscriptions {
}
//# sourceMappingURL=subscriptions.mjs.map