/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; /** * Custom tool call output item: The output payload returned by a custom tool call. */ export type CustomToolCallOutputWithId = { type: "custom_tool_call_output"; callId: string; output: string; /** * The unique ID of the message. */ id: string; /** * The ID of the response that created this item, if any. */ responseId?: string | null | undefined; /** * Metadata from the response that created this item, if any. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const CustomToolCallOutputWithId$inboundSchema: z.ZodType< CustomToolCallOutputWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("custom_tool_call_output"), call_id: z.string(), output: z.string(), id: z.string(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "call_id": "callId", "response_id": "responseId", }); }); /** @internal */ export type CustomToolCallOutputWithId$Outbound = { type: "custom_tool_call_output"; call_id: string; output: string; id: string; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const CustomToolCallOutputWithId$outboundSchema: z.ZodType< CustomToolCallOutputWithId$Outbound, z.ZodTypeDef, CustomToolCallOutputWithId > = z.object({ type: z.literal("custom_tool_call_output"), callId: z.string(), output: z.string(), id: z.string(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { callId: "call_id", responseId: "response_id", }); }); export function customToolCallOutputWithIdToJSON( customToolCallOutputWithId: CustomToolCallOutputWithId, ): string { return JSON.stringify( CustomToolCallOutputWithId$outboundSchema.parse(customToolCallOutputWithId), ); } export function customToolCallOutputWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomToolCallOutputWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomToolCallOutputWithId' from JSON`, ); }