export type GetApiV1VideosVideoIdContentArgs = {video_id: string, range?: string | undefined, 'if-range'?: string | undefined}; export type GetApiV1VideosVideoIdContentOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Video content * * GET /v1/videos/{video_id}/content */ export const getApiV1VideosVideoIdContent = async (args: GetApiV1VideosVideoIdContentArgs, options?: GetApiV1VideosVideoIdContentOptions) => { const {baseUrl = "https://api.llmgateway.io", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "video/mp4") if (args.range != null) headers.set("range", String(args.range)) if (args['if-range'] != null) headers.set("if-range", String(args['if-range'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/videos/${encodeURIComponent(String(args.video_id))}/content${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() };