export type GetApiV1AgentsAgentIdAudioCacheEntryIdFileOptions = {baseUrl?: string | undefined, polyApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download cached audio file * * GET /v1/agents/{agentId}/audio-cache/{entryId}/file */ export const getApiV1AgentsAgentIdAudioCacheEntryIdFile = async (options?: GetApiV1AgentsAgentIdAudioCacheEntryIdFileOptions) => { const {baseUrl = "https://api.us.poly.ai", fetch: fetchFn = fetch, polyApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "audio/wav") if (polyApiKey !== undefined) headers.set("X-API-KEY", polyApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/agents/${encodeURIComponent(String(args.agentId))}/audio-cache/${encodeURIComponent(String(args.entryId))}/file${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() };