UNPKG

n8n-nodes-arubacentral

Version:

n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities

38 lines (37 loc) 1.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDevice = getDevice; const apiRequest_1 = require("../../../../helpers/apiRequest"); const logger_1 = require("../../../../helpers/logger"); const errorHandler_1 = require("../../../../helpers/errorHandler"); const device_types_1 = require("../device.types"); /** * Retrieves firmware details for a specific device * GET /firmware/v1/devices/{serial} * * @param this The n8n execution context * @returns Firmware details for the specified device */ async function getDevice() { try { const serial = this.getNodeParameter('serial', 0); const deviceType = this.getNodeParameter('deviceType', 0); if (!serial) { throw new Error('Device serial number is required'); } // Add device_type as a query parameter const qs = { device_type: deviceType, }; const responseData = await apiRequest_1.apiRequest.call(this, 'GET', `/firmware/v1/devices/${serial}`, {}, // body qs); if (!(0, device_types_1.validateDevice)(responseData)) { throw new Error('Invalid response from API'); } return [{ json: responseData }]; } catch (error) { logger_1.logger.error('firmware:device:getDevice:error', { message: error.message }); return errorHandler_1.handleApiError.call(this, error, 'Failed to retrieve device firmware details'); } }