export type EvidenceId = string; export type GetApiV1EvidenceEvidenceIdVideoSegmentArgs = {evidence_id: EvidenceId}; export type GetApiV1EvidenceEvidenceIdVideoSegmentOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream the source segment for local Evidence * * GET /v1/evidence/{evidence_id}/video-segment * * Also accepts auth: apiKeyAuth */ export const getApiV1EvidenceEvidenceIdVideoSegment = async (args: GetApiV1EvidenceEvidenceIdVideoSegmentArgs, options?: GetApiV1EvidenceEvidenceIdVideoSegmentOptions) => { const {baseUrl = "https://api.cerul.ai", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "video/mp4") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/evidence/${encodeURIComponent(String(args.evidence_id))}/video-segment${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() };