n8n-nodes-binalyze-air
Version:
Binalyze AIR nodes for automating DFIR with n8n workflows
60 lines • 3.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.api = void 0;
const helpers_1 = require("../../utils/helpers");
exports.api = {
async getTasks(context, credentials, organizationIds = '0', options) {
const orgIds = Array.isArray(organizationIds) ? organizationIds.join(',') : organizationIds;
const queryParams = {
'filter[organizationIds]': orgIds
};
if (options === null || options === void 0 ? void 0 : options.pageNumber) {
queryParams.pageNumber = options.pageNumber;
}
if (options === null || options === void 0 ? void 0 : options.pageSize) {
queryParams.pageSize = options.pageSize;
}
if ((options === null || options === void 0 ? void 0 : options.name) || (options === null || options === void 0 ? void 0 : options.searchTerm)) {
queryParams['filter[name]'] = options.name || options.searchTerm || '';
}
if ((options === null || options === void 0 ? void 0 : options.type) && options.type.length > 0) {
queryParams['filter[type]'] = options.type.join(',');
}
else if (options === null || options === void 0 ? void 0 : options.typeFilter) {
queryParams['filter[type]'] = options.typeFilter;
}
if ((options === null || options === void 0 ? void 0 : options.source) && options.source.length > 0) {
queryParams['filter[source]'] = options.source.join(',');
}
if ((options === null || options === void 0 ? void 0 : options.status) && options.status.length > 0) {
queryParams['filter[status]'] = options.status.join(',');
}
else if (options === null || options === void 0 ? void 0 : options.statusFilter) {
queryParams['filter[status]'] = options.statusFilter;
}
if ((options === null || options === void 0 ? void 0 : options.executionType) && options.executionType.length > 0) {
queryParams['filter[executionType]'] = options.executionType.join(',');
}
if (options === null || options === void 0 ? void 0 : options.createdByFilter) {
queryParams['filter[createdBy]'] = options.createdByFilter;
}
if (options === null || options === void 0 ? void 0 : options.scheduledOnly) {
queryParams['filter[isScheduled]'] = 'true';
}
if (options === null || options === void 0 ? void 0 : options.sortBy) {
queryParams.sortBy = options.sortBy;
}
if (options === null || options === void 0 ? void 0 : options.sortType) {
queryParams.sortType = options.sortType;
}
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', '/api/public/tasks', queryParams);
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'fetch tasks');
return response;
},
async getTaskById(context, credentials, id) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', `/api/public/tasks/${id}`);
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `fetch task with ID ${id}`);
return response;
},
};
//# sourceMappingURL=tasks.js.map