n8n-nodes-base
Version:
Base nodes of n8n
29 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.uptimeRobotApiRequest = uptimeRobotApiRequest;
const n8n_workflow_1 = require("n8n-workflow");
async function uptimeRobotApiRequest(method, resource, body = {}, qs = {}, uri, option = {}) {
const credentials = await this.getCredentials('uptimeRobotApi');
let options = {
method,
qs,
form: {
api_key: credentials.apiKey,
...body,
},
uri: uri || `https://api.uptimerobot.com/v2${resource}`,
json: true,
};
options = Object.assign({}, options, option);
try {
const responseData = await this.helpers.request(options);
if (responseData.stat !== 'ok') {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), responseData);
}
return responseData;
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=GenericFunctions.js.map