// 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, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.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> = { modifiedOn: "modified_on", }; export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class InvalidObjectIdentifier extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "InvalidObjectIdentifier", { code: S.Number, message: S.String, }, ), [{ code: 7003 }], ) {} export class NotAuthorized extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("NotAuthorized", { code: S.Number, message: S.String, }), [{ code: 1015 }], ) {} export class ZoneNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("ZoneNotFound", { code: S.Number, message: S.String, }), [{ status: 404, message: { includes: "Invalid or missing zone" } }], ) {} export interface GetSmartRoutingRequest { /** Specifies the zone associated with the API call. */ zoneId: string; } export const GetSmartRoutingRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/argo/smart_routing", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetSmartRoutingRequest", }) as any as S.Schema; export type SmartRoutingGetResponseValue = "on" | "off"; export const SmartRoutingGetResponseValue = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetSmartRoutingResponse { /** Specifies the identifier of the Argo Smart Routing setting. */ id: string; /** Specifies if the setting is editable. */ editable: boolean; /** Specifies the enablement value of Argo Smart Routing. */ value: SmartRoutingGetResponseValue; /** Specifies the time when the setting was last modified. */ modifiedOn?: string | null; } export const GetSmartRoutingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, editable: S.Boolean, value: SmartRoutingGetResponseValue, modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetSmartRoutingResponse", }) as any as S.Schema; export interface GetTieredCachingRequest { /** Identifier. */ zoneId: string; } export const GetTieredCachingRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/argo/tiered_caching", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetTieredCachingRequest", }) as any as S.Schema; export type TieredCachingGetResponseId = "tiered_caching"; export const TieredCachingGetResponseId = /*@__PURE__*/ S.String; export type TieredCachingGetResponseValue = "on" | "off"; export const TieredCachingGetResponseValue = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetTieredCachingResponse { /** The identifier of the caching setting. */ id: TieredCachingGetResponseId; /** Whether the setting is editable. */ editable: boolean; /** Value of the Tiered Cache zone setting. */ value: TieredCachingGetResponseValue; /** Last time this setting was modified. */ modifiedOn?: string | null; } export const GetTieredCachingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: TieredCachingGetResponseId, editable: S.Boolean, value: TieredCachingGetResponseValue, modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetTieredCachingResponse", }) as any as S.Schema; export type SmartRoutingEditRequestValue = "on" | "off"; export const SmartRoutingEditRequestValue = /*@__PURE__*/ S.String; export interface PatchSmartRoutingRequest { /** Specifies the zone associated with the API call. */ zoneId: string; /** Specifies the enablement value of Argo Smart Routing. */ value: SmartRoutingEditRequestValue | (string & {}); } export const PatchSmartRoutingRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), value: SmartRoutingEditRequestValue, }) .pipe( T.Http({ method: "PATCH", uri: "/zones/{zone_id}/argo/smart_routing", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchSmartRoutingRequest", }) as any as S.Schema; export type SmartRoutingEditResponseValue = "on" | "off"; export const SmartRoutingEditResponseValue = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchSmartRoutingResponse { /** Specifies the identifier of the Argo Smart Routing setting. */ id: string; /** Specifies if the setting is editable. */ editable: boolean; /** Specifies the enablement value of Argo Smart Routing. */ value: SmartRoutingEditResponseValue; /** Specifies the time when the setting was last modified. */ modifiedOn?: string | null; } export const PatchSmartRoutingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, editable: S.Boolean, value: SmartRoutingEditResponseValue, modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchSmartRoutingResponse", }) as any as S.Schema; export type TieredCachingEditRequestValue = "on" | "off"; export const TieredCachingEditRequestValue = /*@__PURE__*/ S.String; export interface PatchTieredCachingRequest { /** Identifier. */ zoneId: string; /** Enables Tiered Caching. */ value: TieredCachingEditRequestValue | (string & {}); } export const PatchTieredCachingRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), value: TieredCachingEditRequestValue, }) .pipe( T.Http({ method: "PATCH", uri: "/zones/{zone_id}/argo/tiered_caching", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchTieredCachingRequest", }) as any as S.Schema; export type TieredCachingEditResponseId = "tiered_caching"; export const TieredCachingEditResponseId = /*@__PURE__*/ S.String; export type TieredCachingEditResponseValue = "on" | "off"; export const TieredCachingEditResponseValue = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchTieredCachingResponse { /** The identifier of the caching setting. */ id: TieredCachingEditResponseId; /** Whether the setting is editable. */ editable: boolean; /** Value of the Tiered Cache zone setting. */ value: TieredCachingEditResponseValue; /** Last time this setting was modified. */ modifiedOn?: string | null; } export const PatchTieredCachingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: TieredCachingEditResponseId, editable: S.Boolean, value: TieredCachingEditResponseValue, modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchTieredCachingResponse", }) as any as S.Schema; export type GetSmartRoutingError = | InvalidObjectIdentifier | NotAuthorized | Forbidden | CloudflareOpError; /** Retrieves the value of Argo Smart Routing enablement setting. */ export const getSmartRouting: API.OperationMethod< GetSmartRoutingRequest, GetSmartRoutingResponse, GetSmartRoutingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetSmartRoutingRequest, output: GetSmartRoutingResponse, errors: [ InvalidObjectIdentifier, NotAuthorized, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetTieredCachingError = | InvalidObjectIdentifier | ZoneNotFound | Forbidden | CloudflareOpError; /** Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources. */ export const getTieredCaching: API.OperationMethod< GetTieredCachingRequest, GetTieredCachingResponse, GetTieredCachingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetTieredCachingRequest, output: GetTieredCachingResponse, errors: [ InvalidObjectIdentifier, ZoneNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PatchSmartRoutingError = | InvalidObjectIdentifier | NotAuthorized | Forbidden | CloudflareOpError; /** Configures the value of the Argo Smart Routing enablement setting. */ export const patchSmartRouting: API.OperationMethod< PatchSmartRoutingRequest, PatchSmartRoutingResponse, PatchSmartRoutingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchSmartRoutingRequest, output: PatchSmartRoutingResponse, errors: [ InvalidObjectIdentifier, NotAuthorized, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PatchTieredCachingError = | InvalidObjectIdentifier | Forbidden | CloudflareOpError; /** Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources. */ export const patchTieredCaching: API.OperationMethod< PatchTieredCachingRequest, PatchTieredCachingResponse, PatchTieredCachingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchTieredCachingRequest, output: PatchTieredCachingResponse, errors: [ InvalidObjectIdentifier, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));