export type GetApiDiV1ExperimentRunIdLogArgs = {id: number, from_line?: number | undefined, size?: number | undefined}; export type GetApiDiV1ExperimentRunIdLogOptions = {baseUrl?: string | undefined, basicAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Experiment Exec Log By Exec Id. * * GET /di/v1/experimentRun/{id}/log * * Also accepts auth: watsonAuthToken, watsonAuthTokenQuery */ export const getApiDiV1ExperimentRunIdLog = async (args: GetApiDiV1ExperimentRunIdLogArgs, options?: GetApiDiV1ExperimentRunIdLogOptions) => { const {baseUrl = "https://di.prophecis.com", fetch: fetchFn = fetch, basicAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.from_line != null) query.append("from_line", String(args.from_line)) if (args.size != null) query.append("size", String(args.size)) if (basicAuthToken !== undefined) headers.set("Authorization", basicAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/di/v1/experimentRun/${encodeURIComponent(String(args.id))}/log${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 };