// 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> = { emailState: "email_state", modifiedOn: "modified_on", resendEmail: "resend_email", zonePlan: "zone_plan", }; export interface GetCsamScannerRequest { /** Identifier for the zone. */ zoneId: string; } export const GetCsamScannerRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/settings/csam_scanner_third_party", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCsamScannerRequest", }) as any as S.Schema; export type GetResponseId = "csam_scanner"; export const GetResponseId = /*@__PURE__*/ S.String; export type GetResponseValueEmailState = "valid" | "pending" | "unverified"; export const GetResponseValueEmailState = /*@__PURE__*/ S.String; export type GetResponseValueSourcesMap = { [key: string]: boolean | undefined }; export const GetResponseValueSourcesMap = /*@__PURE__*/ S.Record( S.String, S.Boolean, ) as any as S.Schema; export interface GetResponseValue { /** Notification email address for CSAM scan results. Masked in */ email?: string | null; /** Current verification state of the notification email. */ emailState?: GetResponseValueEmailState | null; /** Whether CSAM scanning is enabled for this zone. */ enabled?: boolean | null; /** Map of scanning sources and their enabled state. */ sources?: GetResponseValueSourcesMap | null; /** The zone's plan level. */ zonePlan?: string | null; } export const GetResponseValue = /*@__PURE__*/ S.suspend(() => S.Struct({ email: S.optional(S.NullOr(S.String)), emailState: S.optional( S.NullOr(GetResponseValueEmailState).pipe(T.Body("email_state")), ), enabled: S.optional(S.NullOr(S.Boolean)), sources: S.optional(S.NullOr(GetResponseValueSourcesMap)), zonePlan: S.optional(S.NullOr(S.String).pipe(T.Body("zone_plan"))), }), ).annotate({ identifier: "GetResponseValue", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetCsamScannerResponse { /** The feature identifier. */ id?: GetResponseId | null; /** Whether the feature state can be changed. When false, the zone */ editable?: boolean | null; /** When the setting was last modified. Currently always null as the */ modifiedOn?: string | null; /** The CSAM Scanner feature configuration values. Contains the */ value?: GetResponseValue | null; } export const GetCsamScannerResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(GetResponseId)), editable: S.optional(S.NullOr(S.Boolean)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), value: S.optional(S.NullOr(GetResponseValue)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCsamScannerResponse", }) as any as S.Schema; export type EditRequestId = "csam_scanner"; export const EditRequestId = /*@__PURE__*/ S.String; export type EditRequestValueSourcesMap = { [key: string]: boolean | undefined }; export const EditRequestValueSourcesMap = /*@__PURE__*/ S.Record( S.String, S.Boolean, ) as any as S.Schema; export interface EditRequestValue { /** Notification email address for CSAM scan results. When changed, */ email?: string; /** Whether CSAM scanning is enabled for this zone. */ enabled?: boolean; /** Set to true to trigger re-sending the email verification. */ resendEmail?: boolean; /** Map of scanning sources and their enabled state. */ sources?: EditRequestValueSourcesMap; } export const EditRequestValue = /*@__PURE__*/ S.suspend(() => S.Struct({ email: S.optional(S.String), enabled: S.optional(S.Boolean), resendEmail: S.optional(S.Boolean.pipe(T.Body("resend_email"))), sources: S.optional(EditRequestValueSourcesMap), }), ).annotate({ identifier: "EditRequestValue", }) as any as S.Schema; export interface PatchCsamScannerRequest { /** Identifier for the zone. */ zoneId: string; /** The feature identifier. */ id?: EditRequestId | (string & {}); /** Writable CSAM Scanner feature configuration values. */ value?: EditRequestValue; } export const PatchCsamScannerRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), id: S.optional(EditRequestId), value: S.optional(EditRequestValue), }) .pipe( T.Http({ method: "PATCH", uri: "/zones/{zone_id}/settings/csam_scanner_third_party", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchCsamScannerRequest", }) as any as S.Schema; export type EditResponseId = "csam_scanner"; export const EditResponseId = /*@__PURE__*/ S.String; export type EditResponseValueEmailState = "valid" | "pending" | "unverified"; export const EditResponseValueEmailState = /*@__PURE__*/ S.String; export type EditResponseValueSourcesMap = { [key: string]: boolean | undefined; }; export const EditResponseValueSourcesMap = /*@__PURE__*/ S.Record( S.String, S.Boolean, ) as any as S.Schema; export interface EditResponseValue { /** Notification email address for CSAM scan results. Masked in */ email?: string | null; /** Current verification state of the notification email. */ emailState?: EditResponseValueEmailState | null; /** Whether CSAM scanning is enabled for this zone. */ enabled?: boolean | null; /** Map of scanning sources and their enabled state. */ sources?: EditResponseValueSourcesMap | null; /** The zone's plan level. */ zonePlan?: string | null; } export const EditResponseValue = /*@__PURE__*/ S.suspend(() => S.Struct({ email: S.optional(S.NullOr(S.String)), emailState: S.optional( S.NullOr(EditResponseValueEmailState).pipe(T.Body("email_state")), ), enabled: S.optional(S.NullOr(S.Boolean)), sources: S.optional(S.NullOr(EditResponseValueSourcesMap)), zonePlan: S.optional(S.NullOr(S.String).pipe(T.Body("zone_plan"))), }), ).annotate({ identifier: "EditResponseValue", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchCsamScannerResponse { /** The feature identifier. */ id?: EditResponseId | null; /** Whether the feature state can be changed. When false, the zone */ editable?: boolean | null; /** When the setting was last modified. Currently always null as the */ modifiedOn?: string | null; /** The CSAM Scanner feature configuration values. Contains the */ value?: EditResponseValue | null; } export const PatchCsamScannerResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(EditResponseId)), editable: S.optional(S.NullOr(S.Boolean)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), value: S.optional(S.NullOr(EditResponseValue)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchCsamScannerResponse", }) as any as S.Schema; export type GetCsamScannerError = CloudflareOpError; /** Retrieve the current CSAM Scanner configuration for a zone. The notification email is masked by default in responses. */ export const getCsamScanner: API.OperationMethod< GetCsamScannerRequest, GetCsamScannerResponse, GetCsamScannerError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetCsamScannerRequest, output: GetCsamScannerResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PatchCsamScannerError = CloudflareOpError; /** Update the CSAM Scanner configuration for a zone. Allows enabling or disabling CSAM scanning, updating the notification email, and configuring scanning sources. When a new email is provided, email verification is triggered automatically. The `enabled` field is a toggle; the server may adjust it based on whether the notification email is verified. Returns 403 if the zone or account is locked by Trust & Safety. */ export const patchCsamScanner: API.OperationMethod< PatchCsamScannerRequest, PatchCsamScannerResponse, PatchCsamScannerError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchCsamScannerRequest, output: PatchCsamScannerResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));