/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: ce909efc8e7c */ 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type FunctionResultEntry = { object?: "entry" | undefined; type?: "function.result" | undefined; createdAt?: Date | undefined; completedAt?: Date | null | undefined; id?: string | undefined; toolCallId: string; result: string; }; /** @internal */ export const FunctionResultEntry$inboundSchema: z.ZodType< FunctionResultEntry, unknown > = z.object({ object: z.literal("entry").default("entry"), type: z.literal("function.result").default("function.result"), created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)) .optional(), completed_at: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), id: z.string().optional(), tool_call_id: z.string(), result: z.string(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "completed_at": "completedAt", "tool_call_id": "toolCallId", }); }); /** @internal */ export type FunctionResultEntry$Outbound = { object: "entry"; type: "function.result"; created_at?: string | undefined; completed_at?: string | null | undefined; id?: string | undefined; tool_call_id: string; result: string; }; /** @internal */ export const FunctionResultEntry$outboundSchema: z.ZodType< FunctionResultEntry$Outbound, FunctionResultEntry > = z.object({ object: z.literal("entry").default("entry" as const), type: z.literal("function.result").default("function.result" as const), createdAt: z.date().transform(v => v.toISOString()).optional(), completedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), id: z.string().optional(), toolCallId: z.string(), result: z.string(), }).transform((v) => { return remap$(v, { createdAt: "created_at", completedAt: "completed_at", toolCallId: "tool_call_id", }); }); export function functionResultEntryToJSON( functionResultEntry: FunctionResultEntry, ): string { return JSON.stringify( FunctionResultEntry$outboundSchema.parse(functionResultEntry), ); } export function functionResultEntryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FunctionResultEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FunctionResultEntry' from JSON`, ); }