n8n-nodes-base-wework 1.0.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.
Files changed (63) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +351 -0
  3. package/dist/credentials/BaseWeworkApi.credentials.d.ts +9 -0
  4. package/dist/credentials/BaseWeworkApi.credentials.js +39 -0
  5. package/dist/credentials/BaseWeworkApi.credentials.js.map +1 -0
  6. package/dist/credentials/GithubIssuesApi.credentials.d.ts +10 -0
  7. package/dist/credentials/GithubIssuesApi.credentials.js +37 -0
  8. package/dist/credentials/GithubIssuesApi.credentials.js.map +1 -0
  9. package/dist/credentials/GithubIssuesOAuth2Api.credentials.d.ts +9 -0
  10. package/dist/credentials/GithubIssuesOAuth2Api.credentials.js +54 -0
  11. package/dist/credentials/GithubIssuesOAuth2Api.credentials.js.map +1 -0
  12. package/dist/nodes/BaseWework/BaseWework.node.d.ts +5 -0
  13. package/dist/nodes/BaseWework/BaseWework.node.js +1004 -0
  14. package/dist/nodes/BaseWework/BaseWework.node.js.map +1 -0
  15. package/dist/nodes/BaseWework/BaseWework.node.json +19 -0
  16. package/dist/nodes/BaseWework/basewework.svg +8 -0
  17. package/dist/nodes/Example/Example.node.d.ts +5 -0
  18. package/dist/nodes/Example/Example.node.js +61 -0
  19. package/dist/nodes/Example/Example.node.js.map +1 -0
  20. package/dist/nodes/Example/Example.node.json +18 -0
  21. package/dist/nodes/GithubIssues/GithubIssues.node.d.ts +14 -0
  22. package/dist/nodes/GithubIssues/GithubIssues.node.js +101 -0
  23. package/dist/nodes/GithubIssues/GithubIssues.node.js.map +1 -0
  24. package/dist/nodes/GithubIssues/GithubIssues.node.json +18 -0
  25. package/dist/nodes/GithubIssues/listSearch/getIssues.d.ts +2 -0
  26. package/dist/nodes/GithubIssues/listSearch/getIssues.js +28 -0
  27. package/dist/nodes/GithubIssues/listSearch/getIssues.js.map +1 -0
  28. package/dist/nodes/GithubIssues/listSearch/getRepositories.d.ts +2 -0
  29. package/dist/nodes/GithubIssues/listSearch/getRepositories.js +31 -0
  30. package/dist/nodes/GithubIssues/listSearch/getRepositories.js.map +1 -0
  31. package/dist/nodes/GithubIssues/listSearch/getUsers.d.ts +2 -0
  32. package/dist/nodes/GithubIssues/listSearch/getUsers.js +29 -0
  33. package/dist/nodes/GithubIssues/listSearch/getUsers.js.map +1 -0
  34. package/dist/nodes/GithubIssues/resources/issue/create.d.ts +2 -0
  35. package/dist/nodes/GithubIssues/resources/issue/create.js +75 -0
  36. package/dist/nodes/GithubIssues/resources/issue/create.js.map +1 -0
  37. package/dist/nodes/GithubIssues/resources/issue/get.d.ts +2 -0
  38. package/dist/nodes/GithubIssues/resources/issue/get.js +15 -0
  39. package/dist/nodes/GithubIssues/resources/issue/get.js.map +1 -0
  40. package/dist/nodes/GithubIssues/resources/issue/getAll.d.ts +2 -0
  41. package/dist/nodes/GithubIssues/resources/issue/getAll.js +125 -0
  42. package/dist/nodes/GithubIssues/resources/issue/getAll.js.map +1 -0
  43. package/dist/nodes/GithubIssues/resources/issue/index.d.ts +2 -0
  44. package/dist/nodes/GithubIssues/resources/issue/index.js +76 -0
  45. package/dist/nodes/GithubIssues/resources/issue/index.js.map +1 -0
  46. package/dist/nodes/GithubIssues/resources/issueComment/getAll.d.ts +2 -0
  47. package/dist/nodes/GithubIssues/resources/issueComment/getAll.js +66 -0
  48. package/dist/nodes/GithubIssues/resources/issueComment/getAll.js.map +1 -0
  49. package/dist/nodes/GithubIssues/resources/issueComment/index.d.ts +2 -0
  50. package/dist/nodes/GithubIssues/resources/issueComment/index.js +48 -0
  51. package/dist/nodes/GithubIssues/resources/issueComment/index.js.map +1 -0
  52. package/dist/nodes/GithubIssues/shared/descriptions.d.ts +4 -0
  53. package/dist/nodes/GithubIssues/shared/descriptions.js +151 -0
  54. package/dist/nodes/GithubIssues/shared/descriptions.js.map +1 -0
  55. package/dist/nodes/GithubIssues/shared/transport.d.ts +2 -0
  56. package/dist/nodes/GithubIssues/shared/transport.js +16 -0
  57. package/dist/nodes/GithubIssues/shared/transport.js.map +1 -0
  58. package/dist/nodes/GithubIssues/shared/utils.d.ts +3 -0
  59. package/dist/nodes/GithubIssues/shared/utils.js +17 -0
  60. package/dist/nodes/GithubIssues/shared/utils.js.map +1 -0
  61. package/dist/package.json +62 -0
  62. package/dist/tsconfig.tsbuildinfo +1 -0
  63. package/package.json +59 -0
