/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ 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 { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; export type Contact = { phone?: PhoneNumber | undefined; }; /** @internal */ export const Contact$inboundSchema: z.ZodType = z.object({ phone: PhoneNumber$inboundSchema.optional(), }); /** @internal */ export type Contact$Outbound = { phone?: PhoneNumber$Outbound | undefined; }; /** @internal */ export const Contact$outboundSchema: z.ZodType< Contact$Outbound, z.ZodTypeDef, Contact > = z.object({ phone: PhoneNumber$outboundSchema.optional(), }); export function contactToJSON(contact: Contact): string { return JSON.stringify(Contact$outboundSchema.parse(contact)); } export function contactFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Contact$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Contact' from JSON`, ); }