Skip to content

Instantly share code, notes, and snippets.

@65Mustang289
Created July 29, 2021 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 65Mustang289/4d422b27eaa866558f74e7f4a8ec26ee to your computer and use it in GitHub Desktop.
Save 65Mustang289/4d422b27eaa866558f74e7f4a8ec26ee to your computer and use it in GitHub Desktop.
Add the following in scripts/sampleFunctions.js
// Description:
// Sample Functions
//
// Author:
// tad.hadtrath@optum.com
module.exports = function(robot) {
module.exports = {
searchApi: async function(search){
var url = "http://localhost:8080/demo/api?search=" + search;
return new Promise((resolve, reject) =>
robot.http(url)
.headers({'Accept': 'application/json'})
.get()((err, res, body) => {
if (err != null) {
reject(err);
return;
}
switch (res.statusCode) {
case 200:
resolve(JSON.parse(body));
break;
default:
reject(res.statusCode + " status code returned");
}
})
);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment