n8n-nodes-base-wework 1.0.0 → 1.0.2

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.
@@ -44,26 +44,10 @@ class BaseWework {
44
44
  name: 'Task',
45
45
  value: 'task',
46
46
  },
47
- {
48
- name: 'Manager',
49
- value: 'manager',
50
- },
51
47
  {
52
48
  name: 'Department',
53
49
  value: 'department',
54
50
  },
55
- {
56
- name: 'Tasklist',
57
- value: 'tasklist',
58
- },
59
- {
60
- name: 'Topic',
61
- value: 'topic',
62
- },
63
- {
64
- name: 'User',
65
- value: 'user',
66
- },
67
51
  ],
68
52
  default: 'project',
69
53
  },
@@ -85,28 +69,22 @@ class BaseWework {
85
69
  action: 'Create a project',
86
70
  },
87
71
  {
88
- name: 'Get',
89
- value: 'get',
90
- description: 'Get a project',
91
- action: 'Get a project',
92
- },
93
- {
94
- name: 'Update',
95
- value: 'update',
96
- description: 'Update a project',
97
- action: 'Update a project',
72
+ name: 'Edit',
73
+ value: 'edit',
74
+ description: 'Edit a project',
75
+ action: 'Edit a project',
98
76
  },
99
77
  {
100
- name: 'Delete',
101
- value: 'delete',
102
- description: 'Delete a project',
103
- action: 'Delete a project',
78
+ name: 'Get Full',
79
+ value: 'getFull',
80
+ description: 'Get full information of a project',
81
+ action: 'Get full project information',
104
82
  },
105
83
  {
106
- name: 'Get All',
107
- value: 'getAll',
108
- description: 'Get all projects',
109
- action: 'Get all projects',
84
+ name: 'List',
85
+ value: 'list',
86
+ description: 'Get list of all projects',
87
+ action: 'Get list of projects',
110
88
  },
111
89
  ],
112
90
  default: 'create',
@@ -129,64 +107,32 @@ class BaseWework {
129
107
  action: 'Create a task',
130
108
  },
131
109
  {
132
- name: 'Get',
133
- value: 'get',
134
- description: 'Get a task',
135
- action: 'Get a task',
110
+ name: 'Edit',
111
+ value: 'edit',
112
+ description: 'Edit a task',
113
+ action: 'Edit a task',
136
114
  },
137
115
  {
138
- name: 'Update',
139
- value: 'update',
140
- description: 'Update a task',
141
- action: 'Update a task',
116
+ name: 'Get',
117
+ value: 'get',
118
+ description: 'Get task information',
119
+ action: 'Get task information',
142
120
  },
143
121
  {
144
- name: 'Delete',
145
- value: 'delete',
146
- description: 'Delete a task',
147
- action: 'Delete a task',
122
+ name: 'List by Project',
123
+ value: 'project',
124
+ description: 'Get list of tasks by project',
125
+ action: 'Get list of tasks by project',
148
126
  },
149
127
  {
150
- name: 'Get All',
151
- value: 'getAll',
152
- description: 'Get all tasks',
153
- action: 'Get all tasks',
128
+ name: 'Mark Done',
129
+ value: 'markDone',
130
+ description: 'Mark task as done',
131
+ action: 'Mark task as done',
154
132
  },
155
133
  ],
156
134
  default: 'create',
157
135
  },
