cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
b8fe1835defa2e6f01f3d6b1e58eccdaee01cf8d

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/index.ts

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