export type GetApiV1AssetsAssetIdSegmentsSrtArgs = {'App-ID': string, 'Auth-Token': string, asset_id: string, ids?: string | undefined, query?: string | undefined, transcription_id?: string | undefined, version_id?: string | undefined, segment_type?: string | undefined, segment_color?: string | undefined, status?: string | undefined, words_per_line?: number | undefined}; export type GetApiV1AssetsAssetIdSegmentsSrtOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * List of segments as SRT file * * GET /v1/assets/{asset_id}/segments/srt/ */ export const getApiV1AssetsAssetIdSegmentsSrt = async (args: GetApiV1AssetsAssetIdSegmentsSrtArgs, options: GetApiV1AssetsAssetIdSegmentsSrtOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/srt") if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) if (args.ids != null) query.append("ids", String(args.ids)) if (args.query != null) query.append("query", String(args.query)) if (args.transcription_id != null) query.append("transcription_id", String(args.transcription_id)) if (args.version_id != null) query.append("version_id", String(args.version_id)) if (args.segment_type != null) query.append("segment_type", String(args.segment_type)) if (args.segment_color != null) query.append("segment_color", String(args.segment_color)) if (args.status != null) query.append("status", String(args.status)) if (args.words_per_line != null) query.append("words_per_line", String(args.words_per_line)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/assets/${encodeURIComponent(String(args.asset_id))}/segments/srt/${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.text() };