export type GetApiVideosVideoIdMediaSourceIdAttachmentsIndexArgs = {videoId: string, mediaSourceId: string, index: number}; export type GetApiVideosVideoIdMediaSourceIdAttachmentsIndexOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get video attachment. * * GET /Videos/{videoId}/{mediaSourceId}/Attachments/{index} */ export const getApiVideosVideoIdMediaSourceIdAttachmentsIndex = async (args: GetApiVideosVideoIdMediaSourceIdAttachmentsIndexArgs, options?: GetApiVideosVideoIdMediaSourceIdAttachmentsIndexOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/Videos/${encodeURIComponent(String(args.videoId))}/${encodeURIComponent(String(args.mediaSourceId))}/Attachments/${encodeURIComponent(String(args.index))}${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() };