/* * 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 ResponseHistoryCallInProgressEventArgs = { query: string; }; export type ResponseHistoryCallInProgressEvent = { type: "response.history_call.in_progress"; sequenceNumber: number; itemId: string; outputIndex: number; args?: ResponseHistoryCallInProgressEventArgs | undefined; }; /** @internal */ export const ResponseHistoryCallInProgressEventArgs$inboundSchema: z.ZodType< ResponseHistoryCallInProgressEventArgs, z.ZodTypeDef, unknown > = z.object({ query: z.string(), }); /** @internal */ export type ResponseHistoryCallInProgressEventArgs$Outbound = { query: string; }; /** @internal */ export const ResponseHistoryCallInProgressEventArgs$outboundSchema: z.ZodType< ResponseHistoryCallInProgressEventArgs$Outbound, z.ZodTypeDef, ResponseHistoryCallInProgressEventArgs > = z.object({ query: z.string(), }); export function responseHistoryCallInProgressEventArgsToJSON( responseHistoryCallInProgressEventArgs: ResponseHistoryCallInProgressEventArgs, ): string { return JSON.stringify( ResponseHistoryCallInProgressEventArgs$outboundSchema.parse( responseHistoryCallInProgressEventArgs, ), ); } export function responseHistoryCallInProgressEventArgsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseHistoryCallInProgressEventArgs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseHistoryCallInProgressEventArgs' from JSON`, ); } /** @internal */ export const ResponseHistoryCallInProgressEvent$inboundSchema: z.ZodType< ResponseHistoryCallInProgressEvent, z.ZodTypeDef, unknown > = z.object({ type: z.literal("response.history_call.in_progress"), sequence_number: z.number().int(), item_id: z.string(), output_index: z.number().int(), args: z.lazy(() => ResponseHistoryCallInProgressEventArgs$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "sequence_number": "sequenceNumber", "item_id": "itemId", "output_index": "outputIndex", }); }); /** @internal */ export type ResponseHistoryCallInProgressEvent$Outbound = { type: "response.history_call.in_progress"; sequence_number: number; item_id: string; output_index: number; args?: ResponseHistoryCallInProgressEventArgs$Outbound | undefined; }; /** @internal */ export const ResponseHistoryCallInProgressEvent$outboundSchema: z.ZodType< ResponseHistoryCallInProgressEvent$Outbound, z.ZodTypeDef, ResponseHistoryCallInProgressEvent > = z.object({ type: z.literal("response.history_call.in_progress"), sequenceNumber: z.number().int(), itemId: z.string(), outputIndex: z.number().int(), args: z.lazy(() => ResponseHistoryCallInProgressEventArgs$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { sequenceNumber: "sequence_number", itemId: "item_id", outputIndex: "output_index", }); }); export function responseHistoryCallInProgressEventToJSON( responseHistoryCallInProgressEvent: ResponseHistoryCallInProgressEvent, ): string { return JSON.stringify( ResponseHistoryCallInProgressEvent$outboundSchema.parse( responseHistoryCallInProgressEvent, ), ); } export function responseHistoryCallInProgressEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseHistoryCallInProgressEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseHistoryCallInProgressEvent' from JSON`, ); }