cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
da8a8612215ea86c5425464a95d08ddceed96146

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/index.ts

895lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { type Agent } from './_shims/index';
4import * as qs from './internal/qs';
5import * as Core from './core';
6import * as Errors from './error';
7import * as Pagination from './pagination';
8import {
9 type CursorLimitPaginationParams,
10 CursorLimitPaginationResponse,
11 type CursorPaginationAfterParams,
12 CursorPaginationAfterResponse,
13 type CursorPaginationParams,
14 CursorPaginationResponse,
15 SinglePageResponse,
16 type V4PagePaginationArrayParams,
17 V4PagePaginationArrayResponse,
18 type V4PagePaginationParams,
19 V4PagePaginationResponse,
20} from './pagination';
21import * as Uploads from './uploads';
22import * as API from './resources/index';
23import { AuditLogs } from './resources/audit-logs';
24import { BotManagement } from './resources/bot-management';
25import { ClientCertificates } from './resources/client-certificates';
26import { CustomNameservers } from './resources/custom-nameservers';
27import { CustomPages } from './resources/custom-pages';
28import { DCVDelegation } from './resources/dcv-delegation';
29import { Filters } from './resources/filters';
30import { IPs } from './resources/ips';
31import { KeylessCertificates } from './resources/keyless-certificates';
32import { ManagedTransforms } from './resources/managed-transforms';
33import { Memberships } from './resources/memberships';
34import { OriginCACertificates } from './resources/origin-ca-certificates';
35import { OriginPostQuantumEncryption } from './resources/origin-post-quantum-encryption';
36import { PageRules } from './resources/page-rules';
37import { RateLimits } from './resources/rate-limits';
38import { RealtimeKit } from './resources/realtime-kit';
39import { SecurityTXT } from './resources/security-txt';
40import { URLNormalization } from './resources/url-normalization';
41import { AbuseReports } from './resources/abuse-reports/abuse-reports';
42import { Accounts } from './resources/accounts/accounts';
43import { ACM } from './resources/acm/acm';
44import { Addressing } from './resources/addressing/addressing';
45import { AIGateway } from './resources/ai-gateway/ai-gateway';
46import { AI } from './resources/ai/ai';
47import { Alerting } from './resources/alerting/alerting';
48import { APIGateway } from './resources/api-gateway/api-gateway';
49import { Argo } from './resources/argo/argo';
50import { Billing } from './resources/billing/billing';
51import { BotnetFeed } from './resources/botnet-feed/botnet-feed';
52import { BrandProtection } from './resources/brand-protection/brand-protection';
53import { BrowserRendering } from './resources/browser-rendering/browser-rendering';
54import { Cache } from './resources/cache/cache';
55import { Calls } from './resources/calls/calls';
56import { CertificateAuthorities } from './resources/certificate-authorities/certificate-authorities';
57import { CloudConnector } from './resources/cloud-connector/cloud-connector';
58import { CloudforceOne } from './resources/cloudforce-one/cloudforce-one';
59import { Connectivity } from './resources/connectivity/connectivity';
60import { ContentScanning } from './resources/content-scanning/content-scanning';
61import { CustomCertificates } from './resources/custom-certificates/custom-certificates';
62import { CustomHostnames } from './resources/custom-hostnames/custom-hostnames';
63import { D1Resource } from './resources/d1/d1';
64import { Diagnostics } from './resources/diagnostics/diagnostics';
65import { DNSFirewall } from './resources/dns-firewall/dns-firewall';
66import { DNS } from './resources/dns/dns';
67import { DurableObjects } from './resources/durable-objects/durable-objects';
68import { EmailRouting } from './resources/email-routing/email-routing';
69import { EmailSecurity } from './resources/email-security/email-security';
70import { Firewall } from './resources/firewall/firewall';
71import { Healthchecks } from './resources/healthchecks/healthchecks';
72import { Hostnames } from './resources/hostnames/hostnames';
73import { HyperdriveResource } from './resources/hyperdrive/hyperdrive';
74import { IAM } from './resources/iam/iam';
75import { Images } from './resources/images/images';
76import { Intel } from './resources/intel/intel';
77import { KV } from './resources/kv/kv';
78import { LeakedCredentialChecks } from './resources/leaked-credential-checks/leaked-credential-checks';
79import { LoadBalancers } from './resources/load-balancers/load-balancers';
80import { Logpush } from './resources/logpush/logpush';
81import { Logs } from './resources/logs/logs';
82import { MagicCloudNetworking } from './resources/magic-cloud-networking/magic-cloud-networking';
83import { MagicNetworkMonitoring } from './resources/magic-network-monitoring/magic-network-monitoring';
84import { MagicTransit } from './resources/magic-transit/magic-transit';
85import { MTLSCertificates } from './resources/mtls-certificates/mtls-certificates';
86import { NetworkInterconnects } from './resources/network-interconnects/network-interconnects';
87import { Organizations } from './resources/organizations/organizations';
88import { OriginTLSClientAuth } from './resources/origin-tls-client-auth/origin-tls-client-auth';
89import { PageShield } from './resources/page-shield/page-shield';
90import { Pages } from './resources/pages/pages';
91import { Pipelines } from './resources/pipelines/pipelines';
92import { Queues } from './resources/queues/queues';
93import { R2DataCatalog } from './resources/r2-data-catalog/r2-data-catalog';
94import { R2 } from './resources/r2/r2';
95import { Radar } from './resources/radar/radar';
96import { Registrar } from './resources/registrar/registrar';
97import { RequestTracers } from './resources/request-tracers/request-tracers';
98import { ResourceSharing } from './resources/resource-sharing/resource-sharing';
99import { Rules } from './resources/rules/rules';
100import { Rulesets } from './resources/rulesets/rulesets';
101import { RUM } from './resources/rum/rum';
102import { SchemaValidation } from './resources/schema-validation/schema-validation';
103import { SecretsStore } from './resources/secrets-store/secrets-store';
104import { SecurityCenter } from './resources/security-center/security-center';
105import { Snippets } from './resources/snippets/snippets';
106import { Spectrum } from './resources/spectrum/spectrum';
107import { Speed } from './resources/speed/speed';
108import { SSL } from './resources/ssl/ssl';
109import { Stream } from './resources/stream/stream';
110import { TokenValidation } from './resources/token-validation/token-validation';
111import { Turnstile } from './resources/turnstile/turnstile';
112import { URLScanner } from './resources/url-scanner/url-scanner';
113import { User } from './resources/user/user';
114import { Vectorize } from './resources/vectorize/vectorize';
115import { WaitingRooms } from './resources/waiting-rooms/waiting-rooms';
116import { Web3 } from './resources/web3/web3';
117import { WorkersForPlatforms } from './resources/workers-for-platforms/workers-for-platforms';
118import { Workers } from './resources/workers/workers';
119import { Workflows } from './resources/workflows/workflows';
120import { Zaraz } from './resources/zaraz/zaraz';
121import { ZeroTrust } from './resources/zero-trust/zero-trust';
122import { Zones } from './resources/zones/zones';
123
124export interface ClientOptions {
125 /**
126 * The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).
127 */
128 apiToken?: string | null | undefined;
129
130 /**
131 * The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
132 */
133 apiKey?: string | null | undefined;
134
135 /**
136 * The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
137 */
138 apiEmail?: string | null | undefined;
139
140 /**
141 * Used when interacting with the Origin CA certificates API. [View/change your key](https://developers.cloudflare.com/fundamentals/api/get-started/ca-keys/#viewchange-your-origin-ca-keys).
142 */
143 userServiceKey?: string | null | undefined;
144
145 /**
146 * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
147 *
148 * Defaults to process.env['CLOUDFLARE_BASE_URL'].
149 */
150 baseURL?: string | null | undefined;
151
152 /**
153 * Define the API version to target for the requests, e.g., "2025-01-01"
154 */
155 apiVersion?: string | null;
156
157 /**
158 * The maximum amount of time (in milliseconds) that the client should wait for a response
159 * from the server before timing out a single request.
160 *
161 * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
162 * much longer than this timeout before the promise succeeds or fails.
163 *
164 * @unit milliseconds
165 */
166 timeout?: number | undefined;
167
168 /**
169 * An HTTP agent used to manage HTTP(S) connections.
170 *
171 * If not provided, an agent will be constructed by default in the Node.js environment,
172 * otherwise no agent is used.
173 */
174 httpAgent?: Agent | undefined;
175
176 /**
177 * Specify a custom `fetch` function implementation.
178 *
179 * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
180 * defined globally.
181 */
182 fetch?: Core.Fetch | undefined;
183
184 /**
185 * The maximum number of times that the client will retry a request in case of a
186 * temporary failure, like a network error or a 5XX error from the server.
187 *
188 * @default 2
189 */
190 maxRetries?: number | undefined;
191
192 /**
193 * Default headers to include with every request to the API.
194 *
195 * These can be removed in individual requests by explicitly setting the
196 * header to `undefined` or `null` in request options.
197 */
198 defaultHeaders?: Core.Headers | undefined;
199
200 /**
201 * Default query parameters to include with every request to the API.
202 *
203 * These can be removed in individual requests by explicitly setting the
204 * param to `undefined` in request options.
205 */
206 defaultQuery?: Core.DefaultQuery | undefined;
207}
208
209/**
210 * API Client for interfacing with the Cloudflare API.
211 */
212export class Cloudflare extends Core.APIClient {
213 apiToken: string | null;
214 apiKey: string | null;
215 apiEmail: string | null;
216 userServiceKey: string | null;
217
218 private _options: ClientOptions;
219
220 /**
221 * API Client for interfacing with the Cloudflare API.
222 *
223 * @param {string | null | undefined} [opts.apiToken=process.env['CLOUDFLARE_API_TOKEN'] ?? null]
224 * @param {string | null | undefined} [opts.apiKey=process.env['CLOUDFLARE_API_KEY'] ?? null]
225 * @param {string | null | undefined} [opts.apiEmail=process.env['CLOUDFLARE_EMAIL'] ?? null]
226 * @param {string | null | undefined} [opts.userServiceKey=process.env['CLOUDFLARE_API_USER_SERVICE_KEY'] ?? null]
227 * @param {string} [opts.baseURL=process.env['CLOUDFLARE_BASE_URL'] ?? https://api.cloudflare.com/client/v4] - Override the default base URL for the API.
228 * @param {string | null} [opts.apiVersion] - Define the version to target for the API.
229 * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
230 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
231 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
232 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
233 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
234 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
235 */
236 constructor({
237 baseURL = Core.readEnv('CLOUDFLARE_BASE_URL'),
238 apiVersion = null,
239 apiToken = Core.readEnv('CLOUDFLARE_API_TOKEN') ?? null,
240 apiKey = Core.readEnv('CLOUDFLARE_API_KEY') ?? null,
241 apiEmail = Core.readEnv('CLOUDFLARE_EMAIL') ?? null,
242 userServiceKey = Core.readEnv('CLOUDFLARE_API_USER_SERVICE_KEY') ?? null,
243 ...opts
244 }: ClientOptions = {}) {
245 const options: ClientOptions = {
246 apiToken,
247 apiKey,
248 apiEmail,
249 userServiceKey,
250 ...opts,
251 baseURL: baseURL || `https://api.cloudflare.com/client/v4`,
252 apiVersion: apiVersion || new Date().toISOString().slice(0, 10),
253 };
254
255 super({
256 baseURL: options.baseURL!,
257 apiVersion: options.apiVersion!,
258 baseURLOverridden: baseURL ? baseURL !== 'https://api.cloudflare.com/client/v4' : false,
259 timeout: options.timeout ?? 60000 /* 1 minute */,
260 httpAgent: options.httpAgent,
261 maxRetries: options.maxRetries,
262 fetch: options.fetch,
263 });
264
265 this._options = options;
266
267 this.apiToken = apiToken;
268 this.apiKey = apiKey;
269 this.apiEmail = apiEmail;
270 this.userServiceKey = userServiceKey;
271 }
272
273 accounts: API.Accounts = new API.Accounts(this);
274 organizations: API.Organizations = new API.Organizations(this);
275 originCACertificates: API.OriginCACertificates = new API.OriginCACertificates(this);
276 ips: API.IPs = new API.IPs(this);
277 memberships: API.Memberships = new API.Memberships(this);
278 user: API.User = new API.User(this);
279 zones: API.Zones = new API.Zones(this);
280 loadBalancers: API.LoadBalancers = new API.LoadBalancers(this);
281 cache: API.Cache = new API.Cache(this);
282 ssl: API.SSL = new API.SSL(this);
283 acm: API.ACM = new API.ACM(this);
284 argo: API.Argo = new API.Argo(this);
285 certificateAuthorities: API.CertificateAuthorities = new API.CertificateAuthorities(this);
286 clientCertificates: API.ClientCertificates = new API.ClientCertificates(this);
287 customCertificates: API.CustomCertificates = new API.CustomCertificates(this);
288 customHostnames: API.CustomHostnames = new API.CustomHostnames(this);
289 customNameservers: API.CustomNameservers = new API.CustomNameservers(this);
290 dnsFirewall: API.DNSFirewall = new API.DNSFirewall(this);
291 dns: API.DNS = new API.DNS(this);
292 emailSecurity: API.EmailSecurity = new API.EmailSecurity(this);
293 emailRouting: API.EmailRouting = new API.EmailRouting(this);
294 filters: API.Filters = new API.Filters(this);
295 firewall: API.Firewall = new API.Firewall(this);
296 healthchecks: API.Healthchecks = new API.Healthchecks(this);
297 keylessCertificates: API.KeylessCertificates = new API.KeylessCertificates(this);
298 logpush: API.Logpush = new API.Logpush(this);
299 logs: API.Logs = new API.Logs(this);
300 originTLSClientAuth: API.OriginTLSClientAuth = new API.OriginTLSClientAuth(this);
301 pageRules: API.PageRules = new API.PageRules(this);
302 rateLimits: API.RateLimits = new API.RateLimits(this);
303 waitingRooms: API.WaitingRooms = new API.WaitingRooms(this);
304 web3: API.Web3 = new API.Web3(this);
305 workers: API.Workers = new API.Workers(this);
306 kv: API.KV = new API.KV(this);
307 durableObjects: API.DurableObjects = new API.DurableObjects(this);
308 queues: API.Queues = new API.Queues(this);
309 apiGateway: API.APIGateway = new API.APIGateway(this);
310 managedTransforms: API.ManagedTransforms = new API.ManagedTransforms(this);
311 pageShield: API.PageShield = new API.PageShield(this);
312 rulesets: API.Rulesets = new API.Rulesets(this);
313 urlNormalization: API.URLNormalization = new API.URLNormalization(this);
314 spectrum: API.Spectrum = new API.Spectrum(this);
315 addressing: API.Addressing = new API.Addressing(this);
316 auditLogs: API.AuditLogs = new API.AuditLogs(this);
317 billing: API.Billing = new API.Billing(this);
318 brandProtection: API.BrandProtection = new API.BrandProtection(this);
319 diagnostics: API.Diagnostics = new API.Diagnostics(this);
320 images: API.Images = new API.Images(this);
321 intel: API.Intel = new API.Intel(this);
322 magicTransit: API.MagicTransit = new API.MagicTransit(this);
323 magicNetworkMonitoring: API.MagicNetworkMonitoring = new API.MagicNetworkMonitoring(this);
324 magicCloudNetworking: API.MagicCloudNetworking = new API.MagicCloudNetworking(this);
325 networkInterconnects: API.NetworkInterconnects = new API.NetworkInterconnects(this);
326 mtlsCertificates: API.MTLSCertificates = new API.MTLSCertificates(this);
327 pages: API.Pages = new API.Pages(this);
328 registrar: API.Registrar = new API.Registrar(this);
329 requestTracers: API.RequestTracers = new API.RequestTracers(this);
330 rules: API.Rules = new API.Rules(this);
331 stream: API.Stream = new API.Stream(this);
332 alerting: API.Alerting = new API.Alerting(this);
333 d1: API.D1Resource = new API.D1Resource(this);
334 r2: API.R2 = new API.R2(this);
335 r2DataCatalog: API.R2DataCatalog = new API.R2DataCatalog(this);
336 workersForPlatforms: API.WorkersForPlatforms = new API.WorkersForPlatforms(this);
337 zeroTrust: API.ZeroTrust = new API.ZeroTrust(this);
338 turnstile: API.Turnstile = new API.Turnstile(this);
339 connectivity: API.Connectivity = new API.Connectivity(this);
340 hyperdrive: API.HyperdriveResource = new API.HyperdriveResource(this);
341 rum: API.RUM = new API.RUM(this);
342 vectorize: API.Vectorize = new API.Vectorize(this);
343 urlScanner: API.URLScanner = new API.URLScanner(this);
344 radar: API.Radar = new API.Radar(this);
345 botManagement: API.BotManagement = new API.BotManagement(this);
346 originPostQuantumEncryption: API.OriginPostQuantumEncryption = new API.OriginPostQuantumEncryption(this);
347 zaraz: API.Zaraz = new API.Zaraz(this);
348 speed: API.Speed = new API.Speed(this);
349 dcvDelegation: API.DCVDelegation = new API.DCVDelegation(this);
350 hostnames: API.Hostnames = new API.Hostnames(this);
351 snippets: API.Snippets = new API.Snippets(this);
352 realtimeKit: API.RealtimeKit = new API.RealtimeKit(this);
353 calls: API.Calls = new API.Calls(this);
354 cloudforceOne: API.CloudforceOne = new API.CloudforceOne(this);
355 aiGateway: API.AIGateway = new API.AIGateway(this);
356 iam: API.IAM = new API.IAM(this);
357 cloudConnector: API.CloudConnector = new API.CloudConnector(this);
358 botnetFeed: API.BotnetFeed = new API.BotnetFeed(this);
359 securityTXT: API.SecurityTXT = new API.SecurityTXT(this);
360 workflows: API.Workflows = new API.Workflows(this);
361 resourceSharing: API.ResourceSharing = new API.ResourceSharing(this);
362 leakedCredentialChecks: API.LeakedCredentialChecks = new API.LeakedCredentialChecks(this);
363 contentScanning: API.ContentScanning = new API.ContentScanning(this);
364 abuseReports: API.AbuseReports = new API.AbuseReports(this);
365 ai: API.AI = new API.AI(this);
366 securityCenter: API.SecurityCenter = new API.SecurityCenter(this);
367 browserRendering: API.BrowserRendering = new API.BrowserRendering(this);
368 customPages: API.CustomPages = new API.CustomPages(this);
369 secretsStore: API.SecretsStore = new API.SecretsStore(this);
370 pipelines: API.Pipelines = new API.Pipelines(this);
371 schemaValidation: API.SchemaValidation = new API.SchemaValidation(this);
372 tokenValidation: API.TokenValidation = new API.TokenValidation(this);
373
374 /**
375 * Check whether the base URL is set to its default.
376 */
377 #baseURLOverridden(): boolean {
378 return this.baseURL !== 'https://api.cloudflare.com/client/v4';
379 }
380
381 protected override defaultQuery(): Core.DefaultQuery | undefined {
382 return this._options.defaultQuery;
383 }
384
385 protected override defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers {
386 return {
387 ...super.defaultHeaders(opts),
388 'X-Auth-Key': this.apiKey,
389 'X-Auth-Email': this.apiEmail,
390 ...this._options.defaultHeaders,
391 };
392 }
393
394 protected override validateHeaders(
395 headers: Core.Headers,
396 customHeaders: Core.Headers,
397 usingCustomFetch: boolean,
398 ) {
399 if (this.apiEmail && headers['x-auth-email']) {
400 return;
401 }
402 if (customHeaders['x-auth-email'] === null) {
403 return;
404 }
405
406 if (this.apiKey && headers['x-auth-key']) {
407 return;
408 }
409 if (customHeaders['x-auth-key'] === null) {
410 return;
411 }
412
413 if (this.apiToken && headers['authorization']) {
414 return;
415 }
416 if (customHeaders['authorization'] === null) {
417 return;
418 }
419
420 if (this.userServiceKey && headers['x-auth-user-service-key']) {
421 return;
422 }
423 if (customHeaders['x-auth-user-service-key'] === null) {
424 return;
425 }
426
427 // we can't check for the presence of the headers with a custom fetch implementation, so we shouldn't throw an error
428 if (usingCustomFetch) {
429 return;
430 }
431
432 throw new Error(
433 'Could not resolve authentication method. Expected one of apiEmail, apiKey, apiToken or userServiceKey to be set. Or for one of the "X-Auth-Email", "X-Auth-Key", "Authorization" or "X-Auth-User-Service-Key" headers to be explicitly omitted',
434 );
435 }
436
437 protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
438 const apiEmailAuth = this.apiEmailAuth(opts);
439 const apiKeyAuth = this.apiKeyAuth(opts);
440 const apiTokenAuth = this.apiTokenAuth(opts);
441 const userServiceKeyAuth = this.userServiceKeyAuth(opts);
442
443 if (
444 apiEmailAuth != null &&
445 !Core.isEmptyObj(apiEmailAuth) &&
446 apiKeyAuth != null &&
447 !Core.isEmptyObj(apiKeyAuth)
448 ) {
449 return { ...apiEmailAuth, ...apiKeyAuth };
450 }
451
452 if (apiTokenAuth != null && !Core.isEmptyObj(apiTokenAuth)) {
453 return apiTokenAuth;
454 }
455
456 if (userServiceKeyAuth != null && !Core.isEmptyObj(userServiceKeyAuth)) {
457 return userServiceKeyAuth;
458 }
459 return {};
460 }
461
462 protected apiEmailAuth(opts: Core.FinalRequestOptions): Core.Headers {
463 if (this.apiEmail == null) {
464 return {};
465 }
466 return { 'X-Auth-Email': this.apiEmail };
467 }
468
469 protected apiKeyAuth(opts: Core.FinalRequestOptions): Core.Headers {
470 if (this.apiKey == null) {
471 return {};
472 }
473 return { 'X-Auth-Key': this.apiKey };
474 }
475
476 protected apiTokenAuth(opts: Core.FinalRequestOptions): Core.Headers {
477 if (this.apiToken == null) {
478 return {};
479 }
480 return { Authorization: `Bearer ${this.apiToken}` };
481 }
482
483 protected userServiceKeyAuth(opts: Core.FinalRequestOptions): Core.Headers {
484 if (this.userServiceKey == null) {
485 return {};
486 }
487 return { 'X-Auth-User-Service-Key': this.userServiceKey };
488 }
489
490 protected override stringifyQuery(query: Record<string, unknown>): string {
491 return qs.stringify(query, { allowDots: true, arrayFormat: 'repeat' });
492 }
493
494 static Cloudflare = this;
495 static DEFAULT_TIMEOUT = 60000; // 1 minute
496
497 static CloudflareError = Errors.CloudflareError;
498 static APIError = Errors.APIError;
499 static APIConnectionError = Errors.APIConnectionError;
500 static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
501 static APIUserAbortError = Errors.APIUserAbortError;
502 static NotFoundError = Errors.NotFoundError;
503 static ConflictError = Errors.ConflictError;
504 static RateLimitError = Errors.RateLimitError;
505 static BadRequestError = Errors.BadRequestError;
506 static AuthenticationError = Errors.AuthenticationError;
507 static InternalServerError = Errors.InternalServerError;
508 static PermissionDeniedError = Errors.PermissionDeniedError;
509 static UnprocessableEntityError = Errors.UnprocessableEntityError;
510
511 static toFile = Uploads.toFile;
512 static fileFromPath = Uploads.fileFromPath;
513}
514
515Cloudflare.Accounts = Accounts;
516Cloudflare.Organizations = Organizations;
517Cloudflare.OriginCACertificates = OriginCACertificates;
518Cloudflare.IPs = IPs;
519Cloudflare.Memberships = Memberships;
520Cloudflare.User = User;
521Cloudflare.Zones = Zones;
522Cloudflare.LoadBalancers = LoadBalancers;
523Cloudflare.Cache = Cache;
524Cloudflare.SSL = SSL;
525Cloudflare.ACM = ACM;
526Cloudflare.Argo = Argo;
527Cloudflare.CertificateAuthorities = CertificateAuthorities;
528Cloudflare.ClientCertificates = ClientCertificates;
529Cloudflare.CustomCertificates = CustomCertificates;
530Cloudflare.CustomHostnames = CustomHostnames;
531Cloudflare.CustomNameservers = CustomNameservers;
532Cloudflare.DNSFirewall = DNSFirewall;
533Cloudflare.DNS = DNS;
534Cloudflare.EmailSecurity = EmailSecurity;
535Cloudflare.EmailRouting = EmailRouting;
536Cloudflare.Filters = Filters;
537Cloudflare.Firewall = Firewall;
538Cloudflare.Healthchecks = Healthchecks;
539Cloudflare.KeylessCertificates = KeylessCertificates;
540Cloudflare.Logpush = Logpush;
541Cloudflare.Logs = Logs;
542Cloudflare.OriginTLSClientAuth = OriginTLSClientAuth;
543Cloudflare.PageRules = PageRules;
544Cloudflare.RateLimits = RateLimits;
545Cloudflare.WaitingRooms = WaitingRooms;
546Cloudflare.Web3 = Web3;
547Cloudflare.Workers = Workers;
548Cloudflare.KV = KV;
549Cloudflare.DurableObjects = DurableObjects;
550Cloudflare.Queues = Queues;
551Cloudflare.APIGateway = APIGateway;
552Cloudflare.ManagedTransforms = ManagedTransforms;
553Cloudflare.PageShield = PageShield;
554Cloudflare.Rulesets = Rulesets;
555Cloudflare.URLNormalization = URLNormalization;
556Cloudflare.Spectrum = Spectrum;
557Cloudflare.Addressing = Addressing;
558Cloudflare.AuditLogs = AuditLogs;
559Cloudflare.Billing = Billing;
560Cloudflare.BrandProtection = BrandProtection;
561Cloudflare.Diagnostics = Diagnostics;
562Cloudflare.Images = Images;
563Cloudflare.Intel = Intel;
564Cloudflare.MagicTransit = MagicTransit;
565Cloudflare.MagicNetworkMonitoring = MagicNetworkMonitoring;
566Cloudflare.MagicCloudNetworking = MagicCloudNetworking;
567Cloudflare.NetworkInterconnects = NetworkInterconnects;
568Cloudflare.MTLSCertificates = MTLSCertificates;
569Cloudflare.Pages = Pages;
570Cloudflare.Registrar = Registrar;
571Cloudflare.RequestTracers = RequestTracers;
572Cloudflare.Rules = Rules;
573Cloudflare.Stream = Stream;
574Cloudflare.Alerting = Alerting;
575Cloudflare.D1Resource = D1Resource;
576Cloudflare.R2 = R2;
577Cloudflare.R2DataCatalog = R2DataCatalog;
578Cloudflare.WorkersForPlatforms = WorkersForPlatforms;
579Cloudflare.ZeroTrust = ZeroTrust;
580Cloudflare.Turnstile = Turnstile;
581Cloudflare.Connectivity = Connectivity;
582Cloudflare.HyperdriveResource = HyperdriveResource;
583Cloudflare.RUM = RUM;
584Cloudflare.Vectorize = Vectorize;
585Cloudflare.URLScanner = URLScanner;
586Cloudflare.Radar = Radar;
587Cloudflare.BotManagement = BotManagement;
588Cloudflare.OriginPostQuantumEncryption = OriginPostQuantumEncryption;
589Cloudflare.Zaraz = Zaraz;
590Cloudflare.Speed = Speed;
591Cloudflare.DCVDelegation = DCVDelegation;
592Cloudflare.Hostnames = Hostnames;
593Cloudflare.Snippets = Snippets;
594Cloudflare.RealtimeKit = RealtimeKit;
595Cloudflare.Calls = Calls;
596Cloudflare.CloudforceOne = CloudforceOne;
597Cloudflare.AIGateway = AIGateway;
598Cloudflare.IAM = IAM;
599Cloudflare.CloudConnector = CloudConnector;
600Cloudflare.BotnetFeed = BotnetFeed;
601Cloudflare.SecurityTXT = SecurityTXT;
602Cloudflare.Workflows = Workflows;
603Cloudflare.ResourceSharing = ResourceSharing;
604Cloudflare.LeakedCredentialChecks = LeakedCredentialChecks;
605Cloudflare.ContentScanning = ContentScanning;
606Cloudflare.AbuseReports = AbuseReports;
607Cloudflare.AI = AI;
608Cloudflare.SecurityCenter = SecurityCenter;
609Cloudflare.BrowserRendering = BrowserRendering;
610Cloudflare.CustomPages = CustomPages;
611Cloudflare.SecretsStore = SecretsStore;
612Cloudflare.Pipelines = Pipelines;
613Cloudflare.SchemaValidation = SchemaValidation;
614Cloudflare.TokenValidation = TokenValidation;
615
616export declare namespace Cloudflare {
617 export type RequestOptions = Core.RequestOptions;
618
619 export import V4PagePagination = Pagination.V4PagePagination;
620 export {
621 type V4PagePaginationParams as V4PagePaginationParams,
622 type V4PagePaginationResponse as V4PagePaginationResponse,
623 };
624
625 export import V4PagePaginationArray = Pagination.V4PagePaginationArray;
626 export {
627 type V4PagePaginationArrayParams as V4PagePaginationArrayParams,
628 type V4PagePaginationArrayResponse as V4PagePaginationArrayResponse,
629 };
630
631 export import CursorPagination = Pagination.CursorPagination;
632 export {
633 type CursorPaginationParams as CursorPaginationParams,
634 type CursorPaginationResponse as CursorPaginationResponse,
635 };
636
637 export import CursorPaginationAfter = Pagination.CursorPaginationAfter;
638 export {
639 type CursorPaginationAfterParams as CursorPaginationAfterParams,
640 type CursorPaginationAfterResponse as CursorPaginationAfterResponse,
641 };
642
643 export import CursorLimitPagination = Pagination.CursorLimitPagination;
644 export {
645 type CursorLimitPaginationParams as CursorLimitPaginationParams,
646 type CursorLimitPaginationResponse as CursorLimitPaginationResponse,
647 };
648
649 export import SinglePage = Pagination.SinglePage;
650 export { type SinglePageResponse as SinglePageResponse };
651
652 export { Accounts as Accounts };
653
654 export { Organizations as Organizations };
655
656 export { OriginCACertificates as OriginCACertificates };
657
658 export { IPs as IPs };
659
660 export { Memberships as Memberships };
661
662 export { User as User };
663
664 export { Zones as Zones };
665
666 export { LoadBalancers as LoadBalancers };
667
668 export { Cache as Cache };
669
670 export { SSL as SSL };
671
672 export { ACM as ACM };
673
674 export { Argo as Argo };
675
676 export { CertificateAuthorities as CertificateAuthorities };
677
678 export { ClientCertificates as ClientCertificates };
679
680 export { CustomCertificates as CustomCertificates };
681
682 export { CustomHostnames as CustomHostnames };
683
684 export { CustomNameservers as CustomNameservers };
685
686 export { DNSFirewall as DNSFirewall };
687
688 export { DNS as DNS };
689
690 export { EmailSecurity as EmailSecurity };
691
692 export { EmailRouting as EmailRouting };
693
694 export { Filters as Filters };
695
696 export { Firewall as Firewall };
697
698 export { Healthchecks as Healthchecks };
699
700 export { KeylessCertificates as KeylessCertificates };
701
702 export { Logpush as Logpush };
703
704 export { Logs as Logs };
705
706 export { OriginTLSClientAuth as OriginTLSClientAuth };
707
708 export { PageRules as PageRules };
709
710 export { RateLimits as RateLimits };
711
712 export { WaitingRooms as WaitingRooms };
713
714 export { Web3 as Web3 };
715
716 export { Workers as Workers };
717
718 export { KV as KV };
719
720 export { DurableObjects as DurableObjects };
721
722 export { Queues as Queues };
723
724 export { APIGateway as APIGateway };
725
726 export { ManagedTransforms as ManagedTransforms };
727
728 export { PageShield as PageShield };
729
730 export { Rulesets as Rulesets };
731
732 export { URLNormalization as URLNormalization };
733
734 export { Spectrum as Spectrum };
735
736 export { Addressing as Addressing };
737
738 export { AuditLogs as AuditLogs };
739
740 export { Billing as Billing };
741
742 export { BrandProtection as BrandProtection };
743
744 export { Diagnostics as Diagnostics };
745
746 export { Images as Images };
747
748 export { Intel as Intel };
749
750 export { MagicTransit as MagicTransit };
751
752 export { MagicNetworkMonitoring as MagicNetworkMonitoring };
753
754 export { MagicCloudNetworking as MagicCloudNetworking };
755
756 export { NetworkInterconnects as NetworkInterconnects };
757
758 export { MTLSCertificates as MTLSCertificates };
759
760 export { Pages as Pages };
761
762 export { Registrar as Registrar };
763
764 export { RequestTracers as RequestTracers };
765
766 export { Rules as Rules };
767
768 export { Stream as Stream };
769
770 export { Alerting as Alerting };
771
772 export { D1Resource as D1Resource };
773
774 export { R2 as R2 };
775
776 export { R2DataCatalog as R2DataCatalog };
777
778 export { WorkersForPlatforms as WorkersForPlatforms };
779
780 export { ZeroTrust as ZeroTrust };
781
782 export { Turnstile as Turnstile };
783
784 export { Connectivity as Connectivity };
785
786 export { HyperdriveResource as HyperdriveResource };
787
788 export { RUM as RUM };
789
790 export { Vectorize as Vectorize };
791
792 export { URLScanner as URLScanner };
793
794 export { Radar as Radar };
795
796 export { BotManagement as BotManagement };
797
798 export { OriginPostQuantumEncryption as OriginPostQuantumEncryption };
799
800 export { Zaraz as Zaraz };
801
802 export { Speed as Speed };
803
804 export { DCVDelegation as DCVDelegation };
805
806 export { Hostnames as Hostnames };
807
808 export { Snippets as Snippets };
809
810 export { RealtimeKit as RealtimeKit };
811
812 export { Calls as Calls };
813
814 export { CloudforceOne as CloudforceOne };
815
816 export { AIGateway as AIGateway };
817
818 export { IAM as IAM };
819
820 export { CloudConnector as CloudConnector };
821
822 export { BotnetFeed as BotnetFeed };
823
824 export { SecurityTXT as SecurityTXT };
825
826 export { Workflows as Workflows };
827
828 export { ResourceSharing as ResourceSharing };
829
830 export { LeakedCredentialChecks as LeakedCredentialChecks };
831
832 export { ContentScanning as ContentScanning };
833
834 export { AbuseReports as AbuseReports };
835
836 export { AI as AI };
837
838 export { SecurityCenter as SecurityCenter };
839
840 export { BrowserRendering as BrowserRendering };
841
842 export { CustomPages as CustomPages };
843
844 export { SecretsStore as SecretsStore };
845
846 export { Pipelines as Pipelines };
847
848 export { SchemaValidation as SchemaValidation };
849
850 export { TokenValidation as TokenValidation };
851
852 export type ASN = API.ASN;
853 export type AuditLog = API.AuditLog;
854 export type CertificateCA = API.CertificateCA;
855 export type CertificateRequestType = API.CertificateRequestType;
856 export type CloudflareTunnel = API.CloudflareTunnel;
857 export type ErrorData = API.ErrorData;
858 export type Identifier = API.Identifier;
859 export type LoadBalancerPreview = API.LoadBalancerPreview;
860 export type Member = API.Member;
861 export type PaginationInfo = API.PaginationInfo;
862 export type Permission = API.Permission;
863 export type PermissionGrant = API.PermissionGrant;
864 export type RatePlan = API.RatePlan;
865 export type ResponseInfo = API.ResponseInfo;
866 export type Result = API.Result;
867 export type Role = API.Role;
868 export type SortDirection = API.SortDirection;
869 export type Subscription = API.Subscription;
870 export type SubscriptionComponent = API.SubscriptionComponent;
871 export type SubscriptionZone = API.SubscriptionZone;
872 export type Token = API.Token;
873 export type TokenConditionCIDRList = API.TokenConditionCIDRList;
874 export type TokenPolicy = API.TokenPolicy;
875 export type TokenValue = API.TokenValue;
876}
877
878export { toFile, fileFromPath } from './uploads';
879export {
880 CloudflareError,
881 APIError,
882 APIConnectionError,
883 APIConnectionTimeoutError,
884 APIUserAbortError,
885 NotFoundError,
886 ConflictError,
887 RateLimitError,
888 BadRequestError,
889 AuthenticationError,
890 InternalServerError,
891 PermissionDeniedError,
892 UnprocessableEntityError,
893} from './error';
894
895export default Cloudflare;
896