cloudflare-client
Version:
Universal HTTP client for Cloudflare API
166 lines (165 loc) • 4.27 kB
TypeScript
import { type Credentials } from "./fetch.js";
export declare type Zone = {
/**
* DNS zone identity
*/
zoneId: string;
};
export declare type DnsRecordType = "A" | "AAAA" | "CNAME" | "HTTPS" | "TXT" | "SRV" | "LOC" | "MX" | "NS" | "CERT" | "DNSKEY" | "DS" | "NAPTR" | "SMIMEA" | "SSHFP" | "SVCB" | "TLSA" | "URI";
declare type FindOptions = {
/**
* Whether to match all search requirements or at least one (`any`)
* @default "all"
*/
match?: "all" | "any";
/**
* DNS record name (`max length: 255`)
* @example "example.com"
*/
name?: string;
/**
* Field to order records by
*/
order?: "type" | "name" | "content" | "ttl" | "proxied";
/**
* Page number of paginated results
* @default 1
*/
page?: number;
/**
* Number of DNS records per page (`min: 5`, `max: 5000`)
* @default 100
*/
perPage?: number;
/**
* DNS record content
* @example "127.0.0.1"
*/
content?: string;
/**
* DNS record type
* @example "A"
*/
type?: DnsRecordType;
/**
* DNS record proxied status
*/
proxied?: boolean;
/**
* Direction to order domains
*/
direction?: "asc" | "desc";
};
declare type DnsRecordInput = {
/**
* DNS record type
* @example "A"
*/
type: DnsRecordType;
/**
* DNS record name (`max length: 255`)
* @example "example.com"
*/
name: string;
/**
* DNS record content
* @example "127.0.0.1"
*/
content: string;
/**
* Time to live, in seconds, of the DNS record.
* Must be between `60` and `86400`, or `1` for `automatic`.
* @example 3600
*/
ttl: number;
/**
* Required for MX, SRV and URI records; unused by other record types.
* Records with lower priorities are preferred.
* @example: 10
*/
priority?: number;
/**
* Whether the record is receiving the performance and security benefits of Cloudflare
*/
proxied?: boolean;
};
export declare type DnsRecord = {
/**
* DNS record identifier
*/
id: string;
/**
* DNS record type
*/
type: DnsRecordType;
/**
* DNS record name
* @example "example.com"
*/
name: string;
/**
* DNS record content
* @example "127.0.0.1"
*/
content: string;
proxiable: boolean;
/**
* Whether the record is receiving the performance and security benefits of Cloudflare
*/
proxied: boolean;
/**
* Time to live, in seconds, of the DNS record.
*/
ttl: number;
locked: boolean;
zone_id: string;
zone_name: string;
created_on: string;
modified_on: string;
meta: {
auto_added: boolean;
managed_by_apps: boolean;
managed_by_argo_tunnel: boolean;
source: "primary" | string;
};
data?: Record<string, unknown>;
};
/**
* DNS Records for Zone
* @see https://api.cloudflare.com/#dns-records-for-a-zone-properties
*/
export declare function dnsRecords(options: Zone & Credentials): {
/**
* DNS Record Details
* @see https://api.cloudflare.com/#dns-records-for-a-zone-dns-record-details
*/
get: (id: string) => Promise<DnsRecord>;
/**
* List DNS Records
* @see https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
*/
find: (params?: FindOptions | undefined) => import("./fetch.js").Query<DnsRecord>;
/**
* Create DNS Record
* @see https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
*/
create: (input: DnsRecordInput) => Promise<DnsRecord>;
/**
* Replace DNS Record
* @see https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record
*/
replace: (id: string, input: DnsRecordInput) => Promise<DnsRecord>;
/**
* Update DNS Record
* @see https://api.cloudflare.com/#dns-records-for-a-zone-patch-dns-record
*/
update: (id: string, input: DnsRecordInput) => Promise<DnsRecord>;
/**
* Delete DNS Record
* @see https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record
*/
delete: (id: string) => Promise<{
id: string;
}>;
};
export {};