158
- {
159
- displayName: 'Operation',
160
- name: 'operation',
161
- type: 'options',
162
- noDataExpression: true,
163
- displayOptions: {
164
- show: {
165
- resource: ['manager'],
166
- },
167
- },
168
- options: [
169
- {
170
- name: 'Add List',
171
- value: 'addList',
172
- description: 'Add list of managers to project',
173
- action: 'Add list of managers',
174
- },
175
- {
176
- name: 'Set List',
177
- value: 'setList',
178
- description: 'Set list of managers (change from member to manager)',
179
- action: 'Set list of managers',
180
- },
181
- {
182
- name: 'Exchange Single',
183
- value: 'exchangeSingle',
184
- description: 'Exchange single manager to another project',
185
- action: 'Exchange single manager',
186
- },
187
- ],
188
- default: 'addList',
189
- },
190
136
  {
191
137
  displayName: 'Operation',
192
138
  name: 'operation',
@@ -205,146 +151,32 @@ class BaseWework {
205
151
  action: 'Create a department',
206
152
  },
207
153
  {
208
- name: 'Get',
209
- value: 'get',
210
- description: 'Get a department',
211
- action: 'Get a department',
212
- },
213
- {
214
- name: 'Update',
215
- value: 'update',
216
- description: 'Update a department',
217
- action: 'Update a department',
218
- },
219
- {
220
- name: 'Delete',
221
- value: 'delete',
222
- description: 'Delete a department',
223
- action: 'Delete a department',
224
- },
225
- {
226
- name: 'Get All',
227
- value: 'getAll',
228
- description: 'Get all departments',
229
- action: 'Get all departments',
230
- },
231
- ],
232
- default: 'create',
233
- },
234
- {
235
- displayName: 'Operation',
236
- name: 'operation',
237
- type: 'options',
238
- noDataExpression: true,
239
- displayOptions: {
240
- show: {
241
- resource: ['tasklist'],
242
- },
243
- },
244
- options: [
245
- {
246
- name: 'Create',
247
- value: 'create',
248
- description: 'Create a new tasklist',
249
- action: 'Create a tasklist',
154
+ name: 'Edit',
155
+ value: 'edit',
156
+ description: 'Edit a department',
157
+ action: 'Edit a department',
250
158
  },
251
159
  {
252
160
  name: 'Get',
253
161
  value: 'get',
254
- description: 'Get a tasklist',
255
- action: 'Get a tasklist',
256
- },
257
- {
258
- name: 'Update',
259
- value: 'update',
260
- description: 'Update a tasklist',
261
- action: 'Update a tasklist',
162
+ description: 'Get department information',
163
+ action: 'Get department information',
262
164
  },
263
165
  {
264
- name: 'Delete',
265
- value: 'delete',
266
- description: 'Delete a tasklist',
267
- action: 'Delete a tasklist',
166
+ name: 'List',
167
+ value: 'list',
168
+ description: 'Get list of all departments',
169
+ action: 'Get list of departments',
268
170
  },
269
171
  {
270
- name: 'Get All',
271
- value: 'getAll',
272
- description: 'Get all tasklists',
273
- action: 'Get all tasklists',
172
+ name: 'Remove',
173
+ value: 'remove',
174
+ description: 'Remove a department',
175
+ action: 'Remove a department',
274
176
  },
275
177
  ],
276
178
  default: 'create',
277
179
  },
