/* * 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"; /** * Image generation call item: A tool-call record for image generation, including status and result URL. */ export type ImageGenerationCallWithId = { type: "image_generation_call"; /** * The unique ID of the message. */ id: string; status: string; result: string; background?: string | undefined; outputFormat?: string | undefined; quality?: string | undefined; size?: string | undefined; revisedPrompt?: string | undefined; /** * 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 ImageGenerationCallWithId$inboundSchema: z.ZodType< ImageGenerationCallWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("image_generation_call"), id: z.string(), status: z.string(), result: z.string(), background: z.string().optional(), output_format: z.string().optional(), quality: z.string().optional(), size: z.string().optional(), revised_prompt: z.string().optional(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "output_format": "outputFormat", "revised_prompt": "revisedPrompt", "response_id": "responseId", }); }); /** @internal */ export type ImageGenerationCallWithId$Outbound = { type: "image_generation_call"; id: string; status: string; result: string; background?: string | undefined; output_format?: string | undefined; quality?: string | undefined; size?: string | undefined; revised_prompt?: string | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ImageGenerationCallWithId$outboundSchema: z.ZodType< ImageGenerationCallWithId$Outbound, z.ZodTypeDef, ImageGenerationCallWithId > = z.object({ type: z.literal("image_generation_call"), id: z.string(), status: z.string(), result: z.string(), background: z.string().optional(), outputFormat: z.string().optional(), quality: z.string().optional(), size: z.string().optional(), revisedPrompt: z.string().optional(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { outputFormat: "output_format", revisedPrompt: "revised_prompt", responseId: "response_id", }); }); export function imageGenerationCallWithIdToJSON( imageGenerationCallWithId: ImageGenerationCallWithId, ): string { return JSON.stringify( ImageGenerationCallWithId$outboundSchema.parse(imageGenerationCallWithId), ); } export function imageGenerationCallWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ImageGenerationCallWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ImageGenerationCallWithId' from JSON`, ); }