UNPKG

@daedalus/wso2

Version:

This is a set of tools to help connect and manage interactions with various WSO2 products. Please see README.MD for more details.

72 lines (65 loc) 1.64 kB
const https = require("https"); const axios = require("axios").create({ httpsAgent: new https.Agent({ rejectUnauthorized: false }), proxy: false }); const serviceResource = "bpmn/identity/groups/"; /* data = { server: { url: "" }, auth: { username: "", password: "" } } */ //GET //https://<Host Name>:<Port>/bpmn/runtime/executions const getAll = (data, callback) => { let url = data.server.url + serviceResource; let options = { auth: data.auth }; axios .get(url, options) .then(response => { callback(null, response.data); }) .catch(error => { if (error.response && error.response.data) { callback(null, { success: false, msg: error.response.data}); } else { callback(null, { success: false, msg: 'Uknown Error from Axios'}); } }); }; //GET //https://<Host Name>:<Port>/bpmn/runtime/executions/{executionId} //This request retrieves a specific process definition based on the specified process //definition Id. const get = (id, data, callback) => { let url = data.server.url + serviceResource + id; let options = { auth: data.auth }; axios .get(url, options) .then(response => { callback(null, response.data); }) .catch(error => { if (error.response && error.response.data) { callback(null, { success: false, msg: error.response.data}); } else { callback(null, { success: false, msg: 'Uknown Error from Axios'}); } }); }; module.exports = { getAll, get };