n8n-nodes-quepasa
Version:
This is an n8n community node. It lets you use Quepasa in your n8n workflows. (use with Quepasa >= v4)
39 lines • 1.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.resourceWebhook = void 0;
const GenericFunctions_1 = require("../GenericFunctions");
async function resourceWebhook(operation, items, i) {
let fullResponse;
if (operation === 'find') {
fullResponse = await GenericFunctions_1.apiRequest.call(this, 'GET', '/webhook');
}
else if (operation === 'setup') {
const reqBody = {
url: this.getNodeParameter('url', i),
forwardinternal: this.getNodeParameter('forwardInternal', i),
trackid: this.getNodeParameter('trackid', i),
};
const parExtraAttributes = this.getNodeParameter('extraAttributes', i, {});
if (parExtraAttributes && parExtraAttributes.attribute) {
const data = {};
const atts = parExtraAttributes.attribute;
atts.map(property => {
data[property.key] = property.value;
});
reqBody.extra = data;
}
fullResponse = await GenericFunctions_1.apiRequest.call(this, 'POST', '/webhook', reqBody);
}
else if (operation === 'remove') {
const body = {
url: this.getNodeParameter('url', i),
};
fullResponse = await GenericFunctions_1.apiRequest.call(this, 'DELETE', '/webhook', body);
}
else if (operation === 'clear') {
fullResponse = await GenericFunctions_1.apiRequest.call(this, 'DELETE', '/webhook');
}
return fullResponse === null || fullResponse === void 0 ? void 0 : fullResponse.body;
}
exports.resourceWebhook = resourceWebhook;
//# sourceMappingURL=WebhookMethods.js.map