export type GetApiV1AgentsAgentIdConversationsConversationIdAudioArgs = {agentId: string, conversationId: string, direction?: ('combined' | 'user' | 'agent') | undefined, redacted?: boolean | undefined}; export type GetApiV1AgentsAgentIdConversationsConversationIdAudioOptions = {baseUrl?: string | undefined, polyApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get audio recording for a conversation * * GET /v1/agents/{agentId}/conversations/{conversationId}/audio */ export const getApiV1AgentsAgentIdConversationsConversationIdAudio = async (args: GetApiV1AgentsAgentIdConversationsConversationIdAudioArgs, options?: GetApiV1AgentsAgentIdConversationsConversationIdAudioOptions) => { 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 (args.direction != null) query.append("direction", String(args.direction)) if (args.redacted != null) query.append("redacted", String(args.redacted)) if (polyApiKey !== undefined) headers.set("X-API-KEY", polyApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/agents/${encodeURIComponent(String(args.agentId))}/conversations/${encodeURIComponent(String(args.conversationId))}/audio${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() };