cloudflare
Version:
The official TypeScript library for the Cloudflare API
50 lines • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Plans = exports.BasePlans = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BasePlans = /* @__PURE__ */ (() => {
class BasePlans extends resource_1.APIResource {
/**
* Lists available plans the zone can subscribe to.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const availableRatePlan of client.zones.plans.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/available_plans`, (pagination_1.SinglePage), options);
}
/**
* Details of the available plan that the zone can subscribe to.
*
* @example
* ```ts
* const availableRatePlan = await client.zones.plans.get(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(planIdentifier, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/available_plans/${planIdentifier}`, options)._thenUnwrap((obj) => obj.result);
}
}
BasePlans._key = Object.freeze(['zones', 'plans']);
return BasePlans;
})();
exports.BasePlans = BasePlans;
class Plans extends BasePlans {
}
exports.Plans = Plans;
//# sourceMappingURL=plans.js.map