/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The processing status of this audio item. */ export const OutputAudioItemWithIdStatus = { InProgress: "in_progress", Completed: "completed", Incomplete: "incomplete", } as const; /** * The processing status of this audio item. */ export type OutputAudioItemWithIdStatus = ClosedEnum< typeof OutputAudioItemWithIdStatus >; /** * Output audio item: Audio content synthesized from the model's text response via TTS. */ export type OutputAudioItemWithId = { /** * The content type identifier for audio output. */ type: "output_audio"; /** * Base64-encoded audio data. */ data: string; /** * The text transcript that was synthesized into audio. */ transcript: string; /** * The unique ID of the message. */ id: string; /** * The processing status of this audio item. */ status: OutputAudioItemWithIdStatus; /** * 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 OutputAudioItemWithIdStatus$inboundSchema: z.ZodNativeEnum< typeof OutputAudioItemWithIdStatus > = z.nativeEnum(OutputAudioItemWithIdStatus); /** @internal */ export const OutputAudioItemWithIdStatus$outboundSchema: z.ZodNativeEnum< typeof OutputAudioItemWithIdStatus > = OutputAudioItemWithIdStatus$inboundSchema; /** @internal */ export const OutputAudioItemWithId$inboundSchema: z.ZodType< OutputAudioItemWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("output_audio"), data: z.string(), transcript: z.string(), id: z.string(), status: OutputAudioItemWithIdStatus$inboundSchema, 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 OutputAudioItemWithId$Outbound = { type: "output_audio"; data: string; transcript: string; id: string; status: string; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const OutputAudioItemWithId$outboundSchema: z.ZodType< OutputAudioItemWithId$Outbound, z.ZodTypeDef, OutputAudioItemWithId > = z.object({ type: z.literal("output_audio"), data: z.string(), transcript: z.string(), id: z.string(), status: OutputAudioItemWithIdStatus$outboundSchema, responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { responseId: "response_id", }); }); export function outputAudioItemWithIdToJSON( outputAudioItemWithId: OutputAudioItemWithId, ): string { return JSON.stringify( OutputAudioItemWithId$outboundSchema.parse(outputAudioItemWithId), ); } export function outputAudioItemWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputAudioItemWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputAudioItemWithId' from JSON`, ); }