createCloudflareClient
createCloudflareClient(
opts):object
Defined in: index.ts:42
Creates a Cloudflare API client with alerting, dns, pages, zones, tunnels, tokens and workers groups.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”object
alerting
Section titled “alerting”alerting:
object
alerting.policies
Section titled “alerting.policies”policies:
object
alerting.policies.create
Section titled “alerting.policies.create”create: (
accountId,input) =>Promise<{id:string; }>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<{ id: string; }>
alerting.policies.list
Section titled “alerting.policies.list”list: (
accountId) =>Promise<CfNotificationPolicy[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<CfNotificationPolicy[]>
alerting.policies.update
Section titled “alerting.policies.update”update: (
accountId,policyId,input) =>Promise<{id:string; }>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
policyId
Section titled “policyId”string
Returns
Section titled “Returns”Promise<{ id: string; }>
alerting.webhooks
Section titled “alerting.webhooks”webhooks:
object
alerting.webhooks.create
Section titled “alerting.webhooks.create”create: (
accountId,input) =>Promise<{id:string; }>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<{ id: string; }>
alerting.webhooks.list
Section titled “alerting.webhooks.list”list: (
accountId) =>Promise<CfWebhookDestination[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<CfWebhookDestination[]>
dns:
object
dns.create
Section titled “dns.create”create: (
zoneId,record) =>Promise<CfDnsRecord>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
record
Section titled “record”Returns
Section titled “Returns”Promise<CfDnsRecord>
dns.delete
Section titled “dns.delete”delete: (
zoneId,recordId) =>Promise<{id:string; }>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
recordId
Section titled “recordId”string
Returns
Section titled “Returns”Promise<{ id: string; }>
dns.list
Section titled “dns.list”list: (
zoneId,query?) =>Promise<CfDnsRecord[]>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
query?
Section titled “query?”string
string
Returns
Section titled “Returns”Promise<CfDnsRecord[]>
dns.update
Section titled “dns.update”update: (
zoneId,recordId,record) =>Promise<CfDnsRecord>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
recordId
Section titled “recordId”string
record
Section titled “record”Partial<CfDnsRecordInput>
Returns
Section titled “Returns”Promise<CfDnsRecord>
pages:
object
pages.addDomain
Section titled “pages.addDomain”addDomain: (
accountId,projectName,hostname) =>Promise<CfPagesDomain>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
projectName
Section titled “projectName”string
hostname
Section titled “hostname”string
Returns
Section titled “Returns”Promise<CfPagesDomain>
pages.createDeployment
Section titled “pages.createDeployment”createDeployment: (
accountId,projectName,branch) =>Promise<CfPagesDeployment>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
projectName
Section titled “projectName”string
branch
Section titled “branch”string
Returns
Section titled “Returns”Promise<CfPagesDeployment>
pages.createProject
Section titled “pages.createProject”createProject: (
accountId,input) =>Promise<CfPagesProject>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<CfPagesProject>
pages.deleteDeployment
Section titled “pages.deleteDeployment”deleteDeployment: (
accountId,projectName,deploymentId) =>Promise<void>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
projectName
Section titled “projectName”string
deploymentId
Section titled “deploymentId”string
Returns
Section titled “Returns”Promise<void>
pages.getDeployment
Section titled “pages.getDeployment”getDeployment: (
accountId,projectName,deploymentId) =>Promise<CfPagesDeployment>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
projectName
Section titled “projectName”string
deploymentId
Section titled “deploymentId”string
Returns
Section titled “Returns”Promise<CfPagesDeployment>
pages.getProject
Section titled “pages.getProject”getProject: (
accountId,name) =>Promise<CfPagesProject>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
string
Returns
Section titled “Returns”Promise<CfPagesProject>
pages.listDeployments
Section titled “pages.listDeployments”listDeployments: (
accountId,projectName) =>Promise<CfPagesDeployment[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
projectName
Section titled “projectName”string
Returns
Section titled “Returns”Promise<CfPagesDeployment[]>
pages.listDomains
Section titled “pages.listDomains”listDomains: (
accountId,projectName) =>Promise<CfPagesDomain[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
projectName
Section titled “projectName”string
Returns
Section titled “Returns”Promise<CfPagesDomain[]>
pages.listProjects
Section titled “pages.listProjects”listProjects: (
accountId) =>Promise<CfPagesProject[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<CfPagesProject[]>
pages.updateProject
Section titled “pages.updateProject”updateProject: (
accountId,name,patch) =>Promise<CfPagesProject>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
string
Partial<Pick<CfPagesProject, "deployment_configs" | "production_branch">>
Returns
Section titled “Returns”Promise<CfPagesProject>
tokens
Section titled “tokens”tokens:
object
tokens.create
Section titled “tokens.create”create: (
input) =>Promise<CfCreatedToken>
POST /user/tokens: makes an API token and returns its value, once. Needs a token with API Tokens: Edit.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<CfCreatedToken>
tokens.delete
Section titled “tokens.delete”delete: (
id) =>Promise<CfDeletedToken>
DELETE /user/tokens/{token_id}: destroys an API token. Needs a token with API Tokens: Write. The id goes into the
path through encodeURIComponent. An unknown id is a ProviderApiError (404) the caller decides about.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<CfDeletedToken>
tokens.permissionGroups
Section titled “tokens.permissionGroups”permissionGroups: () =>
Promise<CfPermissionGroup[]>
GET /user/tokens/permission_groups: every permission a token can be given, with its id.
Returns
Section titled “Returns”Promise<CfPermissionGroup[]>
tokens.verify
Section titled “tokens.verify”verify: () =>
Promise<CfTokenVerification>
Returns
Section titled “Returns”Promise<CfTokenVerification>
tunnels
Section titled “tunnels”tunnels:
object
tunnels.create
Section titled “tunnels.create”create: (
accountId,input) =>Promise<CfTunnel>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
string
Returns
Section titled “Returns”Promise<CfTunnel>
tunnels.delete
Section titled “tunnels.delete”delete: (
accountId,tunnelId) =>Promise<void>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
tunnelId
Section titled “tunnelId”string
Returns
Section titled “Returns”Promise<void>
tunnels.getConfig
Section titled “tunnels.getConfig”getConfig: (
accountId,tunnelId) =>Promise<{config:CfTunnelConfig; }>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
tunnelId
Section titled “tunnelId”string
Returns
Section titled “Returns”Promise<{ config: CfTunnelConfig; }>
tunnels.list
Section titled “tunnels.list”list: (
accountId) =>Promise<CfTunnel[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<CfTunnel[]>
tunnels.putConfig
Section titled “tunnels.putConfig”putConfig: (
accountId,tunnelId,config) =>Promise<void>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
tunnelId
Section titled “tunnelId”string
config
Section titled “config”Returns
Section titled “Returns”Promise<void>
tunnels.token
Section titled “tunnels.token”token: (
accountId,tunnelId) =>Promise<string>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
tunnelId
Section titled “tunnelId”string
Returns
Section titled “Returns”Promise<string>
workers
Section titled “workers”workers:
object
workers.createRoute
Section titled “workers.createRoute”createRoute: (
zoneId,pattern,script) =>Promise<CfWorkerRoute>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
pattern
Section titled “pattern”string
script
Section titled “script”string
Returns
Section titled “Returns”Promise<CfWorkerRoute>
workers.deleteSecret
Section titled “workers.deleteSecret”deleteSecret: (
accountId,scriptName,name) =>Promise<void>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
scriptName
Section titled “scriptName”string
string
Returns
Section titled “Returns”Promise<void>
workers.listDeployments
Section titled “workers.listDeployments”listDeployments: (
accountId,scriptName) =>Promise<CfWorkerDeployment[]>
A script’s deployments, as Cloudflare lists them.
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
scriptName
Section titled “scriptName”string
Returns
Section titled “Returns”Promise<CfWorkerDeployment[]>
workers.listRoutes
Section titled “workers.listRoutes”listRoutes: (
zoneId) =>Promise<CfWorkerRoute[]>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
Returns
Section titled “Returns”Promise<CfWorkerRoute[]>
workers.listScripts
Section titled “workers.listScripts”listScripts: (
accountId) =>Promise<CfWorkerScript[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<CfWorkerScript[]>
workers.listSecrets
Section titled “workers.listSecrets”listSecrets: (
accountId,scriptName) =>Promise<CfWorkerSecret[]>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
scriptName
Section titled “scriptName”string
Returns
Section titled “Returns”Promise<CfWorkerSecret[]>
workers.putScript
Section titled “workers.putScript”putScript: (
accountId,scriptName,script,options) =>Promise<void>
Upload a script. Its secrets are kept by default, so a redeploy does not drop what was set earlier;
pass keepSecrets: false to replace the script with no secrets bound.
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
scriptName
Section titled “scriptName”string
script
Section titled “script”string
options?
Section titled “options?”keepSecrets?
Section titled “keepSecrets?”boolean
Returns
Section titled “Returns”Promise<void>
workers.putSecret
Section titled “workers.putSecret”putSecret: (
accountId,scriptName,name,value) =>Promise<CfWorkerSecret>
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
scriptName
Section titled “scriptName”string
string
string
Returns
Section titled “Returns”Promise<CfWorkerSecret>
workers.updateRoute
Section titled “workers.updateRoute”updateRoute: (
zoneId,routeId,pattern,script) =>Promise<CfWorkerRoute>
Parameters
Section titled “Parameters”zoneId
Section titled “zoneId”string
routeId
Section titled “routeId”string
pattern
Section titled “pattern”string
script
Section titled “script”string
Returns
Section titled “Returns”Promise<CfWorkerRoute>
zones:
object
zones.list
Section titled “zones.list”list: (
query?) =>Promise<CfZone[]>
Parameters
Section titled “Parameters”query?
Section titled “query?”string
per_page?
Section titled “per_page?”number
Returns
Section titled “Returns”Promise<CfZone[]>