@solinker/nodes-ikuai
Version:
爱快(iKuai)是一家商业场景网络解决方案提供商,主要从事企业路由器推荐,企业路由器价格、企业级路由器、企业路由器、商用路由器、商用路由器推荐、商用无线路由器的研发、生产与销售;具备X86架构大场景方案,也有ARM架构小场景WiFi方案,拥有DPI七层流控、AP主动探测技术。
109 lines • 4.25 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IkuaiV1 = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const getDevList_1 = __importDefault(require("./getDevList"));
const getAccountList_1 = __importDefault(require("./getAccountList"));
const userOffLine_1 = __importDefault(require("./userOffLine"));
const userDisable_1 = __importDefault(require("./userDisable"));
const descriptionV1 = {
defaults: {
name: '爱快',
},
displayName: '爱快',
description: '爱快(iKuai)是一家商业场景网络解决方案提供商,主要从事企业路由器推荐,企业路由器价格、企业级路由器、企业路由器、商用路由器、商用路由器推荐、商用无线路由器的研发、生产与销售;具备X86架构大场景方案,也有ARM架构小场景WiFi方案,拥有DPI七层流控、AP主动探测技术。',
name: 'ikuai',
inputs: ["main"],
outputs: ['main'],
group: ['group'],
version: 1,
credentials: [{ name: 'ikuaiApi', required: true }],
properties: [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
options: [
{
displayName: '查询授权设备',
name: '查询授权设备',
value: 'getDevList',
action: '查询授权设备 ',
},
{
displayName: '获取账号列表',
name: '获取账号列表',
value: 'getAccountList',
action: '获取账号列表 ',
},
{
displayName: '踢用户下线',
name: '踢用户下线',
value: 'userOffLine',
action: '踢用户下线',
},
{
displayName: '启用/停用账号',
name: '启用/停用账号',
value: 'userDisable',
action: '启用/停用账号',
},
],
default: 'getDevList',
noDataExpression: true,
},
...getDevList_1.default,
...getAccountList_1.default,
...userOffLine_1.default,
...userDisable_1.default,
],
};
class IkuaiV1 {
constructor(baseDescription) {
this.description = {
...baseDescription,
...descriptionV1,
};
}
async execute() {
var _a;
const returnData = [];
const credentials = await this.getCredentials('ikuaiApi');
const items = this.getInputData();
for (let index = 0; index < items.length; index++) {
try {
const parameters = {};
Object.keys(this.getNode().parameters).forEach((key) => {
parameters[key] = this.getNodeParameter(key, index);
});
returnData.push({
json: await this.helpers.httpRequest({
baseURL: `${(_a = process.env.N8N_STORE_API_URL) !== null && _a !== void 0 ? _a : 'https://api.n8n.store'}/api/ikuai`,
url: '/operation',
method: 'POST',
body: {
...parameters,
credentials,
},
headers: {
'X-Instance-Id': this.getInstanceId(),
},
}),
});
}
catch (error) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error.message, { itemIndex: index });
}
}
return this.prepareOutputData(returnData);
}
}
exports.IkuaiV1 = IkuaiV1;
//# sourceMappingURL=IkuaiV1.js.map