@pipedream/trello 0.4.0 → 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 (65) hide show
  1. package/actions/add-attachment-to-card/add-attachment-to-card.mjs +29 -58
  2. package/actions/add-checklist/add-checklist.mjs +9 -19
  3. package/actions/add-comment/add-comment.mjs +4 -5
  4. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +9 -19
  5. package/actions/add-member-to-card/add-member-to-card.mjs +9 -19
  6. package/actions/archive-card/archive-card.mjs +5 -6
  7. package/actions/{common.mjs → common/common.mjs} +1 -1
  8. package/actions/complete-checklist-item/complete-checklist-item.mjs +4 -14
  9. package/actions/create-board/create-board.mjs +10 -47
  10. package/actions/create-card/create-card.mjs +45 -65
  11. package/actions/create-checklist-item/create-checklist-item.mjs +4 -14
  12. package/actions/create-label/create-label.mjs +5 -18
  13. package/actions/create-list/create-list.mjs +4 -12
  14. package/actions/delete-checklist/delete-checklist.mjs +8 -18
  15. package/actions/find-labels/find-labels.mjs +2 -3
  16. package/actions/find-list/find-list.mjs +2 -2
  17. package/actions/get-card/get-card.mjs +2 -2
  18. package/actions/get-list/get-list.mjs +1 -1
  19. package/actions/move-card-to-list/move-card-to-list.mjs +2 -2
  20. package/actions/remove-label-from-card/remove-label-from-card.mjs +9 -18
  21. package/actions/rename-list/rename-list.mjs +2 -2
  22. package/actions/search-boards/search-boards.mjs +10 -8
  23. package/actions/search-cards/search-cards.mjs +11 -8
  24. package/actions/search-checklists/search-checklists.mjs +56 -75
  25. package/actions/search-members/search-members.mjs +13 -23
  26. package/actions/update-card/update-card.mjs +22 -21
  27. package/common/constants.mjs +128 -0
  28. package/common/fields.mjs +1 -0
  29. package/package.json +3 -2
  30. package/sources/card-archived/card-archived.mjs +16 -28
  31. package/sources/card-archived/test-event.mjs +64 -0
  32. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +111 -33
  33. package/sources/card-due-date-reminder/test-event.mjs +75 -0
  34. package/sources/card-moved/card-moved.mjs +20 -23
  35. package/sources/card-moved/test-event.mjs +78 -0
  36. package/sources/card-updates/card-updates.mjs +20 -27
  37. package/sources/card-updates/test-event.mjs +86 -0
  38. package/sources/common/actions.mjs +206 -0
  39. package/sources/common/common-board-based.mjs +12 -7
  40. package/sources/common/common-webhook.mjs +27 -16
  41. package/sources/common/common.mjs +5 -2
  42. package/sources/custom-webhook-events/custom-webhook-events.mjs +17 -48
  43. package/sources/new-activity/new-activity.mjs +22 -31
  44. package/sources/new-attachment/new-attachment.mjs +40 -49
  45. package/sources/new-attachment/test-event.mjs +69 -0
  46. package/sources/new-board/new-board.mjs +18 -11
  47. package/sources/new-board/test-event.mjs +100 -0
  48. package/sources/new-card/new-card.mjs +20 -27
  49. package/sources/new-card/test-event.mjs +79 -0
  50. package/sources/new-checklist/new-checklist.mjs +39 -22
  51. package/sources/new-checklist/test-event.mjs +22 -0
  52. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +38 -44
  53. package/sources/new-comment-added-to-card/test-event.mjs +298 -0
  54. package/sources/new-label/new-label.mjs +13 -14
  55. package/sources/new-label/test-event.mjs +7 -0
  56. package/sources/new-label-added-to-card/new-label-added-to-card.mjs +23 -24
  57. package/sources/new-label-added-to-card/test-event.mjs +85 -0
  58. package/sources/new-member-on-card/new-member-on-card.mjs +17 -26
  59. package/sources/new-member-on-card/test-event.mjs +83 -0
  60. package/sources/new-notification/new-notification.mjs +3 -12
  61. package/trello.app.mjs +211 -33
  62. package/actions/close-board/close-board.mjs +0 -31
  63. package/actions/create-checklist/create-checklist.mjs +0 -78
  64. package/actions/create-comment-on-card/create-comment-on-card.mjs +0 -59
  65. package/sources/new-list/new-list.mjs +0 -33
