export type GetApiV1CallsIdRecordingAudioArgs = {id: string, download?: ('true' | 'false') | undefined, format?: ('mp3' | 'wav') | undefined}; export type GetApiV1CallsIdRecordingAudioOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream the audio of a call recording * * GET /v1/calls/{id}/recording/audio */ export const getApiV1CallsIdRecordingAudio = async (args: GetApiV1CallsIdRecordingAudioArgs, options?: GetApiV1CallsIdRecordingAudioOptions) => { const {baseUrl = "https://api-public.skipcall.app", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "audio/mpeg") if (args.download != null) query.append("download", String(args.download)) if (args.format != null) query.append("format", String(args.format)) if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/calls/${encodeURIComponent(String(args.id))}/recording/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() };