n8n-nodes-binalyze-air
Version:
Binalyze AIR nodes for automating DFIR with n8n workflows
68 lines • 4.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.api = void 0;
const helpers_1 = require("../../utils/helpers");
exports.api = {
async getTriageRules(context, credentials, organizationIds = '0', queryParams) {
const orgIds = Array.isArray(organizationIds) ? organizationIds.join(',') : organizationIds;
const qs = {
'filter[organizationIds]': orgIds
};
if (queryParams) {
Object.assign(qs, queryParams);
}
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', '/api/public/triages/rules', qs);
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'fetch triage rules');
},
async createTriageRule(context, credentials, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/triages/rules');
requestOptions.body = data;
requestOptions.ignoreHttpStatusErrors = true;
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'create triage rule');
},
async updateTriageRule(context, credentials, id, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'PUT', `/api/public/triages/rules/${id}`);
requestOptions.body = data;
requestOptions.ignoreHttpStatusErrors = true;
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `update triage rule with ID ${id}`);
},
async deleteTriageRule(context, credentials, id) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'DELETE', `/api/public/triages/rules/${id}`);
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `delete triage rule with ID ${id}`);
},
async getTriageRuleById(context, credentials, id) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', `/api/public/triages/rules/${id}`);
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `fetch triage rule with ID ${id}`);
},
async validateTriageRule(context, credentials, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/triages/rules/validate');
requestOptions.body = data;
requestOptions.ignoreHttpStatusErrors = true;
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'validate triage rule');
},
async assignTriageTask(context, credentials, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/triages/triage');
requestOptions.body = data;
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'assign triage task');
},
async createTriageTag(context, credentials, name, organizationId = 0) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/triages/tags');
requestOptions.body = {
name,
organizationId
};
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'create triage tag');
},
async getTriageTags(context, credentials, organizationId = '0', searchTerm) {
let queryParams = {
'filter[organizationId]': organizationId,
'filter[withCount]': true
};
if (searchTerm) {
queryParams['filter[searchTerm]'] = searchTerm;
}
let requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', '/api/public/triages/tags', queryParams);
return await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'fetch triage tags');
}
};
//# sourceMappingURL=triagerules.js.map