@pipedream/trello 0.3.13 → 0.4.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 (57) hide show
  1. package/README.md +9 -10
  2. package/actions/add-attachment-to-card/add-attachment-to-card.mjs +124 -0
  3. package/actions/add-checklist/add-checklist.mjs +56 -38
  4. package/actions/add-comment/add-comment.mjs +44 -34
  5. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +26 -11
  6. package/actions/add-member-to-card/add-member-to-card.mjs +26 -11
  7. package/actions/archive-card/archive-card.mjs +13 -7
  8. package/actions/close-board/close-board.mjs +10 -4
  9. package/actions/common.mjs +2 -2
  10. package/actions/complete-checklist-item/complete-checklist-item.mjs +61 -31
  11. package/actions/create-board/create-board.mjs +96 -61
  12. package/actions/create-card/create-card.mjs +83 -39
  13. package/actions/create-checklist/create-checklist.mjs +26 -14
  14. package/actions/create-checklist-item/create-checklist-item.mjs +64 -39
  15. package/actions/create-comment-on-card/create-comment-on-card.mjs +26 -9
  16. package/actions/create-label/create-label.mjs +37 -36
  17. package/actions/create-list/create-list.mjs +51 -42
  18. package/actions/delete-checklist/delete-checklist.mjs +24 -11
  19. package/actions/find-labels/find-labels.mjs +13 -10
  20. package/actions/find-list/find-list.mjs +12 -9
  21. package/actions/get-card/get-card.mjs +12 -8
  22. package/actions/get-list/get-list.mjs +29 -15
  23. package/actions/move-card-to-list/move-card-to-list.mjs +16 -12
  24. package/actions/remove-label-from-card/remove-label-from-card.mjs +26 -10
  25. package/actions/rename-list/rename-list.mjs +23 -9
  26. package/actions/search-boards/search-boards.mjs +17 -15
  27. package/actions/search-cards/search-cards.mjs +17 -15
  28. package/actions/search-checklists/search-checklists.mjs +102 -46
  29. package/actions/search-members/search-members.mjs +48 -28
  30. package/actions/update-card/update-card.mjs +64 -47
  31. package/package.json +5 -5
  32. package/sources/card-archived/card-archived.mjs +21 -5
  33. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +31 -30
  34. package/sources/card-moved/card-moved.mjs +12 -6
  35. package/sources/card-updates/card-updates.mjs +19 -10
  36. package/sources/common/common-board-based.mjs +4 -2
  37. package/sources/common/common-webhook.mjs +63 -20
  38. package/sources/common/common.mjs +2 -2
  39. package/sources/custom-webhook-events/custom-webhook-events.mjs +30 -11
  40. package/sources/new-activity/new-activity.mjs +5 -3
  41. package/sources/new-attachment/new-attachment.mjs +20 -4
  42. package/sources/new-board/new-board.mjs +5 -3
  43. package/sources/new-card/new-card.mjs +19 -10
  44. package/sources/new-checklist/new-checklist.mjs +15 -3
  45. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +30 -9
  46. package/sources/new-label/new-label.mjs +7 -3
  47. package/sources/new-label-added-to-card/new-label-added-to-card.mjs +20 -10
  48. package/sources/new-list/new-list.mjs +7 -3
  49. package/sources/new-member-on-card/new-member-on-card.mjs +15 -3
  50. package/sources/new-notification/new-notification.mjs +15 -5
  51. package/trello.app.mjs +269 -487
  52. package/actions/add-attachment-to-card-via-url/add-attachment-to-card-via-url.mjs +0 -73
  53. package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +0 -72
  54. package/actions/add-image-attachment/add-image-attachment.mjs +0 -75
  55. package/actions/add-label-to-card/add-label-to-card.mjs +0 -55
  56. package/actions/copy-board/copy-board.mjs +0 -174
  57. /package/{common → sources/common}/events.mjs +0 -0
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # Overview
2
2
 
