export type GetApiV1VideosVideoIdContentArgs = {videoId: string, variant?: ('video' | 'thumbnail' | 'spritesheet') | undefined}; export type GetApiV1VideosVideoIdContentOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Video content * * GET /v1/videos/{videoId}/content * * Also accepts auth: apiKey */ export const getApiV1VideosVideoIdContent = async (args: GetApiV1VideosVideoIdContentArgs, options?: GetApiV1VideosVideoIdContentOptions) => { const {baseUrl = "https://api.agentlab.cresclab.com", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "video/mp4") if (args.variant != null) query.append("variant", String(args.variant)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/videos/${encodeURIComponent(String(args.videoId))}/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() };