/* * 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"; export type ResponseHistoryCallCompletedEvent = { type: "response.history_call.completed"; sequenceNumber: number; itemId: string; outputIndex: number; functionCallOutput?: string | undefined; }; /** @internal */ export const ResponseHistoryCallCompletedEvent$inboundSchema: z.ZodType< ResponseHistoryCallCompletedEvent, z.ZodTypeDef, unknown > = z.object({ type: z.literal("response.history_call.completed"), sequence_number: z.number().int(), item_id: z.string(), output_index: z.number().int(), function_call_output: z.string().optional(), }).transform((v) => { return remap$(v, { "sequence_number": "sequenceNumber", "item_id": "itemId", "output_index": "outputIndex", "function_call_output": "functionCallOutput", }); }); /** @internal */ export type ResponseHistoryCallCompletedEvent$Outbound = { type: "response.history_call.completed"; sequence_number: number; item_id: string; output_index: number; function_call_output?: string | undefined; }; /** @internal */ export const ResponseHistoryCallCompletedEvent$outboundSchema: z.ZodType< ResponseHistoryCallCompletedEvent$Outbound, z.ZodTypeDef, ResponseHistoryCallCompletedEvent > = z.object({ type: z.literal("response.history_call.completed"), sequenceNumber: z.number().int(), itemId: z.string(), outputIndex: z.number().int(), functionCallOutput: z.string().optional(), }).transform((v) => { return remap$(v, { sequenceNumber: "sequence_number", itemId: "item_id", outputIndex: "output_index", functionCallOutput: "function_call_output", }); }); export function responseHistoryCallCompletedEventToJSON( responseHistoryCallCompletedEvent: ResponseHistoryCallCompletedEvent, ): string { return JSON.stringify( ResponseHistoryCallCompletedEvent$outboundSchema.parse( responseHistoryCallCompletedEvent, ), ); } export function responseHistoryCallCompletedEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseHistoryCallCompletedEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseHistoryCallCompletedEvent' from JSON`, ); }