// 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 }; export class AiSecurityNotEntitled extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "AiSecurityNotEntitled", { code: S.Number, message: S.String, }, ), [{ code: 13101, message: { includes: "not entitled" } }], ) {} export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class ZoneNotAuthorized extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("ZoneNotAuthorized", { code: S.Number, message: S.String, }), [{ code: 10000, message: { includes: "Authentication error" } }], ) {} export interface GetAiSecurityRequest { /** Defines the zone. */ zoneId: string; } export const GetAiSecurityRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }).pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/ai-security/settings", code: 200, }), ), ).annotate({ identifier: "GetAiSecurityRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetAiSecurityResponse { /** Whether AI Security for Apps is enabled on the zone. */ enabled?: boolean | null; } export const GetAiSecurityResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), }), ).annotate({ identifier: "GetAiSecurityResponse", }) as any as S.Schema; export interface GetCustomTopicRequest { /** Defines the zone. */ zoneId: string; } export const GetCustomTopicRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }).pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/ai-security/custom-topics", code: 200, }), ), ).annotate({ identifier: "GetCustomTopicRequest", }) as any as S.Schema; export interface CustomTopicsGetResponseTopicsItem { /** Unique label identifier. Must contain only lowercase letters (a–z), digits (0–9), and hyphens. */ label: string; /** Description of the topic category. Must contain only printable ASCII characters. */ topic: string; } export const CustomTopicsGetResponseTopicsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ label: S.String, topic: S.String, }), ).annotate({ identifier: "CustomTopicsGetResponseTopicsItem", }) as any as S.Schema; export type CustomTopicsGetResponseTopicsList = Array; export const CustomTopicsGetResponseTopicsList = /*@__PURE__*/ S.Array( CustomTopicsGetResponseTopicsItem, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetCustomTopicResponse { /** Custom topic categories for AI Security for Apps content detection. */ topics?: CustomTopicsGetResponseTopicsList | null; } export const GetCustomTopicResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ topics: S.optional(S.NullOr(CustomTopicsGetResponseTopicsList)), }), ).annotate({ identifier: "GetCustomTopicResponse", }) as any as S.Schema; export interface PutAiSecurityRequest { /** Defines the zone. */ zoneId: string; /** Whether AI Security for Apps is enabled on the zone. */ enabled?: boolean; } export const PutAiSecurityRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), enabled: S.optional(S.Boolean), }).pipe( T.Http({ method: "PUT", uri: "/zones/{zone_id}/ai-security/settings", code: 200, }), ), ).annotate({ identifier: "PutAiSecurityRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PutAiSecurityResponse { /** Whether AI Security for Apps is enabled on the zone. */ enabled?: boolean | null; } export const PutAiSecurityResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), }), ).annotate({ identifier: "PutAiSecurityResponse", }) as any as S.Schema; export type CustomTopicsUpdateRequestTopicsItem = CustomTopicsGetResponseTopicsItem; export const CustomTopicsUpdateRequestTopicsItem = CustomTopicsGetResponseTopicsItem; export type CustomTopicsUpdateRequestTopicsList = Array; export const CustomTopicsUpdateRequestTopicsList = /*@__PURE__*/ S.Array( CustomTopicsGetResponseTopicsItem, ) as any as S.Schema; export interface PutCustomTopicRequest { /** Defines the zone. */ zoneId: string; /** Custom topic categories for AI Security for Apps content detection. */ topics?: CustomTopicsUpdateRequestTopicsList; } export const PutCustomTopicRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), topics: S.optional(CustomTopicsUpdateRequestTopicsList), }).pipe( T.Http({ method: "PUT", uri: "/zones/{zone_id}/ai-security/custom-topics", code: 200, }), ), ).annotate({ identifier: "PutCustomTopicRequest", }) as any as S.Schema; export type CustomTopicsUpdateResponseTopicsItem = CustomTopicsGetResponseTopicsItem; export const CustomTopicsUpdateResponseTopicsItem = CustomTopicsGetResponseTopicsItem; export type CustomTopicsUpdateResponseTopicsList = Array; export const CustomTopicsUpdateResponseTopicsList = /*@__PURE__*/ S.Array( CustomTopicsGetResponseTopicsItem, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PutCustomTopicResponse { /** Custom topic categories for AI Security for Apps content detection. */ topics?: CustomTopicsUpdateResponseTopicsList | null; } export const PutCustomTopicResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ topics: S.optional(S.NullOr(CustomTopicsUpdateResponseTopicsList)), }), ).annotate({ identifier: "PutCustomTopicResponse", }) as any as S.Schema; export type GetAiSecurityError = | AiSecurityNotEntitled | ZoneNotAuthorized | Forbidden | CloudflareOpError; /** Get whether AI Security for Apps is enabled or disabled for a zone. */ export const getAiSecurity: API.OperationMethod< GetAiSecurityRequest, GetAiSecurityResponse, GetAiSecurityError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetAiSecurityRequest, output: GetAiSecurityResponse, errors: [ AiSecurityNotEntitled, ZoneNotAuthorized, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetCustomTopicError = | AiSecurityNotEntitled | ZoneNotAuthorized | Forbidden | CloudflareOpError; /** Get the AI Security for Apps custom topic categories for a zone. */ export const getCustomTopic: API.OperationMethod< GetCustomTopicRequest, GetCustomTopicResponse, GetCustomTopicError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetCustomTopicRequest, output: GetCustomTopicResponse, errors: [ AiSecurityNotEntitled, ZoneNotAuthorized, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PutAiSecurityError = | AiSecurityNotEntitled | ZoneNotAuthorized | Forbidden | CloudflareOpError; /** Enable or disable AI Security for Apps for a zone. Changes can take up to a minute to propagate to the zone. */ export const putAiSecurity: API.OperationMethod< PutAiSecurityRequest, PutAiSecurityResponse, PutAiSecurityError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PutAiSecurityRequest, output: PutAiSecurityResponse, errors: [ AiSecurityNotEntitled, ZoneNotAuthorized, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PutCustomTopicError = | AiSecurityNotEntitled | ZoneNotAuthorized | Forbidden | CloudflareOpError; /** Set the AI Security for Apps custom topic categories for a zone. A maximum of 20 custom topics can be configured per zone. Each topic label must be 2–20 characters using only lowercase letters (a–z), digits (0–9), and hyphens. Each topic description must be 2–50 printable ASCII characters. Changes can take up to a minute to propagate to the zone. */ export const putCustomTopic: API.OperationMethod< PutCustomTopicRequest, PutCustomTopicResponse, PutCustomTopicError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PutCustomTopicRequest, output: PutCustomTopicResponse, errors: [ AiSecurityNotEntitled, ZoneNotAuthorized, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));