n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
48 lines (40 loc) • 1.3 kB
text/typescript
// getSyncedApList.methods.ts
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { ISyncedApList } from '../keymanagement.types';
import {
KEYMANAGEMENT_BASE_PATH,
KEYMANAGEMENT_ENDPOINTS,
validateClientMac,
} from '../keymanagement.common';
import { apiRequest } from '../../../helpers/apiRequest';
import { logger } from '../../../helpers/logger';
export async function getSyncedApList(this: IExecuteFunctions): Promise<INodeExecutionData[]> {
const clientMac = this.getNodeParameter('client_mac', 0) as string;
logger.info(
'keymanagement:getSyncedApList',
`Retrieving synced AP list for client: ${clientMac}`,
);
validateClientMac(clientMac);
const endpoint = `${KEYMANAGEMENT_BASE_PATH}${KEYMANAGEMENT_ENDPOINTS.SYNCED_AP_LIST}/${clientMac}`;
try {
const response = await apiRequest.call(this, 'GET', endpoint, {}, {});
logger.debug(
'keymanagement:getSyncedApList',
`Retrieved synced AP list for ${clientMac} - AP count: ${Object.keys(response || {}).length}`,
);
return [
{
json: {
client_mac: clientMac,
...response,
},
},
];
} catch (error) {
logger.error(
'keymanagement:getSyncedApList:error',
`Failed to retrieve synced AP list for ${clientMac}: ${error.message}`,
);
throw error;
}
}