export type GetApiSystemEnvOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * The system environment as PREMIS ontology * * GET /systemEnv */ export const getApiSystemEnv = async (options: GetApiSystemEnvOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/systemEnv${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.blob() };