3
- With the Trello API, you can:
4
-
5
- - Create new boards
6
- - Add and remove lists from boards
7
- - Add and remove cards from lists
8
- - Add comments to cards
9
- - Add and remove attachments from cards
10
- - Add and remove members from boards
11
- - Change the background of boards
12
- - And more!
3
+ Trello's API lets you craft workflows around managing boards, lists, cards, and users. With Pipedream, you can automate Trello tasks, like syncing cards with external databases, updating checklists, and posting notifications to other platforms. It enables seamless connection with other apps, fostering productivity by automating routine board operations, card management, and team notifications.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Automated Project Management**: Sync Trello cards with a GitHub repository, creating issues from new cards, and updating cards when issues are closed. This keeps developers and stakeholders aligned across platforms.
8
+
9
+ - **Marketing Campaign Tracker**: Connect Trello with Google Sheets to track campaign progress. When a card moves to the "Complete" list, automatically log the details in a spreadsheet, giving a real-time view of campaign status.
10
+
11
+ - **Team Coordination**: Integrate Trello with Slack, notifying a channel when due dates are updated or cards are marked complete, ensuring the team stays informed of task progression without having to check Trello.
@@ -0,0 +1,124 @@
1
+ import { ConfigurationError } from "@pipedream/platform";
2
+ import fs from "fs";
3
+ import FormData from "form-data";
4
+ import common from "../common.mjs";
5
+
6
+ export default {
7
+ ...common,
8
+ key: "trello-add-attachment-to-card",
9
+ name: "Add Attachment To Card",
10
+ description: "Adds a file attachment on a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post)",
11
+ version: "0.0.1",
12
+ type: "action",
13
+ props: {
14
+ ...common.props,
15
+ board: {
16
+ propDefinition: [
17
+ common.props.app,
18
+ "board",
19
+ ],
20
+ },
21
+ cardId: {
22
+ propDefinition: [
23
+ common.props.app,
24
+ "cards",
25
+ (c) => ({
26
+ board: c.board,
27
+ }),
28
+ ],
29
+ type: "string",
30
+ label: "Card",
31
+ description: "The ID of the Card to add the Attachment to",
32
+ optional: false,
33
+ },
34
+ name: {
35
+ propDefinition: [
36
+ common.props.app,
37
+ "name",
38
+ ],
39
+ },
40
+ url: {
41
+ propDefinition: [
42
+ common.props.app,
43
+ "url",
44
+ ],
45
+ },
46
+ mimeType: {
47
+ propDefinition: [
48
+ common.props.app,
49
+ "mimeType",
50
+ ],
51
+ },
52
+ file: {
53
+ propDefinition: [
54
+ common.props.app,
55
+ "file",
56
+ ],
57
+ },
58
+ setCover: {
59
+ type: "boolean",
60
+ label: "Set Cover?",
61
+ description: "Determines whether to use the new attachment as a cover for the Card",
62
+ default: false,
63
+ },
64
+ },
65
+ methods: {
66
+ ...common.methods,
67
+ addAttachmentToCard({
68
+ cardId, ...args
69
+ } = {}) {
70
+ return this.app.post({
71
+ path: `/cards/${cardId}/attachments`,
72
+ ...args,
73
+ });
74
+ },
75
+ },
76
+ async run({ $ }) {
77
+ const {
78
+ addAttachmentToCard,
79
+ cardId,
80
+ name,
81
+ url,
82
+ mimeType,
83
+ setCover,
84
+ file,
85
+ } = this;
86
+
87
+ let response;
88
+ const params = {
89
+ name,
90
+ mimeType,
91
+ setCover,
92
+ };
93
+
94
+ if (file && !file?.startsWith("/tmp")) {
95
+ throw new ConfigurationError("The file path must be in the `/tmp` directory");
96
+ }
97
+
98
+ if (file) {
99
+ const form = new FormData();
100
+ form.append("file", fs.createReadStream(file));
101
+
102
+ response = await addAttachmentToCard({
103
+ $,
104
+ cardId,
105
+ params,
106
+ headers: form.getHeaders(),
107
+ data: form,
108
+ });
109
+
110
+ } else {
111
+ response = await addAttachmentToCard({
112
+ $,
113
+ cardId,
114
+ params: {
115
+ ...params,
116
+ url,
117
+ },
118
+ });
119
+ }
120
+
121
+ $.export("$summary", `Successfully added attachement to card ${cardId}`);
122
+ return response;
123
+ },
124
+ };
@@ -1,68 +1,86 @@
1
- // legacy_hash_id: a_WYieM3
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-add-checklist",
6
5
  name: "Create a Checklist",
