/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Operator = { Larger: "LARGER", Smaller: "SMALLER", LargerEqual: "LARGER_EQUAL", SmallerEqual: "SMALLER_EQUAL", Equal: "EQUAL", NotEqual: "NOT_EQUAL", AllIn: "ALL_IN", AnyIn: "ANY_IN", NotIn: "NOT_IN", Between: "BETWEEN", NotBetween: "NOT_BETWEEN", Like: "LIKE", NotLike: "NOT_LIKE", In: "IN", } as const; export type Operator = ClosedEnum; export const On = { Subscriber: "subscriber", Payload: "payload", } as const; export type On = ClosedEnum; export type FieldFilterPartDto = { field: string; value: string; operator: Operator; on: On; }; /** @internal */ export const Operator$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Operator); /** @internal */ export const Operator$outboundSchema: z.ZodNativeEnum = Operator$inboundSchema; /** @internal */ export const On$inboundSchema: z.ZodNativeEnum = z.nativeEnum(On); /** @internal */ export const On$outboundSchema: z.ZodNativeEnum = On$inboundSchema; /** @internal */ export const FieldFilterPartDto$inboundSchema: z.ZodType< FieldFilterPartDto, z.ZodTypeDef, unknown > = z.object({ field: z.string(), value: z.string(), operator: Operator$inboundSchema, on: On$inboundSchema, }); /** @internal */ export type FieldFilterPartDto$Outbound = { field: string; value: string; operator: string; on: string; }; /** @internal */ export const FieldFilterPartDto$outboundSchema: z.ZodType< FieldFilterPartDto$Outbound, z.ZodTypeDef, FieldFilterPartDto > = z.object({ field: z.string(), value: z.string(), operator: Operator$outboundSchema, on: On$outboundSchema, }); export function fieldFilterPartDtoToJSON( fieldFilterPartDto: FieldFilterPartDto, ): string { return JSON.stringify( FieldFilterPartDto$outboundSchema.parse(fieldFilterPartDto), ); } export function fieldFilterPartDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FieldFilterPartDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FieldFilterPartDto' from JSON`, ); }