export type UpdateApiV2ItamUnmanagedDeviceNodeIdArgs = {nodeId: number, body: {name: string, orgId: number, locationId: number, assignedUserUid?: string | undefined, warrantyStartDate?: number | undefined, warrantyEndDate?: number | undefined, assetFields?: ({serialNumber?: string | undefined, assetId?: string | undefined, assetStatus?: string | undefined, assetPurchaseDate?: number | undefined, assetPurchaseAmount?: number | undefined, assetExpectedLifetime?: string | undefined}) | undefined}}; export type UpdateApiV2ItamUnmanagedDeviceNodeIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an Unmanaged Device * * PUT /v2/itam/unmanaged-device/{nodeId} * * Also accepts auth: sessionKey */ export const updateApiV2ItamUnmanagedDeviceNodeId = async (args: UpdateApiV2ItamUnmanagedDeviceNodeIdArgs, options: UpdateApiV2ItamUnmanagedDeviceNodeIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/itam/unmanaged-device/${encodeURIComponent(String(args.nodeId))}${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 };