7
- description: "Adds a new checklist to a card.",
8
- version: "0.1.3",
6
+ description: "Adds a new checklist to a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-checklists-post).",
7
+ version: "0.2.0",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
10
+ app,
11
+ boardId: {
12
+ propDefinition: [
13
+ app,
14
+ "board",
15
+ ],
14
16
  },
15
- id: {
17
+ cardId: {
16
18
  type: "string",
19
+ label: "Card ID",
17
20
  description: "The ID of the card.",
21
+ optional: false,
22
+ propDefinition: [
23
+ app,
24
+ "cards",
25
+ ({ boardId }) => ({
26
+ board: boardId,
27
+ }),
28
+ ],
18
29
  },
19
30
  name: {
20
31
  type: "string",
32
+ label: "Checklist Name",
21
33
  description: "The name of the checklist.",
22
34
  optional: true,
23
35
  },
24
36
  idChecklistSource: {
25
- type: "string",
26
- description: "The ID of a source checklist to copy into the new one.",
27
37
  optional: true,
38
+ propDefinition: [
39
+ app,
40
+ "checklist",
41
+ ({ boardId }) => ({
42
+ board: boardId,
43
+ }),
44
+ ],
28
45
  },
29
46
  pos: {
30
47
  type: "string",
48
+ label: "Position",
31
49
  description: "The position of the checklist on the card. One of: top, bottom, or a positive number.",
32
50
  optional: true,
33
51
  },
34
52
  },
53
+ methods: {
54
+ addChecklist({
55
+ cardId, ...args
56
+ } = {}) {
57
+ return this.app.post({
58
+ path: `/cards/${cardId}/checklists`,
59
+ ...args,
60
+ });
61
+ },
62
+ },
35
63
  async run({ $ }) {
36
- const oauthSignerUri = this.trello.$auth.oauth_signer_uri;
37
-
38
- let id = this.id;
39
- const trelloParams = [
40
- "name",
41
- "idChecklistSource",
42
- "pos",
43
- ];
44
- let p = this;
45
-
46
- const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
47
- .join("&");
48
-
49
- const config = {
50
- url: `https://api.trello.com/1/cards/${id}/checklists?${queryString}`,
51
- method: "POST",
52
- data: "",
53
- };
64
+ const {
65
+ addChecklist,
66
+ cardId,
67
+ name,
68
+ idChecklistSource,
69
+ pos,
70
+ } = this;
54
71
 
55
- const token = {
56
- key: this.trello.$auth.oauth_access_token,
57
- secret: this.trello.$auth.oauth_refresh_token,
58
- };
72
+ const response = await addChecklist({
73
+ $,
74
+ cardId,
75
+ params: {
76
+ name,
77
+ idChecklistSource,
78
+ pos,
79
+ },
80
+ });
59
81
 
60
- const signConfig = {
61
- token,
62
- oauthSignerUri,
63
- };
82
+ $.export("$summary", "Successfully added checklist.");
64
83
 
65
- const resp = await axios($, config, signConfig);
66
- return resp;
84
+ return response;
67
85
  },
68
86
  };
@@ -1,55 +1,65 @@
1
- // legacy_hash_id: a_Xzi26w
2
- import { axios } from "@pipedream/platform";
1
+ import app from "../../trello.app.mjs";
3
2
 
