export type GetApiAudioItemIdHlsSegmentIdStreamAacArgs = {itemId: string, segmentId: string}; export type GetApiAudioItemIdHlsSegmentIdStreamAacOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the specified audio segment for an audio item. * * GET /Audio/{itemId}/hls/{segmentId}/stream.aac */ export const getApiAudioItemIdHlsSegmentIdStreamAac = async (args: GetApiAudioItemIdHlsSegmentIdStreamAacArgs, options?: GetApiAudioItemIdHlsSegmentIdStreamAacOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "audio/*") const url = `${baseUrl.replace(/\/+$/, '')}/Audio/${encodeURIComponent(String(args.itemId))}/hls/${encodeURIComponent(String(args.segmentId))}/stream.aac${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() };