export type GetApiStatusLogsArgs = {mode?: string | undefined}; export type GetApiStatusLogsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get log information from the server * * GET /status/logs */ export const getApiStatusLogs = async (args: GetApiStatusLogsArgs, options?: GetApiStatusLogsOptions) => { const {baseUrl = "https://kg2cploverdb.transltr.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.mode != null) query.append("mode", String(args.mode)) const url = `${baseUrl.replace(/\/+$/, '')}/status/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 res.text() };