export type UpdateApiToolsLogLevelHttpArgs = {body: BodyInit}; export type UpdateApiToolsLogLevelHttpOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set log level for `http` * * PUT /tools/log-level-http */ export const updateApiToolsLogLevelHttp = async (args: UpdateApiToolsLogLevelHttpArgs, options?: UpdateApiToolsLogLevelHttpOptions) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "text/plain") const url = `${baseUrl.replace(/\/+$/, '')}/tools/log-level-http${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };