export type UpdateApiNmOidOidArgs = {levels?: number | undefined, body: BodyInit}; export type UpdateApiNmOidOidOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update the navigation model of a page * * PUT /nm/oid:{oid} */ export const updateApiNmOidOid = async (args: UpdateApiNmOidOidArgs, options: UpdateApiNmOidOidOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/atom+xml") if (args.levels != null) query.append("levels", String(args.levels)) const url = `${baseUrl.replace(/\/+$/, '')}/nm/oid:${encodeURIComponent(String(args.oid))}${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 };