n8n-nodes-confirm8 0.10.0 → 0.13.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.
@@ -5,179 +5,583 @@ const n8n_workflow_1 = require("n8n-workflow");
5
5
  class ApiConfirm8 {
6
6
  constructor() {
7
7
  this.description = {
8
- displayName: 'API Confirm8',
9
- name: 'apiConfirm8',
10
- icon: 'file:api.svg',
11
- group: ['transform'],
8
+ displayName: "API Confirm8",
9
+ name: "apiConfirm8",
10
+ icon: "file:api.svg",
11
+ group: ["transform"],
12
12
  version: 1,
13
13
  subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
14
- description: 'Interact with Confirm8 API',
14
+ description: "Complete Confirm8 API integration",
15
15
  defaults: {
16
- name: 'API Confirm8',
16
+ name: "API Confirm8",
17
17
  },
18
- inputs: ['main'],
19
- outputs: ['main'],
20
- credentials: [
18
+ inputs: ["main"],
19
+ outputs: ["main"],
20
+ properties: [
21
+ // API Configuration
21
22
  {
22
- name: 'confirm8Api',
23
+ displayName: "Base URL",
24
+ name: "baseUrl",
25
+ type: "string",
26
+ default: "",
27
+ placeholder: "https://api.confirm8.com",
23
28
  required: true,
29
+ description: "Base URL of your API",
24
30
  },
25
- ],
26
- properties: [
27
31
  {
28
- displayName: 'Resource',
29
- name: 'resource',
30
- type: 'options',
32
+ displayName: "Bearer Token",
33
+ name: "bearerToken",
34
+ type: "string",
35
+ typeOptions: { password: true },
36
+ default: "",
37
+ required: true,
38
+ },
39
+ {
40
+ displayName: "X-API-DOMAIN",
41
+ name: "apiDomain",
42
+ type: "string",
43
+ default: "",
44
+ required: true,
45
+ },
46
+ {
47
+ displayName: "X-APIKEY-TOKEN",
48
+ name: "apiKeyToken",
49
+ type: "string",
50
+ typeOptions: { password: true },
51
+ default: "",
52
+ required: true,
53
+ },
54
+ // Resource Selection
55
+ {
56
+ displayName: "Resource",
57
+ name: "resource",
58
+ type: "options",
59
+ noDataExpression: true,
60
+ options: [
61
+ { name: "User", value: "user" },
62
+ { name: "Client", value: "client" },
63
+ { name: "Item", value: "item" },
64
+ { name: "Item Type", value: "itemType" },
65
+ { name: "Task", value: "task" },
66
+ { name: "Service", value: "service" },
67
+ { name: "Product", value: "product" },
68
+ { name: "Order", value: "order" },
69
+ { name: "Modality", value: "modality" },
70
+ { name: "Ticket", value: "ticket" },
71
+ { name: "Property", value: "property" },
72
+ ],
73
+ default: "user",
74
+ },
75
+ // ============= USER OPERATIONS =============
76
+ {
77
+ displayName: "Operation",
78
+ name: "operation",
79
+ type: "options",
31
80
  noDataExpression: true,
81
+ displayOptions: { show: { resource: ["user"] } },
32
82
  options: [
83
+ { name: "Create", value: "create", action: "Create a user" },
84
+ { name: "Get", value: "get", action: "Get a user" },
85
+ { name: "Get All", value: "getAll", action: "Get all users" },
86
+ {
87
+ name: "Get By Username",
88
+ value: "getByUsername",
89
+ action: "Get user by username",
90
+ },
91
+ { name: "Update", value: "update", action: "Update a user" },
92
+ { name: "Activate", value: "activate", action: "Activate user" },
93
+ {
94
+ name: "Deactivate",
95
+ value: "deactivate",
96
+ action: "Deactivate user",
97
+ },
98
+ {
99
+ name: "Get Tickets",
100
+ value: "getTickets",
101
+ action: "Get user tickets",
102
+ },
103
+ { name: "Get Tasks", value: "getTasks", action: "Get user tasks" },
104
+ {
105
+ name: "Get Permissions",
106
+ value: "getPermissions",
107
+ action: "Get user permissions",
108
+ },
33
109
  {
34
- name: 'User',
35
- value: 'user',
110
+ name: "Link Tasks",
111
+ value: "linkTasks",
112
+ action: "Link tasks with user",
36
113
  },
37
114
  {
38
- name: 'Client',
39
- value: 'client',
115
+ name: "Delete Linked Tasks",
116
+ value: "deleteLinkedTasks",
117
+ action: "Delete linked tasks",
118
+ },
119
+ {
120
+ name: "Delete Linked Tasks By User",
121
+ value: "deleteLinkedTasksByUser",
122
+ action: "Delete linked tasks by user",
123
+ },
124
+ {
125
+ name: "Upload Photo",
126
+ value: "uploadPhoto",
127
+ action: "Upload user photo",
128
+ },
129
+ {
130
+ name: "Upload Signature",
131
+ value: "uploadSignature",
132
+ action: "Upload user signature",
40
133
  },
41
134
  ],
42
- default: 'user',
135
+ default: "getAll",
43
136
  },
44
- // USER OPERATIONS
137
+ // User ID
45
138
  {
46
- displayName: 'Operation',
47
- name: 'operation',
48
- type: 'options',
49
- noDataExpression: true,
139
+ displayName: "User ID",
140
+ name: "userId",
141
+ type: "string",
50
142
  displayOptions: {
51
143
  show: {
52
- resource: ['user'],
144
+ resource: ["user"],
145
+ operation: [
146
+ "get",
147
+ "update",
148
+ "activate",
149
+ "deactivate",
150
+ "getTickets",
151
+ "getTasks",
152
+ "getPermissions",
153
+ "uploadPhoto",
154
+ "uploadSignature",
155
+ ],
156
+ },
157
+ },
158
+ default: "",
159
+ required: true,
160
+ },
161
+ // Username
162
+ {
163
+ displayName: "Username",
164
+ name: "username",
165
+ type: "string",
166
+ displayOptions: {
167
+ show: {
168
+ resource: ["user"],
169
+ operation: ["create", "getByUsername"],
170
+ },
171
+ },
172
+ default: "",
173
+ required: true,
174
+ },
175
+ // Employee ID for delete
176
+ {
177
+ displayName: "Employee ID",
178
+ name: "employeeId",
179
+ type: "string",
180
+ displayOptions: {
181
+ show: {
182
+ resource: ["user"],
183
+ operation: ["deleteLinkedTasksByUser"],
184
+ },
185
+ },
186
+ default: "",
187
+ required: true,
188
+ },
189
+ // User Additional Fields
190
+ {
191
+ displayName: "Additional Fields",
192
+ name: "additionalFields",
193
+ type: "collection",
194
+ placeholder: "Add Field",
195
+ default: {},
196
+ displayOptions: {
197
+ show: {
198
+ resource: ["user"],
199
+ operation: ["create", "update"],
53
200
  },
54
201
  },
55
202
  options: [
203
+ { displayName: "Email", name: "email", type: "string", default: "" },
204
+ { displayName: "Name", name: "name", type: "string", default: "" },
205
+ { displayName: "Phone", name: "phone", type: "string", default: "" },
56
206
  {
57
- name: 'Get',
58
- value: 'get',
59
- description: 'Get a user',
60
- action: 'Get a user',
207
+ displayName: "Password",
208
+ name: "password",
209
+ type: "string",
210
+ typeOptions: { password: true },
211
+ default: "",
61
212
  },
213
+ ],
214
+ },
215
+ // ============= CLIENT OPERATIONS =============
216
+ {
217
+ displayName: "Operation",
218
+ name: "operation",
219
+ type: "options",
220
+ noDataExpression: true,
221
+ displayOptions: { show: { resource: ["client"] } },
222
+ options: [
223
+ { name: "Create", value: "create", action: "Create a client" },
224
+ { name: "Get", value: "get", action: "Get a client" },
225
+ { name: "Get All", value: "getAll", action: "Get all clients" },
226
+ { name: "Update", value: "update", action: "Update a client" },
227
+ { name: "Activate", value: "activate", action: "Activate client" },
62
228
  {
63
- name: 'Get All',
64
- value: 'getAll',
65
- description: 'Get all users',
66
- action: 'Get all users',
229
+ name: "Deactivate",
230
+ value: "deactivate",
231
+ action: "Deactivate client",
67
232
  },
68
- {
69
- name: 'Create',
70
- value: 'create',
71
- description: 'Create a new user',
72
- action: 'Create a user',
233
+ ],
234
+ default: "getAll",
235
+ },
236
+ {
237
+ displayName: "Client ID",
238
+ name: "clientId",
239
+ type: "string",
240
+ displayOptions: {
241
+ show: {
242
+ resource: ["client"],
243
+ operation: ["get", "update", "activate", "deactivate"],
73
244
  },
245
+ },
246
+ default: "",
247
+ required: true,
248
+ },
249
+ {
250
+ displayName: "Additional Fields",
251
+ name: "additionalFields",
252
+ type: "collection",
253
+ placeholder: "Add Field",
254
+ default: {},
255
+ displayOptions: {
256
+ show: {
257
+ resource: ["client"],
258
+ operation: ["create", "update"],
259
+ },
260
+ },
261
+ options: [
262
+ { displayName: "Name", name: "name", type: "string", default: "" },
263
+ { displayName: "Email", name: "email", type: "string", default: "" },
264
+ { displayName: "Phone", name: "phone", type: "string", default: "" },
265
+ ],
266
+ },
267
+ // ============= ITEM OPERATIONS =============
268
+ {
269
+ displayName: "Operation",
270
+ name: "operation",
271
+ type: "options",
272
+ noDataExpression: true,
273
+ displayOptions: { show: { resource: ["item"] } },
274
+ options: [
275
+ { name: "Create", value: "create", action: "Create an item" },
276
+ { name: "Get", value: "get", action: "Get an item" },
277
+ { name: "Get All", value: "getAll", action: "Get all items" },
278
+ { name: "Update", value: "update", action: "Update an item" },
279
+ { name: "Activate", value: "activate", action: "Activate item" },
74
280
  {
75
- name: 'Update',
76
- value: 'update',
77
- description: 'Update a user',
78
- action: 'Update a user',
281
+ name: "Deactivate",
282
+ value: "deactivate",
283
+ action: "Deactivate item",
79
284
  },
80
285
  ],
81
- default: 'getAll',
286
+ default: "getAll",
82
287
  },
83
- // User ID
84
288
  {
85
- displayName: 'User ID',
86
- name: 'userId',
87
- type: 'string',
88
- required: true,
289
+ displayName: "Item ID",
290
+ name: "itemId",
291
+ type: "string",
89
292
  displayOptions: {
90
293
  show: {
91
- resource: ['user'],
92
- operation: ['get', 'update'],
294
+ resource: ["item"],
295
+ operation: ["get", "update", "activate", "deactivate"],
93
296
  },
94
297
  },
95
- default: '',
96
- description: 'The ID of the user',
298
+ default: "",
299
+ required: true,
300
+ },
301
+ // ============= ITEM TYPE OPERATIONS =============
302
+ {
303
+ displayName: "Operation",
304
+ name: "operation",
305
+ type: "options",
306
+ noDataExpression: true,
307
+ displayOptions: { show: { resource: ["itemType"] } },
308
+ options: [
309
+ { name: "Create", value: "create", action: "Create an item type" },
310
+ { name: "Get", value: "get", action: "Get an item type" },
311
+ { name: "Get All", value: "getAll", action: "Get all item types" },
312
+ { name: "Update", value: "update", action: "Update an item type" },
313
+ { name: "Activate", value: "activate", action: "Activate item type" },
314
+ {
315
+ name: "Deactivate",
316
+ value: "deactivate",
317
+ action: "Deactivate item type",
318
+ },
319
+ ],
320
+ default: "getAll",
97
321
  },
98
- // Username for create
99
322
  {
100
- displayName: 'Username',
101
- name: 'username',
102
- type: 'string',
323
+ displayName: "Item Type ID",
324
+ name: "itemTypeId",
325
+ type: "string",
326
+ displayOptions: {
327
+ show: {
328
+ resource: ["itemType"],
329
+ operation: ["get", "update", "activate", "deactivate"],
330
+ },
331
+ },
332
+ default: "",
103
333
  required: true,
334
+ },
335
+ // ============= TASK OPERATIONS =============
336
+ {
337
+ displayName: "Operation",
338
+ name: "operation",
339
+ type: "options",
340
+ noDataExpression: true,
341
+ displayOptions: { show: { resource: ["task"] } },
342
+ options: [
343
+ { name: "Create", value: "create", action: "Create a task" },
344
+ { name: "Get", value: "get", action: "Get a task" },
345
+ { name: "Get All", value: "getAll", action: "Get all tasks" },
346
+ { name: "Update", value: "update", action: "Update a task" },
347
+ { name: "Activate", value: "activate", action: "Activate task" },
348
+ {
349
+ name: "Deactivate",
350
+ value: "deactivate",
351
+ action: "Deactivate task",
352
+ },
353
+ ],
354
+ default: "getAll",
355
+ },
356
+ {
357
+ displayName: "Task ID",
358
+ name: "taskId",
359
+ type: "string",
104
360
  displayOptions: {
105
361
  show: {
106
- resource: ['user'],
107
- operation: ['create'],
362
+ resource: ["task"],
363
+ operation: ["get", "update", "activate", "deactivate"],
108
364
  },
109
365
  },
110
- default: '',
111
- description: 'Username for the new user',
366
+ default: "",
367
+ required: true,
112
368
  },
113
- // Additional fields
369
+ // ============= SERVICE OPERATIONS =============
114
370
  {
115
- displayName: 'Additional Fields',
116
- name: 'additionalFields',
117
- type: 'collection',
118
- placeholder: 'Add Field',
119
- default: {},
371
+ displayName: "Operation",
372
+ name: "operation",
373
+ type: "options",
374
+ noDataExpression: true,
375
+ displayOptions: { show: { resource: ["service"] } },
376
+ options: [
377
+ { name: "Create", value: "create", action: "Create a service" },
378
+ { name: "Get", value: "get", action: "Get a service" },
379
+ { name: "Get All", value: "getAll", action: "Get all services" },
380
+ { name: "Update", value: "update", action: "Update a service" },
381
+ { name: "Activate", value: "activate", action: "Activate service" },
382
+ {
383
+ name: "Deactivate",
384
+ value: "deactivate",
385
+ action: "Deactivate service",
386
+ },
387
+ ],
388
+ default: "getAll",
389
+ },
390
+ {
391
+ displayName: "Service ID",
392
+ name: "serviceId",
393
+ type: "string",
120
394
  displayOptions: {
121
395
  show: {
122
- resource: ['user'],
123
- operation: ['create', 'update'],
396
+ resource: ["service"],
397
+ operation: ["get", "update", "activate", "deactivate"],
124
398
  },
125
399
  },
400
+ default: "",
401
+ required: true,
402
+ },
403
+ // ============= PRODUCT OPERATIONS =============
404
+ {
405
+ displayName: "Operation",
406
+ name: "operation",
407
+ type: "options",
408
+ noDataExpression: true,
409
+ displayOptions: { show: { resource: ["product"] } },
126
410
  options: [
411
+ { name: "Create", value: "create", action: "Create a product" },
412
+ { name: "Get", value: "get", action: "Get a product" },
413
+ { name: "Get All", value: "getAll", action: "Get all products" },
414
+ { name: "Update", value: "update", action: "Update a product" },
415
+ { name: "Activate", value: "activate", action: "Activate product" },
127
416
  {
128
- displayName: 'Email',
129
- name: 'email',
130
- type: 'string',
131
- default: '',
417
+ name: "Deactivate",
418
+ value: "deactivate",
419
+ action: "Deactivate product",
420
+ },
421
+ ],
422
+ default: "getAll",
423
+ },
424
+ {
425
+ displayName: "Product ID",
426
+ name: "productId",
427
+ type: "string",
428
+ displayOptions: {
429
+ show: {
430
+ resource: ["product"],
431
+ operation: ["get", "update", "activate", "deactivate"],
132
432
  },
433
+ },
434
+ default: "",
435
+ required: true,
436
+ },
437
+ // ============= ORDER (WOS) OPERATIONS =============
438
+ {
439
+ displayName: "Operation",
440
+ name: "operation",
441
+ type: "options",
442
+ noDataExpression: true,
443
+ displayOptions: { show: { resource: ["order"] } },
444
+ options: [
445
+ { name: "Create", value: "create", action: "Create an order" },
446
+ { name: "Get", value: "get", action: "Get an order" },
447
+ { name: "Get All", value: "getAll", action: "Get all orders" },
448
+ { name: "Update", value: "update", action: "Update an order" },
449
+ { name: "Activate", value: "activate", action: "Activate order" },
133
450
  {
134
- displayName: 'Name',
135
- name: 'name',
136
- type: 'string',
137
- default: '',
451
+ name: "Deactivate",
452
+ value: "deactivate",
453
+ action: "Deactivate order",
138
454
  },
139
455
  ],
456
+ default: "getAll",
140
457
  },
141
- // CLIENT OPERATIONS
142
458
  {
143
- displayName: 'Operation',
144
- name: 'operation',
145
- type: 'options',
459
+ displayName: "Order ID",
460
+ name: "orderId",
461
+ type: "string",
462
+ displayOptions: {
463
+ show: {
464
+ resource: ["order"],
465
+ operation: ["get", "update", "activate", "deactivate"],
466
+ },
467
+ },
468
+ default: "",
469
+ required: true,
470
+ },
471
+ // ============= MODALITY OPERATIONS =============
472
+ {
473
+ displayName: "Operation",
474
+ name: "operation",
475
+ type: "options",
146
476
  noDataExpression: true,
477
+ displayOptions: { show: { resource: ["modality"] } },
478
+ options: [
479
+ { name: "Create", value: "create", action: "Create a modality" },
480
+ { name: "Get", value: "get", action: "Get a modality" },
481
+ { name: "Get All", value: "getAll", action: "Get all modalities" },
482
+ { name: "Update", value: "update", action: "Update a modality" },
483
+ { name: "Activate", value: "activate", action: "Activate modality" },
484
+ {
485
+ name: "Deactivate",
486
+ value: "deactivate",
487
+ action: "Deactivate modality",
488
+ },
489
+ ],
490
+ default: "getAll",
491
+ },
492
+ {
493
+ displayName: "Modality ID",
494
+ name: "modalityId",
495
+ type: "string",
147
496
  displayOptions: {
148
497
  show: {
149
- resource: ['client'],
498
+ resource: ["modality"],
499
+ operation: ["get", "update", "activate", "deactivate"],
150
500
  },
151
501
  },
502
+ default: "",
503
+ required: true,
504
+ },
505
+ // ============= TICKET OPERATIONS =============
506
+ {
507
+ displayName: "Operation",
508
+ name: "operation",
509
+ type: "options",
510
+ noDataExpression: true,
511
+ displayOptions: { show: { resource: ["ticket"] } },
152
512
  options: [
513
+ { name: "Create", value: "create", action: "Create a ticket" },
514
+ { name: "Get", value: "get", action: "Get a ticket" },
515
+ { name: "Get All", value: "getAll", action: "Get all tickets" },
516
+ { name: "Update", value: "update", action: "Update a ticket" },
517
+ { name: "Activate", value: "activate", action: "Activate ticket" },
153
518
  {
154
- name: 'Get',
155
- value: 'get',
156
- description: 'Get a client',
157
- action: 'Get a client',
519
+ name: "Deactivate",
520
+ value: "deactivate",
521
+ action: "Deactivate ticket",
158
522
  },
523
+ ],
524
+ default: "getAll",
525
+ },
526
+ {
527
+ displayName: "Ticket ID",
528
+ name: "ticketId",
529
+ type: "string",
530
+ displayOptions: {
531
+ show: {
532
+ resource: ["ticket"],
533
+ operation: ["get", "update", "activate", "deactivate"],
534
+ },
535
+ },
536
+ default: "",
537
+ required: true,
538
+ },
539
+ // ============= PROPERTY OPERATIONS =============
540
+ {
541
+ displayName: "Operation",
542
+ name: "operation",
543
+ type: "options",
544
+ noDataExpression: true,
545
+ displayOptions: { show: { resource: ["property"] } },
546
+ options: [
547
+ { name: "Create", value: "create", action: "Create a property" },
548
+ { name: "Get", value: "get", action: "Get a property" },
549
+ { name: "Get All", value: "getAll", action: "Get all properties" },
550
+ { name: "Update", value: "update", action: "Update a property" },
551
+ { name: "Activate", value: "activate", action: "Activate property" },
159
552
  {
160
- name: 'Get All',
161
- value: 'getAll',
162
- description: 'Get all clients',
163
- action: 'Get all clients',
553
+ name: "Deactivate",
554
+ value: "deactivate",
555
+ action: "Deactivate property",
164
556
  },
165
557
  ],
166
- default: 'getAll',
558
+ default: "getAll",
167
559
  },
168
- // Client ID
169
560
  {
170
- displayName: 'Client ID',
171
- name: 'clientId',
172
- type: 'string',
561
+ displayName: "Property ID",
562
+ name: "propertyId",
563
+ type: "string",
564
+ displayOptions: {
565
+ show: {
566
+ resource: ["property"],
567
+ operation: ["get", "update", "activate", "deactivate"],
568
+ },
569
+ },
570
+ default: "",
173
571
  required: true,
572
+ },
573
+ // Generic Additional Fields for POST/PUT operations
574
+ {
575
+ displayName: "Body Data (JSON)",
576
+ name: "bodyData",
577
+ type: "json",
578
+ default: "{}",
174
579
  displayOptions: {
175
580
  show: {
176
- resource: ['client'],
177
- operation: ['get'],
581
+ operation: ["create", "update", "linkTasks"],
178
582
  },
179
583
  },
180
- default: '',
584
+ description: "Request body as JSON",
181
585
  },
182
586
  ],
183
587
  };
@@ -187,56 +591,415 @@ class ApiConfirm8 {
187
591
  const returnData = [];
188
592
  for (let i = 0; i < items.length; i++) {
189
593
  try {
190
- const resource = this.getNodeParameter('resource', i);
191
- const operation = this.getNodeParameter('operation', i);
192
- let endpoint = '';
193
- let method = 'GET';
594
+ const baseUrl = this.getNodeParameter("baseUrl", i);
595
+ const bearerToken = this.getNodeParameter("bearerToken", i);
596
+ const apiDomain = this.getNodeParameter("apiDomain", i);
597
+ const apiKeyToken = this.getNodeParameter("apiKeyToken", i);
598
+ const resource = this.getNodeParameter("resource", i);
599
+ const operation = this.getNodeParameter("operation", i);
600
+ let endpoint = "";
601
+ let method = "GET";
194
602
  let body = {};
195
- // USER OPERATIONS
196
- if (resource === 'user') {
197
- if (operation === 'getAll') {
198
- endpoint = '/users';
199
- }
200
- else if (operation === 'get') {
201
- const userId = this.getNodeParameter('userId', i);
202
- endpoint = `/users/${userId}`;
203
- }
204
- else if (operation === 'create') {
205
- endpoint = '/users';
206
- method = 'POST';
207
- const username = this.getNodeParameter('username', i);
208
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
209
- body = { username, ...additionalFields };
210
- }
211
- else if (operation === 'update') {
212
- const userId = this.getNodeParameter('userId', i);
213
- endpoint = `/users/${userId}`;
214
- method = 'PUT';
215
- body = this.getNodeParameter('additionalFields', i, {});
603
+ // Parse body data if provided
604
+ try {
605
+ const bodyDataStr = this.getNodeParameter("bodyData", i, "{}");
606
+ if (bodyDataStr && bodyDataStr.trim() !== "{}") {
607
+ body = JSON.parse(bodyDataStr);
216
608
  }
217
609
  }
218
- // CLIENT OPERATIONS
219
- else if (resource === 'client') {
220
- if (operation === 'getAll') {
221
- endpoint = '/clients';
222
- }
223
- else if (operation === 'get') {
224
- const clientId = this.getNodeParameter('clientId', i);
225
- endpoint = `/clients/${clientId}`;
226
- }
610
+ catch (e) {
611
+ // Body data is optional
227
612
  }
228
- const requestOptions = {
229
- method: method,
230
- url: endpoint,
231
- json: true,
613
+ // Build endpoint and method based on resource and operation
614
+ switch (resource) {
615
+ case "user":
616
+ switch (operation) {
617
+ case "create":
618
+ endpoint = "/users";
619
+ method = "POST";
620
+ const username = this.getNodeParameter("username", i);
621
+ const userFields = this.getNodeParameter("additionalFields", i, {});
622
+ body = { username, ...userFields, ...body };
623
+ break;
624
+ case "getAll":
625
+ endpoint = "/users";
626
+ break;
627
+ case "get":
628
+ const userId = this.getNodeParameter("userId", i);
629
+ endpoint = `/users/${userId}`;
630
+ break;
631
+ case "getByUsername":
632
+ const usernameGet = this.getNodeParameter("username", i);
633
+ endpoint = `/users/${usernameGet}/user`;
634
+ break;
635
+ case "update":
636
+ const userIdUpdate = this.getNodeParameter("userId", i);
637
+ endpoint = `/users/${userIdUpdate}`;
638
+ method = "PUT";
639
+ const updateFields = this.getNodeParameter("additionalFields", i, {});
640
+ body = { ...updateFields, ...body };
641
+ break;
642
+ case "activate":
643
+ const userIdActivate = this.getNodeParameter("userId", i);
644
+ endpoint = `/users/${userIdActivate}/active`;
645
+ method = "PATCH";
646
+ break;
647
+ case "deactivate":
648
+ const userIdDeactivate = this.getNodeParameter("userId", i);
649
+ endpoint = `/users/${userIdDeactivate}/inactive`;
650
+ method = "PATCH";
651
+ break;
652
+ case "getTickets":
653
+ const userIdTickets = this.getNodeParameter("userId", i);
654
+ endpoint = `/users/${userIdTickets}/tickets`;
655
+ break;
656
+ case "getTasks":
657
+ const userIdTasks = this.getNodeParameter("userId", i);
658
+ endpoint = `/users/${userIdTasks}/tasks`;
659
+ break;
660
+ case "getPermissions":
661
+ const userIdPermissions = this.getNodeParameter("userId", i);
662
+ endpoint = `/users/${userIdPermissions}/permissions`;
663
+ break;
664
+ case "linkTasks":
665
+ endpoint = "/users/tasks";
666
+ method = "POST";
667
+ break;
668
+ case "deleteLinkedTasks":
669
+ endpoint = "/users/tasks";
670
+ method = "DELETE";
671
+ break;
672
+ case "deleteLinkedTasksByUser":
673
+ const employeeId = this.getNodeParameter("employeeId", i);
674
+ endpoint = `/users/tasks/${employeeId}`;
675
+ method = "DELETE";
676
+ break;
677
+ case "uploadPhoto":
678
+ const userIdPhoto = this.getNodeParameter("userId", i);
679
+ endpoint = `/users/${userIdPhoto}/photos`;
680
+ method = "PATCH";
681
+ break;
682
+ case "uploadSignature":
683
+ const userIdSignature = this.getNodeParameter("userId", i);
684
+ endpoint = `/users/${userIdSignature}/signatures`;
685
+ method = "PATCH";
686
+ break;
687
+ }
688
+ break;
689
+ case "client":
690
+ const clientId = operation !== "create" && operation !== "getAll"
691
+ ? this.getNodeParameter("clientId", i)
692
+ : "";
693
+ switch (operation) {
694
+ case "create":
695
+ endpoint = "/clients";
696
+ method = "POST";
697
+ break;
698
+ case "getAll":
699
+ endpoint = "/clients";
700
+ break;
701
+ case "get":
702
+ endpoint = `/clients/${clientId}`;
703
+ break;
704
+ case "update":
705
+ endpoint = `/clients/${clientId}`;
706
+ method = "PUT";
707
+ break;
708
+ case "activate":
709
+ endpoint = `/clients/${clientId}/active`;
710
+ method = "PUT";
711
+ break;
712
+ case "deactivate":
713
+ endpoint = `/clients/${clientId}/inactive`;
714
+ method = "PUT";
715
+ break;
716
+ }
717
+ if (operation === "create" || operation === "update") {
718
+ const clientFields = this.getNodeParameter("additionalFields", i, {});
719
+ body = { ...clientFields, ...body };
720
+ }
721
+ break;
722
+ case "item":
723
+ const itemId = operation !== "create" && operation !== "getAll"
724
+ ? this.getNodeParameter("itemId", i)
725
+ : "";
726
+ switch (operation) {
727
+ case "create":
728
+ endpoint = "/items";
729
+ method = "POST";
730
+ break;
731
+ case "getAll":
732
+ endpoint = "/items";
733
+ break;
734
+ case "get":
735
+ endpoint = `/items/${itemId}`;
736
+ break;
737
+ case "update":
738
+ endpoint = `/items/${itemId}`;
739
+ method = "PUT";
740
+ break;
741
+ case "activate":
742
+ endpoint = `/items/${itemId}/active`;
743
+ method = "PUT";
744
+ break;
745
+ case "deactivate":
746
+ endpoint = `/items/${itemId}/inactive`;
747
+ method = "PUT";
748
+ break;
749
+ }
750
+ break;
751
+ case "itemType":
752
+ const itemTypeId = operation !== "create" && operation !== "getAll"
753
+ ? this.getNodeParameter("itemTypeId", i)
754
+ : "";
755
+ switch (operation) {
756
+ case "create":
757
+ endpoint = "/itemTypes";
758
+ method = "POST";
759
+ break;
760
+ case "getAll":
761
+ endpoint = "/itemTypes";
762
+ break;
763
+ case "get":
764
+ endpoint = `/itemTypes/${itemTypeId}`;
765
+ break;
766
+ case "update":
767
+ endpoint = `/itemTypes/${itemTypeId}`;
768
+ method = "PUT";
769
+ break;
770
+ case "activate":
771
+ endpoint = `/itemTypes/${itemTypeId}/active`;
772
+ method = "PUT";
773
+ break;
774
+ case "deactivate":
775
+ endpoint = `/itemTypes/${itemTypeId}/inactive`;
776
+ method = "PUT";
777
+ break;
778
+ }
779
+ break;
780
+ case "task":
781
+ const taskId = operation !== "create" && operation !== "getAll"
782
+ ? this.getNodeParameter("taskId", i)
783
+ : "";
784
+ switch (operation) {
785
+ case "create":
786
+ endpoint = "/tasks";
787
+ method = "POST";
788
+ break;
789
+ case "getAll":
790
+ endpoint = "/tasks";
791
+ break;
792
+ case "get":
793
+ endpoint = `/tasks/${taskId}`;
794
+ break;
795
+ case "update":
796
+ endpoint = `/tasks/${taskId}`;
797
+ method = "PUT";
798
+ break;
799
+ case "activate":
800
+ endpoint = `/tasks/${taskId}/active`;
801
+ method = "PUT";
802
+ break;
803
+ case "deactivate":
804
+ endpoint = `/tasks/${taskId}/inactive`;
805
+ method = "PUT";
806
+ break;
807
+ }
808
+ break;
809
+ case "service":
810
+ const serviceId = operation !== "create" && operation !== "getAll"
811
+ ? this.getNodeParameter("serviceId", i)
812
+ : "";
813
+ switch (operation) {
814
+ case "create":
815
+ endpoint = "/services";
816
+ method = "POST";
817
+ break;
818
+ case "getAll":
819
+ endpoint = "/services";
820
+ break;
821
+ case "get":
822
+ endpoint = `/services/${serviceId}`;
823
+ break;
824
+ case "update":
825
+ endpoint = `/services/${serviceId}`;
826
+ method = "PUT";
827
+ break;
828
+ case "activate":
829
+ endpoint = `/services/${serviceId}/active`;
830
+ method = "PUT";
831
+ break;
832
+ case "deactivate":
833
+ endpoint = `/services/${serviceId}/inactive`;
834
+ method = "PUT";
835
+ break;
836
+ }
837
+ break;
838
+ case "product":
839
+ const productId = operation !== "create" && operation !== "getAll"
840
+ ? this.getNodeParameter("productId", i)
841
+ : "";
842
+ switch (operation) {
843
+ case "create":
844
+ endpoint = "/products";
845
+ method = "POST";
846
+ break;
847
+ case "getAll":
848
+ endpoint = "/products";
849
+ break;
850
+ case "get":
851
+ endpoint = `/products/${productId}`;
852
+ break;
853
+ case "update":
854
+ endpoint = `/products/${productId}`;
855
+ method = "PUT";
856
+ break;
857
+ case "activate":
858
+ endpoint = `/products/${productId}/active`;
859
+ method = "PUT";
860
+ break;
861
+ case "deactivate":
862
+ endpoint = `/products/${productId}/inactive`;
863
+ method = "PUT";
864
+ break;
865
+ }
866
+ break;
867
+ case "order":
868
+ const orderId = operation !== "create" && operation !== "getAll"
869
+ ? this.getNodeParameter("orderId", i)
870
+ : "";
871
+ switch (operation) {
872
+ case "create":
873
+ endpoint = "/wos";
874
+ method = "POST";
875
+ break;
876
+ case "getAll":
877
+ endpoint = "/wos";
878
+ break;
879
+ case "get":
880
+ endpoint = `/wos/${orderId}`;
881
+ break;
882
+ case "update":
883
+ endpoint = `/wos/${orderId}`;
884
+ method = "PUT";
885
+ break;
886
+ case "activate":
887
+ endpoint = `/wos/${orderId}/active`;
888
+ method = "PUT";
889
+ break;
890
+ case "deactivate":
891
+ endpoint = `/wos/${orderId}/inactive`;
892
+ method = "PUT";
893
+ break;
894
+ }
895
+ break;
896
+ case "modality":
897
+ const modalityId = operation !== "create" && operation !== "getAll"
898
+ ? this.getNodeParameter("modalityId", i)
899
+ : "";
900
+ switch (operation) {
901
+ case "create":
902
+ endpoint = "/modalities";
903
+ method = "POST";
904
+ break;
905
+ case "getAll":
906
+ endpoint = "/modalities";
907
+ break;
908
+ case "get":
909
+ endpoint = `/modalities/${modalityId}`;
910
+ break;
911
+ case "update":
912
+ endpoint = `/modalities/${modalityId}`;
913
+ method = "PUT";
914
+ break;
915
+ case "activate":
916
+ endpoint = `/modalities/${modalityId}/active`;
917
+ method = "PUT";
918
+ break;
919
+ case "deactivate":
920
+ endpoint = `/modalities/${modalityId}/inactive`;
921
+ method = "PUT";
922
+ break;
923
+ }
924
+ break;
925
+ case "ticket":
926
+ const ticketId = operation !== "create" && operation !== "getAll"
927
+ ? this.getNodeParameter("ticketId", i)
928
+ : "";
929
+ switch (operation) {
930
+ case "create":
931
+ endpoint = "/tickets";
932
+ method = "POST";
933
+ break;
934
+ case "getAll":
935
+ endpoint = "/tickets";
936
+ break;
937
+ case "get":
938
+ endpoint = `/tickets/${ticketId}`;
939
+ break;
940
+ case "update":
941
+ endpoint = `/tickets/${ticketId}`;
942
+ method = "PUT";
943
+ break;
944
+ case "activate":
945
+ endpoint = "/tickets/active";
946
+ method = "PUT";
947
+ break;
948
+ case "deactivate":
949
+ endpoint = "/tickets/inactive";
950
+ method = "PUT";
951
+ break;
952
+ }
953
+ break;
954
+ case "property":
955
+ const propertyId = operation !== "create" && operation !== "getAll"
956
+ ? this.getNodeParameter("propertyId", i)
957
+ : "";
958
+ switch (operation) {
959
+ case "create":
960
+ endpoint = "/properties";
961
+ method = "POST";
962
+ break;
963
+ case "getAll":
964
+ endpoint = "/properties";
965
+ break;
966
+ case "get":
967
+ endpoint = `/properties/${propertyId}`;
968
+ break;
969
+ case "update":
970
+ endpoint = `/properties/${propertyId}`;
971
+ method = "PUT";
972
+ break;
973
+ case "activate":
974
+ endpoint = `/properties/${propertyId}/active`;
975
+ method = "PATCH";
976
+ break;
977
+ case "deactivate":
978
+ endpoint = `/properties/${propertyId}/inactive`;
979
+ method = "PATCH";
980
+ break;
981
+ }
982
+ break;
983
+ }
984
+ // Make the HTTP request
985
+ const url = `${baseUrl}${endpoint}`;
986
+ const options = {
987
+ method,
988
+ uri: url,
232
989
  headers: {
233
- 'Content-Type': 'application/json',
990
+ Authorization: `Bearer ${bearerToken}`,
991
+ "X-API-DOMAIN": apiDomain,
992
+ "X-APIKEY-TOKEN": apiKeyToken,
993
+ "Content-Type": "application/json",
234
994
  },
995
+ json: true,
235
996
  };
236
- if (method !== 'GET' && Object.keys(body).length > 0) {
237
- requestOptions.body = body;
997
+ if (method !== "GET" &&
998
+ method !== "DELETE" &&
999
+ Object.keys(body).length > 0) {
1000
+ options.body = body;
238
1001
  }
239
- const responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'confirm8Api', requestOptions);
1002
+ const responseData = await this.helpers.request(options);
240
1003
  returnData.push({
241
1004
  json: responseData,
242
1005
  pairedItem: { item: i },
@@ -245,14 +1008,14 @@ class ApiConfirm8 {
245
1008
  catch (error) {
246
1009
  if (this.continueOnFail()) {
247
1010
  returnData.push({
248
- json: {
249
- error: error instanceof Error ? error.message : String(error),
250
- },
1011
+ json: { error: error || "Unknown Error" },
251
1012
  pairedItem: { item: i },
252
1013
  });
253
1014
  continue;
254
1015
  }
255
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
1016
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
1017
+ itemIndex: i,
1018
+ });
256
1019
  }
257
1020
  }
258
1021
  return [returnData];