// 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> = { acceptFoa: "accept_foa", approveTransfer: "approve_transfer", autoRenew: "auto_renew", canCancelTransfer: "can_cancel_transfer", canRegister: "can_register", createdAt: "created_at", currentRegistrar: "current_registrar", disablePrivacy: "disable_privacy", enterAuthCode: "enter_auth_code", expiresAt: "expires_at", firstName: "first_name", lastName: "last_name", registrantContact: "registrant_contact", registrationCost: "registration_cost", registryStatuses: "registry_statuses", renewalCost: "renewal_cost", supportedTld: "supported_tld", transferIn: "transfer_in", unlockDomain: "unlock_domain", updatedAt: "updated_at", }; export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class RegistrarDomainNotOwned extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "RegistrarDomainNotOwned", { code: S.Number, message: S.String, }, ), [ { code: 10000, status: 403, message: { includes: "Domain doesn't belong to the user" }, }, ], ) {} export class RegistrarUpdateNotAllowed extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "RegistrarUpdateNotAllowed", { code: S.Number, message: S.String, }, ), [{ status: 422 }], ) {} export type CheckRequestDomainsList = Array; export const CheckRequestDomainsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface CheckRegistrarRequest { /** Identifier */ accountId: string; /** List of fully qualified domain names (FQDNs) to check for availability. Each domain must include the extension. */ domains: CheckRequestDomainsList; } export const CheckRegistrarRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domains: CheckRequestDomainsList, }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/registrar/domain-check", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CheckRegistrarRequest", }) as any as S.Schema; export interface CheckResponseDomainsItemPricing { /** ISO-4217 currency code for the prices (e.g., "USD", "EUR", "GBP"). */ currency: string; /** The first-year cost to register this domain. For premium domains */ registrationCost: string; /** Per-year renewal cost for this domain. Applied to each year beyond */ renewalCost: string; } export const CheckResponseDomainsItemPricing = /*@__PURE__*/ S.suspend(() => S.Struct({ currency: S.String, registrationCost: S.String.pipe(T.Body("registration_cost")), renewalCost: S.String.pipe(T.Body("renewal_cost")), }), ).annotate({ identifier: "CheckResponseDomainsItemPricing", }) as any as S.Schema; export type CheckResponseDomainsItemReason = | "extension_not_supported_via_api" | "extension_not_supported" | "extension_disallows_registration" | "domain_premium" | "domain_unavailable"; export const CheckResponseDomainsItemReason = /*@__PURE__*/ S.String; export type CheckResponseDomainsItemTier = "standard" | "premium"; export const CheckResponseDomainsItemTier = /*@__PURE__*/ S.String; export interface CheckResponseDomainsItem { /** The fully qualified domain name (FQDN) in punycode format for internationalized domain names (IDNs). */ name: string; /** Indicates whether this domain can be registered programmatically through this API based on a real-time registry check. */ registrable: boolean; /** Annual pricing information for a registrable domain. This object is only */ pricing?: CheckResponseDomainsItemPricing | null; /** Present only when `registrable` is `false`. Explains why the domain cannot be registered via this API. */ reason?: CheckResponseDomainsItemReason | null; /** The pricing tier for this domain. Always present when `registrable` is `true`; defaults to `standard` for most domains. May be absent when `registrable` is `false`. */ tier?: CheckResponseDomainsItemTier | null; } export const CheckResponseDomainsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ name: S.String, registrable: S.Boolean, pricing: S.optional(S.NullOr(CheckResponseDomainsItemPricing)), reason: S.optional(S.NullOr(CheckResponseDomainsItemReason)), tier: S.optional(S.NullOr(CheckResponseDomainsItemTier)), }), ).annotate({ identifier: "CheckResponseDomainsItem", }) as any as S.Schema; export type CheckResponseDomainsList = Array; export const CheckResponseDomainsList = /*@__PURE__*/ S.Array( CheckResponseDomainsItem, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CheckRegistrarResponse { /** Array of domain availability results. Domains on unsupported */ domains: CheckResponseDomainsList; } export const CheckRegistrarResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ domains: CheckResponseDomainsList, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CheckRegistrarResponse", }) as any as S.Schema; export interface CreateRegistrationRequestContactsRegistrantPostalInfoAddress { /** City or locality name. */ city: string; /** Two-letter country code per ISO 3166-1 alpha-2 (e.g., `US`, `GB`, `CA`, `DE`). */ countryCode: string; /** Postal or ZIP code. */ postalCode: string; /** State, province, or region. Use the standard abbreviation where applicable (e.g., `TX` for Texas, `ON` for Ontario). */ state: string; /** Street address including building/suite number. */ street: string; } export const CreateRegistrationRequestContactsRegistrantPostalInfoAddress = /*@__PURE__*/ S.suspend(() => S.Struct({ city: S.String, countryCode: S.String.pipe(T.Body("country_code")), postalCode: S.String.pipe(T.Body("postal_code")), state: S.String, street: S.String, }), ).annotate({ identifier: "CreateRegistrationRequestContactsRegistrantPostalInfoAddress", }) as any as S.Schema; export interface CreateRegistrationRequestContactsRegistrantPostalInfo { /** Physical mailing address for the registrant contact. */ address: CreateRegistrationRequestContactsRegistrantPostalInfoAddress; /** Full legal name of the registrant (individual or authorized representative). */ name: string; /** Organization or company name. Optional for individual registrants. */ organization?: string; } export const CreateRegistrationRequestContactsRegistrantPostalInfo = /*@__PURE__*/ S.suspend(() => S.Struct({ address: CreateRegistrationRequestContactsRegistrantPostalInfoAddress, name: S.String, organization: S.optional(S.String), }), ).annotate({ identifier: "CreateRegistrationRequestContactsRegistrantPostalInfo", }) as any as S.Schema; export interface CreateRegistrationRequestContactsRegistrant { /** Email address for the registrant. Used for domain-related */ email: string; /** Phone number in E.164 format: `+{country_code}.{number}` with no */ phone: string; /** Postal/mailing information for the registrant contact. */ postalInfo: CreateRegistrationRequestContactsRegistrantPostalInfo; /** Fax number in E.164 format (e.g., `+1.5555555555`). Optional. */ fax?: string; } export const CreateRegistrationRequestContactsRegistrant = /*@__PURE__*/ S.suspend(() => S.Struct({ email: S.String, phone: S.String, postalInfo: CreateRegistrationRequestContactsRegistrantPostalInfo.pipe( T.Body("postal_info"), ), fax: S.optional(S.String), }), ).annotate({ identifier: "CreateRegistrationRequestContactsRegistrant", }) as any as S.Schema; export interface CreateRegistrationRequestContacts { /** Registrant contact data for the domain registration. This information */ registrant?: CreateRegistrationRequestContactsRegistrant; } export const CreateRegistrationRequestContacts = /*@__PURE__*/ S.suspend(() => S.Struct({ registrant: S.optional(CreateRegistrationRequestContactsRegistrant), }), ).annotate({ identifier: "CreateRegistrationRequestContacts", }) as any as S.Schema; export type CreateRegistrationRequestPrivacyMode = "redaction"; export const CreateRegistrationRequestPrivacyMode = /*@__PURE__*/ S.String; export interface CreateRegistrationRequest { /** Identifier */ accountId: string; prefer?: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; /** Enable or disable automatic renewal. Defaults to `false` if omitted. */ autoRenew?: boolean; /** Contact data for the registration request. */ contacts?: CreateRegistrationRequestContacts; /** WHOIS privacy mode for the registration. Defaults to `redaction`. */ privacyMode?: CreateRegistrationRequestPrivacyMode | (string & {}); /** Number of years to register (1–10). If omitted, defaults to the */ years?: number; } export const CreateRegistrationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), prefer: S.optional(S.String.pipe(T.Header("Prefer"))), domainName: S.String.pipe(T.Body("domain_name")), autoRenew: S.optional(S.Boolean.pipe(T.Body("auto_renew"))), contacts: S.optional(CreateRegistrationRequestContacts), privacyMode: S.optional( CreateRegistrationRequestPrivacyMode.pipe(T.Body("privacy_mode")), ), years: S.optional(S.Number), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/registrar/registrations", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRegistrationRequest", }) as any as S.Schema; export interface CreateRegistrationResponseLinks { /** URL to this status resource. */ self: string; /** URL to the domain resource. */ resource?: string | null; } export const CreateRegistrationResponseLinks = /*@__PURE__*/ S.suspend(() => S.Struct({ self: S.String, resource: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "CreateRegistrationResponseLinks", }) as any as S.Schema; export type CreateRegistrationResponseState = | "pending" | "in_progress" | "action_required" | "blocked" | "succeeded" | "failed"; export const CreateRegistrationResponseState = /*@__PURE__*/ S.String; export type CreateRegistrationResponseContextMap = { [key: string]: unknown | undefined; }; export const CreateRegistrationResponseContextMap = /*@__PURE__*/ S.Record( S.String, S.Unknown, ) as any as S.Schema; export interface CreateRegistrationResponseError { /** Machine-readable error code identifying the failure reason. */ code: string; /** Human-readable explanation of the failure. May include registry-specific details. */ message: string; } export const CreateRegistrationResponseError = /*@__PURE__*/ S.suspend(() => S.Struct({ code: S.String, message: S.String, }), ).annotate({ identifier: "CreateRegistrationResponseError", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateRegistrationResponse { /** Whether the workflow has reached a terminal state. `true` when */ completed: boolean; createdAt: string; links: CreateRegistrationResponseLinks; /** Workflow lifecycle state. */ state: CreateRegistrationResponseState; updatedAt: string; /** Workflow-specific data for this workflow. */ context?: CreateRegistrationResponseContextMap | null; /** Error details when a workflow reaches the `failed` state. The specific */ error?: CreateRegistrationResponseError | null; } export const CreateRegistrationResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ completed: S.Boolean, createdAt: S.String.pipe(T.Body("created_at")), links: CreateRegistrationResponseLinks, state: CreateRegistrationResponseState, updatedAt: S.String.pipe(T.Body("updated_at")), context: S.optional(S.NullOr(CreateRegistrationResponseContextMap)), error: S.optional(S.NullOr(CreateRegistrationResponseError)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRegistrationResponse", }) as any as S.Schema; export type EditRegistrationRequestPrefer = "respond-async"; export const EditRegistrationRequestPrefer = /*@__PURE__*/ S.String; export interface EditRegistrationRequest { /** Identifier */ accountId: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; prefer?: EditRegistrationRequestPrefer | (string & {}); /** Enable or disable automatic renewal. */ autoRenew?: boolean; } export const EditRegistrationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domainName: S.String.pipe(T.Label("domain_name")), prefer: S.optional(EditRegistrationRequestPrefer.pipe(T.Header("Prefer"))), autoRenew: S.optional(S.Boolean.pipe(T.Body("auto_renew"))), }) .pipe( T.Http({ method: "PATCH", uri: "/accounts/{account_id}/registrar/registrations/{domain_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "EditRegistrationRequest", }) as any as S.Schema; export type EditRegistrationResponseLinks = CreateRegistrationResponseLinks; export const EditRegistrationResponseLinks = CreateRegistrationResponseLinks; export type EditRegistrationResponseState = | "pending" | "in_progress" | "action_required" | "blocked" | "succeeded" | "failed"; export const EditRegistrationResponseState = /*@__PURE__*/ S.String; export type EditRegistrationResponseContextMap = { [key: string]: unknown | undefined; }; export const EditRegistrationResponseContextMap = /*@__PURE__*/ S.Record( S.String, S.Unknown, ) as any as S.Schema; export type EditRegistrationResponseError = CreateRegistrationResponseError; export const EditRegistrationResponseError = CreateRegistrationResponseError; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface EditRegistrationResponse { /** Whether the workflow has reached a terminal state. `true` when */ completed: boolean; createdAt: string; links: CreateRegistrationResponseLinks; /** Workflow lifecycle state. */ state: EditRegistrationResponseState; updatedAt: string; /** Workflow-specific data for this workflow. */ context?: EditRegistrationResponseContextMap | null; /** Error details when a workflow reaches the `failed` state. The specific */ error?: CreateRegistrationResponseError | null; } export const EditRegistrationResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ completed: S.Boolean, createdAt: S.String.pipe(T.Body("created_at")), links: CreateRegistrationResponseLinks, state: EditRegistrationResponseState, updatedAt: S.String.pipe(T.Body("updated_at")), context: S.optional(S.NullOr(EditRegistrationResponseContextMap)), error: S.optional(S.NullOr(CreateRegistrationResponseError)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "EditRegistrationResponse", }) as any as S.Schema; export interface GetDomainRequest { /** Identifier */ accountId: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; } export const GetDomainRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domainName: S.String.pipe(T.Label("domain_name")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/domains/{domain_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetDomainRequest", }) as any as S.Schema; export type GetDomainResponse = unknown; export const GetDomainResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetDomainResponse", }) as any as S.Schema; export interface GetRegistrationRequest { /** Identifier */ accountId: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; } export const GetRegistrationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domainName: S.String.pipe(T.Label("domain_name")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/registrations/{domain_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegistrationRequest", }) as any as S.Schema; export type GetRegistrationResponsePrivacyMode = "redaction"; export const GetRegistrationResponsePrivacyMode = /*@__PURE__*/ S.String; export type GetRegistrationResponseStatus = | "active" | "registration_pending" | "expired" | "suspended" | "redemption_period" | "pending_delete"; export const GetRegistrationResponseStatus = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetRegistrationResponse { /** Whether the domain will be automatically renewed before expiration. */ autoRenew: boolean; /** When the domain was registered. Present when the registration resource exists. */ createdAt: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; /** When the domain registration expires. Present when the registration is ready; may be null only while `status` is `registration_pending`. */ expiresAt: string; /** Whether the domain is locked for transfer. */ locked: boolean; /** Current WHOIS privacy mode for the registration. */ privacyMode: GetRegistrationResponsePrivacyMode; /** Current registration status. */ status: GetRegistrationResponseStatus; } export const GetRegistrationResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ autoRenew: S.Boolean.pipe(T.Body("auto_renew")), createdAt: S.String.pipe(T.Body("created_at")), domainName: S.String.pipe(T.Body("domain_name")), expiresAt: S.String.pipe(T.Body("expires_at")), locked: S.Boolean, privacyMode: GetRegistrationResponsePrivacyMode.pipe( T.Body("privacy_mode"), ), status: GetRegistrationResponseStatus, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegistrationResponse", }) as any as S.Schema; export interface GetRegistrationStatusRequest { /** Identifier */ accountId: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; } export const GetRegistrationStatusRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domainName: S.String.pipe(T.Label("domain_name")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/registrations/{domain_name}/registration-status", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegistrationStatusRequest", }) as any as S.Schema; export type RegistrationStatusGetResponseLinks = CreateRegistrationResponseLinks; export const RegistrationStatusGetResponseLinks = CreateRegistrationResponseLinks; export type RegistrationStatusGetResponseState = | "pending" | "in_progress" | "action_required" | "blocked" | "succeeded" | "failed"; export const RegistrationStatusGetResponseState = /*@__PURE__*/ S.String; export type RegistrationStatusGetResponseContextMap = { [key: string]: unknown | undefined; }; export const RegistrationStatusGetResponseContextMap = /*@__PURE__*/ S.Record( S.String, S.Unknown, ) as any as S.Schema; export type RegistrationStatusGetResponseError = CreateRegistrationResponseError; export const RegistrationStatusGetResponseError = CreateRegistrationResponseError; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetRegistrationStatusResponse { /** Whether the workflow has reached a terminal state. `true` when */ completed: boolean; createdAt: string; links: CreateRegistrationResponseLinks; /** Workflow lifecycle state. */ state: RegistrationStatusGetResponseState; updatedAt: string; /** Workflow-specific data for this workflow. */ context?: RegistrationStatusGetResponseContextMap | null; /** Error details when a workflow reaches the `failed` state. The specific */ error?: CreateRegistrationResponseError | null; } export const GetRegistrationStatusResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ completed: S.Boolean, createdAt: S.String.pipe(T.Body("created_at")), links: CreateRegistrationResponseLinks, state: RegistrationStatusGetResponseState, updatedAt: S.String.pipe(T.Body("updated_at")), context: S.optional(S.NullOr(RegistrationStatusGetResponseContextMap)), error: S.optional(S.NullOr(CreateRegistrationResponseError)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegistrationStatusResponse", }) as any as S.Schema; export interface GetUpdateStatusRequest { /** Identifier */ accountId: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; } export const GetUpdateStatusRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domainName: S.String.pipe(T.Label("domain_name")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/registrations/{domain_name}/update-status", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetUpdateStatusRequest", }) as any as S.Schema; export type UpdateStatusGetResponseLinks = CreateRegistrationResponseLinks; export const UpdateStatusGetResponseLinks = CreateRegistrationResponseLinks; export type UpdateStatusGetResponseState = | "pending" | "in_progress" | "action_required" | "blocked" | "succeeded" | "failed"; export const UpdateStatusGetResponseState = /*@__PURE__*/ S.String; export type UpdateStatusGetResponseContextMap = { [key: string]: unknown | undefined; }; export const UpdateStatusGetResponseContextMap = /*@__PURE__*/ S.Record( S.String, S.Unknown, ) as any as S.Schema; export type UpdateStatusGetResponseError = CreateRegistrationResponseError; export const UpdateStatusGetResponseError = CreateRegistrationResponseError; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetUpdateStatusResponse { /** Whether the workflow has reached a terminal state. `true` when */ completed: boolean; createdAt: string; links: CreateRegistrationResponseLinks; /** Workflow lifecycle state. */ state: UpdateStatusGetResponseState; updatedAt: string; /** Workflow-specific data for this workflow. */ context?: UpdateStatusGetResponseContextMap | null; /** Error details when a workflow reaches the `failed` state. The specific */ error?: CreateRegistrationResponseError | null; } export const GetUpdateStatusResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ completed: S.Boolean, createdAt: S.String.pipe(T.Body("created_at")), links: CreateRegistrationResponseLinks, state: UpdateStatusGetResponseState, updatedAt: S.String.pipe(T.Body("updated_at")), context: S.optional(S.NullOr(UpdateStatusGetResponseContextMap)), error: S.optional(S.NullOr(CreateRegistrationResponseError)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetUpdateStatusResponse", }) as any as S.Schema; export interface ListDomainsRequest { /** Identifier */ accountId: string; } export const ListDomainsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/domains", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListDomainsRequest", }) as any as S.Schema; export interface DomainsListResultItemRegistrantContact { /** Address. */ address: string; /** City. */ city: string; /** The country in which the user lives. */ country: string; /** User's first name */ firstName: string; /** User's last name */ lastName: string; /** Name of organization. */ organization: string; /** User's telephone number */ phone: string; /** State. */ state: string; /** The zipcode or postal code where the user lives. */ zip: string; /** Contact Identifier. */ id?: string | null; /** Optional address line for unit, floor, suite, etc. */ address2?: string | null; /** The contact email address of the user. */ email?: string | null; /** Contact fax number. */ fax?: string | null; } export const DomainsListResultItemRegistrantContact = /*@__PURE__*/ S.suspend( () => S.Struct({ address: S.String, city: S.String, country: S.String, firstName: S.String.pipe(T.Body("first_name")), lastName: S.String.pipe(T.Body("last_name")), organization: S.String, phone: S.String, state: S.String, zip: S.String, id: S.optional(S.NullOr(S.String)), address2: S.optional(S.NullOr(S.String)), email: S.optional(S.NullOr(S.String)), fax: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "DomainsListResultItemRegistrantContact", }) as any as S.Schema; export type DomainsListResultItemTransferInAcceptFoa = "needed" | "ok"; export const DomainsListResultItemTransferInAcceptFoa = /*@__PURE__*/ S.String; export type DomainsListResultItemTransferInApproveTransfer = | "needed" | "ok" | "pending" | "trying" | "rejected" | "unknown"; export const DomainsListResultItemTransferInApproveTransfer = /*@__PURE__*/ S.String; export type DomainsListResultItemTransferInDisablePrivacy = | "needed" | "ok" | "unknown"; export const DomainsListResultItemTransferInDisablePrivacy = /*@__PURE__*/ S.String; export type DomainsListResultItemTransferInEnterAuthCode = | "needed" | "ok" | "pending" | "trying" | "rejected"; export const DomainsListResultItemTransferInEnterAuthCode = /*@__PURE__*/ S.String; export type DomainsListResultItemTransferInUnlockDomain = | "needed" | "ok" | "pending" | "trying" | "unknown"; export const DomainsListResultItemTransferInUnlockDomain = /*@__PURE__*/ S.String; export interface DomainsListResultItemTransferIn { /** Form of authorization has been accepted by the registrant. */ acceptFoa?: DomainsListResultItemTransferInAcceptFoa | null; /** Shows transfer status with the registry. */ approveTransfer?: DomainsListResultItemTransferInApproveTransfer | null; /** Indicates if cancellation is still possible. */ canCancelTransfer?: boolean | null; /** Privacy guards are disabled at the foreign registrar. */ disablePrivacy?: DomainsListResultItemTransferInDisablePrivacy | null; /** Auth code has been entered and verified. */ enterAuthCode?: DomainsListResultItemTransferInEnterAuthCode | null; /** Domain is unlocked at the foreign registrar. */ unlockDomain?: DomainsListResultItemTransferInUnlockDomain | null; } export const DomainsListResultItemTransferIn = /*@__PURE__*/ S.suspend(() => S.Struct({ acceptFoa: S.optional( S.NullOr(DomainsListResultItemTransferInAcceptFoa).pipe( T.Body("accept_foa"), ), ), approveTransfer: S.optional( S.NullOr(DomainsListResultItemTransferInApproveTransfer).pipe( T.Body("approve_transfer"), ), ), canCancelTransfer: S.optional( S.NullOr(S.Boolean).pipe(T.Body("can_cancel_transfer")), ), disablePrivacy: S.optional( S.NullOr(DomainsListResultItemTransferInDisablePrivacy).pipe( T.Body("disable_privacy"), ), ), enterAuthCode: S.optional( S.NullOr(DomainsListResultItemTransferInEnterAuthCode).pipe( T.Body("enter_auth_code"), ), ), unlockDomain: S.optional( S.NullOr(DomainsListResultItemTransferInUnlockDomain).pipe( T.Body("unlock_domain"), ), ), }), ).annotate({ identifier: "DomainsListResultItemTransferIn", }) as any as S.Schema; export interface DomainsListResultItem { /** Domain identifier. */ id?: string | null; /** Shows if a domain is available for transferring into Cloudflare Registrar. */ available?: boolean | null; /** Indicates if the domain can be registered as a new domain. */ canRegister?: boolean | null; /** Shows time of creation. */ createdAt?: string | null; /** Shows name of current registrar. */ currentRegistrar?: string | null; /** Shows when domain name registration expires. */ expiresAt?: string | null; /** Shows whether a registrar lock is in place for a domain. */ locked?: boolean | null; /** Shows contact information for domain registrant. */ registrantContact?: DomainsListResultItemRegistrantContact | null; /** A comma-separated list of registry status codes. A full list of status codes can be found at [EPP Status Codes](https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en). */ registryStatuses?: string | null; /** Whether a particular TLD is currently supported by Cloudflare Registrar. Refer to [TLD Policies](https://www.cloudflare.com/tld-policies/) for a list of supported TLDs. */ supportedTld?: boolean | null; /** Statuses for domain transfers into Cloudflare Registrar. */ transferIn?: DomainsListResultItemTransferIn | null; /** Last updated. */ updatedAt?: string | null; /** Domain name. */ name?: string | null; /** Whether the domain auto-renews. */ autoRenew?: boolean | null; /** Whether WHOIS privacy is enabled. */ privacy?: boolean | null; } export const DomainsListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), available: S.optional(S.NullOr(S.Boolean)), canRegister: S.optional(S.NullOr(S.Boolean).pipe(T.Body("can_register"))), createdAt: S.optional(S.NullOr(S.String).pipe(T.Body("created_at"))), currentRegistrar: S.optional( S.NullOr(S.String).pipe(T.Body("current_registrar")), ), expiresAt: S.optional(S.NullOr(S.String).pipe(T.Body("expires_at"))), locked: S.optional(S.NullOr(S.Boolean)), registrantContact: S.optional( S.NullOr(DomainsListResultItemRegistrantContact).pipe( T.Body("registrant_contact"), ), ), registryStatuses: S.optional( S.NullOr(S.String).pipe(T.Body("registry_statuses")), ), supportedTld: S.optional(S.NullOr(S.Boolean).pipe(T.Body("supported_tld"))), transferIn: S.optional( S.NullOr(DomainsListResultItemTransferIn).pipe(T.Body("transfer_in")), ), updatedAt: S.optional(S.NullOr(S.String).pipe(T.Body("updated_at"))), name: S.optional(S.NullOr(S.String)), autoRenew: S.optional(S.NullOr(S.Boolean).pipe(T.Body("auto_renew"))), privacy: S.optional(S.NullOr(S.Boolean)), }), ).annotate({ identifier: "DomainsListResultItem", }) as any as S.Schema; export type DomainsListResultList = Array; export const DomainsListResultList = /*@__PURE__*/ S.Array( DomainsListResultItem, ) as any as S.Schema; export interface ListDomainsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: DomainsListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListDomainsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: DomainsListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListDomainsResponse", }) as any as S.Schema; export type ListRegistrationsRequestDirection = "asc" | "desc"; export const ListRegistrationsRequestDirection = /*@__PURE__*/ S.String; export type ListRegistrationsRequestSortBy = | "registry_created_at" | "registry_expires_at" | "name"; export const ListRegistrationsRequestSortBy = /*@__PURE__*/ S.String; export interface ListRegistrationsRequest { /** Identifier */ accountId: string; /** Opaque token from a previous response's `result_info.cursor`. */ cursor?: string; /** Sort direction for results. Defaults to ascending order. */ direction?: ListRegistrationsRequestDirection | (string & {}); /** Number of items to return per page. */ perPage?: number; /** Column to sort results by. Defaults to registration date */ sortBy?: ListRegistrationsRequestSortBy | (string & {}); } export const ListRegistrationsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), cursor: S.optional(S.String.pipe(T.Query())), direction: S.optional(ListRegistrationsRequestDirection.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), sortBy: S.optional(ListRegistrationsRequestSortBy.pipe(T.Query("sort_by"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/registrations", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRegistrationsRequest", }) as any as S.Schema; export type ListRegistrationsResultItemPrivacyMode = "redaction"; export const ListRegistrationsResultItemPrivacyMode = /*@__PURE__*/ S.String; export type ListRegistrationsResultItemStatus = | "active" | "registration_pending" | "expired" | "suspended" | "redemption_period" | "pending_delete"; export const ListRegistrationsResultItemStatus = /*@__PURE__*/ S.String; export interface ListRegistrationsResultItem { /** Whether the domain will be automatically renewed before expiration. */ autoRenew: boolean; /** When the domain was registered. Present when the registration resource exists. */ createdAt: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; /** When the domain registration expires. Present when the registration is ready; may be null only while `status` is `registration_pending`. */ expiresAt: string; /** Whether the domain is locked for transfer. */ locked: boolean; /** Current WHOIS privacy mode for the registration. */ privacyMode: ListRegistrationsResultItemPrivacyMode; /** Current registration status. */ status: ListRegistrationsResultItemStatus; } export const ListRegistrationsResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ autoRenew: S.Boolean.pipe(T.Body("auto_renew")), createdAt: S.String.pipe(T.Body("created_at")), domainName: S.String.pipe(T.Body("domain_name")), expiresAt: S.String.pipe(T.Body("expires_at")), locked: S.Boolean, privacyMode: ListRegistrationsResultItemPrivacyMode.pipe( T.Body("privacy_mode"), ), status: ListRegistrationsResultItemStatus, }), ).annotate({ identifier: "ListRegistrationsResultItem", }) as any as S.Schema; export type ListRegistrationsResultList = Array; export const ListRegistrationsResultList = /*@__PURE__*/ S.Array( ListRegistrationsResultItem, ) as any as S.Schema; export type ListRegistrationsResponse = ListRegistrationsResultList; export const ListRegistrationsResponse = /*@__PURE__*/ S.suspend(() => ListRegistrationsResultList.pipe( T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY), ), ).annotate({ identifier: "ListRegistrationsResponse", }) as any as S.Schema; export interface PutDomainRequest { /** Identifier */ accountId: string; /** Fully qualified domain name (FQDN) including the extension */ domainName: string; /** Auto-renew controls whether subscription is automatically renewed upon domain expiration. */ autoRenew?: boolean; /** Shows whether a registrar lock is in place for a domain. */ locked?: boolean; /** Privacy option controls redacting WHOIS information. */ privacy?: boolean; } export const PutDomainRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), domainName: S.String.pipe(T.Label("domain_name")), autoRenew: S.optional(S.Boolean.pipe(T.Body("auto_renew"))), locked: S.optional(S.Boolean), privacy: S.optional(S.Boolean), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/registrar/domains/{domain_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PutDomainRequest", }) as any as S.Schema; export type PutDomainResponse = unknown; export const PutDomainResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PutDomainResponse", }) as any as S.Schema; export type SearchRequestExtensionsList = Array; export const SearchRequestExtensionsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface SearchRegistrarRequest { /** Identifier */ accountId: string; /** The search term to find domain suggestions. Accepts keywords, phrases, or full domain names. */ q: string; /** Limits results to specific domain extensions from the supported set. If not specified, */ extensions?: SearchRequestExtensionsList; /** Maximum number of domain suggestions to return. Defaults to 20 if not specified. */ limit?: number; } export const SearchRegistrarRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), q: S.String.pipe(T.Query()), extensions: S.optional(SearchRequestExtensionsList.pipe(T.Query())), limit: S.optional(S.Number.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/registrar/domain-search", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "SearchRegistrarRequest", }) as any as S.Schema; export type SearchResponseDomainsItemPricing = CheckResponseDomainsItemPricing; export const SearchResponseDomainsItemPricing = CheckResponseDomainsItemPricing; export type SearchResponseDomainsItemReason = | "extension_not_supported_via_api" | "extension_not_supported" | "extension_disallows_registration" | "domain_premium" | "domain_unavailable"; export const SearchResponseDomainsItemReason = /*@__PURE__*/ S.String; export type SearchResponseDomainsItemTier = "standard" | "premium"; export const SearchResponseDomainsItemTier = /*@__PURE__*/ S.String; export interface SearchResponseDomainsItem { /** The fully qualified domain name (FQDN) in punycode format for internationalized domain names (IDNs). */ name: string; /** Indicates whether this domain appears available based on search data. Search results are non-authoritative and may be stale. - `true`: The domain appears available. Use POST /domain-check to confirm before registration. */ registrable: boolean; /** Annual pricing information for a registrable domain. This object is only */ pricing?: CheckResponseDomainsItemPricing | null; /** Present only when `registrable` is `false` on search results. Explains why the domain does not appear registrable through this API. These values are advisory; use POST /domain-check for authoritative status. */ reason?: SearchResponseDomainsItemReason | null; /** The pricing tier for this domain. Always present when `registrable` is `true`; */ tier?: SearchResponseDomainsItemTier | null; } export const SearchResponseDomainsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ name: S.String, registrable: S.Boolean, pricing: S.optional(S.NullOr(CheckResponseDomainsItemPricing)), reason: S.optional(S.NullOr(SearchResponseDomainsItemReason)), tier: S.optional(S.NullOr(SearchResponseDomainsItemTier)), }), ).annotate({ identifier: "SearchResponseDomainsItem", }) as any as S.Schema; export type SearchResponseDomainsList = Array; export const SearchResponseDomainsList = /*@__PURE__*/ S.Array( SearchResponseDomainsItem, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface SearchRegistrarResponse { /** Array of domain suggestions sorted by relevance. May be empty if no domains match the search criteria. */ domains: SearchResponseDomainsList; } export const SearchRegistrarResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ domains: SearchResponseDomainsList, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "SearchRegistrarResponse", }) as any as S.Schema; export type CheckRegistrarError = CloudflareOpError; /** Performs real-time, authoritative availability checks directly against domain registries. Use this endpoint to verify a domain is available before attempting registration via `POST /registrations`. **Important:** Unlike the Search endpoint, these results are authoritative and reflect current registry status. Always check availability immediately before registration as domain status can change rapidly. **Note:** This endpoint uses POST to accept a list of domains in the request body. It is a read-only operation — it does not create, modify, or reserve any domains. */ export const checkRegistrar: API.OperationMethod< CheckRegistrarRequest, CheckRegistrarResponse, CheckRegistrarError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CheckRegistrarRequest, output: CheckRegistrarResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateRegistrationError = CloudflareOpError; /** Starts a domain registration workflow. This is a billable operation — successful registration charges the account's default payment method. All successful domain registrations are non-refundable — once the workflow completes with `state: succeeded`, the charge cannot be reversed. */ export const createRegistration: API.OperationMethod< CreateRegistrationRequest, CreateRegistrationResponse, CreateRegistrationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateRegistrationRequest, output: CreateRegistrationResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type EditRegistrationError = CloudflareOpError; /** Updates an existing domain registration. By default, the server holds the connection for a bounded, server-defined amount of time while the update completes. Most updates finish within this window and return `200 OK` with a completed workflow status. If the update is still processing after this synchronous wait window, the server returns `202 Accepted`. Poll the URL in `links.self` to track progress. To skip the wait and receive an immediate `202`, send `Prefer: respond-async`. This endpoint currently supports updating `auto_renew` only. */ export const editRegistration: API.OperationMethod< EditRegistrationRequest, EditRegistrationResponse, EditRegistrationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: EditRegistrationRequest, output: EditRegistrationResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetDomainError = Forbidden | CloudflareOpError; /** Show individual domain. */ export const getDomain: API.OperationMethod< GetDomainRequest, GetDomainResponse, GetDomainError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetDomainRequest, output: GetDomainResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetRegistrationError = CloudflareOpError; /** Returns the current state of a domain registration. This is the canonical read endpoint for a domain you own. It returns the full registration resource including current settings and expiration. When the registration resource is ready, both `created_at` and `expires_at` are present in the response. */ export const getRegistration: API.OperationMethod< GetRegistrationRequest, GetRegistrationResponse, GetRegistrationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetRegistrationRequest, output: GetRegistrationResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetRegistrationStatusError = CloudflareOpError; /** Returns the current status of a domain registration workflow. Use this endpoint to poll for completion when the POST response returned `202 Accepted`. The URL is provided in the `links.self` field of the workflow status response. Poll this endpoint until the workflow reaches a terminal state or a state that requires user attention. **Terminal states:** `succeeded` and `failed` are terminal and always have `completed: true`. **Non-terminal states:** - `action_required` has `completed: false` and will not resolve on its own. The workflow is paused pending user intervention. - `blocked` has `completed: false` and indicates the workflow is waiting on a third party such as the extension registry or losing registrar. Continue polling while informing the user of the delay. Use increasing backoff between polls. When `state: blocked`, use a longer polling interval and do not poll indefinitely. A naive polling loop that only checks `completed` can run indefinitely when `state: action_required`. Break explicitly on `action_required`: ```js let status; do { await new Promise(r => setTimeout(r, 2000)); status = await cloudflare.request({ method: 'GET', path: reg.result.links.self, }); } while ( !status.result.completed && status.result.state !== 'action_required' ); if (status.result.state === 'action_required') { // Surface context.action and context.confirmation_sent_to to the user. // Do not re-submit the registration request. } ``` */ export const getRegistrationStatus: API.OperationMethod< GetRegistrationStatusRequest, GetRegistrationStatusResponse, GetRegistrationStatusError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetRegistrationStatusRequest, output: GetRegistrationStatusResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetUpdateStatusError = CloudflareOpError; /** Returns the current status of a domain update workflow. Use this endpoint to poll for completion when the PATCH response returned `202 Accepted`. The URL is provided in the `links.self` field of the workflow status response. Poll this endpoint until the workflow reaches a terminal state or a state that requires user attention. Use increasing backoff between polls. When the workflow remains blocked on a third party, use a longer polling interval and do not poll indefinitely. */ export const getUpdateStatus: API.OperationMethod< GetUpdateStatusRequest, GetUpdateStatusResponse, GetUpdateStatusError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetUpdateStatusRequest, output: GetUpdateStatusResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListDomainsError = Forbidden | CloudflareOpError; /** List domains handled by Registrar. */ export const listDomains: API.PaginatedOperationMethod< ListDomainsRequest, ListDomainsResponse, ListDomainsError, CloudflareOpContext, DomainsListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListDomainsRequest, output: ListDomainsResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type ListRegistrationsError = CloudflareOpError; /** Returns a paginated list of domain registrations owned by the account. This endpoint uses cursor-based pagination. Results are ordered by registration date by default. To fetch the next page, pass the `cursor` value from the `result_info` object in the response as the `cursor` query parameter in your next request. An empty `cursor` string indicates there are no more pages. */ export const listRegistrations: API.OperationMethod< ListRegistrationsRequest, ListRegistrationsResponse, ListRegistrationsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListRegistrationsRequest, output: ListRegistrationsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PutDomainError = | RegistrarDomainNotOwned | RegistrarUpdateNotAllowed | Forbidden | CloudflareOpError; /** Update individual domain. */ export const putDomain: API.OperationMethod< PutDomainRequest, PutDomainResponse, PutDomainError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PutDomainRequest, output: PutDomainResponse, errors: [ RegistrarDomainNotOwned, RegistrarUpdateNotAllowed, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type SearchRegistrarError = CloudflareOpError; /** Searches for domain name suggestions based on a keyword, phrase, or partial domain name. Returns a list of potentially available domains with pricing information. **Important:** Results are non-authoritative and based on cached data. Always use the `/domain-check` endpoint to verify real-time availability before attempting registration. Suggestions are scoped to extensions supported for programmatic registration via this API (`POST /registrations`). Domains on unsupported extensions will not appear in results, even if they are available at the registry level. */ export const searchRegistrar: API.OperationMethod< SearchRegistrarRequest, SearchRegistrarResponse, SearchRegistrarError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: SearchRegistrarRequest, output: SearchRegistrarResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));