@@ -1,52 +1,43 @@
1
1
  import common from "../common/common-board-based.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "trello-new-member-on-card",
6
7
  name: "New Member on Card (Instant)",
7
8
  description: "Emit new event for each member that join in a card.",
8
- version: "0.1.0",
9
+ version: "0.1.1",
9
10
  type: "source",
10
11
  dedupe: "unique",
11
12
  methods: {
12
13
  ...common.methods,
13
- getMemberCards({
14
- userId, ...args
15
- } = {}) {
16
- return this.app._makeRequest({
17
- path: `/members/${userId}/cards`,
18
- ...args,
19
- });
20
- },
21
- async getSampleEvents() {
22
- const cards = await this.getMemberCards({
14
+ getSampleEvents() {
15
+ return this.app.getMemberCards({
23
16
  userId: "me",
24
17
  });
25
- return {
26
- sampleEvents: cards,
27
- sortField: "dateLastActivity",
28
- };
29
18
  },
30
- isCorrectEventType(event) {
31
- const eventType = event.body?.action?.type;
32
- return eventType === "addMemberToCard";
19
+ getSortField() {
20
+ return "dateLastActivity";
21
+ },
22
+ isCorrectEventType({ type }) {
23
+ return type === "addMemberToCard";
33
24
  },
34
- async getResult(event) {
35
- const cardId = event.body?.action?.data?.card?.id;
25
+ getResult({ data }) {
36
26
  return this.app.getCard({
37
- cardId,
27
+ cardId: data?.card?.id,
38
28
  });
39
29
  },
40
30
  generateMeta({
41
- id, name: summary, dateLastActivity,
31
+ id, name, dateLastActivity,
42
32
  }) {
43
33
  return {
44
- id: this.onlyEventsRelatedWithAuthenticatedUser ?
45
- id :
46
- `${id}${dateLastActivity}`,
47
- summary,
34
+ id: this.onlyEventsRelatedWithAuthenticatedUser
35
+ ? id
36
+ : `${id}${dateLastActivity}`,
37
+ summary: name || id,
48
38
  ts: Date.now(),
49
39
  };
50
40
  },
51
41
  },
42
+ sampleEmit,
52
43
  };
@@ -0,0 +1,83 @@
1
+ export default {
2
+ "id": "66f5aef006f1cca76bb3250f",
3
+ "badges": {
4
+ "attachmentsByType": {
5
+ "trello": {
6
+ "board": 0,
7
+ "card": 0
8
+ }
9
+ },
10
+ "externalSource": null,
11
+ "location": false,
12
+ "votes": 0,
13
+ "viewingMemberVoted": false,
14
+ "subscribed": true,
15
+ "attachments": 0,
16
+ "fogbugz": "",
17
+ "checkItems": 0,
18
+ "checkItemsChecked": 0,
19
+ "checkItemsEarliestDue": null,
20
+ "comments": 2,
21
+ "description": false,
22
+ "due": null,
23
+ "dueComplete": false,
24
+ "lastUpdatedByAi": false,
25
+ "start": null
26
+ },
27
+ "checkItemStates": [],
28
+ "closed": false,
29
+ "dueComplete": false,
30
+ "dateLastActivity": "2024-09-30T16:22:46.307Z",
31
+ "desc": "",
32
+ "descData": {
33
+ "emoji": {}
34
+ },
35
+ "due": null,
36
+ "dueReminder": null,
37
+ "email": null,
38
+ "idBoard": "5f4d7be6c45c22583f75fa02",
39
+ "idChecklists": [
40
+ "66f5b2296cb1ec0c66c5a119",
41
+ "66f6f798f4c23c2020f2bbad"
42
+ ],
43
+ "idList": "5f4d7f78bdd7ce4d2d25fdda",
44
+ "idMembers": [
45
+ "5df149d4fa80be39e64c9a43"
46
+ ],
47
+ "idMembersVoted": [],
48
+ "idShort": 98,
49
+ "idAttachmentCover": null,
50
+ "labels": [
51
+ {
52
+ "id": "66f5c1fd51d74d4e66aa26e0",
53
+ "idBoard": "5f4d7be6c45c22583f75fa02",
54
+ "idOrganization": "6047c17c2f558003144e04d7",
55
+ "name": "subtle sky label",
56
+ "nodeId": "ari:cloud:trello::label/workspace/6047c17c2f558003144e04d7/66f5c1fd51d74d4e66aa26e0",
57
+ "color": "sky_light",
58
+ "uses": 1
59
+ },
60
+ ],
61
+ "idLabels": [
62
+ "66f5c1fd51d74d4e66aa26e0",
63
+ ],
64
+ "manualCoverAttachment": false,
65
+ "name": "hello world",
66
+ "pinned": false,
67
+ "pos": 393215,
68
+ "shortLink": "bRoOO9Bh",
69
+ "shortUrl": "https://trello.com/c/bRoOO9Bh",
70
+ "start": null,
71
+ "subscribed": true,
72
+ "url": "https://trello.com/c/bRoOO9Bh/98-hello-world",
73
+ "cover": {
74
+ "idAttachment": null,
75
+ "color": null,
76
+ "idUploadedBackground": null,
77
+ "size": "normal",
78
+ "brightness": "dark",
79
+ "idPlugin": null
80
+ },
81
+ "isTemplate": false,
82
+ "cardRole": null
83
+ }
@@ -4,21 +4,12 @@ export default {
4
4
  ...common,
5
5
  key: "trello-new-notification",
6
6
  name: "New Notification",
7
- description:
8
- "Emit new event for each new Trello notification for the authenticated user.",
9
- version: "0.1.0",
7
+ description: "Emit new event for each new Trello notification for the authenticated user.",
8
+ version: "0.1.1",
10
9
  type: "source",
11
10
  dedupe: "unique",
12
11
  methods: {
13
12
  ...common.methods,
14
- getNotifications({
15
- notificationId, ...args
16
- } = {}) {
17
- return this.app._makeRequest({
18
- path: `/members/${notificationId}/notifications`,
19
- ...args,
20
- });
21
- },
22
13
  _getLastNotificationId() {
23
14
  return this.db.get("lastNotificationId") || null;
24
15
  },
@@ -38,7 +29,7 @@ export default {
38
29
  async run() {
39
30
  const since = this._getLastNotificationId();
40
31
 
41
- const notifications = await this.getNotifications({
32
+ const notifications = await this.app.getNotifications({
42
33
  notificationId: "me",
43
34
  params: {
44
35
  since,
package/trello.app.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  import { axios } from "@pipedream/platform";
2
2
  import fields from "./common/fields.mjs";
3
+ import constants from "./common/constants.mjs";
4
+ import mime from "mime/types/standard.js";
3
5
 
4
6
  export default {
5
7
  type: "app",
@@ -26,10 +28,18 @@ export default {
26
28
  label: "Cards",
27
29
  description: "The Trello cards you wish to select",
28
30
  optional: true,
29
- async options({ board }) {
30
- const cards = await this.getCards({
31
+ async options({
32
+ board, list, checklistCardsOnly,
33
+ }) {
34
+ let cards = await this.getCards({
31
35
  boardId: board,
32
36
  });
37
+ if (list) {
38
+ cards = cards.filter(({ idList }) => idList === list);
39
+ }
40
+ if (checklistCardsOnly) {
41
+ cards = cards.filter(({ idChecklists }) => idChecklists?.length);
42
+ }
33
43
  return cards.map(({
34
44
  id: value, name: label,
35
45
  }) => ({
@@ -41,7 +51,7 @@ export default {
41
51
  boardFields: {
42
52
  type: "string[]",
43
53
  label: "Boards Fields",
44
- description: "`all` or a list of board [fields](https://developer.atlassian.com/cloud/trello/guides/rest-api/object-definitions/#board-object)",
54
+ description: "`all` or a list of board [fields](https://developer.atlassian.com/cloud/trello/guides/rest-api/object-definitions/#board-object) to be returned in the results",
45
55
  options: fields.board,
46
56
  default: [
47
57
  "name",
@@ -51,7 +61,7 @@ export default {
51
61
  cardFields: {
52
62
  type: "string[]",
53
63
  label: "Cards Fields",
54
- description: "`all` or a list of card [fields](https://developer.atlassian.com/cloud/trello/guides/rest-api/object-definitions/#card-object)",
64
+ description: "`all` or a list of card [fields](https://developer.atlassian.com/cloud/trello/guides/rest-api/object-definitions/#card-object) to be returned in the results",
55
65
  options: fields.card,
56
66
  default: [
57
67
  "all",
@@ -111,10 +121,23 @@ export default {
111
121
  type: "string",
112
122
  label: "Label",
113
123
  description: "The ID of the Label to be added to the card",
114
- async options({ board }) {
115
- const labels = await this.findLabel({
124
+ async options({
125
+ board, card, excludeCardLabels, cardLabelsOnly,
126
+ }) {
127
+ let labels = await this.findLabel({
116
128
  boardId: board,
117
129
  });
130
+ if (card) {
131
+ const { idLabels } = await this.getCard({
132
+ cardId: card,
133
+ });
134
+ if (excludeCardLabels) {
135
+ labels = labels.filter(({ id }) => !idLabels.includes(id));
136
+ }
137
+ if (cardLabelsOnly) {
138
+ labels = labels.filter(({ id }) => idLabels.includes(id));
139
+ }
140
+ }
118
141
  return labels.map(({
119
142
  name, color, id: value,
120
143
  }) => ({
@@ -127,10 +150,18 @@ export default {
127
150
  type: "string",
128
151
  label: "Member",
129
152
  description: "The ID of the Member to be added to the card",
130
- async options(opts) {
131
- const members = await this.listMembers({
132
- boardId: opts.board,
153
+ async options({
154
+ board, card, excludeCardMembers,
155
+ }) {
156
+ let members = await this.listMembers({
157
+ boardId: board,
133
158
  });
159
+ if (card && excludeCardMembers) {
160
+ const { idMembers } = await this.getCard({
161
+ cardId: card,
162
+ });
163
+ members = members.filter(({ id }) => !idMembers.includes(id));
164
+ }
134
165
  return members.map((member) => ({
135
166
  label: member.fullName,
136
167
  value: member.id,
@@ -184,19 +215,19 @@ export default {
184
215
  type: "string",
185
216
  label: "File Attachment URL",
186
217
  description: "URL must start with `http://` or `https://`",
187
- optional: true,
188
218
  },
189
219
  mimeType: {
190
220
  type: "string",
191
- label: "File Attachment Type",
192
- description: "Not required for **File Attachment URL** property. Eg. `application/pdf`",
193
- optional: true,
221
+ label: "Mime Type",
222
+ description: "Mime type of the attached file. Eg. `application/pdf`",
223
+ options() {
224
+ return Object.keys(mime);
225
+ },
194
226
  },
195
227
  file: {
196
228
  type: "string",
197
229
  label: "File Attachment Path",
198
- description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.pdf`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory). If you provide a file path, the **File Attachment URL** field will be ignored.",
199
- optional: true,
230
+ description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.pdf`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)",
200
231
  },
201
232
  desc: {
202
233
  type: "string",
@@ -207,11 +238,8 @@ export default {
207
238
  pos: {
208
239
  type: "string",
209
240
  label: "Position",
210
- description: "The position of the new card, can be `top`, `bottom`, or a positive number",
211
- options: [
212
- "top",
213
- "bottom",
214
- ],
241
+ description: "The position of the checklist on the card. One of: top, bottom, or a positive number.",
242
+ options: constants.POSITIONS,
215
243
  optional: true,
216
244
  },
217
245
  due: {
@@ -248,25 +276,14 @@ export default {
248
276
  type: "string",
249
277
  label: "Card Filter",
250
278
  description: "Filter to apply to Cards. Valid values: `all`, `closed`, `none`, `open`, `visible`",
251
- options: [
252
- "all",
253
- "closed",
254
- "none",
255
- "open",
256
- "visible",
257
- ],
279
+ options: constants.CARD_FILTERS,
258
280
  default: "all",
259
281
  },
260
282
  listFilter: {
261
283
  type: "string",
262
284
  label: "List Filter",
263
285
  description: "Type of list to search for",
264
- options: [
265
- "all",
266
- "closed",
267
- "none",
268
- "open",
269
- ],
286
+ options: constants.LIST_FILTERS,
270
287
  default: "all",
271
288
  },
272
289
  customFieldItems: {
@@ -312,6 +329,15 @@ export default {
312
329
  }));
313
330
  },
314
331
  },
332
+ fileType: {
333
+ type: "string",
334
+ label: "File Attachment Type",
335
+ description: "Select whether to attach file from a path or URL",
336
+ options: [
337
+ "path",
338
+ "url",
339
+ ],
340
+ },
315
341
  },
316
342
  methods: {
317
343
  getSignerUri() {
@@ -377,6 +403,12 @@ export default {
377
403
  ...args,
378
404
  });
379
405
  },
406
+ createCard(args = {}) {
407
+ return this.post({
408
+ path: "/cards",
409
+ ...args,
410
+ });
411
+ },
380
412
  updateCard({
381
413
  cardId, ...args
382
414
  } = {}) {
@@ -393,6 +425,14 @@ export default {
393
425
  ...args,
394
426
  });
395
427
  },
428
+ getCardActivity({
429
+ cardId, ...args
430
+ } = {}) {
431
+ return this._makeRequest({
432
+ path: `/cards/${cardId}/actions`,
433
+ ...args,
434
+ });
435
+ },
396
436
  getBoardActivity({
397
437
  boardId, ...args
398
438
  } = {}) {
@@ -433,6 +473,30 @@ export default {
433
473
  ...args,
434
474
  });
435
475
  },
476
+ getChecklist({
477
+ checklistId, ...args
478
+ } = {}) {
479
+ return this._makeRequest({
480
+ path: `/checklists/${checklistId}`,
481
+ ...args,
482
+ });
483
+ },
484
+ getFilteredCards({
485
+ boardId, filter, ...args
486
+ } = {}) {
487
+ return this._makeRequest({
488
+ path: `/boards/${boardId}/cards/${filter}`,
489
+ ...args,
490
+ });
491
+ },
492
+ getCardList({
493
+ cardId, ...args
494
+ } = {}) {
495
+ return this._makeRequest({
496
+ path: `/cards/${cardId}/list`,
497
+ ...args,
498
+ });
499
+ },
436
500
  getCardsInList({
437
501
  listId, ...args
438
502
  } = {}) {
@@ -473,6 +537,30 @@ export default {
473
537
  ...args,
474
538
  });
475
539
  },
540
+ getMemberCards({
541
+ userId, ...args
542
+ } = {}) {
543
+ return this._makeRequest({
544
+ path: `/members/${userId}/cards`,
545
+ ...args,
546
+ });
547
+ },
548
+ getAttachment({
549
+ cardId, attachmentId, ...args
550
+ } = {}) {
551
+ return this._makeRequest({
552
+ path: `/cards/${cardId}/attachments/${attachmentId}`,
553
+ ...args,
554
+ });
555
+ },
556
+ getNotifications({
557
+ notificationId, ...args
558
+ } = {}) {
559
+ return this._makeRequest({
560
+ path: `/members/${notificationId}/notifications`,
561
+ ...args,
562
+ });
563
+ },
476
564
  /**
477
565
  * Searches for members, cards, boards, and/or organizations matching the specified query.
478
566
  *
@@ -560,5 +648,95 @@ export default {
560
648
  ...args,
561
649
  });
562
650
  },
651
+ addAttachmentToCard({
652
+ cardId, ...args
653
+ } = {}) {
654
+ return this.post({
655
+ path: `/cards/${cardId}/attachments`,
656
+ ...args,
657
+ });
658
+ },
659
+ addChecklist({
660
+ cardId, ...args
661
+ } = {}) {
662
+ return this.post({
663
+ path: `/cards/${cardId}/checklists`,
664
+ ...args,
665
+ });
666
+ },
667
+ addComment({
668
+ cardId, ...args
669
+ } = {}) {
670
+ return this.post({
671
+ path: `/cards/${cardId}/actions/comments`,
672
+ ...args,
673
+ });
674
+ },
675
+ addExistingLabelToCard({
676
+ cardId, ...args
677
+ } = {}) {
678
+ return this.post({
679
+ path: `/cards/${cardId}/idLabels`,
680
+ ...args,
681
+ });
682
+ },
683
+ removeLabelFromCard({
684
+ cardId, labelId, ...args
685
+ } = {}) {
686
+ return this.delete({
687
+ path: `/cards/${cardId}/idLabels/${labelId}`,
688
+ ...args,
689
+ });
690
+ },
691
+ addMemberToCard({
692
+ cardId, ...args
693
+ } = {}) {
694
+ return this.post({
695
+ path: `/cards/${cardId}/idMembers`,
696
+ ...args,
697
+ });
698
+ },
699
+ completeChecklistItem({
700
+ cardId, checklistItemId, ...args
701
+ } = {}) {
702
+ return this.put({
703
+ path: `/cards/${cardId}/checkItem/${checklistItemId}`,
704
+ ...args,
705
+ });
706
+ },
707
+ createChecklistItem({
708
+ checklistId, ...args
709
+ } = {}) {
710
+ return this.post({
711
+ path: `/checklists/${checklistId}/checkItems`,
712
+ ...args,
713
+ });
714
+ },
715
+ createLabel(args = {}) {
716
+ return this.post({
717
+ path: "/labels",
718
+ ...args,
719
+ });
720
+ },
721
+ createList(args = {}) {
722
+ return this.post({
723
+ path: "/lists",
724
+ ...args,
725
+ });
726
+ },
727
+ deleteChecklist({
728
+ checklistId, ...args
729
+ } = {}) {
730
+ return this.delete({
731
+ path: `/checklists/${checklistId}`,
732
+ ...args,
733
+ });
734
+ },
735
+ searchMembers(args = {}) {
736
+ return this._makeRequest({
737
+ path: "/search/members",
738
+ ...args,
739
+ });
740
+ },
563
741
  },
564
742
  };
@@ -1,31 +0,0 @@
1
- import common from "../common.mjs";
2
-
3
- export default {
4
- ...common,
5
- key: "trello-close-board",
6
- name: "Close Board",
7
- description: "Closes a board. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-put).",
8
- version: "0.1.0",
9
- type: "action",
10
- props: {
11
- ...common.props,
12
- boardId: {
13
- propDefinition: [
14
- common.props.app,
15
- "board",
16
- ],
17
- description: "The ID of the Board to close",
18
- },
19
- },
20
- async run({ $ }) {
21
- const res = await this.app.updateBoard({
22
- $,
23
- boardId: this.boardId,
24
- data: {
25
- closed: true,
26
- },
27
- });
28
- $.export("$summary", `Successfully closed board ${this.boardId}`);
29
- return res;
30
- },
31
- };
@@ -1,78 +0,0 @@
1
- import common from "../common.mjs";
2
-
3
- export default {
4
- ...common,
5
- key: "trello-create-checklist",
6
- name: "Create Checklist",
7
- description: "Creates a checklist on the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-checklists/#api-checklists-post).",
8
- version: "0.1.0",
9
- type: "action",
10
- props: {
11
- ...common.props,
12
- board: {
13
- propDefinition: [
14
- common.props.app,
15
- "board",
16
- ],
17
- },
18
- idCard: {
19
- propDefinition: [
20
- common.props.app,
21
- "cards",
22
- (c) => ({
23
- board: c.board,
24
- }),
25
- ],
26
- type: "string",
27
- label: "Card",
28
- description: "The ID of the Card that the checklist should be added to",
29
- optional: false,
30
- },
31
- name: {
32
- propDefinition: [
33
- common.props.app,
34
- "name",
35
- ],
36
- description: "The name of the checklist. Should be a string of length 1 to 16384.",
37
- },
38
- pos: {
39
- propDefinition: [
40
- common.props.app,
41
- "pos",
42
- ],
43
- description: "The position of the new checklist. Valid values: `top`, `bottom`, or a positive float.",
44
- },
45
- idChecklistSource: {
46
- optional: true,
47
- propDefinition: [
48
- common.props.app,
49
- "checklist",
50
- (c) => ({
51
- board: c.board,
52
- }),
53
- ],
54
- },
55
- },
56
- methods: {
57
- ...common.methods,
58
- createChecklist(args = {}) {
59
- return this.app.post({
60
- path: "/checklists",
61
- ...args,
62
- });
63
- },
64
- },
65
- async run({ $ }) {
66
- const res = await this.createChecklist({
67
- $,
68
- params: {
69
- idCard: this.idCard,
70
- name: this.name,
71
- pos: this.pos,
72
- idChecklistSource: this.idChecklistSource,
73
- },
74
- });
75
- $.export("$summary", `Successfully created checklist ${res.name}`);
76
- return res;
77
- },
78
- };