@growsalesai/n8n-nodes-datacrazy 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/DatacrazyApi.credentials.js +2 -2
- package/dist/credentials/DatacrazyApi.credentials.js.map +1 -1
- package/dist/nodes/Datacrazy/Datacrazy.node.d.ts +4 -1
- package/dist/nodes/Datacrazy/Datacrazy.node.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/Datacrazy.node.js +99 -426
- package/dist/nodes/Datacrazy/Datacrazy.node.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/BusinessActionDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/BusinessActionDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/BusinessActionDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/BusinessDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/BusinessDescription.js +18 -4
- package/dist/nodes/Datacrazy/descriptions/BusinessDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/BusinessLossReasonDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/BusinessLossReasonDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/BusinessLossReasonDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/ConversationDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/ConversationDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/ConversationDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/InstanceDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/InstanceDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/InstanceDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/LeadDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/LeadDescription.js +17 -8
- package/dist/nodes/Datacrazy/descriptions/LeadDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/LeadMoverDescription.d.ts +4 -0
- package/dist/nodes/Datacrazy/descriptions/LeadMoverDescription.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/descriptions/LeadMoverDescription.js +91 -0
- package/dist/nodes/Datacrazy/descriptions/LeadMoverDescription.js.map +1 -0
- package/dist/nodes/Datacrazy/descriptions/LeadSubResourceDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/LeadSubResourceDescription.js +26 -40
- package/dist/nodes/Datacrazy/descriptions/LeadSubResourceDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/ListDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/ListDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/ListDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/MessageContextDescription.d.ts +4 -0
- package/dist/nodes/Datacrazy/descriptions/MessageContextDescription.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/descriptions/MessageContextDescription.js +73 -0
- package/dist/nodes/Datacrazy/descriptions/MessageContextDescription.js.map +1 -0
- package/dist/nodes/Datacrazy/descriptions/PipelineDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/PipelineDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/PipelineDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/ProductDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/ProductDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/ProductDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/TagDescription.d.ts.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/TagDescription.js +17 -3
- package/dist/nodes/Datacrazy/descriptions/TagDescription.js.map +1 -1
- package/dist/nodes/Datacrazy/descriptions/WebhookParserDescription.d.ts +4 -0
- package/dist/nodes/Datacrazy/descriptions/WebhookParserDescription.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/descriptions/WebhookParserDescription.js +58 -0
- package/dist/nodes/Datacrazy/descriptions/WebhookParserDescription.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/activity.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/activity.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/activity.handler.js +37 -0
- package/dist/nodes/Datacrazy/handlers/activity.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/attendant.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/attendant.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/attendant.handler.js +14 -0
- package/dist/nodes/Datacrazy/handlers/attendant.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/business.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/business.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/business.handler.js +37 -0
- package/dist/nodes/Datacrazy/handlers/business.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/businessAction.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/businessAction.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/businessAction.handler.js +26 -0
- package/dist/nodes/Datacrazy/handlers/businessAction.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/businessLossReason.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/businessLossReason.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/businessLossReason.handler.js +26 -0
- package/dist/nodes/Datacrazy/handlers/businessLossReason.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/conversation.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/conversation.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/conversation.handler.js +32 -0
- package/dist/nodes/Datacrazy/handlers/conversation.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/instance.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/instance.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/instance.handler.js +13 -0
- package/dist/nodes/Datacrazy/handlers/instance.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/lead.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/lead.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/lead.handler.js +89 -0
- package/dist/nodes/Datacrazy/handlers/lead.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/leadMover.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/leadMover.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/leadMover.handler.js +50 -0
- package/dist/nodes/Datacrazy/handlers/leadMover.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/leadSubResources.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/leadSubResources.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/leadSubResources.handler.js +71 -0
- package/dist/nodes/Datacrazy/handlers/leadSubResources.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/list.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/list.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/list.handler.js +28 -0
- package/dist/nodes/Datacrazy/handlers/list.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/messageContext.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/messageContext.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/messageContext.handler.js +87 -0
- package/dist/nodes/Datacrazy/handlers/messageContext.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/pipeline.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/pipeline.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/pipeline.handler.js +17 -0
- package/dist/nodes/Datacrazy/handlers/pipeline.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/product.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/product.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/product.handler.js +28 -0
- package/dist/nodes/Datacrazy/handlers/product.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/tag.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/tag.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/tag.handler.js +28 -0
- package/dist/nodes/Datacrazy/handlers/tag.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/handlers/webhookParser.handler.d.ts +3 -0
- package/dist/nodes/Datacrazy/handlers/webhookParser.handler.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/handlers/webhookParser.handler.js +106 -0
- package/dist/nodes/Datacrazy/handlers/webhookParser.handler.js.map +1 -0
- package/dist/nodes/Datacrazy/methods/loadOptions.d.ts +10 -0
- package/dist/nodes/Datacrazy/methods/loadOptions.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/methods/loadOptions.js +102 -0
- package/dist/nodes/Datacrazy/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Datacrazy/utils/request.d.ts +4 -0
- package/dist/nodes/Datacrazy/utils/request.d.ts.map +1 -0
- package/dist/nodes/Datacrazy/utils/request.js +20 -0
- package/dist/nodes/Datacrazy/utils/request.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.Datacrazy = void 0;
|
|
4
37
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
@@ -15,6 +48,26 @@ const InstanceDescription_1 = require("./descriptions/InstanceDescription");
|
|
|
15
48
|
const AttendantDescription_1 = require("./descriptions/AttendantDescription");
|
|
16
49
|
const PipelineDescription_1 = require("./descriptions/PipelineDescription");
|
|
17
50
|
const LeadSubResourceDescription_1 = require("./descriptions/LeadSubResourceDescription");
|
|
51
|
+
const WebhookParserDescription_1 = require("./descriptions/WebhookParserDescription");
|
|
52
|
+
const MessageContextDescription_1 = require("./descriptions/MessageContextDescription");
|
|
53
|
+
const LeadMoverDescription_1 = require("./descriptions/LeadMoverDescription");
|
|
54
|
+
const lead_handler_1 = require("./handlers/lead.handler");
|
|
55
|
+
const business_handler_1 = require("./handlers/business.handler");
|
|
56
|
+
const businessAction_handler_1 = require("./handlers/businessAction.handler");
|
|
57
|
+
const businessLossReason_handler_1 = require("./handlers/businessLossReason.handler");
|
|
58
|
+
const tag_handler_1 = require("./handlers/tag.handler");
|
|
59
|
+
const list_handler_1 = require("./handlers/list.handler");
|
|
60
|
+
const product_handler_1 = require("./handlers/product.handler");
|
|
61
|
+
const activity_handler_1 = require("./handlers/activity.handler");
|
|
62
|
+
const conversation_handler_1 = require("./handlers/conversation.handler");
|
|
63
|
+
const instance_handler_1 = require("./handlers/instance.handler");
|
|
64
|
+
const attendant_handler_1 = require("./handlers/attendant.handler");
|
|
65
|
+
const pipeline_handler_1 = require("./handlers/pipeline.handler");
|
|
66
|
+
const leadSubResources_handler_1 = require("./handlers/leadSubResources.handler");
|
|
67
|
+
const webhookParser_handler_1 = require("./handlers/webhookParser.handler");
|
|
68
|
+
const messageContext_handler_1 = require("./handlers/messageContext.handler");
|
|
69
|
+
const leadMover_handler_1 = require("./handlers/leadMover.handler");
|
|
70
|
+
const loadOptions = __importStar(require("./methods/loadOptions"));
|
|
18
71
|
class Datacrazy {
|
|
19
72
|
constructor() {
|
|
20
73
|
this.description = {
|
|
@@ -28,12 +81,7 @@ class Datacrazy {
|
|
|
28
81
|
defaults: { name: 'Datacrazy' },
|
|
29
82
|
inputs: ['main'],
|
|
30
83
|
outputs: ['main'],
|
|
31
|
-
credentials: [
|
|
32
|
-
{
|
|
33
|
-
name: 'datacrazyApi',
|
|
34
|
-
required: true,
|
|
35
|
-
},
|
|
36
|
-
],
|
|
84
|
+
credentials: [{ name: 'datacrazyApi', required: true }],
|
|
37
85
|
properties: [
|
|
38
86
|
{
|
|
39
87
|
displayName: 'Recurso',
|
|
@@ -41,6 +89,9 @@ class Datacrazy {
|
|
|
41
89
|
type: 'options',
|
|
42
90
|
noDataExpression: true,
|
|
43
91
|
options: [
|
|
92
|
+
{ name: '⚡ Analisar Webhook Datacrazy', value: 'webhookParser' },
|
|
93
|
+
{ name: '⚡ Contexto de Mensagem Referenciada', value: 'messageContext' },
|
|
94
|
+
{ name: '⚡ Mover Lead na Pipeline', value: 'leadMover' },
|
|
44
95
|
{ name: 'Leads', value: 'lead' },
|
|
45
96
|
{ name: 'Negócios do Lead', value: 'leadBusiness' },
|
|
46
97
|
{ name: 'Anexos do Lead', value: 'leadAttachment' },
|
|
@@ -60,9 +111,11 @@ class Datacrazy {
|
|
|
60
111
|
{ name: 'Atendentes (CRM)', value: 'attendantCrm' },
|
|
61
112
|
{ name: 'Pipelines', value: 'pipeline' },
|
|
62
113
|
],
|
|
63
|
-
default: '
|
|
114
|
+
default: 'webhookParser',
|
|
64
115
|
},
|
|
65
|
-
|
|
116
|
+
...WebhookParserDescription_1.webhookParserOperations,
|
|
117
|
+
...MessageContextDescription_1.messageContextOperations,
|
|
118
|
+
...LeadMoverDescription_1.leadMoverOperations,
|
|
66
119
|
...LeadDescription_1.leadOperations,
|
|
67
120
|
...LeadSubResourceDescription_1.leadBusinessOperations,
|
|
68
121
|
...LeadSubResourceDescription_1.leadAttachmentOperations,
|
|
@@ -80,7 +133,9 @@ class Datacrazy {
|
|
|
80
133
|
...InstanceDescription_1.instanceOperations,
|
|
81
134
|
...AttendantDescription_1.attendantOperations,
|
|
82
135
|
...PipelineDescription_1.pipelineOperations,
|
|
83
|
-
|
|
136
|
+
...WebhookParserDescription_1.webhookParserFields,
|
|
137
|
+
...MessageContextDescription_1.messageContextFields,
|
|
138
|
+
...LeadMoverDescription_1.leadMoverFields,
|
|
84
139
|
...LeadDescription_1.leadFields,
|
|
85
140
|
...LeadSubResourceDescription_1.leadBusinessFields,
|
|
86
141
|
...LeadSubResourceDescription_1.leadAttachmentFields,
|
|
@@ -100,6 +155,18 @@ class Datacrazy {
|
|
|
100
155
|
...PipelineDescription_1.pipelineFields,
|
|
101
156
|
],
|
|
102
157
|
};
|
|
158
|
+
this.methods = {
|
|
159
|
+
listSearch: {
|
|
160
|
+
searchLeads: loadOptions.searchLeads,
|
|
161
|
+
searchPipelines: loadOptions.searchPipelines,
|
|
162
|
+
searchTags: loadOptions.searchTags,
|
|
163
|
+
searchConversations: loadOptions.searchConversations,
|
|
164
|
+
searchInstances: loadOptions.searchInstances,
|
|
165
|
+
searchLossReasons: loadOptions.searchLossReasons,
|
|
166
|
+
searchLists: loadOptions.searchLists,
|
|
167
|
+
searchProducts: loadOptions.searchProducts,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
103
170
|
}
|
|
104
171
|
async execute() {
|
|
105
172
|
const items = this.getInputData();
|
|
@@ -108,438 +175,56 @@ class Datacrazy {
|
|
|
108
175
|
const baseUrl = credentials.apiUrl.replace(/\/$/, '');
|
|
109
176
|
for (let i = 0; i < items.length; i++) {
|
|
110
177
|
const resource = this.getNodeParameter('resource', i);
|
|
111
|
-
const operation = this.getNodeParameter('operation', i);
|
|
178
|
+
const operation = this.getNodeParameter('operation', i, '');
|
|
112
179
|
let responseData;
|
|
113
180
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// ============================================================
|
|
117
|
-
if (resource === 'lead') {
|
|
118
|
-
if (operation === 'getAll') {
|
|
119
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
120
|
-
const qs = {};
|
|
121
|
-
if (opts.search)
|
|
122
|
-
qs.search = opts.search;
|
|
123
|
-
if (opts.skip !== undefined)
|
|
124
|
-
qs.skip = opts.skip;
|
|
125
|
-
if (opts.take !== undefined)
|
|
126
|
-
qs.take = opts.take;
|
|
127
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/leads', undefined, qs);
|
|
128
|
-
}
|
|
129
|
-
else if (operation === 'get') {
|
|
130
|
-
const id = this.getNodeParameter('leadId', i);
|
|
131
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/leads/${id}`);
|
|
132
|
-
}
|
|
133
|
-
else if (operation === 'create') {
|
|
134
|
-
const name = this.getNodeParameter('name', i, '');
|
|
135
|
-
const phone = this.getNodeParameter('phone', i, '');
|
|
136
|
-
const email = this.getNodeParameter('email', i, '');
|
|
137
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
138
|
-
const body = { name, phone, email, ...extra };
|
|
139
|
-
if (extra.tagIds)
|
|
140
|
-
body.tagIds = extra.tagIds.split(',').map((s) => s.trim());
|
|
141
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/leads', body);
|
|
142
|
-
}
|
|
143
|
-
else if (operation === 'createWithAdditionalFields') {
|
|
144
|
-
const name = this.getNodeParameter('name', i, '');
|
|
145
|
-
const phone = this.getNodeParameter('phone', i, '');
|
|
146
|
-
const email = this.getNodeParameter('email', i, '');
|
|
147
|
-
const leadJson = this.getNodeParameter('leadJson', i, '{}');
|
|
148
|
-
const parsed = typeof leadJson === 'string' ? JSON.parse(leadJson) : leadJson;
|
|
149
|
-
const body = { name, phone, email, ...parsed };
|
|
150
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/leads/additional-fields', body);
|
|
151
|
-
}
|
|
152
|
-
else if (operation === 'update') {
|
|
153
|
-
const id = this.getNodeParameter('leadId', i);
|
|
154
|
-
const name = this.getNodeParameter('name', i, '');
|
|
155
|
-
const phone = this.getNodeParameter('phone', i, '');
|
|
156
|
-
const email = this.getNodeParameter('email', i, '');
|
|
157
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
158
|
-
const body = {};
|
|
159
|
-
if (name)
|
|
160
|
-
body.name = name;
|
|
161
|
-
if (phone)
|
|
162
|
-
body.phone = phone;
|
|
163
|
-
if (email)
|
|
164
|
-
body.email = email;
|
|
165
|
-
if (extra.tagIds)
|
|
166
|
-
extra.tagIds = extra.tagIds.split(',').map((s) => s.trim());
|
|
167
|
-
Object.assign(body, extra);
|
|
168
|
-
responseData = await makeRequest.call(this, baseUrl, 'PATCH', `/api/v1/leads/${id}`, body);
|
|
169
|
-
}
|
|
170
|
-
else if (operation === 'delete') {
|
|
171
|
-
const id = this.getNodeParameter('leadId', i);
|
|
172
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/leads/${id}`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// ============================================================
|
|
176
|
-
// NEGÓCIOS DO LEAD
|
|
177
|
-
// ============================================================
|
|
178
|
-
else if (resource === 'leadBusiness') {
|
|
179
|
-
const leadId = this.getNodeParameter('leadId', i);
|
|
180
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
181
|
-
const qs = {};
|
|
182
|
-
if (opts.search)
|
|
183
|
-
qs.search = opts.search;
|
|
184
|
-
if (opts.skip !== undefined)
|
|
185
|
-
qs.skip = opts.skip;
|
|
186
|
-
if (opts.take !== undefined)
|
|
187
|
-
qs.take = opts.take;
|
|
188
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/leads/${leadId}/businesses`, undefined, qs);
|
|
181
|
+
if (resource === 'webhookParser') {
|
|
182
|
+
responseData = await webhookParser_handler_1.executeWebhookParser.call(this, i);
|
|
189
183
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// ============================================================
|
|
193
|
-
else if (resource === 'leadAttachment') {
|
|
194
|
-
const leadId = this.getNodeParameter('leadId', i);
|
|
195
|
-
if (operation === 'getAll') {
|
|
196
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/leads/${leadId}/attachments`);
|
|
197
|
-
}
|
|
198
|
-
else if (operation === 'create') {
|
|
199
|
-
const url = this.getNodeParameter('url', i);
|
|
200
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
201
|
-
const body = { url, ...extra };
|
|
202
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', `/api/v1/leads/${leadId}/attachments`, body);
|
|
203
|
-
}
|
|
204
|
-
else if (operation === 'delete') {
|
|
205
|
-
const attachmentId = this.getNodeParameter('attachmentId', i);
|
|
206
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/leads/${leadId}/attachments/${attachmentId}`);
|
|
207
|
-
}
|
|
184
|
+
else if (resource === 'messageContext') {
|
|
185
|
+
responseData = await messageContext_handler_1.executeMessageContext.call(this, baseUrl, i);
|
|
208
186
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// ============================================================
|
|
212
|
-
else if (resource === 'leadNote') {
|
|
213
|
-
const leadId = this.getNodeParameter('leadId', i);
|
|
214
|
-
if (operation === 'getAll') {
|
|
215
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/leads/${leadId}/notes`);
|
|
216
|
-
}
|
|
217
|
-
else if (operation === 'create') {
|
|
218
|
-
const content = this.getNodeParameter('content', i);
|
|
219
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', `/api/v1/leads/${leadId}/notes`, { content });
|
|
220
|
-
}
|
|
221
|
-
else if (operation === 'update') {
|
|
222
|
-
const noteId = this.getNodeParameter('noteId', i);
|
|
223
|
-
const content = this.getNodeParameter('content', i);
|
|
224
|
-
responseData = await makeRequest.call(this, baseUrl, 'PUT', `/api/v1/leads/${leadId}/notes/${noteId}`, { content });
|
|
225
|
-
}
|
|
226
|
-
else if (operation === 'delete') {
|
|
227
|
-
const noteId = this.getNodeParameter('noteId', i);
|
|
228
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/leads/${leadId}/notes/${noteId}`);
|
|
229
|
-
}
|
|
187
|
+
else if (resource === 'leadMover') {
|
|
188
|
+
responseData = await leadMover_handler_1.executeLeadMover.call(this, baseUrl, i);
|
|
230
189
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
// ============================================================
|
|
234
|
-
else if (resource === 'leadHistory') {
|
|
235
|
-
const leadId = this.getNodeParameter('leadId', i);
|
|
236
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
237
|
-
const qs = {};
|
|
238
|
-
if (opts.search)
|
|
239
|
-
qs.search = opts.search;
|
|
240
|
-
if (opts.skip !== undefined)
|
|
241
|
-
qs.skip = opts.skip;
|
|
242
|
-
if (opts.take !== undefined)
|
|
243
|
-
qs.take = opts.take;
|
|
244
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/leads/${leadId}/history`, undefined, qs);
|
|
190
|
+
else if (resource === 'lead') {
|
|
191
|
+
responseData = await lead_handler_1.executeLead.call(this, operation, baseUrl, i);
|
|
245
192
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
// ============================================================
|
|
249
|
-
else if (resource === 'leadActivity') {
|
|
250
|
-
const leadId = this.getNodeParameter('leadId', i);
|
|
251
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
252
|
-
const qs = {};
|
|
253
|
-
if (opts.search)
|
|
254
|
-
qs.search = opts.search;
|
|
255
|
-
if (opts.skip !== undefined)
|
|
256
|
-
qs.skip = opts.skip;
|
|
257
|
-
if (opts.take !== undefined)
|
|
258
|
-
qs.take = opts.take;
|
|
259
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/leads/${leadId}/activities`, undefined, qs);
|
|
193
|
+
else if (['leadBusiness', 'leadAttachment', 'leadNote', 'leadHistory', 'leadActivity'].includes(resource)) {
|
|
194
|
+
responseData = await leadSubResources_handler_1.executeLeadSubResource.call(this, resource, operation, baseUrl, i);
|
|
260
195
|
}
|
|
261
|
-
// ============================================================
|
|
262
|
-
// NEGÓCIOS
|
|
263
|
-
// ============================================================
|
|
264
196
|
else if (resource === 'business') {
|
|
265
|
-
|
|
266
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
267
|
-
const qs = {};
|
|
268
|
-
if (opts.search)
|
|
269
|
-
qs.search = opts.search;
|
|
270
|
-
if (opts.skip !== undefined)
|
|
271
|
-
qs.skip = opts.skip;
|
|
272
|
-
if (opts.take !== undefined)
|
|
273
|
-
qs.take = opts.take;
|
|
274
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/businesses', undefined, qs);
|
|
275
|
-
}
|
|
276
|
-
else if (operation === 'get') {
|
|
277
|
-
const id = this.getNodeParameter('businessId', i);
|
|
278
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/businesses/${id}`);
|
|
279
|
-
}
|
|
280
|
-
else if (operation === 'create') {
|
|
281
|
-
const leadId = this.getNodeParameter('leadId', i);
|
|
282
|
-
const stageId = this.getNodeParameter('stageId', i);
|
|
283
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
284
|
-
const body = { leadId, stageId, ...extra };
|
|
285
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/businesses', body);
|
|
286
|
-
}
|
|
287
|
-
else if (operation === 'update') {
|
|
288
|
-
const id = this.getNodeParameter('businessId', i);
|
|
289
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
290
|
-
responseData = await makeRequest.call(this, baseUrl, 'PATCH', `/api/v1/businesses/${id}`, extra);
|
|
291
|
-
}
|
|
292
|
-
else if (operation === 'delete') {
|
|
293
|
-
const id = this.getNodeParameter('businessId', i);
|
|
294
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/businesses/${id}`);
|
|
295
|
-
}
|
|
197
|
+
responseData = await business_handler_1.executeBusiness.call(this, operation, baseUrl, i);
|
|
296
198
|
}
|
|
297
|
-
// ============================================================
|
|
298
|
-
// AÇÕES DE NEGÓCIO
|
|
299
|
-
// ============================================================
|
|
300
199
|
else if (resource === 'businessAction') {
|
|
301
|
-
|
|
302
|
-
const businessIds = typeof rawIds === 'string' ? JSON.parse(rawIds) : rawIds;
|
|
303
|
-
if (operation === 'move') {
|
|
304
|
-
const stageId = this.getNodeParameter('stageId', i);
|
|
305
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/businesses/actions/move', { businessIds, stageId });
|
|
306
|
-
}
|
|
307
|
-
else if (operation === 'win') {
|
|
308
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/businesses/actions/win', { businessIds });
|
|
309
|
-
}
|
|
310
|
-
else if (operation === 'lose') {
|
|
311
|
-
const lossReasonId = this.getNodeParameter('lossReasonId', i, '');
|
|
312
|
-
const body = { businessIds };
|
|
313
|
-
if (lossReasonId)
|
|
314
|
-
body.lossReasonId = lossReasonId;
|
|
315
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/businesses/actions/lose', body);
|
|
316
|
-
}
|
|
317
|
-
else if (operation === 'restore') {
|
|
318
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/businesses/actions/restore', { businessIds });
|
|
319
|
-
}
|
|
200
|
+
responseData = await businessAction_handler_1.executeBusinessAction.call(this, operation, baseUrl, i);
|
|
320
201
|
}
|
|
321
|
-
// ============================================================
|
|
322
|
-
// MOTIVOS DE PERDA
|
|
323
|
-
// ============================================================
|
|
324
202
|
else if (resource === 'businessLossReason') {
|
|
325
|
-
|
|
326
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/business-loss-reasons');
|
|
327
|
-
}
|
|
328
|
-
else if (operation === 'get') {
|
|
329
|
-
const id = this.getNodeParameter('lossReasonId', i);
|
|
330
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/business-loss-reasons/${id}`);
|
|
331
|
-
}
|
|
332
|
-
else if (operation === 'create') {
|
|
333
|
-
const name = this.getNodeParameter('name', i);
|
|
334
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/business-loss-reasons', { name });
|
|
335
|
-
}
|
|
336
|
-
else if (operation === 'update') {
|
|
337
|
-
const id = this.getNodeParameter('lossReasonId', i);
|
|
338
|
-
const name = this.getNodeParameter('name', i);
|
|
339
|
-
responseData = await makeRequest.call(this, baseUrl, 'PUT', `/api/v1/business-loss-reasons/${id}`, { name });
|
|
340
|
-
}
|
|
341
|
-
else if (operation === 'delete') {
|
|
342
|
-
const id = this.getNodeParameter('lossReasonId', i);
|
|
343
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/business-loss-reasons/${id}`);
|
|
344
|
-
}
|
|
203
|
+
responseData = await businessLossReason_handler_1.executeBusinessLossReason.call(this, operation, baseUrl, i);
|
|
345
204
|
}
|
|
346
|
-
// ============================================================
|
|
347
|
-
// TAGS
|
|
348
|
-
// ============================================================
|
|
349
205
|
else if (resource === 'tag') {
|
|
350
|
-
|
|
351
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/tags');
|
|
352
|
-
}
|
|
353
|
-
else if (operation === 'get') {
|
|
354
|
-
const id = this.getNodeParameter('tagId', i);
|
|
355
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/tags/${id}`);
|
|
356
|
-
}
|
|
357
|
-
else if (operation === 'create') {
|
|
358
|
-
const name = this.getNodeParameter('name', i);
|
|
359
|
-
const color = this.getNodeParameter('color', i, '#0000FF');
|
|
360
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/tags', { name, color });
|
|
361
|
-
}
|
|
362
|
-
else if (operation === 'update') {
|
|
363
|
-
const id = this.getNodeParameter('tagId', i);
|
|
364
|
-
const name = this.getNodeParameter('name', i);
|
|
365
|
-
const color = this.getNodeParameter('color', i, '#0000FF');
|
|
366
|
-
responseData = await makeRequest.call(this, baseUrl, 'PUT', `/api/v1/tags/${id}`, { name, color });
|
|
367
|
-
}
|
|
368
|
-
else if (operation === 'delete') {
|
|
369
|
-
const id = this.getNodeParameter('tagId', i);
|
|
370
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/tags/${id}`);
|
|
371
|
-
}
|
|
206
|
+
responseData = await tag_handler_1.executeTag.call(this, operation, baseUrl, i);
|
|
372
207
|
}
|
|
373
|
-
// ============================================================
|
|
374
|
-
// LISTAS
|
|
375
|
-
// ============================================================
|
|
376
208
|
else if (resource === 'list') {
|
|
377
|
-
|
|
378
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/lists');
|
|
379
|
-
}
|
|
380
|
-
else if (operation === 'get') {
|
|
381
|
-
const id = this.getNodeParameter('listId', i);
|
|
382
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/lists/${id}`);
|
|
383
|
-
}
|
|
384
|
-
else if (operation === 'create') {
|
|
385
|
-
const name = this.getNodeParameter('name', i);
|
|
386
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
387
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/lists', { name, ...extra });
|
|
388
|
-
}
|
|
389
|
-
else if (operation === 'update') {
|
|
390
|
-
const id = this.getNodeParameter('listId', i);
|
|
391
|
-
const name = this.getNodeParameter('name', i);
|
|
392
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
393
|
-
responseData = await makeRequest.call(this, baseUrl, 'PUT', `/api/v1/lists/${id}`, { name, ...extra });
|
|
394
|
-
}
|
|
395
|
-
else if (operation === 'delete') {
|
|
396
|
-
const id = this.getNodeParameter('listId', i);
|
|
397
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/lists/${id}`);
|
|
398
|
-
}
|
|
209
|
+
responseData = await list_handler_1.executeList.call(this, operation, baseUrl, i);
|
|
399
210
|
}
|
|
400
|
-
// ============================================================
|
|
401
|
-
// PRODUTOS
|
|
402
|
-
// ============================================================
|
|
403
211
|
else if (resource === 'product') {
|
|
404
|
-
|
|
405
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/products');
|
|
406
|
-
}
|
|
407
|
-
else if (operation === 'get') {
|
|
408
|
-
const id = this.getNodeParameter('productId', i);
|
|
409
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/products/${id}`);
|
|
410
|
-
}
|
|
411
|
-
else if (operation === 'create') {
|
|
412
|
-
const name = this.getNodeParameter('name', i);
|
|
413
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
414
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/products', { name, ...extra });
|
|
415
|
-
}
|
|
416
|
-
else if (operation === 'update') {
|
|
417
|
-
const id = this.getNodeParameter('productId', i);
|
|
418
|
-
const name = this.getNodeParameter('name', i);
|
|
419
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
420
|
-
responseData = await makeRequest.call(this, baseUrl, 'PUT', `/api/v1/products/${id}`, { name, ...extra });
|
|
421
|
-
}
|
|
422
|
-
else if (operation === 'delete') {
|
|
423
|
-
const id = this.getNodeParameter('productId', i);
|
|
424
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/products/${id}`);
|
|
425
|
-
}
|
|
212
|
+
responseData = await product_handler_1.executeProduct.call(this, operation, baseUrl, i);
|
|
426
213
|
}
|
|
427
|
-
// ============================================================
|
|
428
|
-
// ATIVIDADES
|
|
429
|
-
// ============================================================
|
|
430
214
|
else if (resource === 'activity') {
|
|
431
|
-
|
|
432
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
433
|
-
const qs = {};
|
|
434
|
-
if (opts.search)
|
|
435
|
-
qs.search = opts.search;
|
|
436
|
-
if (opts.skip !== undefined)
|
|
437
|
-
qs.skip = opts.skip;
|
|
438
|
-
if (opts.take !== undefined)
|
|
439
|
-
qs.take = opts.take;
|
|
440
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/activities', undefined, qs);
|
|
441
|
-
}
|
|
442
|
-
else if (operation === 'get') {
|
|
443
|
-
const id = this.getNodeParameter('activityId', i);
|
|
444
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/activities/${id}`);
|
|
445
|
-
}
|
|
446
|
-
else if (operation === 'create') {
|
|
447
|
-
const title = this.getNodeParameter('title', i);
|
|
448
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
449
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', '/api/v1/activities', { title, ...extra });
|
|
450
|
-
}
|
|
451
|
-
else if (operation === 'update') {
|
|
452
|
-
const id = this.getNodeParameter('activityId', i);
|
|
453
|
-
const title = this.getNodeParameter('title', i);
|
|
454
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
455
|
-
responseData = await makeRequest.call(this, baseUrl, 'PATCH', `/api/v1/activities/${id}`, { title, ...extra });
|
|
456
|
-
}
|
|
457
|
-
else if (operation === 'delete') {
|
|
458
|
-
const id = this.getNodeParameter('activityId', i);
|
|
459
|
-
responseData = await makeRequest.call(this, baseUrl, 'DELETE', `/api/v1/activities/${id}`);
|
|
460
|
-
}
|
|
215
|
+
responseData = await activity_handler_1.executeActivity.call(this, operation, baseUrl, i);
|
|
461
216
|
}
|
|
462
|
-
// ============================================================
|
|
463
|
-
// CONVERSAS
|
|
464
|
-
// ============================================================
|
|
465
217
|
else if (resource === 'conversation') {
|
|
466
|
-
|
|
467
|
-
const opts = this.getNodeParameter('queryOptions', i, {});
|
|
468
|
-
const qs = {};
|
|
469
|
-
if (opts.search)
|
|
470
|
-
qs.search = opts.search;
|
|
471
|
-
if (opts.skip !== undefined)
|
|
472
|
-
qs.skip = opts.skip;
|
|
473
|
-
if (opts.take !== undefined)
|
|
474
|
-
qs.take = opts.take;
|
|
475
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/conversations', undefined, qs);
|
|
476
|
-
}
|
|
477
|
-
else if (operation === 'getMessages') {
|
|
478
|
-
const id = this.getNodeParameter('conversationId', i);
|
|
479
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/conversations/${id}/messages`);
|
|
480
|
-
}
|
|
481
|
-
else if (operation === 'sendMessage') {
|
|
482
|
-
const id = this.getNodeParameter('conversationId', i);
|
|
483
|
-
const message = this.getNodeParameter('message', i);
|
|
484
|
-
const extra = this.getNodeParameter('additionalFields', i, {});
|
|
485
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', `/api/v1/conversations/${id}/messages`, { message, ...extra });
|
|
486
|
-
}
|
|
487
|
-
else if (operation === 'finish') {
|
|
488
|
-
const id = this.getNodeParameter('conversationId', i);
|
|
489
|
-
responseData = await makeRequest.call(this, baseUrl, 'POST', `/api/v1/conversations/${id}/finish`);
|
|
490
|
-
}
|
|
218
|
+
responseData = await conversation_handler_1.executeConversation.call(this, operation, baseUrl, i);
|
|
491
219
|
}
|
|
492
|
-
// ============================================================
|
|
493
|
-
// INSTÂNCIAS
|
|
494
|
-
// ============================================================
|
|
495
220
|
else if (resource === 'instance') {
|
|
496
|
-
|
|
497
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/instances');
|
|
498
|
-
}
|
|
499
|
-
else if (operation === 'get') {
|
|
500
|
-
const id = this.getNodeParameter('instanceId', i);
|
|
501
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/instances/${id}`);
|
|
502
|
-
}
|
|
221
|
+
responseData = await instance_handler_1.executeInstance.call(this, operation, baseUrl, i);
|
|
503
222
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
// ============================================================
|
|
507
|
-
else if (resource === 'attendantMulti') {
|
|
508
|
-
if (operation === 'getAll') {
|
|
509
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/attendants/multi');
|
|
510
|
-
}
|
|
511
|
-
else if (operation === 'get') {
|
|
512
|
-
const id = this.getNodeParameter('attendantId', i);
|
|
513
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/attendants/multi/${id}`);
|
|
514
|
-
}
|
|
223
|
+
else if (resource === 'attendantCrm' || resource === 'attendantMulti') {
|
|
224
|
+
responseData = await attendant_handler_1.executeAttendant.call(this, resource, operation, baseUrl, i);
|
|
515
225
|
}
|
|
516
|
-
// ============================================================
|
|
517
|
-
// ATENDENTES CRM
|
|
518
|
-
// ============================================================
|
|
519
|
-
else if (resource === 'attendantCrm') {
|
|
520
|
-
if (operation === 'getAll') {
|
|
521
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/attendants/crm');
|
|
522
|
-
}
|
|
523
|
-
else if (operation === 'get') {
|
|
524
|
-
const id = this.getNodeParameter('attendantId', i);
|
|
525
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/attendants/crm/${id}`);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
// ============================================================
|
|
529
|
-
// PIPELINES
|
|
530
|
-
// ============================================================
|
|
531
226
|
else if (resource === 'pipeline') {
|
|
532
|
-
|
|
533
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', '/api/v1/pipelines');
|
|
534
|
-
}
|
|
535
|
-
else if (operation === 'get') {
|
|
536
|
-
const id = this.getNodeParameter('pipelineId', i);
|
|
537
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/pipelines/${id}`);
|
|
538
|
-
}
|
|
539
|
-
else if (operation === 'getStages') {
|
|
540
|
-
const id = this.getNodeParameter('pipelineId', i);
|
|
541
|
-
responseData = await makeRequest.call(this, baseUrl, 'GET', `/api/v1/pipelines/${id}/stages`);
|
|
542
|
-
}
|
|
227
|
+
responseData = await pipeline_handler_1.executePipeline.call(this, operation, baseUrl, i);
|
|
543
228
|
}
|
|
544
229
|
else {
|
|
545
230
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Recurso "${resource}" não encontrado.`);
|
|
@@ -559,16 +244,4 @@ class Datacrazy {
|
|
|
559
244
|
}
|
|
560
245
|
}
|
|
561
246
|
exports.Datacrazy = Datacrazy;
|
|
562
|
-
async function makeRequest(baseUrl, method, path, body, qs) {
|
|
563
|
-
const options = {
|
|
564
|
-
method,
|
|
565
|
-
url: `${baseUrl}${path}`,
|
|
566
|
-
json: true,
|
|
567
|
-
};
|
|
568
|
-
if (body && Object.keys(body).length > 0)
|
|
569
|
-
options.body = body;
|
|
570
|
-
if (qs && Object.keys(qs).length > 0)
|
|
571
|
-
options.qs = qs;
|
|
572
|
-
return this.helpers.httpRequestWithAuthentication.call(this, 'datacrazyApi', options);
|
|
573
|
-
}
|
|
574
247
|
//# sourceMappingURL=Datacrazy.node.js.map
|