n8n-nodes-imobzi 0.3.42 → 0.3.43
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.
@@ -2,7 +2,21 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Imobzi = void 0;
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
5
|
-
const
|
5
|
+
const resourceEndpoint = {
|
6
|
+
lead: 'leads',
|
7
|
+
property: 'properties',
|
8
|
+
contact: 'contacts',
|
9
|
+
contrato: 'contracts',
|
10
|
+
financeiro: 'financial/accounts',
|
11
|
+
locacao: 'rentals',
|
12
|
+
documento: 'documents',
|
13
|
+
tarefa: 'tasks',
|
14
|
+
agenda: 'events',
|
15
|
+
integracao: 'integrations',
|
16
|
+
usuario: 'users',
|
17
|
+
account: 'account',
|
18
|
+
};
|
19
|
+
const createFiltersProperty = () => ({
|
6
20
|
displayName: 'Filtros',
|
7
21
|
name: 'filters',
|
8
22
|
type: 'fixedCollection',
|
@@ -11,7 +25,6 @@ const createFiltersProperty = (resourceName, loadOptionsMethod) => ({
|
|
11
25
|
default: {},
|
12
26
|
displayOptions: {
|
13
27
|
show: {
|
14
|
-
resource: [resourceName],
|
15
28
|
operation: ['getAll', 'delete'],
|
16
29
|
},
|
17
30
|
},
|
@@ -23,8 +36,7 @@ const createFiltersProperty = (resourceName, loadOptionsMethod) => ({
|
|
23
36
|
{
|
24
37
|
displayName: 'Campo',
|
25
38
|
name: 'field',
|
26
|
-
type: '
|
27
|
-
typeOptions: { loadOptionsMethod },
|
39
|
+
type: 'string',
|
28
40
|
default: '',
|
29
41
|
description: 'Campo para filtrar',
|
30
42
|
},
|
@@ -58,164 +70,156 @@ const createFiltersProperty = (resourceName, loadOptionsMethod) => ({
|
|
58
70
|
},
|
59
71
|
],
|
60
72
|
});
|
73
|
+
const createCreateFieldsProperty = (resourceName) => ({
|
74
|
+
displayName: 'Create Fields',
|
75
|
+
name: 'createFields',
|
76
|
+
type: 'collection',
|
77
|
+
placeholder: 'Add Field',
|
78
|
+
default: {},
|
79
|
+
displayOptions: {
|
80
|
+
show: {
|
81
|
+
resource: [resourceName],
|
82
|
+
operation: ['create'],
|
83
|
+
},
|
84
|
+
},
|
85
|
+
options: [
|
86
|
+
{
|
87
|
+
displayName: 'Date',
|
88
|
+
name: 'date',
|
89
|
+
type: 'string',
|
90
|
+
default: '',
|
91
|
+
description: 'Date of the item',
|
92
|
+
},
|
93
|
+
{
|
94
|
+
displayName: 'Description',
|
95
|
+
name: 'description',
|
96
|
+
type: 'string',
|
97
|
+
default: '',
|
98
|
+
description: 'Description of the item',
|
99
|
+
},
|
100
|
+
{
|
101
|
+
displayName: 'Email',
|
102
|
+
name: 'email',
|
103
|
+
type: 'string',
|
104
|
+
placeholder: 'name@email.com',
|
105
|
+
default: '',
|
106
|
+
description: 'Email address',
|
107
|
+
},
|
108
|
+
{
|
109
|
+
displayName: 'Name',
|
110
|
+
name: 'name',
|
111
|
+
type: 'string',
|
112
|
+
default: '',
|
113
|
+
description: 'Name of the item',
|
114
|
+
},
|
115
|
+
{
|
116
|
+
displayName: 'Phone',
|
117
|
+
name: 'phone',
|
118
|
+
type: 'string',
|
119
|
+
default: '',
|
120
|
+
description: 'Phone number',
|
121
|
+
},
|
122
|
+
{
|
123
|
+
displayName: 'Title',
|
124
|
+
name: 'title',
|
125
|
+
type: 'string',
|
126
|
+
default: '',
|
127
|
+
description: 'Title of the item',
|
128
|
+
},
|
129
|
+
{
|
130
|
+
displayName: 'Value',
|
131
|
+
name: 'value',
|
132
|
+
type: 'number',
|
133
|
+
default: 0,
|
134
|
+
description: 'Value of the item',
|
135
|
+
},
|
136
|
+
],
|
137
|
+
});
|
138
|
+
const createUpdateFieldsProperty = (resourceName) => ({
|
139
|
+
displayName: 'Update Fields',
|
140
|
+
name: 'updateFields',
|
141
|
+
type: 'collection',
|
142
|
+
placeholder: 'Add Field',
|
143
|
+
default: {},
|
144
|
+
displayOptions: {
|
145
|
+
show: {
|
146
|
+
resource: [resourceName],
|
147
|
+
operation: ['update'],
|
148
|
+
},
|
149
|
+
},
|
150
|
+
options: [
|
151
|
+
{
|
152
|
+
displayName: 'Date',
|
153
|
+
name: 'date',
|
154
|
+
type: 'string',
|
155
|
+
default: '',
|
156
|
+
description: 'Date of the item',
|
157
|
+
},
|
158
|
+
{
|
159
|
+
displayName: 'Description',
|
160
|
+
name: 'description',
|
161
|
+
type: 'string',
|
162
|
+
default: '',
|
163
|
+
description: 'Description of the item',
|
164
|
+
},
|
165
|
+
{
|
166
|
+
displayName: 'Email',
|
167
|
+
name: 'email',
|
168
|
+
type: 'string',
|
169
|
+
placeholder: 'name@email.com',
|
170
|
+
default: '',
|
171
|
+
description: 'Email address',
|
172
|
+
},
|
173
|
+
{
|
174
|
+
displayName: 'Name',
|
175
|
+
name: 'name',
|
176
|
+
type: 'string',
|
177
|
+
default: '',
|
178
|
+
description: 'Name of the item',
|
179
|
+
},
|
180
|
+
{
|
181
|
+
displayName: 'Phone',
|
182
|
+
name: 'phone',
|
183
|
+
type: 'string',
|
184
|
+
default: '',
|
185
|
+
description: 'Phone number',
|
186
|
+
},
|
187
|
+
{
|
188
|
+
displayName: 'Title',
|
189
|
+
name: 'title',
|
190
|
+
type: 'string',
|
191
|
+
default: '',
|
192
|
+
description: 'Title of the item',
|
193
|
+
},
|
194
|
+
{
|
195
|
+
displayName: 'Value',
|
196
|
+
name: 'value',
|
197
|
+
type: 'number',
|
198
|
+
default: 0,
|
199
|
+
description: 'Value of the item',
|
200
|
+
},
|
201
|
+
],
|
202
|
+
});
|
61
203
|
class Imobzi {
|
62
204
|
constructor() {
|
63
205
|
this.methods = {
|
64
206
|
loadOptions: {
|
65
|
-
async
|
66
|
-
const
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
return (response.data || []).map((item) => ({
|
82
|
-
name: `${item.title || item.name || `ID ${item.id}`}`,
|
83
|
-
value: item.id
|
84
|
-
}));
|
85
|
-
},
|
86
|
-
async getPropertyFields() {
|
87
|
-
return [
|
88
|
-
{ name: 'Título', value: 'title' },
|
89
|
-
{ name: 'Tipo', value: 'type' },
|
90
|
-
{ name: 'Status', value: 'status' },
|
91
|
-
{ name: 'Valor', value: 'price' },
|
92
|
-
{ name: 'Endereço', value: 'address' },
|
93
|
-
{ name: 'Proprietário', value: 'owner' },
|
94
|
-
{ name: 'Imagens', value: 'images' },
|
95
|
-
];
|
96
|
-
},
|
97
|
-
async getContactIds() {
|
98
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/contacts' });
|
99
|
-
return (response.data || []).map((item) => ({
|
100
|
-
name: `${item.name || `ID ${item.id}`}`,
|
101
|
-
value: item.id
|
102
|
-
}));
|
103
|
-
},
|
104
|
-
async getContactFields() {
|
105
|
-
return [
|
106
|
-
{ name: 'Nome', value: 'name' },
|
107
|
-
{ name: 'Email', value: 'email' },
|
108
|
-
{ name: 'Telefone', value: 'phone' },
|
109
|
-
];
|
110
|
-
},
|
111
|
-
async getContratoIds() {
|
112
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/contracts' });
|
113
|
-
return (response.data || []).map((item) => ({
|
114
|
-
name: `${item.cliente || `ID ${item.id}`}`,
|
115
|
-
value: item.id
|
116
|
-
}));
|
117
|
-
},
|
118
|
-
async getContratoFields() {
|
119
|
-
return [
|
120
|
-
{ name: 'Cliente', value: 'cliente' },
|
121
|
-
{ name: 'Valor', value: 'valor' },
|
122
|
-
{ name: 'Data De Início', value: 'dataInicio' },
|
123
|
-
];
|
124
|
-
},
|
125
|
-
async getFinanceiroIds() {
|
126
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/financial/accounts' });
|
127
|
-
return (response.data || []).map((item) => ({
|
128
|
-
name: `${item.descricao || `ID ${item.id}`}`,
|
129
|
-
value: item.id
|
130
|
-
}));
|
131
|
-
},
|
132
|
-
async getFinanceiroFields() {
|
133
|
-
return [
|
134
|
-
{ name: 'Descrição', value: 'descricao' },
|
135
|
-
{ name: 'Valor', value: 'valor' },
|
136
|
-
{ name: 'Data', value: 'data' },
|
137
|
-
];
|
138
|
-
},
|
139
|
-
async getLocacaoIds() {
|
140
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/rentals' });
|
141
|
-
return (response.data || []).map((item) => ({
|
142
|
-
name: `${item.inquilino || `ID ${item.id}`}`,
|
143
|
-
value: item.id
|
144
|
-
}));
|
145
|
-
},
|
146
|
-
async getLocacaoFields() {
|
147
|
-
return [
|
148
|
-
{ name: 'Inquilino', value: 'inquilino' },
|
149
|
-
{ name: 'Imóvel', value: 'imovel' },
|
150
|
-
{ name: 'Data De Início', value: 'dataInicio' },
|
151
|
-
];
|
152
|
-
},
|
153
|
-
async getDocumentoIds() {
|
154
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/documents' });
|
155
|
-
return (response.data || []).map((item) => ({
|
156
|
-
name: `${item.nomeArquivo || `ID ${item.id}`}`,
|
157
|
-
value: item.id
|
158
|
-
}));
|
159
|
-
},
|
160
|
-
async getDocumentoFields() {
|
161
|
-
return [
|
162
|
-
{ name: 'Nome Do Arquivo', value: 'nomeArquivo' },
|
163
|
-
{ name: 'Conteúdo', value: 'conteudo' },
|
164
|
-
];
|
165
|
-
},
|
166
|
-
async getTarefaIds() {
|
167
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/tasks' });
|
168
|
-
return (response.data || []).map((item) => ({
|
169
|
-
name: `${item.titulo || `ID ${item.id}`}`,
|
170
|
-
value: item.id
|
171
|
-
}));
|
172
|
-
},
|
173
|
-
async getTarefaFields() {
|
174
|
-
return [
|
175
|
-
{ name: 'Título', value: 'titulo' },
|
176
|
-
{ name: 'Descrição', value: 'descricao' },
|
177
|
-
{ name: 'Data De Vencimento', value: 'dataVencimento' },
|
178
|
-
];
|
179
|
-
},
|
180
|
-
async getAgendaIds() {
|
181
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/events' });
|
182
|
-
return (response.data || []).map((item) => ({
|
183
|
-
name: `${item.titulo || `ID ${item.id}`}`,
|
184
|
-
value: item.id
|
185
|
-
}));
|
186
|
-
},
|
187
|
-
async getAgendaFields() {
|
188
|
-
return [
|
189
|
-
{ name: 'Título', value: 'titulo' },
|
190
|
-
{ name: 'Data', value: 'data' },
|
191
|
-
{ name: 'Descrição', value: 'descricao' },
|
192
|
-
];
|
193
|
-
},
|
194
|
-
async getIntegracaoIds() {
|
195
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/integrations' });
|
196
|
-
return (response.data || []).map((item) => ({
|
197
|
-
name: `${item.nome || `ID ${item.id}`}`,
|
198
|
-
value: item.id
|
199
|
-
}));
|
200
|
-
},
|
201
|
-
async getIntegracaoFields() {
|
202
|
-
return [
|
203
|
-
{ name: 'Nome', value: 'nome' },
|
204
|
-
{ name: 'Tipo', value: 'tipo' },
|
205
|
-
];
|
206
|
-
},
|
207
|
-
async getUsuarioIds() {
|
208
|
-
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: '/users' });
|
209
|
-
return (response.data || []).map((item) => ({
|
210
|
-
name: `${item.name || `ID ${item.id}`}`,
|
211
|
-
value: item.id
|
212
|
-
}));
|
213
|
-
},
|
214
|
-
async getUsuarioFields() {
|
215
|
-
return [
|
216
|
-
{ name: 'Nome', value: 'name' },
|
217
|
-
{ name: 'Email', value: 'email' },
|
218
|
-
];
|
207
|
+
async getAllResources() {
|
208
|
+
const resource = this.getNodeParameter('resource', 0);
|
209
|
+
const endpoint = resourceEndpoint[resource];
|
210
|
+
if (!endpoint) {
|
211
|
+
return [];
|
212
|
+
}
|
213
|
+
try {
|
214
|
+
const response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', { method: 'GET', url: `/${endpoint}` });
|
215
|
+
return (response.data || []).map((item) => ({
|
216
|
+
name: item.name || item.title || item.titulo || `ID ${item.id}`,
|
217
|
+
value: item.id,
|
218
|
+
}));
|
219
|
+
}
|
220
|
+
catch (error) {
|
221
|
+
return [];
|
222
|
+
}
|
219
223
|
},
|
220
224
|
},
|
221
225
|
};
|
@@ -259,452 +263,74 @@ class Imobzi {
|
|
259
263
|
],
|
260
264
|
default: 'lead',
|
261
265
|
},
|
262
|
-
createFiltersProperty('lead', 'getLeadFields'),
|
263
|
-
createFiltersProperty('property', 'getPropertyFields'),
|
264
|
-
createFiltersProperty('contact', 'getContactFields'),
|
265
|
-
createFiltersProperty('contrato', 'getContratoFields'),
|
266
|
-
createFiltersProperty('financeiro', 'getFinanceiroFields'),
|
267
|
-
createFiltersProperty('locacao', 'getLocacaoFields'),
|
268
|
-
createFiltersProperty('documento', 'getDocumentoFields'),
|
269
|
-
createFiltersProperty('tarefa', 'getTarefaFields'),
|
270
|
-
createFiltersProperty('agenda', 'getAgendaFields'),
|
271
|
-
createFiltersProperty('integracao', 'getIntegracaoFields'),
|
272
|
-
createFiltersProperty('usuario', 'getUsuarioFields'),
|
273
|
-
{
|
274
|
-
displayName: 'Lead ID',
|
275
|
-
name: 'id',
|
276
|
-
type: 'string',
|
277
|
-
default: '',
|
278
|
-
required: true,
|
279
|
-
displayOptions: { show: { resource: ['lead'], operation: ['get', 'update', 'delete'] } },
|
280
|
-
description: 'ID do lead a ser consultado, atualizado ou deletado',
|
281
|
-
},
|
282
|
-
{
|
283
|
-
displayName: 'Property ID',
|
284
|
-
name: 'id',
|
285
|
-
type: 'string',
|
286
|
-
default: '',
|
287
|
-
required: true,
|
288
|
-
displayOptions: { show: { resource: ['property'], operation: ['get', 'update', 'delete'] } },
|
289
|
-
description: 'ID do imóvel a ser consultado, atualizado ou deletado',
|
290
|
-
},
|
291
|
-
{
|
292
|
-
displayName: 'Contact ID',
|
293
|
-
name: 'id',
|
294
|
-
type: 'string',
|
295
|
-
default: '',
|
296
|
-
required: true,
|
297
|
-
displayOptions: { show: { resource: ['contact'], operation: ['get', 'update', 'delete'] } },
|
298
|
-
description: 'ID do contato a ser consultado, atualizado ou deletado',
|
299
|
-
},
|
300
|
-
{
|
301
|
-
displayName: 'Contrato ID',
|
302
|
-
name: 'id',
|
303
|
-
type: 'string',
|
304
|
-
default: '',
|
305
|
-
required: true,
|
306
|
-
displayOptions: { show: { resource: ['contrato'], operation: ['get', 'update', 'delete'] } },
|
307
|
-
description: 'ID do contrato a ser consultado, atualizado ou deletado',
|
308
|
-
},
|
309
|
-
{
|
310
|
-
displayName: 'Financeiro ID',
|
311
|
-
name: 'id',
|
312
|
-
type: 'string',
|
313
|
-
default: '',
|
314
|
-
required: true,
|
315
|
-
displayOptions: { show: { resource: ['financeiro'], operation: ['get', 'update', 'delete'] } },
|
316
|
-
description: 'ID da conta financeira a ser consultada, atualizada ou deletada',
|
317
|
-
},
|
318
|
-
{
|
319
|
-
displayName: 'Locacao ID',
|
320
|
-
name: 'id',
|
321
|
-
type: 'string',
|
322
|
-
default: '',
|
323
|
-
required: true,
|
324
|
-
displayOptions: { show: { resource: ['locacao'], operation: ['get', 'update', 'delete'] } },
|
325
|
-
description: 'ID da locação a ser consultada, atualizada ou deletada',
|
326
|
-
},
|
327
|
-
{
|
328
|
-
displayName: 'Documento ID',
|
329
|
-
name: 'id',
|
330
|
-
type: 'string',
|
331
|
-
default: '',
|
332
|
-
required: true,
|
333
|
-
displayOptions: { show: { resource: ['documento'], operation: ['get', 'update', 'delete'] } },
|
334
|
-
description: 'ID do documento a ser consultado, atualizado ou deletado',
|
335
|
-
},
|
336
|
-
{
|
337
|
-
displayName: 'Tarefa ID',
|
338
|
-
name: 'id',
|
339
|
-
type: 'string',
|
340
|
-
default: '',
|
341
|
-
required: true,
|
342
|
-
displayOptions: { show: { resource: ['tarefa'], operation: ['get', 'update', 'delete'] } },
|
343
|
-
description: 'ID da tarefa a ser consultada, atualizada ou deletada',
|
344
|
-
},
|
345
|
-
{
|
346
|
-
displayName: 'Agenda ID',
|
347
|
-
name: 'id',
|
348
|
-
type: 'string',
|
349
|
-
default: '',
|
350
|
-
required: true,
|
351
|
-
displayOptions: { show: { resource: ['agenda'], operation: ['get', 'update', 'delete'] } },
|
352
|
-
description: 'ID do evento a ser consultado, atualizado ou deletado',
|
353
|
-
},
|
354
|
-
{
|
355
|
-
displayName: 'Integracao ID',
|
356
|
-
name: 'id',
|
357
|
-
type: 'string',
|
358
|
-
default: '',
|
359
|
-
required: true,
|
360
|
-
displayOptions: { show: { resource: ['integracao'], operation: ['get', 'update', 'delete'] } },
|
361
|
-
description: 'ID da integração a ser consultada, atualizada ou deletada',
|
362
|
-
},
|
363
|
-
{
|
364
|
-
displayName: 'Usuario ID',
|
365
|
-
name: 'id',
|
366
|
-
type: 'string',
|
367
|
-
default: '',
|
368
|
-
required: true,
|
369
|
-
displayOptions: { show: { resource: ['usuario'], operation: ['get', 'update', 'delete'] } },
|
370
|
-
description: 'ID do usuário/agente a ser consultado, atualizado ou deletado',
|
371
|
-
},
|
372
266
|
{
|
373
267
|
displayName: 'Operation',
|
374
268
|
name: 'operation',
|
375
269
|
type: 'options',
|
376
270
|
noDataExpression: true,
|
377
|
-
displayOptions: { show: { resource: ['lead'] } },
|
378
271
|
options: [
|
379
|
-
{ name: 'Create', value: 'create', action: 'Create a
|
380
|
-
{ name: 'Delete', value: 'delete', action: 'Delete
|
381
|
-
{ name: 'Get', value: 'get', action: 'Get
|
382
|
-
{ name: 'Get Many', value: 'getAll', action: 'Get many
|
383
|
-
{ name: 'Update', value: 'update', action: 'Update
|
272
|
+
{ name: 'Create', value: 'create', action: 'Create a new item' },
|
273
|
+
{ name: 'Delete', value: 'delete', action: 'Delete an item' },
|
274
|
+
{ name: 'Get', value: 'get', action: 'Get an item by ID' },
|
275
|
+
{ name: 'Get Many', value: 'getAll', action: 'Get many items' },
|
276
|
+
{ name: 'Update', value: 'update', action: 'Update an item' },
|
384
277
|
],
|
385
278
|
default: 'create',
|
386
279
|
},
|
387
280
|
{
|
388
|
-
displayName: '
|
389
|
-
name: '
|
390
|
-
type: 'fixedCollection',
|
391
|
-
options: [
|
392
|
-
{
|
393
|
-
name: 'field',
|
394
|
-
displayName: 'Field',
|
395
|
-
values: [
|
396
|
-
{
|
397
|
-
displayName: 'Campo Name or ID',
|
398
|
-
name: 'campo',
|
399
|
-
type: 'options',
|
400
|
-
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
401
|
-
typeOptions: { loadOptionsMethod: 'getLeadFields' },
|
402
|
-
default: '',
|
403
|
-
},
|
404
|
-
{
|
405
|
-
displayName: 'Valor',
|
406
|
-
name: 'valor',
|
407
|
-
type: 'string',
|
408
|
-
default: '',
|
409
|
-
},
|
410
|
-
],
|
411
|
-
},
|
412
|
-
],
|
413
|
-
default: {},
|
414
|
-
displayOptions: { show: { resource: ['lead'], operation: ['create', 'update'] } },
|
415
|
-
},
|
416
|
-
{
|
417
|
-
displayName: 'Ordenar Por Name or ID',
|
418
|
-
name: 'orderBy',
|
281
|
+
displayName: 'ID Name or ID',
|
282
|
+
name: 'id',
|
419
283
|
type: 'options',
|
420
|
-
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
421
|
-
typeOptions: { loadOptionsMethod: 'getLeadFields' },
|
422
|
-
default: '',
|
423
|
-
displayOptions: { show: { resource: ['lead'], operation: ['getAll'] } },
|
424
|
-
},
|
425
|
-
{
|
426
|
-
displayName: 'Limite',
|
427
|
-
name: 'limit',
|
428
|
-
type: 'number',
|
429
284
|
typeOptions: {
|
430
|
-
|
285
|
+
loadOptionsMethod: 'getAllResources',
|
431
286
|
},
|
432
|
-
description: 'Max number of results to return',
|
433
|
-
default: 50,
|
434
|
-
displayOptions: { show: { resource: ['lead'], operation: ['getAll'] } },
|
435
|
-
},
|
436
|
-
{
|
437
|
-
displayName: 'Offset',
|
438
|
-
name: 'offset',
|
439
|
-
type: 'number',
|
440
|
-
default: 0,
|
441
|
-
typeOptions: { minValue: 0 },
|
442
|
-
displayOptions: { show: { resource: ['lead'], operation: ['getAll'] } },
|
443
|
-
},
|
444
|
-
{
|
445
|
-
displayName: 'Use Custom Schema',
|
446
|
-
name: 'useCustomSchema',
|
447
|
-
type: 'boolean',
|
448
|
-
default: false,
|
449
|
-
description: 'Whether to allow using custom fields/schema',
|
450
|
-
},
|
451
|
-
{
|
452
|
-
displayName: 'Operation',
|
453
|
-
name: 'operation',
|
454
|
-
type: 'options',
|
455
|
-
noDataExpression: true,
|
456
|
-
displayOptions: { show: { resource: ['contrato'] } },
|
457
|
-
options: [
|
458
|
-
{ name: 'Create', value: 'create', description: 'Create new contract', action: 'Create new contract' },
|
459
|
-
{ name: 'Get', value: 'get', description: 'Get contract by ID', action: 'Get contract by ID' },
|
460
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many contracts', action: 'Get many contracts' },
|
461
|
-
{ name: 'Update', value: 'update', description: 'Update contract', action: 'Update contract' },
|
462
|
-
],
|
463
|
-
default: 'create',
|
464
|
-
},
|
465
|
-
{
|
466
|
-
displayName: 'Client Name',
|
467
|
-
name: 'cliente',
|
468
|
-
type: 'string',
|
469
|
-
default: '',
|
470
|
-
required: true,
|
471
|
-
displayOptions: { show: { resource: ['contrato'], operation: ['create'] } },
|
472
|
-
description: 'Client name for the contract',
|
473
|
-
},
|
474
|
-
{
|
475
|
-
displayName: 'Value',
|
476
|
-
name: 'valor',
|
477
|
-
type: 'number',
|
478
|
-
default: 0,
|
479
|
-
displayOptions: { show: { resource: ['contrato'], operation: ['create'] } },
|
480
|
-
description: 'Contract value',
|
481
|
-
},
|
482
|
-
{
|
483
|
-
displayName: 'Start Date',
|
484
|
-
name: 'dataInicio',
|
485
|
-
type: 'string',
|
486
|
-
default: '',
|
487
|
-
displayOptions: { show: { resource: ['contrato'], operation: ['create'] } },
|
488
|
-
description: 'Contract start date',
|
489
|
-
},
|
490
|
-
{
|
491
|
-
displayName: 'Name',
|
492
|
-
name: 'name',
|
493
|
-
type: 'string',
|
494
|
-
default: '',
|
495
287
|
required: true,
|
496
|
-
displayOptions: {
|
497
|
-
show: {
|
498
|
-
resource: ['lead'],
|
499
|
-
operation: ['create'],
|
500
|
-
},
|
501
|
-
},
|
502
|
-
description: 'Lead name',
|
503
|
-
},
|
504
|
-
{
|
505
|
-
displayName: 'Email',
|
506
|
-
name: 'email',
|
507
|
-
type: 'string',
|
508
|
-
placeholder: 'name@email.com',
|
509
288
|
default: '',
|
289
|
+
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
510
290
|
displayOptions: {
|
511
291
|
show: {
|
512
|
-
|
513
|
-
|
292
|
+
operation: ['get', 'update', 'delete'],
|
293
|
+
resource: ['lead', 'property', 'contact', 'contrato', 'financeiro', 'locacao', 'documento', 'tarefa', 'agenda', 'integracao', 'usuario'],
|
514
294
|
},
|
515
295
|
},
|
516
|
-
description: 'Lead email',
|
517
296
|
},
|
518
|
-
|
519
|
-
|
520
|
-
|
297
|
+
createFiltersProperty(),
|
298
|
+
createCreateFieldsProperty('lead'),
|
299
|
+
createCreateFieldsProperty('property'),
|
300
|
+
createCreateFieldsProperty('contact'),
|
301
|
+
createCreateFieldsProperty('contrato'),
|
302
|
+
createCreateFieldsProperty('financeiro'),
|
303
|
+
createCreateFieldsProperty('locacao'),
|
304
|
+
createCreateFieldsProperty('documento'),
|
305
|
+
createCreateFieldsProperty('tarefa'),
|
306
|
+
createCreateFieldsProperty('agenda'),
|
307
|
+
createCreateFieldsProperty('integracao'),
|
308
|
+
createCreateFieldsProperty('usuario'),
|
309
|
+
createUpdateFieldsProperty('lead'),
|
310
|
+
createUpdateFieldsProperty('property'),
|
311
|
+
createUpdateFieldsProperty('contact'),
|
312
|
+
createUpdateFieldsProperty('contrato'),
|
313
|
+
createUpdateFieldsProperty('financeiro'),
|
314
|
+
createUpdateFieldsProperty('locacao'),
|
315
|
+
createUpdateFieldsProperty('documento'),
|
316
|
+
createUpdateFieldsProperty('tarefa'),
|
317
|
+
createUpdateFieldsProperty('agenda'),
|
318
|
+
createUpdateFieldsProperty('integracao'),
|
319
|
+
createUpdateFieldsProperty('usuario'),
|
320
|
+
{
|
321
|
+
displayName: 'Order By',
|
322
|
+
name: 'orderBy',
|
521
323
|
type: 'string',
|
522
324
|
default: '',
|
325
|
+
description: 'Field to order by',
|
523
326
|
displayOptions: {
|
524
327
|
show: {
|
525
|
-
|
526
|
-
operation: ['create'],
|
328
|
+
operation: ['getAll'],
|
527
329
|
},
|
528
330
|
},
|
529
|
-
description: 'Lead phone',
|
530
|
-
},
|
531
|
-
{
|
532
|
-
displayName: 'Operation',
|
533
|
-
name: 'operation',
|
534
|
-
type: 'options',
|
535
|
-
noDataExpression: true,
|
536
|
-
displayOptions: { show: { resource: ['property'] } },
|
537
|
-
options: [
|
538
|
-
{ name: 'Create', value: 'create', description: 'Criar novo imovel', action: 'Criar novo imovel' },
|
539
|
-
{ name: 'Delete', value: 'delete', description: 'Deletar imovel', action: 'Deletar imovel' },
|
540
|
-
{ name: 'Get', value: 'get', description: 'Obter imovel por ID', action: 'Obter imovel por id' },
|
541
|
-
{ name: 'Get Many', value: 'getAll', description: 'Listar imoveis', action: 'Listar imoveis' },
|
542
|
-
{ name: 'Update', value: 'update', description: 'Atualizar imovel', action: 'Atualizar imovel' },
|
543
|
-
],
|
544
|
-
default: 'create',
|
545
|
-
},
|
546
|
-
{
|
547
|
-
displayName: 'Título',
|
548
|
-
name: 'title',
|
549
|
-
type: 'string',
|
550
|
-
default: '',
|
551
|
-
required: true,
|
552
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
553
|
-
description: 'Título do imóvel',
|
554
|
-
},
|
555
|
-
{
|
556
|
-
displayName: 'Tipo',
|
557
|
-
name: 'type',
|
558
|
-
type: 'options',
|
559
|
-
options: [
|
560
|
-
{ name: 'Apartamento', value: 'apartment' },
|
561
|
-
{ name: 'Casa', value: 'house' },
|
562
|
-
{ name: 'Comercial', value: 'commercial' },
|
563
|
-
{ name: 'Outro', value: 'other' },
|
564
|
-
{ name: 'Terreno', value: 'land' },
|
565
|
-
],
|
566
|
-
default: 'house',
|
567
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
568
|
-
description: 'Tipo do imóvel',
|
569
|
-
},
|
570
|
-
{
|
571
|
-
displayName: 'Status',
|
572
|
-
name: 'status',
|
573
|
-
type: 'options',
|
574
|
-
options: [
|
575
|
-
{ name: 'Alugado', value: 'rented' },
|
576
|
-
{ name: 'Disponível', value: 'available' },
|
577
|
-
{ name: 'Outro', value: 'other' },
|
578
|
-
{ name: 'Pendente', value: 'pending' },
|
579
|
-
{ name: 'Suspenso', value: 'suspended' },
|
580
|
-
{ name: 'Vendido', value: 'sold' },
|
581
|
-
],
|
582
|
-
default: 'available',
|
583
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
584
|
-
description: 'Status do imóvel',
|
585
|
-
},
|
586
|
-
{
|
587
|
-
displayName: 'Valor',
|
588
|
-
name: 'price',
|
589
|
-
type: 'number',
|
590
|
-
default: 0,
|
591
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
592
|
-
description: 'Valor do imóvel',
|
593
|
-
},
|
594
|
-
{
|
595
|
-
displayName: 'Endereço',
|
596
|
-
name: 'address',
|
597
|
-
type: 'string',
|
598
|
-
default: '',
|
599
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
600
|
-
description: 'Endereço do imóvel',
|
601
331
|
},
|
602
332
|
{
|
603
|
-
displayName: '
|
604
|
-
name: 'owner',
|
605
|
-
type: 'string',
|
606
|
-
default: '',
|
607
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
608
|
-
description: 'Nome ou ID do proprietário',
|
609
|
-
},
|
610
|
-
{
|
611
|
-
displayName: 'Imagens (URLs)',
|
612
|
-
name: 'images',
|
613
|
-
type: 'string',
|
614
|
-
default: '',
|
615
|
-
displayOptions: { show: { resource: ['property'], operation: ['create'] } },
|
616
|
-
description: 'URLs das imagens separadas por vírgula',
|
617
|
-
},
|
618
|
-
{
|
619
|
-
displayName: 'Update Fields',
|
620
|
-
name: 'updateFields',
|
621
|
-
type: 'collection',
|
622
|
-
placeholder: 'Add Field',
|
623
|
-
default: {},
|
624
|
-
displayOptions: {
|
625
|
-
show: {
|
626
|
-
resource: ['property'],
|
627
|
-
operation: ['update'],
|
628
|
-
},
|
629
|
-
},
|
630
|
-
options: [
|
631
|
-
{
|
632
|
-
displayName: 'Endereço',
|
633
|
-
name: 'address',
|
634
|
-
type: 'string',
|
635
|
-
default: '',
|
636
|
-
description: 'Endereço do imóvel',
|
637
|
-
},
|
638
|
-
{
|
639
|
-
displayName: 'Imagens (URLs)',
|
640
|
-
name: 'images',
|
641
|
-
type: 'string',
|
642
|
-
default: '',
|
643
|
-
description: 'URLs das imagens separadas por vírgula',
|
644
|
-
},
|
645
|
-
{
|
646
|
-
displayName: 'Proprietário',
|
647
|
-
name: 'owner',
|
648
|
-
type: 'string',
|
649
|
-
default: '',
|
650
|
-
description: 'Nome ou ID do proprietário',
|
651
|
-
},
|
652
|
-
{
|
653
|
-
displayName: 'Status',
|
654
|
-
name: 'status',
|
655
|
-
type: 'options',
|
656
|
-
options: [
|
657
|
-
{ name: 'Alugado', value: 'rented' },
|
658
|
-
{ name: 'Disponível', value: 'available' },
|
659
|
-
{ name: 'Outro', value: 'other' },
|
660
|
-
{ name: 'Pendente', value: 'pending' },
|
661
|
-
{ name: 'Suspenso', value: 'suspended' },
|
662
|
-
{ name: 'Vendido', value: 'sold' },
|
663
|
-
],
|
664
|
-
default: 'available',
|
665
|
-
description: 'Status do imóvel',
|
666
|
-
},
|
667
|
-
{
|
668
|
-
displayName: 'Tipo',
|
669
|
-
name: 'type',
|
670
|
-
type: 'options',
|
671
|
-
options: [
|
672
|
-
{ name: 'Apartamento', value: 'apartment' },
|
673
|
-
{ name: 'Casa', value: 'house' },
|
674
|
-
{ name: 'Comercial', value: 'commercial' },
|
675
|
-
{ name: 'Outro', value: 'other' },
|
676
|
-
{ name: 'Terreno', value: 'land' },
|
677
|
-
],
|
678
|
-
default: 'house',
|
679
|
-
description: 'Tipo do imóvel',
|
680
|
-
},
|
681
|
-
{
|
682
|
-
displayName: 'Título',
|
683
|
-
name: 'title',
|
684
|
-
type: 'string',
|
685
|
-
default: '',
|
686
|
-
description: 'Título do imóvel',
|
687
|
-
},
|
688
|
-
{
|
689
|
-
displayName: 'Valor',
|
690
|
-
name: 'price',
|
691
|
-
type: 'number',
|
692
|
-
default: 0,
|
693
|
-
description: 'Valor do imóvel',
|
694
|
-
},
|
695
|
-
],
|
696
|
-
},
|
697
|
-
{
|
698
|
-
displayName: 'Ordenar Por Name or ID',
|
699
|
-
name: 'orderBy',
|
700
|
-
type: 'options',
|
701
|
-
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
702
|
-
typeOptions: { loadOptionsMethod: 'getPropertyFields' },
|
703
|
-
default: '',
|
704
|
-
displayOptions: { show: { resource: ['property'], operation: ['getAll'] } },
|
705
|
-
},
|
706
|
-
{
|
707
|
-
displayName: 'Limite',
|
333
|
+
displayName: 'Limit',
|
708
334
|
name: 'limit',
|
709
335
|
type: 'number',
|
710
336
|
typeOptions: {
|
@@ -712,7 +338,11 @@ class Imobzi {
|
|
712
338
|
},
|
713
339
|
description: 'Max number of results to return',
|
714
340
|
default: 50,
|
715
|
-
displayOptions: {
|
341
|
+
displayOptions: {
|
342
|
+
show: {
|
343
|
+
operation: ['getAll'],
|
344
|
+
},
|
345
|
+
},
|
716
346
|
},
|
717
347
|
{
|
718
348
|
displayName: 'Offset',
|
@@ -720,295 +350,12 @@ class Imobzi {
|
|
720
350
|
type: 'number',
|
721
351
|
default: 0,
|
722
352
|
typeOptions: { minValue: 0 },
|
723
|
-
|
724
|
-
},
|
725
|
-
{
|
726
|
-
displayName: 'Name',
|
727
|
-
name: 'contactName',
|
728
|
-
type: 'string',
|
729
|
-
default: '',
|
730
|
-
required: true,
|
731
|
-
displayOptions: {
|
732
|
-
show: {
|
733
|
-
resource: ['contact'],
|
734
|
-
operation: ['create'],
|
735
|
-
},
|
736
|
-
},
|
737
|
-
description: 'Contact name',
|
738
|
-
},
|
739
|
-
{
|
740
|
-
displayName: 'Email',
|
741
|
-
name: 'contactEmail',
|
742
|
-
type: 'string',
|
743
|
-
default: '',
|
744
|
-
displayOptions: {
|
745
|
-
show: {
|
746
|
-
resource: ['contact'],
|
747
|
-
operation: ['create'],
|
748
|
-
},
|
749
|
-
},
|
750
|
-
description: 'Contact email',
|
751
|
-
},
|
752
|
-
{
|
753
|
-
displayName: 'Phone',
|
754
|
-
name: 'contactPhone',
|
755
|
-
type: 'string',
|
756
|
-
default: '',
|
353
|
+
description: 'Number of items to skip',
|
757
354
|
displayOptions: {
|
758
355
|
show: {
|
759
|
-
|
760
|
-
operation: ['create'],
|
356
|
+
operation: ['getAll'],
|
761
357
|
},
|
762
358
|
},
|
763
|
-
description: 'Contact phone',
|
764
|
-
},
|
765
|
-
{
|
766
|
-
displayName: 'Operation',
|
767
|
-
name: 'operation',
|
768
|
-
type: 'options',
|
769
|
-
noDataExpression: true,
|
770
|
-
displayOptions: { show: { resource: ['financeiro'] } },
|
771
|
-
options: [
|
772
|
-
{ name: 'Create', value: 'create', description: 'Create new entry', action: 'Create new entry' },
|
773
|
-
{ name: 'Get', value: 'get', description: 'Get entry by ID', action: 'Get entry by ID' },
|
774
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many entries', action: 'Get many entries' },
|
775
|
-
{ name: 'Update', value: 'update', description: 'Update entry', action: 'Update entry' },
|
776
|
-
],
|
777
|
-
default: 'create',
|
778
|
-
},
|
779
|
-
{
|
780
|
-
displayName: 'Description',
|
781
|
-
name: 'descricao',
|
782
|
-
type: 'string',
|
783
|
-
default: '',
|
784
|
-
required: true,
|
785
|
-
displayOptions: { show: { resource: ['financeiro'], operation: ['create'] } },
|
786
|
-
description: 'Entry description',
|
787
|
-
},
|
788
|
-
{
|
789
|
-
displayName: 'Value',
|
790
|
-
name: 'valor',
|
791
|
-
type: 'number',
|
792
|
-
default: 0,
|
793
|
-
displayOptions: { show: { resource: ['financeiro'], operation: ['create'] } },
|
794
|
-
description: 'Entry value',
|
795
|
-
},
|
796
|
-
{
|
797
|
-
displayName: 'Date',
|
798
|
-
name: 'data',
|
799
|
-
type: 'string',
|
800
|
-
default: '',
|
801
|
-
displayOptions: { show: { resource: ['financeiro'], operation: ['create'] } },
|
802
|
-
description: 'Entry date',
|
803
|
-
},
|
804
|
-
{
|
805
|
-
displayName: 'Operation',
|
806
|
-
name: 'operation',
|
807
|
-
type: 'options',
|
808
|
-
noDataExpression: true,
|
809
|
-
displayOptions: { show: { resource: ['locacao'] } },
|
810
|
-
options: [
|
811
|
-
{ name: 'Create', value: 'create', description: 'Create new rental', action: 'Create new rental' },
|
812
|
-
{ name: 'Get', value: 'get', description: 'Get rental by ID', action: 'Get rental by ID' },
|
813
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many rentals', action: 'Get many rentals' },
|
814
|
-
{ name: 'Update', value: 'update', description: 'Update rental', action: 'Update rental' },
|
815
|
-
],
|
816
|
-
default: 'create',
|
817
|
-
},
|
818
|
-
{
|
819
|
-
displayName: 'Tenant Name',
|
820
|
-
name: 'inquilino',
|
821
|
-
type: 'string',
|
822
|
-
default: '',
|
823
|
-
required: true,
|
824
|
-
displayOptions: { show: { resource: ['locacao'], operation: ['create'] } },
|
825
|
-
},
|
826
|
-
{
|
827
|
-
displayName: 'Property',
|
828
|
-
name: 'imovel',
|
829
|
-
type: 'string',
|
830
|
-
default: '',
|
831
|
-
displayOptions: { show: { resource: ['locacao'], operation: ['create'] } },
|
832
|
-
description: 'Rented property ID',
|
833
|
-
},
|
834
|
-
{
|
835
|
-
displayName: 'Start Date',
|
836
|
-
name: 'dataInicio',
|
837
|
-
type: 'string',
|
838
|
-
default: '',
|
839
|
-
displayOptions: { show: { resource: ['locacao'], operation: ['create'] } },
|
840
|
-
description: 'Rental start date',
|
841
|
-
},
|
842
|
-
{
|
843
|
-
displayName: 'Operation',
|
844
|
-
name: 'operation',
|
845
|
-
type: 'options',
|
846
|
-
noDataExpression: true,
|
847
|
-
displayOptions: { show: { resource: ['documento'] } },
|
848
|
-
options: [
|
849
|
-
{ name: 'Create', value: 'create', description: 'Upload document', action: 'Upload document' },
|
850
|
-
{ name: 'Get', value: 'get', description: 'Get document by ID', action: 'Get document by ID' },
|
851
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many documents', action: 'Get many documents' },
|
852
|
-
{ name: 'Update', value: 'update', description: 'Update document', action: 'Update document' },
|
853
|
-
],
|
854
|
-
default: 'create',
|
855
|
-
},
|
856
|
-
{
|
857
|
-
displayName: 'File Name',
|
858
|
-
name: 'nomeArquivo',
|
859
|
-
type: 'string',
|
860
|
-
default: '',
|
861
|
-
required: true,
|
862
|
-
displayOptions: { show: { resource: ['documento'], operation: ['create'] } },
|
863
|
-
description: 'Name of the file to upload',
|
864
|
-
},
|
865
|
-
{
|
866
|
-
displayName: 'Content (Base64)',
|
867
|
-
name: 'conteudo',
|
868
|
-
type: 'string',
|
869
|
-
default: '',
|
870
|
-
displayOptions: { show: { resource: ['documento'], operation: ['create'] } },
|
871
|
-
description: 'File content in base64',
|
872
|
-
},
|
873
|
-
{
|
874
|
-
displayName: 'Operation',
|
875
|
-
name: 'operation',
|
876
|
-
type: 'options',
|
877
|
-
noDataExpression: true,
|
878
|
-
displayOptions: { show: { resource: ['tarefa'] } },
|
879
|
-
options: [
|
880
|
-
{ name: 'Create', value: 'create', description: 'Create new task', action: 'Create new task' },
|
881
|
-
{ name: 'Get', value: 'get', description: 'Get task by ID', action: 'Get task by ID' },
|
882
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many tasks', action: 'Get many tasks' },
|
883
|
-
{ name: 'Update', value: 'update', description: 'Update task', action: 'Update task' },
|
884
|
-
],
|
885
|
-
default: 'create',
|
886
|
-
},
|
887
|
-
{
|
888
|
-
displayName: 'Title',
|
889
|
-
name: 'titulo',
|
890
|
-
type: 'string',
|
891
|
-
default: '',
|
892
|
-
required: true,
|
893
|
-
displayOptions: { show: { resource: ['tarefa'], operation: ['create'] } },
|
894
|
-
description: 'Task title',
|
895
|
-
},
|
896
|
-
{
|
897
|
-
displayName: 'Description',
|
898
|
-
name: 'descricao',
|
899
|
-
type: 'string',
|
900
|
-
default: '',
|
901
|
-
displayOptions: { show: { resource: ['tarefa'], operation: ['create'] } },
|
902
|
-
description: 'Task description',
|
903
|
-
},
|
904
|
-
{
|
905
|
-
displayName: 'Due Date',
|
906
|
-
name: 'dataVencimento',
|
907
|
-
type: 'string',
|
908
|
-
default: '',
|
909
|
-
displayOptions: { show: { resource: ['tarefa'], operation: ['create'] } },
|
910
|
-
description: 'Task due date',
|
911
|
-
},
|
912
|
-
{
|
913
|
-
displayName: 'Operation',
|
914
|
-
name: 'operation',
|
915
|
-
type: 'options',
|
916
|
-
noDataExpression: true,
|
917
|
-
displayOptions: { show: { resource: ['agenda'] } },
|
918
|
-
options: [
|
919
|
-
{ name: 'Create', value: 'create', description: 'Create new event', action: 'Create new event' },
|
920
|
-
{ name: 'Get', value: 'get', description: 'Get event by ID', action: 'Get event by ID' },
|
921
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many events', action: 'Get many events' },
|
922
|
-
{ name: 'Update', value: 'update', description: 'Update event', action: 'Update event' },
|
923
|
-
],
|
924
|
-
default: 'create',
|
925
|
-
},
|
926
|
-
{
|
927
|
-
displayName: 'Title',
|
928
|
-
name: 'titulo',
|
929
|
-
type: 'string',
|
930
|
-
default: '',
|
931
|
-
required: true,
|
932
|
-
displayOptions: { show: { resource: ['agenda'], operation: ['create'] } },
|
933
|
-
description: 'Event title',
|
934
|
-
},
|
935
|
-
{
|
936
|
-
displayName: 'Date',
|
937
|
-
name: 'data',
|
938
|
-
type: 'string',
|
939
|
-
default: '',
|
940
|
-
displayOptions: { show: { resource: ['agenda'], operation: ['create'] } },
|
941
|
-
description: 'Event date',
|
942
|
-
},
|
943
|
-
{
|
944
|
-
displayName: 'Description',
|
945
|
-
name: 'descricao',
|
946
|
-
type: 'string',
|
947
|
-
default: '',
|
948
|
-
displayOptions: { show: { resource: ['agenda'], operation: ['create'] } },
|
949
|
-
description: 'Event description',
|
950
|
-
},
|
951
|
-
{
|
952
|
-
displayName: 'Operation',
|
953
|
-
name: 'operation',
|
954
|
-
type: 'options',
|
955
|
-
noDataExpression: true,
|
956
|
-
displayOptions: { show: { resource: ['integracao'] } },
|
957
|
-
options: [
|
958
|
-
{ name: 'Create', value: 'create', description: 'Create new integration', action: 'Create new integration' },
|
959
|
-
{ name: 'Get', value: 'get', description: 'Get integration by ID', action: 'Get integration by ID' },
|
960
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many integrations', action: 'Get many integrations' },
|
961
|
-
{ name: 'Update', value: 'update', description: 'Update integration', action: 'Update integration' },
|
962
|
-
],
|
963
|
-
default: 'create',
|
964
|
-
},
|
965
|
-
{
|
966
|
-
displayName: 'Integration Name',
|
967
|
-
name: 'nome',
|
968
|
-
type: 'string',
|
969
|
-
default: '',
|
970
|
-
required: true,
|
971
|
-
displayOptions: { show: { resource: ['integracao'], operation: ['create'] } },
|
972
|
-
},
|
973
|
-
{
|
974
|
-
displayName: 'Type',
|
975
|
-
name: 'tipo',
|
976
|
-
type: 'string',
|
977
|
-
default: '',
|
978
|
-
displayOptions: { show: { resource: ['integracao'], operation: ['create'] } },
|
979
|
-
description: 'Integration type',
|
980
|
-
},
|
981
|
-
{
|
982
|
-
displayName: 'Operation',
|
983
|
-
name: 'operation',
|
984
|
-
type: 'options',
|
985
|
-
noDataExpression: true,
|
986
|
-
displayOptions: { show: { resource: ['usuario'] } },
|
987
|
-
options: [
|
988
|
-
{ name: 'Create', value: 'create', description: 'Create new user/agent', action: 'Create new user agent' },
|
989
|
-
{ name: 'Get', value: 'get', description: 'Get user/agent by ID', action: 'Get user agent by id' },
|
990
|
-
{ name: 'Get Many', value: 'getAll', description: 'Get many users/agents', action: 'Get many users agents' },
|
991
|
-
{ name: 'Update', value: 'update', description: 'Update user/agent', action: 'Update user agent' },
|
992
|
-
],
|
993
|
-
default: 'create',
|
994
|
-
},
|
995
|
-
{
|
996
|
-
displayName: 'Name',
|
997
|
-
name: 'nome',
|
998
|
-
type: 'string',
|
999
|
-
default: '',
|
1000
|
-
required: true,
|
1001
|
-
displayOptions: { show: { resource: ['usuario'], operation: ['create'] } },
|
1002
|
-
description: 'User/Agent name',
|
1003
|
-
},
|
1004
|
-
{
|
1005
|
-
displayName: 'Email',
|
1006
|
-
name: 'email',
|
1007
|
-
type: 'string',
|
1008
|
-
placeholder: 'name@email.com',
|
1009
|
-
default: '',
|
1010
|
-
displayOptions: { show: { resource: ['usuario'], operation: ['create'] } },
|
1011
|
-
description: 'User/Agent email',
|
1012
359
|
},
|
1013
360
|
],
|
1014
361
|
};
|
@@ -1016,395 +363,86 @@ class Imobzi {
|
|
1016
363
|
async execute() {
|
1017
364
|
const items = this.getInputData();
|
1018
365
|
const returnData = [];
|
1019
|
-
const
|
1020
|
-
|
1021
|
-
const credentials = await this.getCredentials('imobziApi');
|
1022
|
-
const apiUrl = 'https://api.imobzi.app/v1';
|
1023
|
-
const processFilters = (filters) => {
|
1024
|
-
const processedFilters = {};
|
366
|
+
const buildQueryFromFilters = (filters) => {
|
367
|
+
const query = {};
|
1025
368
|
if (filters && filters.filter && Array.isArray(filters.filter)) {
|
1026
369
|
filters.filter.forEach((filter) => {
|
1027
370
|
if (filter.field && filter.operator && filter.value !== undefined) {
|
1028
|
-
const
|
1029
|
-
|
1030
|
-
const value = filter.value;
|
1031
|
-
const filterKey = `${fieldName}_${operator}`;
|
1032
|
-
processedFilters[filterKey] = value;
|
371
|
+
const filterKey = `${filter.field}_${filter.operator}`;
|
372
|
+
query[filterKey] = filter.value;
|
1033
373
|
}
|
1034
374
|
});
|
1035
375
|
}
|
1036
|
-
return
|
376
|
+
return query;
|
1037
377
|
};
|
1038
378
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
1039
379
|
try {
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
if (['get', 'getAll', 'delete'].includes(operation)) {
|
1046
|
-
const filters = this.getNodeParameter('filters', itemIndex);
|
1047
|
-
const processedFilters = processFilters(filters);
|
1048
|
-
if (Object.keys(processedFilters).length > 0) {
|
1049
|
-
qs = { ...qs, ...processedFilters };
|
1050
|
-
}
|
1051
|
-
}
|
1052
|
-
if (resource === 'lead') {
|
1053
|
-
if (operation === 'create') {
|
1054
|
-
method = 'POST';
|
1055
|
-
endpoint = '/leads';
|
1056
|
-
body = {
|
1057
|
-
name: this.getNodeParameter('name', itemIndex),
|
1058
|
-
email: this.getNodeParameter('email', itemIndex),
|
1059
|
-
phone: this.getNodeParameter('phone', itemIndex),
|
1060
|
-
};
|
1061
|
-
}
|
1062
|
-
else if (operation === 'get') {
|
1063
|
-
method = 'GET';
|
1064
|
-
endpoint = `/lead/${this.getNodeParameter('id', itemIndex)}`;
|
1065
|
-
}
|
1066
|
-
else if (operation === 'getAll') {
|
1067
|
-
method = 'GET';
|
1068
|
-
endpoint = '/leads';
|
1069
|
-
const orderBy = this.getNodeParameter('orderBy', itemIndex);
|
1070
|
-
const limit = this.getNodeParameter('limit', itemIndex);
|
1071
|
-
const offset = this.getNodeParameter('offset', itemIndex);
|
1072
|
-
if (orderBy) {
|
1073
|
-
qs.orderBy = orderBy;
|
1074
|
-
}
|
1075
|
-
if (limit) {
|
1076
|
-
qs.limit = limit;
|
1077
|
-
}
|
1078
|
-
if (offset) {
|
1079
|
-
qs.offset = offset;
|
1080
|
-
}
|
1081
|
-
}
|
1082
|
-
else if (operation === 'update') {
|
1083
|
-
method = 'PUT';
|
1084
|
-
endpoint = `/lead/${this.getNodeParameter('id', itemIndex)}`;
|
1085
|
-
body = {
|
1086
|
-
name: this.getNodeParameter('name', itemIndex),
|
1087
|
-
email: this.getNodeParameter('email', itemIndex),
|
1088
|
-
phone: this.getNodeParameter('phone', itemIndex),
|
1089
|
-
};
|
1090
|
-
}
|
1091
|
-
else if (operation === 'delete') {
|
1092
|
-
method = 'DELETE';
|
1093
|
-
endpoint = `/lead/${this.getNodeParameter('id', itemIndex)}`;
|
1094
|
-
}
|
380
|
+
const resource = this.getNodeParameter('resource', itemIndex);
|
381
|
+
const operation = this.getNodeParameter('operation', itemIndex);
|
382
|
+
const endpoint = resourceEndpoint[resource];
|
383
|
+
if (!endpoint) {
|
384
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Recurso "${resource}" não suportado!`);
|
1095
385
|
}
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
const imagesParam = this.getNodeParameter('images', itemIndex);
|
1101
|
-
body = {
|
1102
|
-
title: this.getNodeParameter('title', itemIndex),
|
1103
|
-
type: this.getNodeParameter('type', itemIndex),
|
1104
|
-
status: this.getNodeParameter('status', itemIndex),
|
1105
|
-
price: this.getNodeParameter('price', itemIndex),
|
1106
|
-
address: this.getNodeParameter('address', itemIndex),
|
1107
|
-
owner: this.getNodeParameter('owner', itemIndex),
|
1108
|
-
images: typeof imagesParam === 'string' ? imagesParam.split(',').map((i) => i.trim()).filter(Boolean) : [],
|
1109
|
-
};
|
1110
|
-
}
|
1111
|
-
else if (operation === 'get') {
|
1112
|
-
method = 'GET';
|
1113
|
-
endpoint = `/property/${this.getNodeParameter('id', itemIndex)}`;
|
1114
|
-
}
|
1115
|
-
else if (operation === 'getAll') {
|
1116
|
-
method = 'GET';
|
1117
|
-
endpoint = '/properties';
|
386
|
+
let response;
|
387
|
+
switch (operation) {
|
388
|
+
case 'getAll': {
|
389
|
+
const filters = this.getNodeParameter('filters', itemIndex, {});
|
1118
390
|
const orderBy = this.getNodeParameter('orderBy', itemIndex);
|
1119
391
|
const limit = this.getNodeParameter('limit', itemIndex);
|
1120
392
|
const offset = this.getNodeParameter('offset', itemIndex);
|
1121
|
-
|
393
|
+
const qs = buildQueryFromFilters(filters);
|
394
|
+
if (orderBy)
|
1122
395
|
qs.orderBy = orderBy;
|
1123
|
-
|
1124
|
-
if (limit) {
|
396
|
+
if (limit)
|
1125
397
|
qs.limit = limit;
|
1126
|
-
|
1127
|
-
if (offset) {
|
398
|
+
if (offset)
|
1128
399
|
qs.offset = offset;
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
};
|
1173
|
-
}
|
1174
|
-
}
|
1175
|
-
else if (resource === 'contrato') {
|
1176
|
-
if (operation === 'create') {
|
1177
|
-
method = 'POST';
|
1178
|
-
endpoint = '/contracts';
|
1179
|
-
body = {
|
1180
|
-
cliente: this.getNodeParameter('cliente', itemIndex),
|
1181
|
-
valor: this.getNodeParameter('valor', itemIndex),
|
1182
|
-
dataInicio: this.getNodeParameter('dataInicio', itemIndex),
|
1183
|
-
};
|
1184
|
-
}
|
1185
|
-
else if (operation === 'get') {
|
1186
|
-
method = 'GET';
|
1187
|
-
endpoint = `/contract/${this.getNodeParameter('id', itemIndex)}`;
|
1188
|
-
}
|
1189
|
-
else if (operation === 'getAll') {
|
1190
|
-
method = 'GET';
|
1191
|
-
endpoint = '/contracts';
|
1192
|
-
}
|
1193
|
-
else if (operation === 'update') {
|
1194
|
-
method = 'PUT';
|
1195
|
-
endpoint = `/contract/${this.getNodeParameter('id', itemIndex)}`;
|
1196
|
-
body = {
|
1197
|
-
cliente: this.getNodeParameter('cliente', itemIndex),
|
1198
|
-
valor: this.getNodeParameter('valor', itemIndex),
|
1199
|
-
dataInicio: this.getNodeParameter('dataInicio', itemIndex),
|
1200
|
-
};
|
1201
|
-
}
|
1202
|
-
}
|
1203
|
-
else if (resource === 'financeiro') {
|
1204
|
-
if (operation === 'create') {
|
1205
|
-
method = 'POST';
|
1206
|
-
endpoint = '/financial/accounts';
|
1207
|
-
body = {
|
1208
|
-
descricao: this.getNodeParameter('descricao', itemIndex),
|
1209
|
-
valor: this.getNodeParameter('valor', itemIndex),
|
1210
|
-
data: this.getNodeParameter('data', itemIndex),
|
1211
|
-
};
|
1212
|
-
}
|
1213
|
-
else if (operation === 'get') {
|
1214
|
-
method = 'GET';
|
1215
|
-
endpoint = `/financial/account/${this.getNodeParameter('id', itemIndex)}`;
|
1216
|
-
}
|
1217
|
-
else if (operation === 'getAll') {
|
1218
|
-
method = 'GET';
|
1219
|
-
endpoint = '/financial/accounts';
|
1220
|
-
}
|
1221
|
-
else if (operation === 'update') {
|
1222
|
-
method = 'PUT';
|
1223
|
-
endpoint = `/financial/account/${this.getNodeParameter('id', itemIndex)}`;
|
1224
|
-
body = {
|
1225
|
-
descricao: this.getNodeParameter('descricao', itemIndex),
|
1226
|
-
valor: this.getNodeParameter('valor', itemIndex),
|
1227
|
-
data: this.getNodeParameter('data', itemIndex),
|
1228
|
-
};
|
1229
|
-
}
|
1230
|
-
}
|
1231
|
-
else if (resource === 'locacao') {
|
1232
|
-
if (operation === 'create') {
|
1233
|
-
method = 'POST';
|
1234
|
-
endpoint = '/rentals';
|
1235
|
-
body = {
|
1236
|
-
inquilino: this.getNodeParameter('inquilino', itemIndex),
|
1237
|
-
imovel: this.getNodeParameter('imovel', itemIndex),
|
1238
|
-
dataInicio: this.getNodeParameter('dataInicio', itemIndex),
|
1239
|
-
};
|
1240
|
-
}
|
1241
|
-
else if (operation === 'get') {
|
1242
|
-
method = 'GET';
|
1243
|
-
endpoint = `/rental/${this.getNodeParameter('id', itemIndex)}`;
|
1244
|
-
}
|
1245
|
-
else if (operation === 'getAll') {
|
1246
|
-
method = 'GET';
|
1247
|
-
endpoint = '/rentals';
|
1248
|
-
}
|
1249
|
-
else if (operation === 'update') {
|
1250
|
-
method = 'PUT';
|
1251
|
-
endpoint = `/rental/${this.getNodeParameter('id', itemIndex)}`;
|
1252
|
-
body = {
|
1253
|
-
inquilino: this.getNodeParameter('inquilino', itemIndex),
|
1254
|
-
imovel: this.getNodeParameter('imovel', itemIndex),
|
1255
|
-
dataInicio: this.getNodeParameter('dataInicio', itemIndex),
|
1256
|
-
};
|
1257
|
-
}
|
1258
|
-
}
|
1259
|
-
else if (resource === 'documento') {
|
1260
|
-
if (operation === 'create') {
|
1261
|
-
method = 'POST';
|
1262
|
-
endpoint = '/documents';
|
1263
|
-
body = {
|
1264
|
-
nomeArquivo: this.getNodeParameter('nomeArquivo', itemIndex),
|
1265
|
-
conteudo: this.getNodeParameter('conteudo', itemIndex),
|
1266
|
-
};
|
1267
|
-
}
|
1268
|
-
else if (operation === 'get') {
|
1269
|
-
method = 'GET';
|
1270
|
-
endpoint = `/document/${this.getNodeParameter('id', itemIndex)}`;
|
1271
|
-
}
|
1272
|
-
else if (operation === 'getAll') {
|
1273
|
-
method = 'GET';
|
1274
|
-
endpoint = '/documents';
|
1275
|
-
}
|
1276
|
-
else if (operation === 'update') {
|
1277
|
-
method = 'PUT';
|
1278
|
-
endpoint = `/document/${this.getNodeParameter('id', itemIndex)}`;
|
1279
|
-
body = {
|
1280
|
-
nomeArquivo: this.getNodeParameter('nomeArquivo', itemIndex),
|
1281
|
-
conteudo: this.getNodeParameter('conteudo', itemIndex),
|
1282
|
-
};
|
1283
|
-
}
|
400
|
+
response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', {
|
401
|
+
method: 'GET',
|
402
|
+
url: `/${endpoint}`,
|
403
|
+
qs: Object.keys(qs).length > 0 ? qs : undefined,
|
404
|
+
});
|
405
|
+
break;
|
406
|
+
}
|
407
|
+
case 'get': {
|
408
|
+
const id = this.getNodeParameter('id', itemIndex);
|
409
|
+
response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', {
|
410
|
+
method: 'GET',
|
411
|
+
url: `/${endpoint}/${id}`,
|
412
|
+
});
|
413
|
+
break;
|
414
|
+
}
|
415
|
+
case 'create': {
|
416
|
+
const body = this.getNodeParameter('createFields', itemIndex);
|
417
|
+
response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', {
|
418
|
+
method: 'POST',
|
419
|
+
url: `/${endpoint}`,
|
420
|
+
body: Object.keys(body).length > 0 ? body : undefined,
|
421
|
+
});
|
422
|
+
break;
|
423
|
+
}
|
424
|
+
case 'update': {
|
425
|
+
const id = this.getNodeParameter('id', itemIndex);
|
426
|
+
const body = this.getNodeParameter('updateFields', itemIndex);
|
427
|
+
response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', {
|
428
|
+
method: 'PUT',
|
429
|
+
url: `/${endpoint}/${id}`,
|
430
|
+
body: Object.keys(body).length > 0 ? body : undefined,
|
431
|
+
});
|
432
|
+
break;
|
433
|
+
}
|
434
|
+
case 'delete': {
|
435
|
+
const id = this.getNodeParameter('id', itemIndex);
|
436
|
+
response = await this.helpers.requestWithAuthentication.call(this, 'imobziApi', {
|
437
|
+
method: 'DELETE',
|
438
|
+
url: `/${endpoint}/${id}`,
|
439
|
+
});
|
440
|
+
break;
|
441
|
+
}
|
442
|
+
default:
|
443
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operação "${operation}" não suportada!`);
|
1284
444
|
}
|
1285
|
-
|
1286
|
-
if (operation === 'create') {
|
1287
|
-
method = 'POST';
|
1288
|
-
endpoint = '/tasks';
|
1289
|
-
body = {
|
1290
|
-
titulo: this.getNodeParameter('titulo', itemIndex),
|
1291
|
-
descricao: this.getNodeParameter('descricao', itemIndex),
|
1292
|
-
dataVencimento: this.getNodeParameter('dataVencimento', itemIndex),
|
1293
|
-
};
|
1294
|
-
}
|
1295
|
-
else if (operation === 'get') {
|
1296
|
-
method = 'GET';
|
1297
|
-
endpoint = `/task/${this.getNodeParameter('id', itemIndex)}`;
|
1298
|
-
}
|
1299
|
-
else if (operation === 'getAll') {
|
1300
|
-
method = 'GET';
|
1301
|
-
endpoint = '/tasks';
|
1302
|
-
}
|
1303
|
-
else if (operation === 'update') {
|
1304
|
-
method = 'PUT';
|
1305
|
-
endpoint = `/task/${this.getNodeParameter('id', itemIndex)}`;
|
1306
|
-
body = {
|
1307
|
-
titulo: this.getNodeParameter('titulo', itemIndex),
|
1308
|
-
descricao: this.getNodeParameter('descricao', itemIndex),
|
1309
|
-
dataVencimento: this.getNodeParameter('dataVencimento', itemIndex),
|
1310
|
-
};
|
1311
|
-
}
|
1312
|
-
}
|
1313
|
-
else if (resource === 'agenda') {
|
1314
|
-
if (operation === 'create') {
|
1315
|
-
method = 'POST';
|
1316
|
-
endpoint = '/events';
|
1317
|
-
body = {
|
1318
|
-
titulo: this.getNodeParameter('titulo', itemIndex),
|
1319
|
-
data: this.getNodeParameter('data', itemIndex),
|
1320
|
-
descricao: this.getNodeParameter('descricao', itemIndex),
|
1321
|
-
};
|
1322
|
-
}
|
1323
|
-
else if (operation === 'get') {
|
1324
|
-
method = 'GET';
|
1325
|
-
endpoint = `/events/${this.getNodeParameter('id', itemIndex)}`;
|
1326
|
-
}
|
1327
|
-
else if (operation === 'getAll') {
|
1328
|
-
method = 'GET';
|
1329
|
-
endpoint = '/events';
|
1330
|
-
}
|
1331
|
-
else if (operation === 'update') {
|
1332
|
-
method = 'PUT';
|
1333
|
-
endpoint = `/events/${this.getNodeParameter('id', itemIndex)}`;
|
1334
|
-
body = {
|
1335
|
-
titulo: this.getNodeParameter('titulo', itemIndex),
|
1336
|
-
data: this.getNodeParameter('data', itemIndex),
|
1337
|
-
descricao: this.getNodeParameter('descricao', itemIndex),
|
1338
|
-
};
|
1339
|
-
}
|
1340
|
-
}
|
1341
|
-
else if (resource === 'integracao') {
|
1342
|
-
if (operation === 'create') {
|
1343
|
-
method = 'POST';
|
1344
|
-
endpoint = '/integrations';
|
1345
|
-
body = {
|
1346
|
-
nome: this.getNodeParameter('nome', itemIndex),
|
1347
|
-
tipo: this.getNodeParameter('tipo', itemIndex),
|
1348
|
-
};
|
1349
|
-
}
|
1350
|
-
else if (operation === 'get') {
|
1351
|
-
method = 'GET';
|
1352
|
-
endpoint = `/integrations/${this.getNodeParameter('id', itemIndex)}`;
|
1353
|
-
}
|
1354
|
-
else if (operation === 'getAll') {
|
1355
|
-
method = 'GET';
|
1356
|
-
endpoint = '/integrations';
|
1357
|
-
}
|
1358
|
-
else if (operation === 'update') {
|
1359
|
-
method = 'PUT';
|
1360
|
-
endpoint = `/integrations/${this.getNodeParameter('id', itemIndex)}`;
|
1361
|
-
body = {
|
1362
|
-
nome: this.getNodeParameter('nome', itemIndex),
|
1363
|
-
tipo: this.getNodeParameter('tipo', itemIndex),
|
1364
|
-
};
|
1365
|
-
}
|
1366
|
-
}
|
1367
|
-
else if (resource === 'usuario') {
|
1368
|
-
if (operation === 'create') {
|
1369
|
-
method = 'POST';
|
1370
|
-
endpoint = '/users';
|
1371
|
-
body = {
|
1372
|
-
name: this.getNodeParameter('name', itemIndex),
|
1373
|
-
email: this.getNodeParameter('email', itemIndex),
|
1374
|
-
};
|
1375
|
-
}
|
1376
|
-
else if (operation === 'get') {
|
1377
|
-
method = 'GET';
|
1378
|
-
endpoint = `/users/${this.getNodeParameter('id', itemIndex)}`;
|
1379
|
-
}
|
1380
|
-
else if (operation === 'getAll') {
|
1381
|
-
method = 'GET';
|
1382
|
-
endpoint = '/users';
|
1383
|
-
}
|
1384
|
-
else if (operation === 'update') {
|
1385
|
-
method = 'PUT';
|
1386
|
-
endpoint = `/users/${this.getNodeParameter('id', itemIndex)}`;
|
1387
|
-
body = {
|
1388
|
-
name: this.getNodeParameter('name', itemIndex),
|
1389
|
-
email: this.getNodeParameter('email', itemIndex),
|
1390
|
-
};
|
1391
|
-
}
|
1392
|
-
}
|
1393
|
-
else if (resource === 'account') {
|
1394
|
-
method = 'GET';
|
1395
|
-
endpoint = '/account';
|
1396
|
-
}
|
1397
|
-
response = await this.helpers.httpRequest.call(this, {
|
1398
|
-
method,
|
1399
|
-
url: `${apiUrl}${endpoint}`,
|
1400
|
-
headers: {
|
1401
|
-
'X-Imobzi-Secret': credentials.apiKey,
|
1402
|
-
},
|
1403
|
-
body: Object.keys(body).length ? body : undefined,
|
1404
|
-
qs: Object.keys(qs).length ? qs : undefined,
|
1405
|
-
json: true,
|
1406
|
-
});
|
1407
|
-
returnData.push({ json: response });
|
445
|
+
returnData.push({ json: response.data || response });
|
1408
446
|
}
|
1409
447
|
catch (error) {
|
1410
448
|
if (this.continueOnFail()) {
|