/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 "./sdkvalidationerror.js"; export type ImageUrl = { /** * The URL of the image. */ url?: string | undefined; /** * Additional details about the image. */ detail?: string | null | undefined; }; export type ChatMessageResponseContent = { /** * The type of content (e.g., "text", "image"). */ type?: string | undefined; /** * The text content of the message. */ text?: string | null | undefined; imageUrl?: ImageUrl | null | undefined; }; /** @internal */ export const ImageUrl$inboundSchema: z.ZodType< ImageUrl, z.ZodTypeDef, unknown > = z.object({ url: z.string().optional(), detail: z.nullable(z.string()).optional(), }); /** @internal */ export type ImageUrl$Outbound = { url?: string | undefined; detail?: string | null | undefined; }; /** @internal */ export const ImageUrl$outboundSchema: z.ZodType< ImageUrl$Outbound, z.ZodTypeDef, ImageUrl > = z.object({ url: z.string().optional(), detail: z.nullable(z.string()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ImageUrl$ { /** @deprecated use `ImageUrl$inboundSchema` instead. */ export const inboundSchema = ImageUrl$inboundSchema; /** @deprecated use `ImageUrl$outboundSchema` instead. */ export const outboundSchema = ImageUrl$outboundSchema; /** @deprecated use `ImageUrl$Outbound` instead. */ export type Outbound = ImageUrl$Outbound; } export function imageUrlToJSON(imageUrl: ImageUrl): string { return JSON.stringify(ImageUrl$outboundSchema.parse(imageUrl)); } export function imageUrlFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ImageUrl' from JSON`, ); } /** @internal */ export const ChatMessageResponseContent$inboundSchema: z.ZodType< ChatMessageResponseContent, z.ZodTypeDef, unknown > = z.object({ type: z.string().optional(), text: z.nullable(z.string()).optional(), image_url: z.nullable(z.lazy(() => ImageUrl$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "image_url": "imageUrl", }); }); /** @internal */ export type ChatMessageResponseContent$Outbound = { type?: string | undefined; text?: string | null | undefined; image_url?: ImageUrl$Outbound | null | undefined; }; /** @internal */ export const ChatMessageResponseContent$outboundSchema: z.ZodType< ChatMessageResponseContent$Outbound, z.ZodTypeDef, ChatMessageResponseContent > = z.object({ type: z.string().optional(), text: z.nullable(z.string()).optional(), imageUrl: z.nullable(z.lazy(() => ImageUrl$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { imageUrl: "image_url", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ChatMessageResponseContent$ { /** @deprecated use `ChatMessageResponseContent$inboundSchema` instead. */ export const inboundSchema = ChatMessageResponseContent$inboundSchema; /** @deprecated use `ChatMessageResponseContent$outboundSchema` instead. */ export const outboundSchema = ChatMessageResponseContent$outboundSchema; /** @deprecated use `ChatMessageResponseContent$Outbound` instead. */ export type Outbound = ChatMessageResponseContent$Outbound; } export function chatMessageResponseContentToJSON( chatMessageResponseContent: ChatMessageResponseContent, ): string { return JSON.stringify( ChatMessageResponseContent$outboundSchema.parse(chatMessageResponseContent), ); } export function chatMessageResponseContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChatMessageResponseContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageResponseContent' from JSON`, ); }