/* * 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 Args = { query: string; location?: string | undefined; language?: string | undefined; country?: string | undefined; }; export type ResponseWebSearchCallInProgressEvent = { type: "response.web_search_call.in_progress"; sequenceNumber: number; itemId: string; outputIndex: number; args?: Args | undefined; }; /** @internal */ export const Args$inboundSchema: z.ZodType = z .object({ query: z.string(), location: z.string().optional(), language: z.string().optional(), country: z.string().optional(), }); /** @internal */ export type Args$Outbound = { query: string; location?: string | undefined; language?: string | undefined; country?: string | undefined; }; /** @internal */ export const Args$outboundSchema: z.ZodType = z.object({ query: z.string(), location: z.string().optional(), language: z.string().optional(), country: z.string().optional(), }); export function argsToJSON(args: Args): string { return JSON.stringify(Args$outboundSchema.parse(args)); } export function argsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Args$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Args' from JSON`, ); } /** @internal */ export const ResponseWebSearchCallInProgressEvent$inboundSchema: z.ZodType< ResponseWebSearchCallInProgressEvent, z.ZodTypeDef, unknown > = z.object({ type: z.literal("response.web_search_call.in_progress"), sequence_number: z.number().int(), item_id: z.string(), output_index: z.number().int(), args: z.lazy(() => Args$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "sequence_number": "sequenceNumber", "item_id": "itemId", "output_index": "outputIndex", }); }); /** @internal */ export type ResponseWebSearchCallInProgressEvent$Outbound = { type: "response.web_search_call.in_progress"; sequence_number: number; item_id: string; output_index: number; args?: Args$Outbound | undefined; }; /** @internal */ export const ResponseWebSearchCallInProgressEvent$outboundSchema: z.ZodType< ResponseWebSearchCallInProgressEvent$Outbound, z.ZodTypeDef, ResponseWebSearchCallInProgressEvent > = z.object({ type: z.literal("response.web_search_call.in_progress"), sequenceNumber: z.number().int(), itemId: z.string(), outputIndex: z.number().int(), args: z.lazy(() => Args$outboundSchema).optional(), }).transform((v) => { return remap$(v, { sequenceNumber: "sequence_number", itemId: "item_id", outputIndex: "output_index", }); }); export function responseWebSearchCallInProgressEventToJSON( responseWebSearchCallInProgressEvent: ResponseWebSearchCallInProgressEvent, ): string { return JSON.stringify( ResponseWebSearchCallInProgressEvent$outboundSchema.parse( responseWebSearchCallInProgressEvent, ), ); } export function responseWebSearchCallInProgressEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseWebSearchCallInProgressEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseWebSearchCallInProgressEvent' from JSON`, ); }