export type GetApiApiV1IndexRunLogsArgs = {runId: string, take?: number | undefined, skip?: number | undefined, order?: ('ASC' | 'DESC') | undefined}; export type GetApiApiV1IndexRunLogsOptions = {baseUrl: string, LocalUserJWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * 🛡️ Get logs for an indexing run. * * GET /api/v1/index/run/logs */ export const getApiApiV1IndexRunLogs = async (args: GetApiApiV1IndexRunLogsArgs, options: GetApiApiV1IndexRunLogsOptions) => { const {baseUrl, fetch: fetchFn = fetch, LocalUserJWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.runId != null) query.append("runId", String(args.runId)) if (args.take != null) query.append("take", String(args.take)) if (args.skip != null) query.append("skip", String(args.skip)) if (args.order != null) query.append("order", String(args.order)) if (LocalUserJWT !== undefined) headers.set('authorization', `Bearer ${LocalUserJWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/index/run/logs${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 };