UNPKG

n8n-nodes-arubacentral

Version:

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

46 lines (45 loc) 2.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getClientMatchSteerHistory = getClientMatchSteerHistory; const apiRequest_1 = require("../../../../helpers/apiRequest"); const logger_1 = require("../../../../helpers/logger"); const errorHandler_1 = require("../../../../helpers/errorHandler"); /** * Get Client Match Steering History * GET /cm-api/ap/{serial}/client-match/steer-history * * @param this The n8n execution context * @returns Formatted API response */ async function getClientMatchSteerHistory() { var _a; try { // Get parameters const serial = this.getNodeParameter('serial', 0); const fromTimestamp = this.getNodeParameter('from_timestamp', 0); const toTimestamp = this.getNodeParameter('to_timestamp', 0); // Construct query parameters const queryParams = {}; if (fromTimestamp) { queryParams.from_timestamp = fromTimestamp; } if (toTimestamp) { queryParams.to_timestamp = toTimestamp; } // Construct API endpoint const endpoint = '/cm-api/ap/' + encodeURIComponent(serial) + '/client-match/steer-history'; logger_1.logger.debug('monitoring:ap:getClientMatchSteerHistory', `Requesting: ${endpoint}`); // Make API request const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, {}, queryParams); // Format and return response return [{ json: responseData }]; } catch (error) { logger_1.logger.error('monitoring:ap:getClientMatchSteerHistory:error', { message: error.message }); // Handle 404 specifically for ClientMatch APIs which may not be available on all clusters if (error.httpCode === 404 || ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('404'))) { return errorHandler_1.handleApiError.call(this, error, 'ClientMatch API not available on this cluster or AP does not support ClientMatch. This is an undocumented API that may not be enabled for all devices.'); } return errorHandler_1.handleApiError.call(this, error, 'Failed to get client match steering history'); } }