// 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 }; export class DetectionNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("DetectionNotFound", { code: S.Number, message: S.String, }), [{ code: 11002 }], ) {} export class DetectionQuotaExceeded extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "DetectionQuotaExceeded", { code: S.Number, message: S.String, }, ), [{ code: 50001 }], ) {} export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class LeakedCredentialChecksDisabled extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "LeakedCredentialChecksDisabled", { code: S.Number, message: S.String, }, ), [{ code: 11001 }], ) {} export interface CreateDetectionRequest { /** Defines an identifier. */ zoneId: string; /** Defines ehe ruleset expression to use in matching the password in a request. */ password?: string; /** Defines the ruleset expression to use in matching the username in a request. */ username?: string; } export const CreateDetectionRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), password: S.optional(S.String), username: S.optional(S.String), }).pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/leaked-credential-checks/detections", code: 200, }), ), ).annotate({ identifier: "CreateDetectionRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateDetectionResponse { /** Defines the unique ID for this custom detection. */ id?: string | null; /** Defines ehe ruleset expression to use in matching the password in a request. */ password?: string | null; /** Defines the ruleset expression to use in matching the username in a request. */ username?: string | null; } export const CreateDetectionResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), password: S.optional(S.NullOr(S.String)), username: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "CreateDetectionResponse", }) as any as S.Schema; export interface CreateLeakedCredentialCheckRequest { /** Defines an identifier. */ zoneId: string; /** Determines whether or not Leaked Credential Checks are enabled. */ enabled?: boolean; } export const CreateLeakedCredentialCheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), enabled: S.optional(S.Boolean), }).pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/leaked-credential-checks", code: 200, }), ), ).annotate({ identifier: "CreateLeakedCredentialCheckRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateLeakedCredentialCheckResponse { /** Determines whether or not Leaked Credential Checks are enabled. */ enabled?: boolean | null; } export const CreateLeakedCredentialCheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), }), ).annotate({ identifier: "CreateLeakedCredentialCheckResponse", }) as any as S.Schema; export interface DeleteDetectionRequest { /** Defines an identifier. */ zoneId: string; /** Defines the unique ID for this custom detection. */ detectionId: string; } export const DeleteDetectionRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), detectionId: S.String.pipe(T.Label("detection_id")), }).pipe( T.Http({ method: "DELETE", uri: "/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}", code: 200, }), ), ).annotate({ identifier: "DeleteDetectionRequest", }) as any as S.Schema; export type DeleteDetectionResponse = unknown; export const DeleteDetectionResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "DeleteDetectionResponse", }) as any as S.Schema; export interface GetDetectionRequest { /** Defines an identifier. */ zoneId: string; /** Defines the unique ID for this custom detection. */ detectionId: string; } export const GetDetectionRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), detectionId: S.String.pipe(T.Label("detection_id")), }).pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}", code: 200, }), ), ).annotate({ identifier: "GetDetectionRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetDetectionResponse { /** Defines the unique ID for this custom detection. */ id?: string | null; /** Defines ehe ruleset expression to use in matching the password in a request. */ password?: string | null; /** Defines the ruleset expression to use in matching the username in a request. */ username?: string | null; } export const GetDetectionResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), password: S.optional(S.NullOr(S.String)), username: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "GetDetectionResponse", }) as any as S.Schema; export interface GetLeakedCredentialCheckRequest { /** Defines an identifier. */ zoneId: string; } export const GetLeakedCredentialCheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }).pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/leaked-credential-checks", code: 200, }), ), ).annotate({ identifier: "GetLeakedCredentialCheckRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetLeakedCredentialCheckResponse { /** Determines whether or not Leaked Credential Checks are enabled. */ enabled?: boolean | null; } export const GetLeakedCredentialCheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), }), ).annotate({ identifier: "GetLeakedCredentialCheckResponse", }) as any as S.Schema; export interface ListDetectionsRequest { /** Defines an identifier. */ zoneId: string; } export const ListDetectionsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }).pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/leaked-credential-checks/detections", code: 200, }), ), ).annotate({ identifier: "ListDetectionsRequest", }) as any as S.Schema; export interface DetectionsListResultItem { /** Defines the unique ID for this custom detection. */ id?: string | null; /** Defines ehe ruleset expression to use in matching the password in a request. */ password?: string | null; /** Defines the ruleset expression to use in matching the username in a request. */ username?: string | null; } export const DetectionsListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), password: S.optional(S.NullOr(S.String)), username: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "DetectionsListResultItem", }) as any as S.Schema; export type DetectionsListResultList = Array; export const DetectionsListResultList = /*@__PURE__*/ S.Array( DetectionsListResultItem, ) as any as S.Schema; export interface ListDetectionsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: DetectionsListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListDetectionsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: DetectionsListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }), ).annotate({ identifier: "ListDetectionsResponse", }) as any as S.Schema; export interface UpdateDetectionRequest { /** Defines an identifier. */ zoneId: string; /** Defines the unique ID for this custom detection. */ detectionId: string; /** Defines ehe ruleset expression to use in matching the password in a request. */ password?: string; /** Defines the ruleset expression to use in matching the username in a request. */ username?: string; } export const UpdateDetectionRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), detectionId: S.String.pipe(T.Label("detection_id")), password: S.optional(S.String), username: S.optional(S.String), }).pipe( T.Http({ method: "PUT", uri: "/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}", code: 200, }), ), ).annotate({ identifier: "UpdateDetectionRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateDetectionResponse { /** Defines the unique ID for this custom detection. */ id?: string | null; /** Defines ehe ruleset expression to use in matching the password in a request. */ password?: string | null; /** Defines the ruleset expression to use in matching the username in a request. */ username?: string | null; } export const UpdateDetectionResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), password: S.optional(S.NullOr(S.String)), username: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "UpdateDetectionResponse", }) as any as S.Schema; export type CreateDetectionError = | DetectionQuotaExceeded | LeakedCredentialChecksDisabled | Forbidden | CloudflareOpError; /** Create user-defined detection pattern for Leaked Credential Checks. */ export const createDetection: API.OperationMethod< CreateDetectionRequest, CreateDetectionResponse, CreateDetectionError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateDetectionRequest, output: CreateDetectionResponse, errors: [ DetectionQuotaExceeded, LeakedCredentialChecksDisabled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateLeakedCredentialCheckError = Forbidden | CloudflareOpError; /** Updates the current status of Leaked Credential Checks. */ export const createLeakedCredentialCheck: API.OperationMethod< CreateLeakedCredentialCheckRequest, CreateLeakedCredentialCheckResponse, CreateLeakedCredentialCheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateLeakedCredentialCheckRequest, output: CreateLeakedCredentialCheckResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteDetectionError = | DetectionNotFound | LeakedCredentialChecksDisabled | Forbidden | CloudflareOpError; /** Remove user-defined detection pattern for Leaked Credential Checks. */ export const deleteDetection: API.OperationMethod< DeleteDetectionRequest, DeleteDetectionResponse, DeleteDetectionError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteDetectionRequest, output: DeleteDetectionResponse, errors: [ DetectionNotFound, LeakedCredentialChecksDisabled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetDetectionError = | DetectionNotFound | LeakedCredentialChecksDisabled | Forbidden | CloudflareOpError; /** Get user-defined detection pattern for Leaked Credential Checks. */ export const getDetection: API.OperationMethod< GetDetectionRequest, GetDetectionResponse, GetDetectionError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetDetectionRequest, output: GetDetectionResponse, errors: [ DetectionNotFound, LeakedCredentialChecksDisabled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetLeakedCredentialCheckError = Forbidden | CloudflareOpError; /** Retrieves the current status of Leaked Credential Checks. */ export const getLeakedCredentialCheck: API.OperationMethod< GetLeakedCredentialCheckRequest, GetLeakedCredentialCheckResponse, GetLeakedCredentialCheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetLeakedCredentialCheckRequest, output: GetLeakedCredentialCheckResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListDetectionsError = | LeakedCredentialChecksDisabled | Forbidden | CloudflareOpError; /** List user-defined detection patterns for Leaked Credential Checks. */ export const listDetections: API.PaginatedOperationMethod< ListDetectionsRequest, ListDetectionsResponse, ListDetectionsError, CloudflareOpContext, DetectionsListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListDetectionsRequest, output: ListDetectionsResponse, errors: [ LeakedCredentialChecksDisabled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type UpdateDetectionError = | DetectionNotFound | LeakedCredentialChecksDisabled | Forbidden | CloudflareOpError; /** Update user-defined detection pattern for Leaked Credential Checks. */ export const updateDetection: API.OperationMethod< UpdateDetectionRequest, UpdateDetectionResponse, UpdateDetectionError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateDetectionRequest, output: UpdateDetectionResponse, errors: [ DetectionNotFound, LeakedCredentialChecksDisabled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));