/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c68813abe092 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AgentConversationAgentVersion = string | number; export type AgentConversation = { /** * Name given to the conversation. */ name?: string | null | undefined; /** * Description of the what the conversation is about. */ description?: string | null | undefined; /** * Custom metadata for the conversation. */ metadata?: { [k: string]: any } | null | undefined; object: "conversation"; id: string; createdAt: Date; updatedAt: Date; agentId: string; agentVersion?: string | number | null | undefined; }; /** @internal */ export const AgentConversationAgentVersion$inboundSchema: z.ZodType< AgentConversationAgentVersion, unknown > = smartUnion([z.string(), z.int()]); export function agentConversationAgentVersionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentConversationAgentVersion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentConversationAgentVersion' from JSON`, ); } /** @internal */ export const AgentConversation$inboundSchema: z.ZodType< AgentConversation, unknown > = z.object({ name: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string(), z.any())).optional(), object: z.literal("conversation").default("conversation"), id: z.string(), created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)), agent_id: z.string(), agent_version: z.nullable(smartUnion([z.string(), z.int()])).optional(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "updated_at": "updatedAt", "agent_id": "agentId", "agent_version": "agentVersion", }); }); export function agentConversationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentConversation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentConversation' from JSON`, ); }