cloudflare
Version:
The official TypeScript library for the Cloudflare API
64 lines • 2.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Subscriptions = exports.BaseSubscriptions = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const path_1 = require("../../internal/utils/path.js");
var BaseSubscriptions = /* @__PURE__ */ (() => {
class BaseSubscriptions extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/zones/${zone_id}/subscription`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSubscriptions._key = Object.freeze([
'zones',
'subscriptions',
]);
return BaseSubscriptions;
})();
exports.BaseSubscriptions = BaseSubscriptions;
class Subscriptions extends BaseSubscriptions {
}
exports.Subscriptions = Subscriptions;
//# sourceMappingURL=subscriptions.js.map