export type GetApiVoiceVoicemailRecordRecordingIdArgs = {recordingId: string}; export type GetApiVoiceVoicemailRecordRecordingIdOptions = {baseUrl?: string | undefined, apiAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Listen to the voicemail record * * GET /voice/voicemail-record/{recordingId} */ export const getApiVoiceVoicemailRecordRecordingId = async (args: GetApiVoiceVoicemailRecordRecordingIdArgs, options?: GetApiVoiceVoicemailRecordRecordingIdOptions) => { const {baseUrl = "https://api.salesmessage.com/pub/v2.3", fetch: fetchFn = fetch, apiAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "audio/wav") if (apiAuth !== undefined) headers.set('authorization', `Bearer ${apiAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/voice/voicemail-record/${encodeURIComponent(String(args.recordingId))}${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() };