// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { dnsRecords: "dns_records", nsName: "ns_name", nsSet: "ns_set", zoneTag: "zone_tag", }; export class CustomNameserverAlreadyExists extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "CustomNameserverAlreadyExists", { code: S.Number, message: S.String, }, ), [{ message: { includes: "already exist" } }], ) {} export class CustomNameserverNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "CustomNameserverNotFound", { code: S.Number, message: S.String, }, ), [{ status: 404 }], ) {} export class CustomNameserversNotEnabled extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "CustomNameserversNotEnabled", { code: S.Number, message: S.String, }, ), [{ code: 1002, message: { includes: "not enabled" } }], ) {} export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export interface CreateCustomNameserverRequest { /** Account identifier tag. */ accountId: string; /** The FQDN of the name server. */ nsName: string; /** The number of the set that this name server belongs to. */ nsSet?: number; } export const CreateCustomNameserverRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), nsName: S.String.pipe(T.Body("ns_name")), nsSet: S.optional(S.Number.pipe(T.Body("ns_set"))), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/custom_ns", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomNameserverRequest", }) as any as S.Schema; export type CreateResponseDnsRecordsItemType = "A" | "AAAA"; export const CreateResponseDnsRecordsItemType = /*@__PURE__*/ S.String; export interface CreateResponseDnsRecordsItem { /** DNS record type. */ type?: CreateResponseDnsRecordsItemType | null; /** DNS record contents (an IPv4 or IPv6 address). */ value?: string | null; } export const CreateResponseDnsRecordsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ type: S.optional(S.NullOr(CreateResponseDnsRecordsItemType)), value: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "CreateResponseDnsRecordsItem", }) as any as S.Schema; export type CreateResponseDnsRecordsList = Array; export const CreateResponseDnsRecordsList = /*@__PURE__*/ S.Array( CreateResponseDnsRecordsItem, ) as any as S.Schema; export type CreateResponseStatus = "moved" | "pending" | "verified"; export const CreateResponseStatus = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateCustomNameserverResponse { /** A and AAAA records associated with the nameserver. */ dnsRecords: CreateResponseDnsRecordsList; /** The FQDN of the name server. */ nsName: string; /** Verification status of the nameserver. */ status: CreateResponseStatus; /** Identifier. */ zoneTag: string; /** The number of the set that this name server belongs to. */ nsSet?: number | null; } export const CreateCustomNameserverResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ dnsRecords: CreateResponseDnsRecordsList.pipe(T.Body("dns_records")), nsName: S.String.pipe(T.Body("ns_name")), status: CreateResponseStatus, zoneTag: S.String.pipe(T.Body("zone_tag")), nsSet: S.optional(S.NullOr(S.Number).pipe(T.Body("ns_set"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomNameserverResponse", }) as any as S.Schema; export interface DeleteCustomNameserverRequest { /** Account identifier tag. */ accountId: string; /** The FQDN of the name server. */ customNsId: string; } export const DeleteCustomNameserverRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), customNsId: S.String.pipe(T.Label("custom_ns_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/custom_ns/{custom_ns_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomNameserverRequest", }) as any as S.Schema; export type DeleteResultList = Array; export const DeleteResultList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface DeleteCustomNameserverResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: DeleteResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const DeleteCustomNameserverResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: DeleteResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomNameserverResponse", }) as any as S.Schema; export interface GetCustomNameserverRequest { /** Account identifier tag. */ accountId: string; } export const GetCustomNameserverRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/custom_ns", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomNameserverRequest", }) as any as S.Schema; export type GetResultItemDnsRecordsItemType = "A" | "AAAA"; export const GetResultItemDnsRecordsItemType = /*@__PURE__*/ S.String; export interface GetResultItemDnsRecordsItem { /** DNS record type. */ type?: GetResultItemDnsRecordsItemType | null; /** DNS record contents (an IPv4 or IPv6 address). */ value?: string | null; } export const GetResultItemDnsRecordsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ type: S.optional(S.NullOr(GetResultItemDnsRecordsItemType)), value: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "GetResultItemDnsRecordsItem", }) as any as S.Schema; export type GetResultItemDnsRecordsList = Array; export const GetResultItemDnsRecordsList = /*@__PURE__*/ S.Array( GetResultItemDnsRecordsItem, ) as any as S.Schema; export type GetResultItemStatus = "moved" | "pending" | "verified"; export const GetResultItemStatus = /*@__PURE__*/ S.String; export interface GetResultItem { /** A and AAAA records associated with the nameserver. */ dnsRecords: GetResultItemDnsRecordsList; /** The FQDN of the name server. */ nsName: string; /** Verification status of the nameserver. */ status: GetResultItemStatus; /** Identifier. */ zoneTag: string; /** The number of the set that this name server belongs to. */ nsSet?: number | null; } export const GetResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ dnsRecords: GetResultItemDnsRecordsList.pipe(T.Body("dns_records")), nsName: S.String.pipe(T.Body("ns_name")), status: GetResultItemStatus, zoneTag: S.String.pipe(T.Body("zone_tag")), nsSet: S.optional(S.NullOr(S.Number).pipe(T.Body("ns_set"))), }), ).annotate({ identifier: "GetResultItem" }) as any as S.Schema; export type GetResultList = Array; export const GetResultList = /*@__PURE__*/ S.Array( GetResultItem, ) as any as S.Schema; export interface GetCustomNameserverResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: GetResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const GetCustomNameserverResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: GetResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomNameserverResponse", }) as any as S.Schema; export type CreateCustomNameserverError = | CustomNameserversNotEnabled | CustomNameserverAlreadyExists | Forbidden | CloudflareOpError; /** Adds a custom nameserver to the account for use as a vanity nameserver on zones. */ export const createCustomNameserver: API.OperationMethod< CreateCustomNameserverRequest, CreateCustomNameserverResponse, CreateCustomNameserverError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateCustomNameserverRequest, output: CreateCustomNameserverResponse, errors: [ CustomNameserversNotEnabled, CustomNameserverAlreadyExists, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteCustomNameserverError = | CustomNameserversNotEnabled | CustomNameserverNotFound | Forbidden | CloudflareOpError; /** Removes a custom nameserver from the account. */ export const deleteCustomNameserver: API.PaginatedOperationMethod< DeleteCustomNameserverRequest, DeleteCustomNameserverResponse, DeleteCustomNameserverError, CloudflareOpContext, string > = /*@__PURE__*/ API.makePaginated( () => ({ input: DeleteCustomNameserverRequest, output: DeleteCustomNameserverResponse, errors: [ CustomNameserversNotEnabled, CustomNameserverNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type GetCustomNameserverError = | CustomNameserversNotEnabled | Forbidden | CloudflareOpError; /** List an account's custom nameservers. */ export const getCustomNameserver: API.PaginatedOperationMethod< GetCustomNameserverRequest, GetCustomNameserverResponse, GetCustomNameserverError, CloudflareOpContext, GetResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: GetCustomNameserverRequest, output: GetCustomNameserverResponse, errors: [ CustomNameserversNotEnabled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any;