4
3
  export default {
5
4
  key: "trello-add-comment",
6
5
  name: "Create a Comment",
7
- description: "Create a new comment on a specific card.",
8
- version: "0.1.3",
6
+ description: "Create a new comment on a specific card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-comments-post).",
7
+ version: "0.2.0",
9
8
  type: "action",
10
9
  props: {
11
- trello: {
12
- type: "app",
13
- app: "trello",
10
+ app,
11
+ boardId: {
12
+ propDefinition: [
13
+ app,
14
+ "board",
15
+ ],
14
16
  },
15
- id: {
17
+ cardId: {
16
18
  type: "string",
19
+ label: "Card ID",
17
20
  description: "The ID of the card.",
21
+ optional: false,
22
+ propDefinition: [
23
+ app,
24
+ "cards",
25
+ ({ boardId }) => ({
26
+ board: boardId,
27
+ }),
28
+ ],
18
29
  },
19
30
  text: {
20
31
  type: "string",
32
+ label: "Comment",
21
33
  description: "The comment to add.",
22
34
  },
23
35
  },
36
+ methods: {
37
+ addComment({
38
+ cardId, ...args
39
+ } = {}) {
40
+ return this.app.post({
41
+ path: `/cards/${cardId}/actions/comments`,
42
+ ...args,
43
+ });
44
+ },
45
+ },
24
46
  async run({ $ }) {
25
- const oauthSignerUri = this.trello.$auth.oauth_signer_uri;
26
-
27
- let id = this.id;
28
- const trelloParams = [
29
- "text",
30
- ];
31
- let p = this;
32
-
33
- const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
34
- .join("&");
35
-
36
- const config = {
37
- url: `https://api.trello.com/1/cards/${id}/actions/comments?${queryString}`,
38
- method: "POST",
39
- data: "",
40
- };
47
+ const {
48
+ addComment,
49
+ cardId,
50
+ text,
51
+ } = this;
41
52
 
42
- const token = {
43
- key: this.trello.$auth.oauth_access_token,
44
- secret: this.trello.$auth.oauth_refresh_token,
45
- };
53
+ const response = await addComment({
54
+ $,
55
+ cardId,
56
+ params: {
57
+ text,
58
+ },
59
+ });
46
60
 
47
- const signConfig = {
48
- token,
49
- oauthSignerUri,
50
- };
61
+ $.export("$summary", "Successfully added comment.");
51
62
 
52
- const resp = await axios($, config, signConfig);
53
- return resp;
63
+ return response;
54
64
  },
55
65
  };
@@ -4,20 +4,20 @@ export default {
4
4
  ...common,
5
5
  key: "trello-add-existing-label-to-card",
6
6
  name: "Add Existing Label to Card",
7
- description: "Adds an existing label to the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post)",
8
- version: "0.0.3",
7
+ description: "Adds an existing label to the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post).",
8
+ version: "0.1.0",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
12
12
  board: {
13
13
  propDefinition: [
14
- common.props.trello,
14
+ common.props.app,
15
15
  "board",
16
16
  ],
17
17
  },
18
- idCard: {
18
+ cardId: {
19
19
  propDefinition: [
20
- common.props.trello,
20
+ common.props.app,
21
21
  "cards",
22
22
  (c) => ({
23
23
  board: c.board,
@@ -28,9 +28,9 @@ export default {
28
28
  description: "The ID of the Card to add the Label to",
29
29
  optional: false,
30
30
  },
31
- idLabel: {
31
+ value: {
32
32
  propDefinition: [
33
- common.props.trello,
33
+ common.props.app,
34
34
  "label",
35
35
  (c) => ({
36
36
  board: c.board,
@@ -38,11 +38,26 @@ export default {
38
38
  ],
39
39
  },
40
40
  },
41
+ methods: {
42
+ ...common.methods,
43
+ addExistingLabelToCard({
44
+ cardId, ...args
45
+ } = {}) {
46
+ return this.app.post({
47
+ path: `/cards/${cardId}/idLabels`,
48
+ ...args,
49
+ });
50
+ },
51
+ },
41
52
  async run({ $ }) {
42
- const res = await this.trello.addExistingLabelToCard(this.idCard, {
43
- value: this.idLabel,
44
- }, $);
45
- $.export("$summary", `Successfully added label ${this.idLabel} to card ${this.idCard}`);
53
+ const res = await this.addExistingLabelToCard({
54
+ $,
55
+ cardId: this.cardId,
56
+ params: {
57
+ value: this.value,
58
+ },
59
+ });
60
+ $.export("$summary", `Successfully added label and returned \`${res.length}\` labels added.`);
46
61
  return res;
47
62
  },
48
63
  };
@@ -4,20 +4,20 @@ export default {
4
4
  ...common,
5
5
  key: "trello-add-member-to-card",
6
6
  name: "Add Member to Card",
7
- description: "Adds a member to the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post)",
8
- version: "0.1.4",
7
+ description: "Adds a member to the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post).",
8
+ version: "0.2.0",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
12
12
  board: {
13
13
  propDefinition: [
14
- common.props.trello,
14
+ common.props.app,
15
15
  "board",
16
16
  ],
17
17
  },
18
- idCard: {
18
+ cardId: {
19
19
  propDefinition: [
20
- common.props.trello,
20
+ common.props.app,
21
21
  "cards",
22
22
  (c) => ({
23
23
  board: c.board,
@@ -28,9 +28,9 @@ export default {
28
28
  description: "The ID of the Card to add the Member to",
29
29
  optional: false,
30
30
  },
31
- idMember: {
31
+ value: {
32
32
  propDefinition: [
33
- common.props.trello,
33
+ common.props.app,
34
34
  "member",
35
35
  (c) => ({
36
36
  board: c.board,
@@ -38,11 +38,26 @@ export default {
38
38
  ],
39
39
  },
40
40
  },
41
+ methods: {
42
+ ...common.methods,
43
+ addMemberToCard({
44
+ cardId, ...args
45
+ } = {}) {
46
+ return this.app.post({
47
+ path: `/cards/${cardId}/idMembers`,
48
+ ...args,
49
+ });
50
+ },
51
+ },
41
52
  async run({ $ }) {
42
- const res = await this.trello.addMemberToCard(this.idCard, {
43
- value: this.idMember,
44
- }, $);
45
- $.export("$summary", `Successfully added member ${res[0].fullName} to card ${this.idCard}`);
53
+ const res = await this.addMemberToCard({
54
+ $,
55
+ cardId: this.cardId,
56
+ params: {
57
+ value: this.value,
58
+ },
59
+ });
60
+ $.export("$summary", `Successfully added member ${res[0].fullName} to card ${this.cardId}`);
46
61
  return res;
47
62
  },
48
63
  };
@@ -4,20 +4,20 @@ export default {
4
4
  ...common,
5
5
  key: "trello-archive-card",
6
6
  name: "Archive Card",
7
- description: "Archives a card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
8
- version: "0.1.4",
7
+ description: "Archives a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put).",
8
+ version: "0.2.0",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
12
12
  board: {
13
13
  propDefinition: [
14
- common.props.trello,
14
+ common.props.app,
15
15
  "board",
16
16
  ],
17
17
  },
18
- idCard: {
18
+ cardId: {
19
19
  propDefinition: [
20
- common.props.trello,
20
+ common.props.app,
21
21
  "cards",
22
22
  (c) => ({
23
23
  board: c.board,
@@ -30,8 +30,14 @@ export default {
30
30
  },
31
31
  },
32
32
  async run({ $ }) {
33
- const res = await this.trello.archiveCard(this.idCard, $);
34
- $.export("$summary", `Successfully archived card ${this.idCard}`);
33
+ const res = await this.app.updateCard({
34
+ $,
35
+ cardId: this.cardId,
36
+ data: {
37
+ closed: true,
38
+ },
39
+ });
40
+ $.export("$summary", `Successfully archived card ${this.cardId}`);
35
41
  return res;
36
42
  },
37
43
  };
@@ -4,21 +4,27 @@ export default {
4
4
  ...common,
5
5
  key: "trello-close-board",
6
6
  name: "Close Board",
7
- description: "Closes a board. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-put)",
8
- version: "0.0.3",
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
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
12
12
  boardId: {
13
13
  propDefinition: [
14
- common.props.trello,
14
+ common.props.app,
15
15
  "board",
16
16
  ],
17
17
  description: "The ID of the Board to close",
18
18
  },
19
19
  },
20
20
  async run({ $ }) {
21
- const res = await this.trello.closeBoard(this.boardId, $);
21
+ const res = await this.app.updateBoard({
22
+ $,
23
+ boardId: this.boardId,
24
+ data: {
25
+ closed: true,
26
+ },
27
+ });
22
28
  $.export("$summary", `Successfully closed board ${this.boardId}`);
23
29
  return res;
24
30
  },
@@ -1,8 +1,8 @@
1
- import trello from "../trello.app.mjs";
1
+ import app from "../trello.app.mjs";
2
2
 
3
3
  export default {
4
4
  props: {
5
- trello,
5
+ app,
6
6
  },
7
7
  methods: {
8
8
  /**