@@ -0,0 +1,1004 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseWework = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ class BaseWework {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'Base WeWork',
9
+ name: 'baseWework',
10
+ icon: 'file:basewework.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
14
+ description: 'Interact with Base WeWork API',
15
+ defaults: {
16
+ name: 'Base WeWork',
17
+ },
18
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
19
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
20
+ credentials: [
21
+ {
22
+ name: 'baseWeworkApi',
23
+ required: true,
24
+ },
25
+ ],
26
+ requestDefaults: {
27
+ baseURL: '=https://wework.{{$credentials.domain}}',
28
+ headers: {
29
+ 'Content-Type': 'application/x-www-form-urlencoded',
30
+ },
31
+ },
32
+ properties: [
33
+ {
34
+ displayName: 'Resource',
35
+ name: 'resource',
36
+ type: 'options',
37
+ noDataExpression: true,
38
+ options: [
39
+ {
40
+ name: 'Project',
41
+ value: 'project',
42
+ },
43
+ {
44
+ name: 'Task',
45
+ value: 'task',
46
+ },
47
+ {
48
+ name: 'Manager',
49
+ value: 'manager',
50
+ },
51
+ {
52
+ name: 'Department',
53
+ value: 'department',
54
+ },
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
+ ],
68
+ default: 'project',
69
+ },
70
+ {
71
+ displayName: 'Operation',
72
+ name: 'operation',
73
+ type: 'options',
74
+ noDataExpression: true,
75
+ displayOptions: {
76
+ show: {
77
+ resource: ['project'],
78
+ },
79
+ },
80
+ options: [
81
+ {
82
+ name: 'Create',
83
+ value: 'create',
84
+ description: 'Create a new project',
85
+ action: 'Create a project',
86
+ },
87
+ {
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',
98
+ },
99
+ {
100
+ name: 'Delete',
101
+ value: 'delete',
102
+ description: 'Delete a project',
103
+ action: 'Delete a project',
104
+ },
105
+ {
106
+ name: 'Get All',
107
+ value: 'getAll',
108
+ description: 'Get all projects',
109
+ action: 'Get all projects',
110
+ },
111
+ ],
112
+ default: 'create',
113
+ },
114
+ {
115
+ displayName: 'Operation',
116
+ name: 'operation',
117
+ type: 'options',
118
+ noDataExpression: true,
119
+ displayOptions: {
120
+ show: {
121
+ resource: ['task'],
122
+ },
123
+ },
124
+ options: [
125
+ {
126
+ name: 'Create',
127
+ value: 'create',
128
+ description: 'Create a new task',
129
+ action: 'Create a task',
130
+ },
131
+ {
132
+ name: 'Get',
133
+ value: 'get',
134
+ description: 'Get a task',
135
+ action: 'Get a task',
136
+ },
137
+ {
138
+ name: 'Update',
139
+ value: 'update',
140
+ description: 'Update a task',
141
+ action: 'Update a task',
142
+ },
143
+ {
144
+ name: 'Delete',
145
+ value: 'delete',
146
+ description: 'Delete a task',
147
+ action: 'Delete a task',
148
+ },
149
+ {
150
+ name: 'Get All',
151
+ value: 'getAll',
152
+ description: 'Get all tasks',
153
+ action: 'Get all tasks',
154
+ },
155
+ ],
156
+ default: 'create',
157
+ },
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
+ {
191
+ displayName: 'Operation',
192
+ name: 'operation',
193
+ type: 'options',
194
+ noDataExpression: true,
195
+ displayOptions: {
196
+ show: {
197
+ resource: ['department'],
198
+ },
199
+ },
200
+ options: [
201
+ {
202
+ name: 'Create',
203
+ value: 'create',
204
+ description: 'Create a new department',
205
+ action: 'Create a department',
206
+ },
207
+ {
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',
250
+ },
251
+ {
252
+ name: 'Get',
253
+ 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',
262
+ },
263
+ {
264
+ name: 'Delete',
265
+ value: 'delete',
266
+ description: 'Delete a tasklist',
267
+ action: 'Delete a tasklist',
268
+ },
269
+ {
270
+ name: 'Get All',
271
+ value: 'getAll',
272
+ description: 'Get all tasklists',
273
+ action: 'Get all tasklists',
274
+ },
275
+ ],
276
+ default: 'create',
277
+ },
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
+ {
349
+ displayName: 'Username',
350
+ name: 'username',
351
+ type: 'string',
352
+ required: true,
353
+ displayOptions: {
354
+ show: {
355
+ resource: ['project'],
356
+ operation: ['create', 'update', 'delete', 'get'],
357
+ },
358
+ },
359
+ default: '',
360
+ description: 'Username of the editor (e.g., @admin)',
361
+ },
362
+ {
363
+ displayName: 'Project ID',
364
+ name: 'projectId',
365
+ type: 'number',
366
+ required: true,
367
+ displayOptions: {
368
+ show: {
369
+ resource: ['project'],
370
+ operation: ['get', 'update', 'delete'],
371
+ },
372
+ },
373
+ default: 0,
374
+ description: 'ID of the project',
375
+ },
376
+ {
377
+ displayName: 'Project Name',
378
+ name: 'projectName',
379
+ type: 'string',
380
+ required: true,
381
+ displayOptions: {
382
+ show: {
383
+ resource: ['project'],
384
+ operation: ['create'],
385
+ },
386
+ },
387
+ default: '',
388
+ description: 'Name of the project',
389
+ },
390
+ {
391
+ displayName: 'Username',
392
+ name: 'username',
393
+ type: 'string',
394
+ required: true,
395
+ displayOptions: {
396
+ show: {
397
+ resource: ['task'],
398
+ operation: ['create', 'update', 'delete'],
399
+ },
400
+ },
401
+ default: '',
402
+ description: 'Username of the editor',
403
+ },
404
+ {
405
+ displayName: 'Task ID',
406
+ name: 'taskId',
407
+ type: 'number',
408
+ required: true,
409
+ displayOptions: {
410
+ show: {
411
+ resource: ['task'],
412
+ operation: ['get', 'update', 'delete'],
413
+ },
414
+ },
415
+ default: 0,
416
+ description: 'ID of the task',
417
+ },
418
+ {
419
+ 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',
435
+ type: 'string',
436
+ required: true,
437
+ displayOptions: {
438
+ show: {
439
+ resource: ['task'],
440
+ operation: ['create'],
441
+ },
442
+ },
443
+ 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
+ description: 'ID of the project',
458
+ },
459
+ {
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,
491
+ displayOptions: {
492
+ show: {
493
+ resource: ['manager'],
494
+ operation: ['exchangeSingle'],
495
+ },
496
+ },
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'],
509
+ },
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'],
523
+ },
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'],
536
+ },
537
+ },
538
+ default: false,
539
+ description: 'Whether to remove assign from all tasks in project',
540
+ },
541
+ {
542
+ displayName: 'Username',
543
+ name: 'username',
544
+ type: 'string',
545
+ required: true,
546
+ displayOptions: {
547
+ show: {
548
+ resource: ['department'],
549
+ operation: ['create', 'update', 'delete'],
550
+ },
551
+ },
552
+ default: '',
553
+ description: 'Username of the editor',
554
+ },
555
+ {
556
+ 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',
572
+ type: 'string',
573
+ required: true,
574
+ displayOptions: {
575
+ show: {
576
+ 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'],
592
+ },
593
+ },
594
+ 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',
708
+ },
709
+ {
710
+ displayName: 'Additional Fields',
711
+ name: 'additionalFields',
712
+ type: 'collection',
713
+ placeholder: 'Add Field',
714
+ default: {},
715
+ options: [
716
+ {
717
+ displayName: 'Description',
718
+ name: 'description',
719
+ type: 'string',
720
+ typeOptions: {
721
+ rows: 4,
722
+ },
723
+ 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',
789
+ },
790
+ ],
791
+ },
792
+ ],
793
+ };
794
+ }
795
+ async execute() {
796
+ const items = this.getInputData();
797
+ const returnData = [];
798
+ const credentials = await this.getCredentials('baseWeworkApi');
799
+ for (let i = 0; i < items.length; i++) {
800
+ try {
801
+ const resource = this.getNodeParameter('resource', i);
802
+ const operation = this.getNodeParameter('operation', i);
803
+ let endpoint = '';
804
+ let method = 'POST';
805
+ const body = {};
806
+ if (resource === 'project') {
807
+ if (operation === 'create') {
808
+ endpoint = '/extapi/v3/project/add';
809
+ body.username = this.getNodeParameter('username', i);
810
+ body.name = this.getNodeParameter('projectName', i);
811
+ }
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') {
818
+ endpoint = '/extapi/v3/project/edit';
819
+ body.username = this.getNodeParameter('username', i);
820
+ body.id = this.getNodeParameter('projectId', i);
821
+ }
822
+ else if (operation === 'delete') {
823
+ endpoint = '/extapi/v3/project/delete';
824
+ body.username = this.getNodeParameter('username', i);
825
+ body.id = this.getNodeParameter('projectId', i);
826
+ }
827
+ else if (operation === 'getAll') {
828
+ endpoint = '/extapi/v3/project/list';
829
+ }
830
+ }
831
+ else if (resource === 'task') {
832
+ if (operation === 'create') {
833
+ endpoint = '/extapi/v3/task/add';
834
+ body.username = this.getNodeParameter('username', i);
835
+ body.project_id = this.getNodeParameter('projectId', i);
836
+ body.name = this.getNodeParameter('taskName', i);
837
+ }
838
+ else if (operation === 'get') {
839
+ endpoint = '/extapi/v3/task/info';
840
+ body.id = this.getNodeParameter('taskId', i);
841
+ }
842
+ else if (operation === 'update') {
843
+ endpoint = '/extapi/v3/task/edit';
844
+ 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);
884
+ }
885
+ else if (operation === 'get') {
886
+ endpoint = '/extapi/v3/department/info';
887
+ body.id = this.getNodeParameter('departmentId', i);
888
+ }
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);
893
+ }
894
+ else if (operation === 'delete') {
895
+ endpoint = '/extapi/v3/department/delete';
896
+ 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';
901
+ }
902
+ }
903
+ else if (resource === 'tasklist') {
904
+ if (operation === 'create') {
905
+ endpoint = '/extapi/v3/tasklist/add';
906
+ body.username = this.getNodeParameter('username', i);
907
+ body.project_id = this.getNodeParameter('projectId', i);
908
+ body.name = this.getNodeParameter('tasklistName', i);
909
+ }
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';
921
+ 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);
934
+ }
935
+ else if (operation === 'get') {
936
+ endpoint = '/extapi/v3/topic/info';
937
+ body.id = this.getNodeParameter('topicId', i);
938
+ }
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);
943
+ }
944
+ else if (operation === 'delete') {
945
+ endpoint = '/extapi/v3/topic/delete';
946
+ 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';
951
+ }
952
+ }
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
+ const formBody = [];
966
+ for (const key in body) {
967
+ const encodedKey = encodeURIComponent(key);
968
+ const encodedValue = encodeURIComponent(String(body[key]));
969
+ formBody.push(`${encodedKey}=${encodedValue}`);
970
+ }
971
+ const baseURL = `https://${credentials.domain}`;
972
+ const fullURL = `${baseURL}${endpoint}`;
973
+ const options = {
974
+ method,
975
+ url: fullURL,
976
+ body: formBody.join('&'),
977
+ headers: {
978
+ 'Content-Type': 'application/x-www-form-urlencoded',
979
+ },
980
+ };
981
+ const responseData = await this.helpers.httpRequest(options);
982
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
983
+ returnData.push(...executionData);
984
+ }
985
+ catch (error) {
986
+ if (this.continueOnFail()) {
987
+ returnData.push({
988
+ json: {
989
+ error: error.message,
990
+ },
991
+ pairedItem: { item: i },
992
+ });
993
+ continue;
994
+ }
995
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
996
+ itemIndex: i,
997
+ });
998
+ }
999
+ }
1000
+ return [returnData];
1001
+ }
1002
+ }
1003
+ exports.BaseWework = BaseWework;
1004
+ //# sourceMappingURL=BaseWework.node.js.map