cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.0.0-beta.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/index.ts

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