export type GetApiInstancesIdMetadataNameArgs = {'If-None-Match'?: string | undefined, id: string, name: string}; export type GetApiInstancesIdMetadataNameOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get metadata * * GET /instances/{id}/metadata/{name} */ export const getApiInstancesIdMetadataName = async (args: GetApiInstancesIdMetadataNameArgs, options?: GetApiInstancesIdMetadataNameOptions) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args['If-None-Match'] != null) headers.set("If-None-Match", String(args['If-None-Match'])) const url = `${baseUrl.replace(/\/+$/, '')}/instances/${encodeURIComponent(String(args.id))}/metadata/${encodeURIComponent(String(args.name))}${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() };