export type GetApiMovieboxCaptionsArgs = {subjectId: string, streamId: string}; export type GetApiMovieboxCaptionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * MovieBox Stream Captions * * GET /moviebox/captions */ export const getApiMovieboxCaptions = async (args: GetApiMovieboxCaptionsArgs, options?: GetApiMovieboxCaptionsOptions) => { const {baseUrl = "https://api.paxsenix.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.subjectId != null) query.append("subjectId", String(args.subjectId)) if (args.streamId != null) query.append("streamId", String(args.streamId)) const url = `${baseUrl.replace(/\/+$/, '')}/moviebox/captions${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 undefined };