cloudflare
Version:
The official TypeScript library for the Cloudflare API
165 lines • 7.38 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as ActivationCheckAPI from "./activation-check.mjs";
import { ActivationCheck, BaseActivationCheck, } from "./activation-check.mjs";
import * as CustomNameserversAPI from "./custom-nameservers.mjs";
import { BaseCustomNameservers, CustomNameservers, } from "./custom-nameservers.mjs";
import * as EntitlementsAPI from "./entitlements.mjs";
import { BaseEntitlements, Entitlements, } from "./entitlements.mjs";
import * as EnvironmentsAPI from "./environments.mjs";
import { BaseEnvironments, Environments, } from "./environments.mjs";
import * as HoldsAPI from "./holds.mjs";
import { BaseHolds, Holds, } from "./holds.mjs";
import * as NELAPI from "./nel.mjs";
import { BaseNEL, NEL as NELResource } from "./nel.mjs";
import * as PlansAPI from "./plans.mjs";
import { BasePlans, Plans, } from "./plans.mjs";
import * as RatePlansAPI from "./rate-plans.mjs";
import { BaseRatePlans, RatePlans, } from "./rate-plans.mjs";
import * as SettingsAPI from "./settings.mjs";
import { BaseSettings, Settings, } from "./settings.mjs";
import * as SubscriptionsAPI from "./subscriptions.mjs";
import { BaseSubscriptions, Subscriptions, } from "./subscriptions.mjs";
import * as TransformationsAllowedOriginsAPI from "./transformations-allowed-origins.mjs";
import { BaseTransformationsAllowedOrigins, } from "./transformations-allowed-origins.mjs";
import * as TransformationsC2paAPI from "./transformations-c2pa.mjs";
import { BaseTransformationsC2paResource, TransformationsC2paResource, } from "./transformations-c2pa.mjs";
import * as CTAPI from "./ct/ct.mjs";
import { BaseCT, CT } from "./ct/ct.mjs";
import * as ObservabilityAPI from "./observability/observability.mjs";
import { BaseObservability, Observability } from "./observability/observability.mjs";
import { V4PagePaginationArray } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseZones = /* @__PURE__ */ (() => {
class BaseZones extends 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', (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(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(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(path `/zones/${zone_id}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseZones._key = Object.freeze(['zones']);
return BaseZones;
})();
export 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 = ActivationCheck;
Zones.BaseActivationCheck = BaseActivationCheck;
Zones.Observability = Observability;
Zones.BaseObservability = BaseObservability;
Zones.Settings = Settings;
Zones.BaseSettings = BaseSettings;
Zones.BaseTransformationsAllowedOrigins = BaseTransformationsAllowedOrigins;
Zones.TransformationsC2paResource = TransformationsC2paResource;
Zones.BaseTransformationsC2paResource = BaseTransformationsC2paResource;
Zones.NELResource = NELResource;
Zones.BaseNEL = BaseNEL;
Zones.Environments = Environments;
Zones.BaseEnvironments = BaseEnvironments;
Zones.CustomNameservers = CustomNameservers;
Zones.BaseCustomNameservers = BaseCustomNameservers;
Zones.Holds = Holds;
Zones.BaseHolds = BaseHolds;
Zones.Subscriptions = Subscriptions;
Zones.BaseSubscriptions = BaseSubscriptions;
Zones.Plans = Plans;
Zones.BasePlans = BasePlans;
Zones.RatePlans = RatePlans;
Zones.BaseRatePlans = BaseRatePlans;
Zones.Entitlements = Entitlements;
Zones.BaseEntitlements = BaseEntitlements;
Zones.CT = CT;
Zones.BaseCT = BaseCT;
return Zones;
})();
//# sourceMappingURL=zones.mjs.map