export type UpdateApiStudiesIdMetadataNameArgs = {'If-Match'?: string | undefined, id: string, name: string, body: BodyInit}; export type UpdateApiStudiesIdMetadataNameOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set metadata * * PUT /studies/{id}/metadata/{name} */ export const updateApiStudiesIdMetadataName = async (args: UpdateApiStudiesIdMetadataNameArgs, options?: UpdateApiStudiesIdMetadataNameOptions) => { 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") if (args['If-Match'] != null) headers.set("If-Match", String(args['If-Match'])) const url = `${baseUrl.replace(/\/+$/, '')}/studies/${encodeURIComponent(String(args.id))}/metadata/${encodeURIComponent(String(args.name))}${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 };