export type AIModelVersion = 'async_flash_v1.0' | 'async_flash_v1.5' | 'async_pro_v1.0'; export type GetApiVoicesPromptAudioVoiceIdArgs = {voice_id: string, model_version?: AIModelVersion | undefined, 'X-Api-Key'?: string | undefined}; export type GetApiVoicesPromptAudioVoiceIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get Voice Prompt Audio * * GET /voices/prompt-audio/{voice_id} */ export const getApiVoicesPromptAudioVoiceId = async (args: GetApiVoicesPromptAudioVoiceIdArgs, options: GetApiVoicesPromptAudioVoiceIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.model_version != null) query.append("model_version", String(args.model_version)) if (args['X-Api-Key'] != null) headers.set("X-Api-Key", String(args['X-Api-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/voices/prompt-audio/${encodeURIComponent(String(args.voice_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };