/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 7fbd07de09e1 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomFieldValueHyperlink, CustomFieldValueHyperlink$inboundSchema, CustomFieldValueHyperlink$Outbound, CustomFieldValueHyperlink$outboundSchema, } from "./customfieldvaluehyperlink.js"; import { CustomFieldValuePerson, CustomFieldValuePerson$inboundSchema, CustomFieldValuePerson$Outbound, CustomFieldValuePerson$outboundSchema, } from "./customfieldvalueperson.js"; import { CustomFieldValueStr, CustomFieldValueStr$inboundSchema, CustomFieldValueStr$Outbound, CustomFieldValueStr$outboundSchema, } from "./customfieldvaluestr.js"; export type CustomFieldValue = | CustomFieldValueStr | CustomFieldValueHyperlink | CustomFieldValuePerson; /** @internal */ export const CustomFieldValue$inboundSchema: z.ZodType< CustomFieldValue, z.ZodTypeDef, unknown > = z.union([ CustomFieldValueStr$inboundSchema, CustomFieldValueHyperlink$inboundSchema, z.lazy(() => CustomFieldValuePerson$inboundSchema), ]); /** @internal */ export type CustomFieldValue$Outbound = | CustomFieldValueStr$Outbound | CustomFieldValueHyperlink$Outbound | CustomFieldValuePerson$Outbound; /** @internal */ export const CustomFieldValue$outboundSchema: z.ZodType< CustomFieldValue$Outbound, z.ZodTypeDef, CustomFieldValue > = z.union([ CustomFieldValueStr$outboundSchema, CustomFieldValueHyperlink$outboundSchema, z.lazy(() => CustomFieldValuePerson$outboundSchema), ]); export function customFieldValueToJSON( customFieldValue: CustomFieldValue, ): string { return JSON.stringify( CustomFieldValue$outboundSchema.parse(customFieldValue), ); } export function customFieldValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomFieldValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomFieldValue' from JSON`, ); }