/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 4ff9ec6cb8ad */ 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 { Person, Person$inboundSchema, Person$Outbound, Person$outboundSchema, } from "./person.js"; export type AnswerLike = { user?: Person | undefined; /** * The time the user liked the answer in ISO format (ISO 8601). */ createTime?: Date | undefined; }; /** @internal */ export const AnswerLike$inboundSchema: z.ZodType< AnswerLike, z.ZodTypeDef, unknown > = z.object({ user: z.lazy(() => Person$inboundSchema).optional(), createTime: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), }); /** @internal */ export type AnswerLike$Outbound = { user?: Person$Outbound | undefined; createTime?: string | undefined; }; /** @internal */ export const AnswerLike$outboundSchema: z.ZodType< AnswerLike$Outbound, z.ZodTypeDef, AnswerLike > = z.object({ user: z.lazy(() => Person$outboundSchema).optional(), createTime: z.date().transform(v => v.toISOString()).optional(), }); export function answerLikeToJSON(answerLike: AnswerLike): string { return JSON.stringify(AnswerLike$outboundSchema.parse(answerLike)); } export function answerLikeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AnswerLike$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnswerLike' from JSON`, ); }