// 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> = { accountTag: "account_tag", commonName: "common_name", createdAt: "created_at", keyType: "key_type", organizationalUnit: "organizational_unit", perPage: "per_page", resultInfo: "result_info", totalCount: "total_count", }; export type CreateRequestSansList = Array; export const CreateRequestSansList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type CreateRequestKeyType = "rsa2048" | "p256v1"; export const CreateRequestKeyType = /*@__PURE__*/ S.String; export interface CreateCustomCsrForAccountRequest { /** The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. */ accountId: string; /** The common name (domain) for the CSR. Must be at most 64 characters. */ commonName: string; /** Two-letter ISO 3166-1 alpha-2 country code. */ country: string; /** City or locality name. */ locality: string; /** Organization name. */ organization: string; /** Subject Alternative Names for the CSR. At least one SAN is required. */ sans: CreateRequestSansList; /** State or province name. */ state: string; /** Optional description for the CSR. */ description?: string; /** Key algorithm to use for the CSR. Defaults to rsa2048 if not specified. */ keyType?: CreateRequestKeyType | (string & {}); /** Human-readable name for the CSR. */ name?: string; /** Organizational unit name. */ organizationalUnit?: string; } export const CreateCustomCsrForAccountRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), commonName: S.String.pipe(T.Body("common_name")), country: S.String, locality: S.String, organization: S.String, sans: CreateRequestSansList, state: S.String, description: S.optional(S.String), keyType: S.optional(CreateRequestKeyType.pipe(T.Body("key_type"))), name: S.optional(S.String), organizationalUnit: S.optional( S.String.pipe(T.Body("organizational_unit")), ), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/custom_csrs", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomCsrForAccountRequest", }) as any as S.Schema; export type CreateResponseKeyType = "rsa2048" | "p256v1"; export const CreateResponseKeyType = /*@__PURE__*/ S.String; export type CreateResponseSansList = Array; export const CreateResponseSansList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateCustomCsrResponse { /** Custom CSR identifier tag. */ id: string; /** When the CSR was created. */ createdAt: string; /** The key algorithm used to generate the CSR. */ keyType: CreateResponseKeyType; /** Account identifier associated with this CSR. */ accountTag?: string | null; /** The common name (domain) for the CSR. */ commonName?: string | null; /** Two-letter ISO 3166-1 alpha-2 country code. */ country?: string | null; /** The PEM-encoded Certificate Signing Request. */ csr?: string | null; /** Optional description for the CSR. */ description?: string | null; /** City or locality name. */ locality?: string | null; /** Human-readable name for the CSR. */ name?: string | null; /** Organization name. */ organization?: string | null; /** Organizational unit name. */ organizationalUnit?: string | null; /** Subject Alternative Names included in the CSR. */ sans?: CreateResponseSansList | null; /** State or province name. */ state?: string | null; } export const CreateCustomCsrResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdAt: S.String.pipe(T.Body("created_at")), keyType: CreateResponseKeyType.pipe(T.Body("key_type")), accountTag: S.optional(S.NullOr(S.String).pipe(T.Body("account_tag"))), commonName: S.optional(S.NullOr(S.String).pipe(T.Body("common_name"))), country: S.optional(S.NullOr(S.String)), csr: S.optional(S.NullOr(S.String)), description: S.optional(S.NullOr(S.String)), locality: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), organization: S.optional(S.NullOr(S.String)), organizationalUnit: S.optional( S.NullOr(S.String).pipe(T.Body("organizational_unit")), ), sans: S.optional(S.NullOr(CreateResponseSansList)), state: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomCsrResponse", }) as any as S.Schema; export interface CreateCustomCsrForZoneRequest { /** The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. */ zoneId: string; /** The common name (domain) for the CSR. Must be at most 64 characters. */ commonName: string; /** Two-letter ISO 3166-1 alpha-2 country code. */ country: string; /** City or locality name. */ locality: string; /** Organization name. */ organization: string; /** Subject Alternative Names for the CSR. At least one SAN is required. */ sans: CreateRequestSansList; /** State or province name. */ state: string; /** Optional description for the CSR. */ description?: string; /** Key algorithm to use for the CSR. Defaults to rsa2048 if not specified. */ keyType?: CreateRequestKeyType | (string & {}); /** Human-readable name for the CSR. */ name?: string; /** Organizational unit name. */ organizationalUnit?: string; } export const CreateCustomCsrForZoneRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), commonName: S.String.pipe(T.Body("common_name")), country: S.String, locality: S.String, organization: S.String, sans: CreateRequestSansList, state: S.String, description: S.optional(S.String), keyType: S.optional(CreateRequestKeyType.pipe(T.Body("key_type"))), name: S.optional(S.String), organizationalUnit: S.optional( S.String.pipe(T.Body("organizational_unit")), ), }) .pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/custom_csrs", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomCsrForZoneRequest", }) as any as S.Schema; export interface DeleteCustomCsrForAccountRequest { /** The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. */ accountId: string; /** Custom CSR identifier tag. */ customCsrId: string; } export const DeleteCustomCsrForAccountRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), customCsrId: S.String.pipe(T.Label("custom_csr_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/custom_csrs/{custom_csr_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomCsrForAccountRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteCustomCsrResponse { /** Custom CSR identifier tag. */ id?: string | null; } export const DeleteCustomCsrResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomCsrResponse", }) as any as S.Schema; export interface DeleteCustomCsrForZoneRequest { /** The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. */ zoneId: string; /** Custom CSR identifier tag. */ customCsrId: string; } export const DeleteCustomCsrForZoneRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), customCsrId: S.String.pipe(T.Label("custom_csr_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/zones/{zone_id}/custom_csrs/{custom_csr_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomCsrForZoneRequest", }) as any as S.Schema; export interface GetCustomCsrForAccountRequest { /** The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. */ accountId: string; /** Custom CSR identifier tag. */ customCsrId: string; } export const GetCustomCsrForAccountRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), customCsrId: S.String.pipe(T.Label("custom_csr_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/custom_csrs/{custom_csr_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomCsrForAccountRequest", }) as any as S.Schema; export type GetResponseKeyType = "rsa2048" | "p256v1"; export const GetResponseKeyType = /*@__PURE__*/ S.String; export type GetResponseSansList = Array; export const GetResponseSansList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetCustomCsrResponse { /** Custom CSR identifier tag. */ id: string; /** When the CSR was created. */ createdAt: string; /** The key algorithm used to generate the CSR. */ keyType: GetResponseKeyType; /** Account identifier associated with this CSR. */ accountTag?: string | null; /** The common name (domain) for the CSR. */ commonName?: string | null; /** Two-letter ISO 3166-1 alpha-2 country code. */ country?: string | null; /** The PEM-encoded Certificate Signing Request. */ csr?: string | null; /** Optional description for the CSR. */ description?: string | null; /** City or locality name. */ locality?: string | null; /** Human-readable name for the CSR. */ name?: string | null; /** Organization name. */ organization?: string | null; /** Organizational unit name. */ organizationalUnit?: string | null; /** Subject Alternative Names included in the CSR. */ sans?: GetResponseSansList | null; /** State or province name. */ state?: string | null; } export const GetCustomCsrResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdAt: S.String.pipe(T.Body("created_at")), keyType: GetResponseKeyType.pipe(T.Body("key_type")), accountTag: S.optional(S.NullOr(S.String).pipe(T.Body("account_tag"))), commonName: S.optional(S.NullOr(S.String).pipe(T.Body("common_name"))), country: S.optional(S.NullOr(S.String)), csr: S.optional(S.NullOr(S.String)), description: S.optional(S.NullOr(S.String)), locality: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), organization: S.optional(S.NullOr(S.String)), organizationalUnit: S.optional( S.NullOr(S.String).pipe(T.Body("organizational_unit")), ), sans: S.optional(S.NullOr(GetResponseSansList)), state: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomCsrResponse", }) as any as S.Schema; export interface GetCustomCsrForZoneRequest { /** The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. */ zoneId: string; /** Custom CSR identifier tag. */ customCsrId: string; } export const GetCustomCsrForZoneRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), customCsrId: S.String.pipe(T.Label("custom_csr_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/custom_csrs/{custom_csr_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomCsrForZoneRequest", }) as any as S.Schema; export interface ListCustomCsrsForAccountRequest { /** The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. */ accountId: string; /** Page number of paginated results. */ page?: number; /** Number of custom CSRs per page. */ perPage?: number; } export const ListCustomCsrsForAccountRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/custom_csrs", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListCustomCsrsForAccountRequest", }) as any as S.Schema; export type ListResultItemKeyType = "rsa2048" | "p256v1"; export const ListResultItemKeyType = /*@__PURE__*/ S.String; export type ListResultItemSansList = Array; export const ListResultItemSansList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface ListResultItem { /** Custom CSR identifier tag. */ id: string; /** When the CSR was created. */ createdAt: string; /** The key algorithm used to generate the CSR. */ keyType: ListResultItemKeyType; /** Account identifier associated with this CSR. */ accountTag?: string | null; /** The common name (domain) for the CSR. */ commonName?: string | null; /** Two-letter ISO 3166-1 alpha-2 country code. */ country?: string | null; /** The PEM-encoded Certificate Signing Request. */ csr?: string | null; /** Optional description for the CSR. */ description?: string | null; /** City or locality name. */ locality?: string | null; /** Human-readable name for the CSR. */ name?: string | null; /** Organization name. */ organization?: string | null; /** Organizational unit name. */ organizationalUnit?: string | null; /** Subject Alternative Names included in the CSR. */ sans?: ListResultItemSansList | null; /** State or province name. */ state?: string | null; } export const ListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdAt: S.String.pipe(T.Body("created_at")), keyType: ListResultItemKeyType.pipe(T.Body("key_type")), accountTag: S.optional(S.NullOr(S.String).pipe(T.Body("account_tag"))), commonName: S.optional(S.NullOr(S.String).pipe(T.Body("common_name"))), country: S.optional(S.NullOr(S.String)), csr: S.optional(S.NullOr(S.String)), description: S.optional(S.NullOr(S.String)), locality: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), organization: S.optional(S.NullOr(S.String)), organizationalUnit: S.optional( S.NullOr(S.String).pipe(T.Body("organizational_unit")), ), sans: S.optional(S.NullOr(ListResultItemSansList)), state: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "ListResultItem" }) as any as S.Schema; export type ListResultList = Array; export const ListResultList = /*@__PURE__*/ S.Array( ListResultItem, ) as any as S.Schema; export interface ListCustomCsrsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: ListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListCustomCsrsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: ListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListCustomCsrsResponse", }) as any as S.Schema; export interface ListCustomCsrsForZoneRequest { /** The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. */ zoneId: string; /** Page number of paginated results. */ page?: number; /** Number of custom CSRs per page. */ perPage?: number; } export const ListCustomCsrsForZoneRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/custom_csrs", code: 200 }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListCustomCsrsForZoneRequest", }) as any as S.Schema; export type CreateCustomCsrForAccountError = CloudflareOpError; /** Generate a new custom Certificate Signing Request (CSR) for an account or zone. Cloudflare generates and securely stores the private key associated with the CSR. */ export const createCustomCsrForAccount: API.OperationMethod< CreateCustomCsrForAccountRequest, CreateCustomCsrResponse, CreateCustomCsrForAccountError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateCustomCsrForAccountRequest, output: CreateCustomCsrResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateCustomCsrForZoneError = CloudflareOpError; /** Generate a new custom Certificate Signing Request (CSR) for an account or zone. Cloudflare generates and securely stores the private key associated with the CSR. */ export const createCustomCsrForZone: API.OperationMethod< CreateCustomCsrForZoneRequest, CreateCustomCsrResponse, CreateCustomCsrForZoneError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateCustomCsrForZoneRequest, output: CreateCustomCsrResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteCustomCsrForAccountError = CloudflareOpError; /** Delete a custom Certificate Signing Request (CSR) and its associated private key. */ export const deleteCustomCsrForAccount: API.OperationMethod< DeleteCustomCsrForAccountRequest, DeleteCustomCsrResponse, DeleteCustomCsrForAccountError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteCustomCsrForAccountRequest, output: DeleteCustomCsrResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteCustomCsrForZoneError = CloudflareOpError; /** Delete a custom Certificate Signing Request (CSR) and its associated private key. */ export const deleteCustomCsrForZone: API.OperationMethod< DeleteCustomCsrForZoneRequest, DeleteCustomCsrResponse, DeleteCustomCsrForZoneError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteCustomCsrForZoneRequest, output: DeleteCustomCsrResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetCustomCsrForAccountError = CloudflareOpError; /** Retrieve details for a specific custom Certificate Signing Request (CSR). */ export const getCustomCsrForAccount: API.OperationMethod< GetCustomCsrForAccountRequest, GetCustomCsrResponse, GetCustomCsrForAccountError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetCustomCsrForAccountRequest, output: GetCustomCsrResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetCustomCsrForZoneError = CloudflareOpError; /** Retrieve details for a specific custom Certificate Signing Request (CSR). */ export const getCustomCsrForZone: API.OperationMethod< GetCustomCsrForZoneRequest, GetCustomCsrResponse, GetCustomCsrForZoneError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetCustomCsrForZoneRequest, output: GetCustomCsrResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListCustomCsrsForAccountError = CloudflareOpError; /** List all custom Certificate Signing Requests (CSRs) for an account or zone. */ export const listCustomCsrsForAccount: API.PaginatedOperationMethod< ListCustomCsrsForAccountRequest, ListCustomCsrsResponse, ListCustomCsrsForAccountError, CloudflareOpContext, ListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListCustomCsrsForAccountRequest, output: ListCustomCsrsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "resultInfo.page", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type ListCustomCsrsForZoneError = CloudflareOpError; /** List all custom Certificate Signing Requests (CSRs) for an account or zone. */ export const listCustomCsrsForZone: API.PaginatedOperationMethod< ListCustomCsrsForZoneRequest, ListCustomCsrsResponse, ListCustomCsrsForZoneError, CloudflareOpContext, ListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListCustomCsrsForZoneRequest, output: ListCustomCsrsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "resultInfo.page", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any;