export type XiqDeviceClientMonitor = {client_monitor_profile_id?: number | undefined, enable?: boolean | undefined}; export type UpdateApiDevicesIdClientMonitorArgs = {id: number, body: XiqDeviceClientMonitor}; export type UpdateApiDevicesIdClientMonitorOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign client monitor setting to a device * * PUT /devices/{id}/client-monitor */ export const updateApiDevicesIdClientMonitor = async (args: UpdateApiDevicesIdClientMonitorArgs, options?: UpdateApiDevicesIdClientMonitorOptions) => { const {baseUrl = "https://api.extremecloudiq.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/devices/${encodeURIComponent(String(args.id))}/client-monitor${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };