export type Channel = {enable?: (boolean | null) | undefined, freq?: number | undefined, radio?: number | undefined, if?: number | undefined, bandwidth?: number | undefined, spread_factor?: number | undefined}; export type RouterConfig = {NetID?: (Array | null) | undefined, JoinEui?: (Array> | null) | undefined, region?: (string | null) | undefined, hwspec?: (string | null) | undefined, freq_range?: (Array | null) | undefined, DRs?: (Array> | null) | undefined, sx1301_conf?: (Array<{[key: string]: Channel}> | null) | undefined, nocca?: boolean | undefined, nodc?: boolean | undefined, nodwell?: boolean | undefined}; export type ConcentratorDto = {deviceId: string, deviceName: string, loraRegion: string, deviceType?: (string | null) | undefined, clientThumbprint?: (string | null) | undefined, isConnected?: boolean | undefined, isEnabled?: boolean | undefined, alreadyLoggedInOnce?: boolean | undefined, routerConfig?: RouterConfig | undefined}; export type UpdateApiApiLorawanConcentratorsArgs = {body: ConcentratorDto}; export type UpdateApiApiLorawanConcentratorsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Updates the device. * * PUT /api/lorawan/concentrators */ export const updateApiApiLorawanConcentrators = async (args: UpdateApiApiLorawanConcentratorsArgs, options: UpdateApiApiLorawanConcentratorsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/lorawan/concentrators${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 };