export type GetApiV1AudioVoicesVoiceIdSampleArgs = {voice_id: string}; export type GetApiV1AudioVoicesVoiceIdSampleOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get voice sample audio * * GET /v1/audio/voices/{voice_id}/sample */ export const getApiV1AudioVoicesVoiceIdSample = async (args: GetApiV1AudioVoicesVoiceIdSampleArgs, options?: GetApiV1AudioVoicesVoiceIdSampleOptions) => { const {baseUrl = "https://api.mistral.ai", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "audio/wav") if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/audio/voices/${encodeURIComponent(String(args.voice_id))}/sample${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 res.blob() };