/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c5061d31d40b */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const RelationType = { /** * The value is equal to the specified value. */ Equals: "EQUALS", /** * The value is equal to the specified ID. */ IdEquals: "ID_EQUALS", /** * The value is less than the specified value. */ Lt: "LT", /** * The value is greater than the specified value. */ Gt: "GT", /** * The value is not equal to the specified value. */ NotEquals: "NOT_EQUALS", } as const; export type RelationType = OpenEnum; export type FacetFilterValue = { value?: string | undefined; relationType?: RelationType | undefined; /** * DEPRECATED - please use relationType instead * * @deprecated field: Deprecated on 2026-02-05, removal scheduled for 2026-10-15: Use relationType instead. */ isNegated?: boolean | undefined; }; /** @internal */ export const RelationType$inboundSchema: z.ZodType< RelationType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(RelationType); /** @internal */ export const RelationType$outboundSchema: z.ZodType< string, z.ZodTypeDef, RelationType > = openEnums.outboundSchema(RelationType); /** @internal */ export const FacetFilterValue$inboundSchema: z.ZodType< FacetFilterValue, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), relationType: RelationType$inboundSchema.optional(), isNegated: z.boolean().optional(), }); /** @internal */ export type FacetFilterValue$Outbound = { value?: string | undefined; relationType?: string | undefined; isNegated?: boolean | undefined; }; /** @internal */ export const FacetFilterValue$outboundSchema: z.ZodType< FacetFilterValue$Outbound, z.ZodTypeDef, FacetFilterValue > = z.object({ value: z.string().optional(), relationType: RelationType$outboundSchema.optional(), isNegated: z.boolean().optional(), }); export function facetFilterValueToJSON( facetFilterValue: FacetFilterValue, ): string { return JSON.stringify( FacetFilterValue$outboundSchema.parse(facetFilterValue), ); } export function facetFilterValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FacetFilterValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FacetFilterValue' from JSON`, ); }