cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.0.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/index.ts

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