278
- {
279
- displayName: 'Operation',
280
- name: 'operation',
281
- type: 'options',
282
- noDataExpression: true,
283
- displayOptions: {
284
- show: {
285
- resource: ['topic'],
286
- },
287
- },
288
- options: [
289
- {
290
- name: 'Create',
291
- value: 'create',
292
- description: 'Create a new topic',
293
- action: 'Create a topic',
294
- },
295
- {
296
- name: 'Get',
297
- value: 'get',
298
- description: 'Get a topic',
299
- action: 'Get a topic',
300
- },
301
- {
302
- name: 'Update',
303
- value: 'update',
304
- description: 'Update a topic',
305
- action: 'Update a topic',
306
- },
307
- {
308
- name: 'Delete',
309
- value: 'delete',
310
- description: 'Delete a topic',
311
- action: 'Delete a topic',
312
- },
313
- {
314
- name: 'Get All',
315
- value: 'getAll',
316
- description: 'Get all topics',
317
- action: 'Get all topics',
318
- },
319
- ],
320
- default: 'create',
321
- },
322
- {
323
- displayName: 'Operation',
324
- name: 'operation',
325
- type: 'options',
326
- noDataExpression: true,
327
- displayOptions: {
328
- show: {
329
- resource: ['user'],
330
- },
331
- },
332
- options: [
333
- {
334
- name: 'Get Info',
335
- value: 'getInfo',
336
- description: 'Get user information',
337
- action: 'Get user info',
338
- },
339
- {
340
- name: 'Get All',
341
- value: 'getAll',
342
- description: 'Get all users',
343
- action: 'Get all users',
344
- },
345
- ],
346
- default: 'getInfo',
347
- },
348
180
  {
349
181
  displayName: 'Username',
350
182
  name: 'username',
@@ -353,7 +185,7 @@ class BaseWework {
353
185
  displayOptions: {
354
186
  show: {
355
187
  resource: ['project'],
356
- operation: ['create', 'update', 'delete', 'get'],
188
+ operation: ['create', 'edit', 'getFull'],
357
189
  },
358
190
  },
359
191
  default: '',
@@ -361,31 +193,49 @@ class BaseWework {
361
193
  },
362
194
  {
363
195
  displayName: 'Project ID',
364
- name: 'projectId',
365
- type: 'number',
196
+ name: 'id',
197
+ type: 'string',
366
198
  required: true,
367
199
  displayOptions: {
368
200
  show: {
369
201
  resource: ['project'],
370
- operation: ['get', 'update', 'delete'],
202
+ operation: ['edit', 'getFull'],
371
203
  },
372
204
  },
373
- default: 0,
205
+ default: '',
374
206
  description: 'ID of the project',
375
207
  },
376
208
  {
377
- displayName: 'Project Name',
378
- name: 'projectName',
379
- type: 'string',
380
- required: true,
209
+ displayName: 'Additional Fields',
210
+ name: 'additionalFields',
211
+ type: 'collection',
212
+ placeholder: 'Add Field',
213
+ default: {},
381
214
  displayOptions: {
382
215
  show: {
383
216
  resource: ['project'],
384
- operation: ['create'],
217
+ operation: ['create', 'edit'],
385
218
  },
386
219
  },
387
- default: '',
388
- description: 'Name of the project',
220
+ options: [
221
+ {
222
+ displayName: 'Name',
223
+ name: 'name',
224
+ type: 'string',
225
+ default: '',
226
+ description: 'Project name',
227
+ },
228
+ {
229
+ displayName: 'Description',
230
+ name: 'description',
231
+ type: 'string',
232
+ typeOptions: {
233
+ rows: 4,
234
+ },
235
+ default: '',
236
+ description: 'Project description',
237
+ },
238
+ ],
389
239
  },
390
240
  {
391
241
  displayName: 'Username',
@@ -395,7 +245,7 @@ class BaseWework {
395
245
  displayOptions: {
396
246
  show: {
397
247
  resource: ['task'],
398
- operation: ['create', 'update', 'delete'],
248
+ operation: ['create', 'edit', 'markDone'],
399
249
  },
400
250
  },
401
251
  default: '',
@@ -403,140 +253,70 @@ class BaseWework {
403
253
  },
404
254
  {
405
255
  displayName: 'Task ID',
406
- name: 'taskId',
407
- type: 'number',
256
+ name: 'id',
257
+ type: 'string',
408
258
  required: true,
409
259
  displayOptions: {
410
260
  show: {
411
261
  resource: ['task'],
412
- operation: ['get', 'update', 'delete'],
262
+ operation: ['edit', 'get', 'markDone'],
413
263
  },
414
264
  },
415
- default: 0,
265
+ default: '',
416
266
  description: 'ID of the task',
417
267
  },
418
268
  {
419
269
  displayName: 'Project ID',
420
- name: 'projectId',
421
- type: 'number',
422
- required: true,
423
- displayOptions: {
424
- show: {
425
- resource: ['task'],
426
- operation: ['create'],
427
- },
428
- },
429
- default: 0,
430
- description: 'ID of the project',
431
- },
432
- {
433
- displayName: 'Task Name',
434
- name: 'taskName',
270
+ name: 'project_id',
435
271
  type: 'string',
436
272
  required: true,
437
273
  displayOptions: {
438
274
  show: {
439
275
  resource: ['task'],
440
- operation: ['create'],
276
+ operation: ['create', 'project'],
441
277
  },
442
278
  },
443
279
  default: '',
444
- description: 'Name of the task',
445
- },
446
- {
447
- displayName: 'Project ID',
448
- name: 'projectId',
449
- type: 'number',
450
- required: true,
451
- displayOptions: {
452
- show: {
453
- resource: ['manager'],
454
- },
455
- },
456
- default: 0,
457
280
  description: 'ID of the project',
458
281
  },
459
282
  {
460
- displayName: 'Username',
461
- name: 'username',
462
- type: 'string',
463
- required: true,
464
- displayOptions: {
465
- show: {
466
- resource: ['manager'],
467
- },
468
- },
469
- default: '',
470
- description: 'Username of the editor',
471
- },
472
- {
473
- displayName: 'Users',
474
- name: 'users',
475
- type: 'string',
476
- required: true,
477
- displayOptions: {
478
- show: {
479
- resource: ['manager'],
480
- operation: ['addList', 'setList'],
481
- },
482
- },
483
- default: '',
484
- description: 'List of usernames (space-separated, e.g., "@user1 @user2")',
485
- },
486
- {
487
- displayName: 'User',
488
- name: 'user',
489
- type: 'string',
490
- required: true,
283
+ displayName: 'Additional Fields',
284
+ name: 'additionalFields',
285
+ type: 'collection',
286
+ placeholder: 'Add Field',
287
+ default: {},
491
288
  displayOptions: {
492
289
  show: {
493
- resource: ['manager'],
494
- operation: ['exchangeSingle'],
290
+ resource: ['task'],
291
+ operation: ['create', 'edit'],
495
292
  },
496
293
  },
497
- default: '',
498
- description: 'Single username to exchange',
499
- },
500
- {
501
- displayName: 'Old Project ID',
502
- name: 'oldProjectId',
503
- type: 'number',
504
- required: true,
505
- displayOptions: {
506
- show: {
507
- resource: ['manager'],
508
- operation: ['exchangeSingle'],
294
+ options: [
295
+ {
296
+ displayName: 'Name',
297
+ name: 'name',
298
+ type: 'string',
299
+ default: '',
300
+ description: 'Task name',
509
301
  },
510
- },
511
- default: 0,
512
- description: 'ID of the old project',
513
- },
514
- {
515
- displayName: 'New Project ID',
516
- name: 'newProjectId',
517
- type: 'number',
518
- required: true,
519
- displayOptions: {
520
- show: {
521
- resource: ['manager'],
522
- operation: ['exchangeSingle'],
302
+ {
303
+ displayName: 'Description',
304
+ name: 'description',
305
+ type: 'string',
306
+ typeOptions: {
307
+ rows: 4,
308
+ },
309
+ default: '',
310
+ description: 'Task description',
523
311
  },
524
- },
525
- default: 0,
526
- description: 'ID of the new project',
527
- },
528
- {
529
- displayName: 'Remove Assign',
530
- name: 'removeAssign',
531
- type: 'boolean',
532
- displayOptions: {
533
- show: {
534
- resource: ['manager'],
535
- operation: ['exchangeSingle'],
312
+ {
313
+ displayName: 'Assignee',
314
+ name: 'assignee',
315
+ type: 'string',
316
+ default: '',
317
+ description: 'Username of assignee',
536
318
  },
537
- },
538
- default: false,
539
- description: 'Whether to remove assign from all tasks in project',
319
+ ],
540
320
  },
541
321
  {
542
322
  displayName: 'Username',
@@ -546,7 +326,7 @@ class BaseWework {
546
326
  displayOptions: {
547
327
  show: {
548
328
  resource: ['department'],
549
- operation: ['create', 'update', 'delete'],
329
+ operation: ['create', 'edit', 'remove'],
550
330
  },
551
331
  },
552
332
  default: '',
@@ -554,157 +334,17 @@ class BaseWework {
554
334
  },
555
335
  {
556
336
  displayName: 'Department ID',
557
- name: 'departmentId',
558
- type: 'number',
559
- required: true,
560
- displayOptions: {
561
- show: {
562
- resource: ['department'],
563
- operation: ['get', 'update', 'delete'],
564
- },
565
- },
566
- default: 0,
567
- description: 'ID of the department',
568
- },
569
- {
570
- displayName: 'Department Name',
571
- name: 'departmentName',
337
+ name: 'id',
572
338
  type: 'string',
573
339
  required: true,
574
340
  displayOptions: {
575
341
  show: {
576
342
  resource: ['department'],
577
- operation: ['create'],
578
- },
579
- },
580
- default: '',
581
- description: 'Name of the department',
582
- },
583
- {
584
- displayName: 'Username',
585
- name: 'username',
586
- type: 'string',
587
- required: true,
588
- displayOptions: {
589
- show: {
590
- resource: ['tasklist'],
591
- operation: ['create', 'update', 'delete'],
343
+ operation: ['edit', 'get', 'remove'],
592
344
  },
593
345
  },
594
346
  default: '',
595
- description: 'Username of the editor',
596
- },
597
- {
598
- displayName: 'Tasklist ID',
599
- name: 'tasklistId',
600
- type: 'number',
601
- required: true,
602
- displayOptions: {
603
- show: {
604
- resource: ['tasklist'],
605
- operation: ['get', 'update', 'delete'],
606
- },
607
- },
608
- default: 0,
609
- description: 'ID of the tasklist',
610
- },
611
- {
612
- displayName: 'Project ID',
613
- name: 'projectId',
614
- type: 'number',
615
- required: true,
616
- displayOptions: {
617
- show: {
618
- resource: ['tasklist'],
619
- operation: ['create'],
620
- },
621
- },
622
- default: 0,
623
- description: 'ID of the project',
624
- },
625
- {
626
- displayName: 'Tasklist Name',
627
- name: 'tasklistName',
628
- type: 'string',
629
- required: true,
630
- displayOptions: {
631
- show: {
632
- resource: ['tasklist'],
633
- operation: ['create'],
634
- },
635
- },
636
- default: '',
637
- description: 'Name of the tasklist',
638
- },
639
- {
640
- displayName: 'Username',
641
- name: 'username',
642
- type: 'string',
643
- required: true,
644
- displayOptions: {
645
- show: {
646
- resource: ['topic'],
647
- operation: ['create', 'update', 'delete'],
648
- },
649
- },
650
- default: '',
651
- description: 'Username of the editor',
652
- },
653
- {
654
- displayName: 'Topic ID',
655
- name: 'topicId',
656
- type: 'number',
657
- required: true,
658
- displayOptions: {
659
- show: {
660
- resource: ['topic'],
661
- operation: ['get', 'update', 'delete'],
662
- },
663
- },
664
- default: 0,
665
- description: 'ID of the topic',
666
- },
667
- {
668
- displayName: 'Project ID',
669
- name: 'projectId',
670
- type: 'number',
671
- required: true,
672
- displayOptions: {
673
- show: {
674
- resource: ['topic'],
675
- operation: ['create'],
676
- },
677
- },
678
- default: 0,
679
- description: 'ID of the project',
680
- },
681
- {
682
- displayName: 'Topic Title',
683
- name: 'topicTitle',
684
- type: 'string',
685
- required: true,
686
- displayOptions: {
687
- show: {
688
- resource: ['topic'],
689
- operation: ['create'],
690
- },
691
- },
692
- default: '',
693
- description: 'Title of the topic',
694
- },
695
- {
696
- displayName: 'Username',
697
- name: 'username',
698
- type: 'string',
699
- required: true,
700
- displayOptions: {
701
- show: {
702
- resource: ['user'],
703
- operation: ['getInfo'],
704
- },
705
- },
706
- default: '',
707
- description: 'Username to get information for',
347
+ description: 'ID of the department',
708
348
  },
709
349
  {
710
350
  displayName: 'Additional Fields',
@@ -712,7 +352,20 @@ class BaseWework {
712
352
  type: 'collection',
713
353
  placeholder: 'Add Field',
714
354
  default: {},
355
+ displayOptions: {
356
+ show: {
357
+ resource: ['department'],
358
+ operation: ['create', 'edit'],
359
+ },
360
+ },
715
361
  options: [
362
+ {
363
+ displayName: 'Name',
364
+ name: 'name',
365
+ type: 'string',
366
+ default: '',
367
+ description: 'Department name',
368
+ },
716
369
  {
717
370
  displayName: 'Description',
718
371
  name: 'description',
@@ -721,71 +374,7 @@ class BaseWework {
721
374
  rows: 4,
722
375
  },
723
376
  default: '',
724
- description: 'Description of the item',
725
- },
726
- {
727
- displayName: 'Status',
728
- name: 'status',
729
- type: 'options',
730
- options: [
731
- {
732
- name: 'Open',
733
- value: 'open',
734
- },
735
- {
736
- name: 'In Progress',
737
- value: 'in_progress',
738
- },
739
- {
740
- name: 'Completed',
741
- value: 'completed',
742
- },
743
- {
744
- name: 'Closed',
745
- value: 'closed',
746
- },
747
- ],
748
- default: 'open',
749
- description: 'Status of the item',
750
- },
751
- {
752
- displayName: 'Priority',
753
- name: 'priority',
754
- type: 'options',
755
- options: [
756
- {
757
- name: 'Low',
758
- value: 'low',
759
- },
760
- {
761
- name: 'Medium',
762
- value: 'medium',
763
- },
764
- {
765
- name: 'High',
766
- value: 'high',
767
- },
768
- {
769
- name: 'Urgent',
770
- value: 'urgent',
771
- },
772
- ],
773
- default: 'medium',
774
- description: 'Priority level',
775
- },
776
- {
777
- displayName: 'Due Date',
778
- name: 'dueDate',
779
- type: 'dateTime',
780
- default: '',
781
- description: 'Due date for the item',
782
- },
783
- {
784
- displayName: 'Assignee',
785
- name: 'assignee',
786
- type: 'string',
787
- default: '',
788
- description: 'Username of assignee',
377
+ description: 'Department description',
789
378
  },
790
379
  ],
791
380
  },
@@ -801,172 +390,95 @@ class BaseWework {
801
390
  const resource = this.getNodeParameter('resource', i);
802
391
  const operation = this.getNodeParameter('operation', i);
803
392
  let endpoint = '';
804
- let method = 'POST';
393
+ const method = 'POST';
805
394
  const body = {};
395
+ body.access_token_v2 = credentials.accessToken;
806
396
  if (resource === 'project') {
807
397
  if (operation === 'create') {
808
- endpoint = '/extapi/v3/project/add';
398
+ endpoint = '/extapi/v3/project/create';
809
399
  body.username = this.getNodeParameter('username', i);
810
- body.name = this.getNodeParameter('projectName', i);
400
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
401
+ Object.assign(body, additionalFields);
811
402
  }
812
- else if (operation === 'get') {
813
- endpoint = '/extapi/v3/project/info';
814
- body.username = this.getNodeParameter('username', i);
815
- body.id = this.getNodeParameter('projectId', i);
816
- }
817
- else if (operation === 'update') {
403
+ else if (operation === 'edit') {
818
404
  endpoint = '/extapi/v3/project/edit';
819
405
  body.username = this.getNodeParameter('username', i);
820
- body.id = this.getNodeParameter('projectId', i);
406
+ body.id = this.getNodeParameter('id', i);
407
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
408
+ Object.assign(body, additionalFields);
821
409
  }
822
- else if (operation === 'delete') {
823
- endpoint = '/extapi/v3/project/delete';
410
+ else if (operation === 'getFull') {
411
+ endpoint = '/extapi/v3/project/get.full';
824
412
  body.username = this.getNodeParameter('username', i);
825
- body.id = this.getNodeParameter('projectId', i);
413
+ body.id = this.getNodeParameter('id', i);
826
414
  }
827
- else if (operation === 'getAll') {
415
+ else if (operation === 'list') {
828
416
  endpoint = '/extapi/v3/project/list';
829
417
  }
830
418
  }
831
419
  else if (resource === 'task') {
832
420
  if (operation === 'create') {
833
- endpoint = '/extapi/v3/task/add';
421
+ endpoint = '/extapi/v3/task/create';
834
422
  body.username = this.getNodeParameter('username', i);
835
- body.project_id = this.getNodeParameter('projectId', i);
836
- body.name = this.getNodeParameter('taskName', i);
423
+ body.project_id = this.getNodeParameter('project_id', i);
424
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
425
+ Object.assign(body, additionalFields);
837
426
  }
838
- else if (operation === 'get') {
839
- endpoint = '/extapi/v3/task/info';
840
- body.id = this.getNodeParameter('taskId', i);
841
- }
842
- else if (operation === 'update') {
427
+ else if (operation === 'edit') {
843
428
  endpoint = '/extapi/v3/task/edit';
844
429
  body.username = this.getNodeParameter('username', i);
845
- body.id = this.getNodeParameter('taskId', i);
846
- }
847
- else if (operation === 'delete') {
848
- endpoint = '/extapi/v3/task/delete';
849
- body.username = this.getNodeParameter('username', i);
850
- body.id = this.getNodeParameter('taskId', i);
851
- }
852
- else if (operation === 'getAll') {
853
- endpoint = '/extapi/v3/task/list';
854
- }
855
- }
856
- else if (resource === 'manager') {
857
- if (operation === 'addList') {
858
- endpoint = '/extapi/v3/project/manager/add.list';
859
- body.id = this.getNodeParameter('projectId', i);
860
- body.username = this.getNodeParameter('username', i);
861
- body.users = this.getNodeParameter('users', i);
862
- }
863
- else if (operation === 'setList') {
864
- endpoint = '/extapi/v3/project/manager/set.list';
865
- body.id = this.getNodeParameter('projectId', i);
866
- body.username = this.getNodeParameter('username', i);
867
- body.users = this.getNodeParameter('users', i);
868
- }
869
- else if (operation === 'exchangeSingle') {
870
- endpoint = '/extapi/v3/project/manager/exchange.single';
871
- body.old_id = this.getNodeParameter('oldProjectId', i);
872
- body.new_id = this.getNodeParameter('newProjectId', i);
873
- body.username = this.getNodeParameter('username', i);
874
- body.user = this.getNodeParameter('user', i);
875
- const removeAssign = this.getNodeParameter('removeAssign', i);
876
- body.remove_assign = removeAssign ? '1' : '0';
877
- }
878
- }
879
- else if (resource === 'department') {
880
- if (operation === 'create') {
881
- endpoint = '/extapi/v3/department/add';
882
- body.username = this.getNodeParameter('username', i);
883
- body.name = this.getNodeParameter('departmentName', i);
430
+ body.id = this.getNodeParameter('id', i);
431
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
432
+ Object.assign(body, additionalFields);
884
433
  }
885
434
  else if (operation === 'get') {
886
- endpoint = '/extapi/v3/department/info';
887
- body.id = this.getNodeParameter('departmentId', i);
435
+ endpoint = '/extapi/v3/task/get';
436
+ body.id = this.getNodeParameter('id', i);
888
437
  }
889
- else if (operation === 'update') {
890
- endpoint = '/extapi/v3/department/edit';
891
- body.username = this.getNodeParameter('username', i);
892
- body.id = this.getNodeParameter('departmentId', i);
438
+ else if (operation === 'project') {
439
+ endpoint = '/extapi/v3/task/project';
440
+ body.id = this.getNodeParameter('project_id', i);
893
441
  }
894
- else if (operation === 'delete') {
895
- endpoint = '/extapi/v3/department/delete';
442
+ else if (operation === 'markDone') {
443
+ endpoint = '/extapi/v3/task/status/mark.done';
896
444
  body.username = this.getNodeParameter('username', i);
897
- body.id = this.getNodeParameter('departmentId', i);
898
- }
899
- else if (operation === 'getAll') {
900
- endpoint = '/extapi/v3/department/list';
445
+ body.id = this.getNodeParameter('id', i);
901
446
  }
902
447
  }
903
- else if (resource === 'tasklist') {
448
+ else if (resource === 'department') {
904
449
  if (operation === 'create') {
905
- endpoint = '/extapi/v3/tasklist/add';
450
+ endpoint = '/extapi/v3/dept/create';
906
451
  body.username = this.getNodeParameter('username', i);
907
- body.project_id = this.getNodeParameter('projectId', i);
908
- body.name = this.getNodeParameter('tasklistName', i);
452
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
453
+ Object.assign(body, additionalFields);
909
454
  }
910
- else if (operation === 'get') {
911
- endpoint = '/extapi/v3/tasklist/info';
912
- body.id = this.getNodeParameter('tasklistId', i);
913
- }
914
- else if (operation === 'update') {
915
- endpoint = '/extapi/v3/tasklist/edit';
916
- body.username = this.getNodeParameter('username', i);
917
- body.id = this.getNodeParameter('tasklistId', i);
918
- }
919
- else if (operation === 'delete') {
920
- endpoint = '/extapi/v3/tasklist/delete';
455
+ else if (operation === 'edit') {
456
+ endpoint = '/extapi/v3/dept/edit';
921
457
  body.username = this.getNodeParameter('username', i);
922
- body.id = this.getNodeParameter('tasklistId', i);
923
- }
924
- else if (operation === 'getAll') {
925
- endpoint = '/extapi/v3/tasklist/list';
926
- }
927
- }
928
- else if (resource === 'topic') {
929
- if (operation === 'create') {
930
- endpoint = '/extapi/v3/topic/add';
931
- body.username = this.getNodeParameter('username', i);
932
- body.project_id = this.getNodeParameter('projectId', i);
933
- body.title = this.getNodeParameter('topicTitle', i);
458
+ body.id = this.getNodeParameter('id', i);
459
+ const additionalFields = this.getNodeParameter('additionalFields', i, {});
460
+ Object.assign(body, additionalFields);
934
461
  }
935
462
  else if (operation === 'get') {
936
- endpoint = '/extapi/v3/topic/info';
937
- body.id = this.getNodeParameter('topicId', i);
463
+ endpoint = '/extapi/v3/dept/get';
464
+ body.id = this.getNodeParameter('id', i);
938
465
  }
939
- else if (operation === 'update') {
940
- endpoint = '/extapi/v3/topic/edit';
941
- body.username = this.getNodeParameter('username', i);
942
- body.id = this.getNodeParameter('topicId', i);
466
+ else if (operation === 'list') {
467
+ endpoint = '/extapi/v3/dept/list';
943
468
  }
944
- else if (operation === 'delete') {
945
- endpoint = '/extapi/v3/topic/delete';
469
+ else if (operation === 'remove') {
470
+ endpoint = '/extapi/v3/dept/remove';
946
471
  body.username = this.getNodeParameter('username', i);
947
- body.id = this.getNodeParameter('topicId', i);
948
- }
949
- else if (operation === 'getAll') {
950
- endpoint = '/extapi/v3/topic/list';
472
+ body.id = this.getNodeParameter('id', i);
951
473
  }
952
474
  }
953
- else if (resource === 'user') {
954
- if (operation === 'getInfo') {
955
- endpoint = '/extapi/v3/user/info';
956
- body.username = this.getNodeParameter('username', i);
957
- }
958
- else if (operation === 'getAll') {
959
- endpoint = '/extapi/v3/user/list';
960
- }
961
- }
962
- const additionalFields = this.getNodeParameter('additionalFields', i, {});
963
- Object.assign(body, additionalFields);
964
- body.access_token_v2 = credentials.accessToken;
965
475
  const formBody = [];
966
476
  for (const key in body) {
967
- const encodedKey = encodeURIComponent(key);
968
- const encodedValue = encodeURIComponent(String(body[key]));
969
- formBody.push(`${encodedKey}=${encodedValue}`);
477
+ if (body[key] !== undefined && body[key] !== null && body[key] !== '') {
478
+ const encodedKey = encodeURIComponent(key);
479
+ const encodedValue = encodeURIComponent(String(body[key]));
480
+ formBody.push(`${encodedKey}=${encodedValue}`);
481
+ }
970
482
  }
971
483
  const baseURL = `https://${credentials.domain}`;
972
484
  const fullURL = `${baseURL}${endpoint}`;