export type UpdateApiAvxSensorlabsV8IdProtectArgs = {id: string, body: BodyInit}; export type UpdateApiAvxSensorlabsV8IdProtectOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Protect a section of a sensor with a password. * * PUT /avx-sensorlabs/v8/{id}/protect */ export const updateApiAvxSensorlabsV8IdProtect = async (args: UpdateApiAvxSensorlabsV8IdProtectArgs, options: UpdateApiAvxSensorlabsV8IdProtectOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/avx-sensorlabs/v8/${encodeURIComponent(String(args.id))}/protect${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 };