/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; /** * Language code: 'auto' for automatic detection, or ISO 639-1 language codes */ export const Language = { Auto: "auto", En: "en", Zh: "zh", Hi: "hi", Es: "es", Ar: "ar", Bn: "bn", Pt: "pt", Ru: "ru", Ja: "ja", Pa: "pa", De: "de", Ko: "ko", Fr: "fr", Tr: "tr", It: "it", Th: "th", Pl: "pl", Nl: "nl", Id: "id", Vi: "vi", Ur: "ur", } as const; /** * Language code: 'auto' for automatic detection, or ISO 639-1 language codes */ export type Language = ClosedEnum; /** * Request parameters for text-to-speech conversion with language selection. */ export type TextToSpeechRequest = { /** * Input text to convert to speech */ text: string; /** * Language code: 'auto' for automatic detection, or ISO 639-1 language codes */ language?: Language | undefined; /** * TTS model identifier. Defaults to 'auto', which selects the default provider. Registry-resolvable ids dispatch to the matching provider. */ model?: string | undefined; /** * When true, persist this generation (input text, parameters, and the generated audio) to text-to-speech history. Defaults to false. */ store?: boolean | undefined; }; /** @internal */ export const Language$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Language); /** @internal */ export const Language$outboundSchema: z.ZodNativeEnum = Language$inboundSchema; /** @internal */ export const TextToSpeechRequest$inboundSchema: z.ZodType< TextToSpeechRequest, z.ZodTypeDef, unknown > = z.object({ text: z.string(), language: Language$inboundSchema.default("auto"), model: z.string().default("auto"), store: z.boolean().default(false), }); /** @internal */ export type TextToSpeechRequest$Outbound = { text: string; language: string; model: string; store: boolean; }; /** @internal */ export const TextToSpeechRequest$outboundSchema: z.ZodType< TextToSpeechRequest$Outbound, z.ZodTypeDef, TextToSpeechRequest > = z.object({ text: z.string(), language: Language$outboundSchema.default("auto"), model: z.string().default("auto"), store: z.boolean().default(false), }); export function textToSpeechRequestToJSON( textToSpeechRequest: TextToSpeechRequest, ): string { return JSON.stringify( TextToSpeechRequest$outboundSchema.parse(textToSpeechRequest), ); } export function textToSpeechRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TextToSpeechRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TextToSpeechRequest' from JSON`, ); }