/* * 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"; import { WebSearchAction, WebSearchAction$inboundSchema, WebSearchAction$Outbound, WebSearchAction$outboundSchema, } from "./websearchaction.js"; /** * Web search call item: A web-search tool-call record containing the executed action and status. */ export type WebSearchToolCallWithId = { type: "web_search_call"; /** * The unique ID of the message. */ id: string; action: WebSearchAction; status: 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 WebSearchToolCallWithId$inboundSchema: z.ZodType< WebSearchToolCallWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("web_search_call"), id: z.string(), action: WebSearchAction$inboundSchema, status: z.string(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "response_id": "responseId", }); }); /** @internal */ export type WebSearchToolCallWithId$Outbound = { type: "web_search_call"; id: string; action: WebSearchAction$Outbound; status: string; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const WebSearchToolCallWithId$outboundSchema: z.ZodType< WebSearchToolCallWithId$Outbound, z.ZodTypeDef, WebSearchToolCallWithId > = z.object({ type: z.literal("web_search_call"), id: z.string(), action: WebSearchAction$outboundSchema, status: z.string(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { responseId: "response_id", }); }); export function webSearchToolCallWithIdToJSON( webSearchToolCallWithId: WebSearchToolCallWithId, ): string { return JSON.stringify( WebSearchToolCallWithId$outboundSchema.parse(webSearchToolCallWithId), ); } export function webSearchToolCallWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebSearchToolCallWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebSearchToolCallWithId' from JSON`, ); }