cloudflare
Version:
The official TypeScript library for the Cloudflare API
171 lines • 8.09 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Zones = exports.BaseZones = void 0;
const tslib_1 = require("../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const ActivationCheckAPI = tslib_1.__importStar(require("./activation-check.js"));
const activation_check_1 = require("./activation-check.js");
const CustomNameserversAPI = tslib_1.__importStar(require("./custom-nameservers.js"));
const custom_nameservers_1 = require("./custom-nameservers.js");
const EntitlementsAPI = tslib_1.__importStar(require("./entitlements.js"));
const entitlements_1 = require("./entitlements.js");
const EnvironmentsAPI = tslib_1.__importStar(require("./environments.js"));
const environments_1 = require("./environments.js");
const HoldsAPI = tslib_1.__importStar(require("./holds.js"));
const holds_1 = require("./holds.js");
const NELAPI = tslib_1.__importStar(require("./nel.js"));
const nel_1 = require("./nel.js");
const PlansAPI = tslib_1.__importStar(require("./plans.js"));
const plans_1 = require("./plans.js");
const RatePlansAPI = tslib_1.__importStar(require("./rate-plans.js"));
const rate_plans_1 = require("./rate-plans.js");
const SettingsAPI = tslib_1.__importStar(require("./settings.js"));
const settings_1 = require("./settings.js");
const SubscriptionsAPI = tslib_1.__importStar(require("./subscriptions.js"));
const subscriptions_1 = require("./subscriptions.js");
const TransformationsAllowedOriginsAPI = tslib_1.__importStar(require("./transformations-allowed-origins.js"));
const transformations_allowed_origins_1 = require("./transformations-allowed-origins.js");
const TransformationsC2paAPI = tslib_1.__importStar(require("./transformations-c2pa.js"));
const transformations_c2pa_1 = require("./transformations-c2pa.js");
const CTAPI = tslib_1.__importStar(require("./ct/ct.js"));
const ct_1 = require("./ct/ct.js");
const ObservabilityAPI = tslib_1.__importStar(require("./observability/observability.js"));
const observability_1 = require("./observability/observability.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseZones = /* @__PURE__ */ (() => {
class BaseZones extends resource_1.APIResource {
/**
* Creates a new zone (domain) in your Cloudflare account.
*
* The zone is created in a pending state and must be activated by updating your
* domain's nameservers to point to Cloudflare, or by completing the verification
* process for partial (CNAME) setups.
*
* @example
* ```ts
* const zone = await client.zones.create({
* account: {},
* name: 'example.com',
* });
* ```
*/
create(body, options) {
return this._client.post('/zones', { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists, searches, sorts, and filters your zones. Listing zones across more than
* 500 accounts is currently not allowed.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const zone of client.zones.list()) {
* // ...
* }
* ```
*/
list(query = {}, options) {
return this._client.getAPIList('/zones', (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes an existing zone.
*
* @example
* ```ts
* const zone = await client.zones.delete({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
delete(params, options) {
const { zone_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Edits a zone. Only one zone property can be changed at a time.
*
* @example
* ```ts
* const zone = await client.zones.edit({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
edit(params, options) {
const { zone_id, ...body } = params;
return this._client.patch((0, path_1.path) `/zones/${zone_id}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves detailed information about a specific zone identified by its zone ID.
*
* Returns zone configuration, status, nameservers, and associated metadata.
*
* @example
* ```ts
* const zone = await client.zones.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseZones._key = Object.freeze(['zones']);
return BaseZones;
})();
exports.BaseZones = BaseZones;
var Zones = /* @__PURE__ */ (() => {
class Zones extends BaseZones {
constructor() {
super(...arguments);
this.activationCheck = new ActivationCheckAPI.ActivationCheck(this._client);
this.observability = new ObservabilityAPI.Observability(this._client);
this.settings = new SettingsAPI.Settings(this._client);
this.transformationsAllowedOrigins = new TransformationsAllowedOriginsAPI.TransformationsAllowedOrigins(this._client);
this.transformationsC2pa = new TransformationsC2paAPI.TransformationsC2paResource(this._client);
this.nel = new NELAPI.NEL(this._client);
this.environments = new EnvironmentsAPI.Environments(this._client);
this.customNameservers = new CustomNameserversAPI.CustomNameservers(this._client);
this.holds = new HoldsAPI.Holds(this._client);
this.subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
this.plans = new PlansAPI.Plans(this._client);
this.ratePlans = new RatePlansAPI.RatePlans(this._client);
this.entitlements = new EntitlementsAPI.Entitlements(this._client);
this.ct = new CTAPI.CT(this._client);
}
}
Zones.ActivationCheck = activation_check_1.ActivationCheck;
Zones.BaseActivationCheck = activation_check_1.BaseActivationCheck;
Zones.Observability = observability_1.Observability;
Zones.BaseObservability = observability_1.BaseObservability;
Zones.Settings = settings_1.Settings;
Zones.BaseSettings = settings_1.BaseSettings;
Zones.BaseTransformationsAllowedOrigins = transformations_allowed_origins_1.BaseTransformationsAllowedOrigins;
Zones.TransformationsC2paResource = transformations_c2pa_1.TransformationsC2paResource;
Zones.BaseTransformationsC2paResource = transformations_c2pa_1.BaseTransformationsC2paResource;
Zones.NELResource = nel_1.NEL;
Zones.BaseNEL = nel_1.BaseNEL;
Zones.Environments = environments_1.Environments;
Zones.BaseEnvironments = environments_1.BaseEnvironments;
Zones.CustomNameservers = custom_nameservers_1.CustomNameservers;
Zones.BaseCustomNameservers = custom_nameservers_1.BaseCustomNameservers;
Zones.Holds = holds_1.Holds;
Zones.BaseHolds = holds_1.BaseHolds;
Zones.Subscriptions = subscriptions_1.Subscriptions;
Zones.BaseSubscriptions = subscriptions_1.BaseSubscriptions;
Zones.Plans = plans_1.Plans;
Zones.BasePlans = plans_1.BasePlans;
Zones.RatePlans = rate_plans_1.RatePlans;
Zones.BaseRatePlans = rate_plans_1.BaseRatePlans;
Zones.Entitlements = entitlements_1.Entitlements;
Zones.BaseEntitlements = entitlements_1.BaseEntitlements;
Zones.CT = ct_1.CT;
Zones.BaseCT = ct_1.BaseCT;
return Zones;
})();
exports.Zones = Zones;
//# sourceMappingURL=zones.js.map