export type GetApiVideosItemIdHlsPlaylistIdSegmentIdSegmentContainerArgs = {itemId: string, playlistId: string, segmentId: string, segmentContainer: string}; export type GetApiVideosItemIdHlsPlaylistIdSegmentIdSegmentContainerOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets a hls video segment. * * GET /Videos/{itemId}/hls/{playlistId}/{segmentId}.{segmentContainer} */ export const getApiVideosItemIdHlsPlaylistIdSegmentIdSegmentContainer = async (args: GetApiVideosItemIdHlsPlaylistIdSegmentIdSegmentContainerArgs, options?: GetApiVideosItemIdHlsPlaylistIdSegmentIdSegmentContainerOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "video/*") const url = `${baseUrl.replace(/\/+$/, '')}/Videos/${encodeURIComponent(String(args.itemId))}/hls/${encodeURIComponent(String(args.playlistId))}/${encodeURIComponent(String(args.segmentId))}.${encodeURIComponent(String(args.segmentContainer))}${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() };