export type GetApiV1CallsIdVoicemailDropAudioArgs = {id: string, format?: ('mp3' | 'wav') | undefined}; export type GetApiV1CallsIdVoicemailDropAudioOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream the audio of the dropped voicemail clip for a call * * GET /v1/calls/{id}/voicemail-drop/audio */ export const getApiV1CallsIdVoicemailDropAudio = async (args: GetApiV1CallsIdVoicemailDropAudioArgs, options?: GetApiV1CallsIdVoicemailDropAudioOptions) => { 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.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))}/voicemail-drop/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() };