cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.2.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/index.ts

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