cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0ba41172b17ccc4dfe612e32596d0019ab25669c

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/index.ts

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