@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
@@ -1,3 +1,4 @@
1
+ import { createHmac } from "crypto";
1
2
  import common from "./common.mjs";
2
3
 
3
4
  export default {
@@ -20,40 +21,68 @@ export default {
20
21
  },
21
22
  async activate() {
22
23
  const modelId = await this.getModelId();
23
- const { id } = await this.trello.createHook({
24
- id: modelId,
25
- endpoint: this.http.endpoint,
24
+ const { id } = await this.createHook({
25
+ params: {
26
+ idModel: modelId,
27
+ description: "Pipedream Source ID",
28
+ callbackURL: this.http.endpoint,
29
+ },
26
30
  });
27
31
  this.db.set("hookId", id);
28
32
  },
29
33
  async deactivate() {
30
34
  const hookId = this.db.get("hookId");
31
- await this.trello.deleteHook({
35
+ await this.deleteHook({
32
36
  hookId,
33
37
  });
34
38
  },
35
39
  },
36
40
  methods: {
37
41
  ...common.methods,
42
+ getBase64Digest(data) {
43
+ const { secret } = this.app.getToken();
44
+ return createHmac("sha1", secret)
45
+ .update(data)
46
+ .digest("base64");
47
+ },
48
+ // Do not remove the async keyword from this function
49
+ async isValidSignature({
50
+ body, bodyRaw, headers,
51
+ }) {
52
+ const data = bodyRaw + body.webhook?.callbackURL;
53
+ const doubleHash = this.getBase64Digest(data);
54
+ const headerHash = headers["x-trello-webhook"];
55
+ return doubleHash === headerHash;
56
+ },
57
+ createHook(args = {}) {
58
+ return this.app.post({
59
+ ...args,
60
+ debug: true,
61
+ path: "/webhooks/",
62
+ });
63
+ },
64
+ deleteHook({
65
+ hookId, ...args
66
+ } = {}) {
67
+ return this.app.delete({
68
+ ...args,
69
+ debug: true,
70
+ path: `/webhooks/${hookId}`,
71
+ });
72
+ },
38
73
  /**
39
74
  * Returns the ID of the current board selected. If no board is selected, returns
40
75
  * the id of the authenticated user.
41
76
  */
42
77
  async getModelId() {
43
- if (this.board) return this.board;
44
- const member = await this.trello.getMember("me");
78
+ if (this.board) {
79
+ return this.board;
80
+ }
81
+ const member = await this.app.getMember({
82
+ memberId: "me",
83
+ });
45
84
  return member.id;
46
85
  },
47
- /**
48
- * Verifies that the event received was sent from Trello.
49
- * @param {object} event - The event returned from a webhook
50
- */
51
- verifyEvent(event) {
52
- return (
53
- this.trello.verifyTrelloWebhookRequest(event, this.http.endpoint) &&
54
- event.body !== undefined
55
- );
56
- },
57
86
  /**
58
87
  * Default isCorrectEventType. Used in components to verify that the event received is
59
88
  * of the type that the component is watching for.
@@ -73,17 +102,31 @@ export default {
73
102
  },
74
103
  },
75
104
  async run(event) {
76
- if (!this.verifyEvent(event)) {
105
+ if (event.body === undefined) {
106
+ console.log("Event body is undefined. Skipping...");
107
+ return;
108
+ }
109
+
110
+ if (!this.isValidSignature(event)) {
77
111
  console.log("The event failed the verification. Skipping...");
78
112
  return;
79
113
  }
80
- if (!this.isCorrectEventType(event)) return;
114
+
115
+ if (!this.isCorrectEventType(event)) {
116
+ console.log("The event is not of the correct type. Skipping...");
117
+ return;
118
+ }
81
119
 
82
120
  const result = await this.getResult(event);
83
- if (!(await this.isRelevant({
121
+ const isRelevant = await this.isRelevant({
84
122
  result,
85
123
  event,
86
- }))) return;
124
+ });
125
+
126
+ if (!isRelevant) {
127
+ console.log("The event is not relevant. Skipping...");
128
+ return;
129
+ }
87
130
 
88
131
  this.emitEvent(result);
89
132
  },
@@ -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
  db: "$.service.db",
7
7
  },
8
8
  methods: {
@@ -1,29 +1,31 @@
1
1
  import common from "../common/common-webhook.mjs";
2
+ import events from "../common/events.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "trello-custom-webhook-events",
6
7
  name: "Custom Webhook Events (Instant)",
7
8
  description: "Emit new events for activity matching a board, event types, lists and/or cards.",
8
- version: "0.0.11",
9
+ version: "0.1.0",
9
10
  type: "source",
10
11
  props: {
11
12
  ...common.props,
12
13
  board: {
13
14
  propDefinition: [
14
- common.props.trello,
15
+ common.props.app,
15
16
  "board",
16
17
  ],
17
18
  },
18
19
  eventTypes: {
19
- propDefinition: [
20
- common.props.trello,
21
- "eventTypes",
22
- ],
20
+ type: "string[]",
21
+ label: "Event Types",
22
+ optional: true,
23
+ description: "Only emit events for the selected event types (e.g., `updateCard`).",
24
+ options: events,
23
25
  },
24
26
  lists: {
25
27
  propDefinition: [
26
- common.props.trello,
28
+ common.props.app,
27
29
  "lists",
28
30
  (c) => ({
29
31
  board: c.board,
@@ -32,7 +34,7 @@ export default {
32
34
  },
33
35
  cards: {
34
36
  propDefinition: [
35
- common.props.trello,
37
+ common.props.app,
36
38
  "cards",
37
39
  (c) => ({
38
40
  board: c.board,
@@ -58,11 +60,24 @@ export default {
58
60
  },
59
61
  methods: {
60
62
  ...common.methods,
63
+ getCardList({
64
+ cardId, ...args
65
+ } = {}) {
66
+ return this.app._makeRequest({
67
+ path: `/cards/${cardId}/list`,
68
+ ...args,
69
+ });
70
+ },
61
71
  async getSampleEvents() {
62
72
  const eventTypes = this.eventTypes && this.eventTypes.length > 0
63
73
  ? this.eventTypes.join(",")
64
74
  : null;
65
- const actions = await this.trello.getBoardActivity(this.board, eventTypes);
75
+ const actions = await this.app.getBoardActivity({
76
+ boardId: this.board,
77
+ params: {
78
+ filter: eventTypes,
79
+ },
80
+ });
66
81
  return {
67
82
  sampleEvents: actions,
68
83
  sortField: "date",
@@ -84,8 +99,12 @@ export default {
84
99
  let listId = body.action?.data?.list?.id;
85
100
  const cardId = body.action?.data?.card?.id;
86
101
  // If listId not returned, see if we can get it from the cardId
87
- if (cardId && !listId)
88
- listId = (await this.trello.getCardList(cardId)).id;
102
+ if (cardId && !listId) {
103
+ const res = await this.app.getCardList({
104
+ cardId,
105
+ });
106
+ listId = res.id;
107
+ }
89
108
  return (
90
109
  (!this.lists ||
91
110
  this.lists.length === 0 ||
@@ -5,13 +5,13 @@ export default {
5
5
  key: "trello-new-activity",
6
6
  name: "New Activity (Instant)",
7
7
  description: "Emit new event for new activity on a board.",
8
- version: "0.0.9",
8
+ version: "0.1.0",
9
9
  type: "source",
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
  },
@@ -35,7 +35,9 @@ export default {
35
35
  methods: {
36
36
  ...common.methods,
37
37
  async getSampleEvents() {
38
- const actions = await this.trello.getBoardActivity(this.board);
38
+ const actions = await this.app.getBoardActivity({
39
+ boardId: this.board,
40
+ });
39
41
  return {
40
42
  sampleEvents: actions,
41
43
  sortField: "date",
@@ -5,13 +5,13 @@ export default {
5
5
  key: "trello-new-attachment",
6
6
  name: "New Attachment (Instant)",
7
7
  description: "Emit new event for new attachment on a board.",
8
- version: "0.0.9",
8
+ version: "0.1.0",
9
9
  type: "source",
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
  },
@@ -36,8 +36,21 @@ export default {
36
36
  },
37
37
  methods: {
38
38
  ...common.methods,
39
+ getAttachment({
40
+ cardId, attachmentId, ...args
41
+ } = {}) {
42
+ return this.app._makeRequest({
43
+ path: `/cards/${cardId}/attachments/${attachmentId}`,
44
+ ...args,
45
+ });
46
+ },
39
47
  async getSampleEvents() {
40
- const actions = await this.trello.getBoardActivity(this.board, "addAttachmentToCard");
48
+ const actions = await this.app.getBoardActivity({
49
+ boardId: this.board,
50
+ params: {
51
+ filter: "addAttachmentToCard",
52
+ },
53
+ });
41
54
  return {
42
55
  sampleEvents: actions,
43
56
  sortField: "date",
@@ -50,7 +63,10 @@ export default {
50
63
  async getResult(event) {
51
64
  const cardId = event.body?.action?.data?.card?.id;
52
65
  const attachmentId = event.body?.action?.data?.attachment?.id;
53
- return this.trello.getAttachment(cardId, attachmentId);
66
+ return this.getAttachment({
67
+ cardId,
68
+ attachmentId,
69
+ });
54
70
  },
55
71
  isRelevant({ event }) {
56
72
  const boardId = event.body?.action?.data?.board?.id;
@@ -5,13 +5,13 @@ export default {
5
5
  key: "trello-new-board",
6
6
  name: "New Board (Instant)",
7
7
  description: "Emit new event for each new board added.",
8
- version: "0.0.13",
8
+ version: "0.1.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
13
13
  async getSampleEvents() {
14
- const boards = await this.trello.getBoards();
14
+ const boards = await this.app.getBoards();
15
15
  return {
16
16
  sampleEvents: boards,
17
17
  sortField: "dateLastView",
@@ -23,7 +23,9 @@ export default {
23
23
  },
24
24
  async getResult(event) {
25
25
  const boardId = event.body?.action?.data?.board?.id;
26
- return this.trello.getBoard(boardId);
26
+ return this.app.getBoard({
27
+ boardId,
28
+ });
27
29
  },
28
30
  },
29
31
  };
@@ -5,20 +5,20 @@ export default {
5
5
  key: "trello-new-card",
6
6
  name: "New Card (Instant)",
7
7
  description: "Emit new event for each new Trello card on a board.",
8
- version: "0.0.12",
8
+ version: "0.1.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
13
13
  board: {
14
14
  propDefinition: [
15
- common.props.trello,
15
+ common.props.app,
16
16
  "board",
17
17
  ],
18
18
  },
19
19
  lists: {
20
20
  propDefinition: [
21
- common.props.trello,
21
+ common.props.app,
22
22
  "lists",
23
23
  (c) => ({
24
24
  board: c.board,
@@ -27,7 +27,7 @@ export default {
27
27
  },
28
28
  customFieldItems: {
29
29
  propDefinition: [
30
- common.props.trello,
30
+ common.props.app,
31
31
  "customFieldItems",
32
32
  ],
33
33
  },
@@ -36,11 +36,17 @@ export default {
36
36
  ...common.methods,
37
37
  async getSampleEvents() {
38
38
  const cards = this.lists && this.lists.length > 0
39
- ? await this.trello.getCardsInList(this.lists[0], {
40
- customFieldItems: this.customFieldItems,
39
+ ? await this.app.getCardsInList({
40
+ listId: this.lists[0],
41
+ params: {
42
+ customFieldItems: this.customFieldItems,
43
+ },
41
44
  })
42
- : await this.trello.getCards(this.board, {
43
- customFieldItems: this.customFieldItems,
45
+ : await this.app.getCards({
46
+ boardId: this.board,
47
+ params: {
48
+ customFieldItems: this.customFieldItems,
49
+ },
44
50
  });
45
51
  return {
46
52
  sampleEvents: cards,
@@ -53,8 +59,11 @@ export default {
53
59
  },
54
60
  async getResult(event) {
55
61
  const cardId = event.body?.action?.data?.card?.id;
56
- return this.trello.getCard(cardId, {
57
- customFieldItems: this.customFieldItems,
62
+ return this.app.getCard({
63
+ cardId,
64
+ params: {
65
+ customFieldItems: this.customFieldItems,
66
+ },
58
67
  });
59
68
  },
60
69
  isRelevant({ result: card }) {
@@ -5,13 +5,23 @@ export default {
5
5
  key: "trello-new-checklist",
6
6
  name: "New Checklist (Instant)",
7
7
  description: "Emit new event for each new checklist added to a board.",
8
- version: "0.0.14",
8
+ version: "0.1.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
13
+ getChecklist({
14
+ checklistId, ...args
15
+ } = {}) {
16
+ return this.app._makeRequest({
17
+ path: `/checklists/${checklistId}`,
18
+ ...args,
19
+ });
20
+ },
13
21
  async getSampleEvents() {
14
- const checklists = await this.trello.listBoardChecklists(this.board);
22
+ const checklists = await this.app.listBoardChecklists({
23
+ boardId: this.board,
24
+ });
15
25
  return {
16
26
  sampleEvents: checklists,
17
27
  sortField: "id",
@@ -23,7 +33,9 @@ export default {
23
33
  },
24
34
  async getResult(event) {
25
35
  const checklistId = event.body?.action?.data?.checklist?.id;
26
- return this.trello.getChecklist(checklistId);
36
+ return this.getChecklist({
37
+ checklistId,
38
+ });
27
39
  },
28
40
  },
29
41
  };
@@ -5,20 +5,20 @@ export default {
5
5
  key: "trello-new-comment-added-to-card",
6
6
  name: "New Comment Added to Card (Instant)",
7
7
  description: "Emit new event for each new comment added to a card.",
8
- version: "0.1.2",
8
+ version: "0.2.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
13
13
  board: {
14
14
  propDefinition: [
15
- common.props.trello,
15
+ common.props.app,
16
16
  "board",
17
17
  ],
18
18
  },
19
19
  cards: {
20
20
  propDefinition: [
21
- common.props.trello,
21
+ common.props.app,
22
22
  "cards",
23
23
  (c) => ({
24
24
  board: c.board,
@@ -42,13 +42,28 @@ export default {
42
42
  },
43
43
  methods: {
44
44
  ...common.methods,
45
+ getCardActivity({
46
+ cardId, ...args
47
+ } = {}) {
48
+ return this.app._makeRequest({
49
+ path: `/cards/${cardId}/actions`,
50
+ ...args,
51
+ });
52
+ },
45
53
  async getSampleEvents() {
46
54
  const cards = this.cards && this.cards.length > 0
47
55
  ? this.cards
48
- : (await this.trello.getCards(this.board)).map((card) => card.id);
56
+ : (await this.app.getCards({
57
+ boardId: this.board,
58
+ })).map((card) => card.id);
49
59
  const actions = [];
50
60
  for (const card of cards) {
51
- const activities = await this.trello.getCardActivity(card, "commentCard");
61
+ const activities = await this.getCardActivity({
62
+ cardId: card,
63
+ params: {
64
+ filter: "commentCard",
65
+ },
66
+ });
52
67
 
53
68
  for (const activity of activities) {
54
69
  actions.push(await this.getResult(activity));
@@ -64,10 +79,16 @@ export default {
64
79
  return eventType === "commentCard";
65
80
  },
66
81
  async getResult(event) {
67
- const card = await this.trello.getCard(event?.body?.action?.data?.card?.id ??
68
- event?.data?.card?.id);
69
- const member = await this.trello.getMember(event?.body?.action?.idMemberCreator ??
70
- event.idMemberCreator);
82
+ const cardId = event?.body?.action?.data?.card?.id ??
83
+ event?.data?.card?.id;
84
+ const card = await this.app.getCard({
85
+ cardId,
86
+ });
87
+ const memberId = event?.body?.action?.idMemberCreator ??
88
+ event.idMemberCreator;
89
+ const member = await this.app.getMember({
90
+ memberId,
91
+ });
71
92
 
72
93
  return {
73
94
  member,
@@ -5,13 +5,15 @@ export default {
5
5
  key: "trello-new-label",
6
6
  name: "New Label (Instant)",
7
7
  description: "Emit new event for each new label added to a board.",
8
- version: "0.0.14",
8
+ version: "0.1.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
13
13
  async getSampleEvents() {
14
- const labels = await this.trello.findLabel(this.board);
14
+ const labels = await this.app.findLabel({
15
+ boardId: this.board,
16
+ });
15
17
  return {
16
18
  sampleEvents: labels,
17
19
  sortField: "id",
@@ -23,7 +25,9 @@ export default {
23
25
  },
24
26
  async getResult(event) {
25
27
  const labelId = event.body?.action?.data?.label?.id;
26
- return this.trello.getLabel(labelId);
28
+ return this.app.getLabel({
29
+ labelId,
30
+ });
27
31
  },
28
32
  generateMeta({
29
33
  id, name, color: summary,
@@ -5,19 +5,19 @@ export default {
5
5
  key: "trello-new-label-added-to-card",
6
6
  name: "New Label Added To Card (Instant)",
7
7
  description: "Emit new event for each label added to a card.",
8
- version: "0.0.12",
8
+ version: "0.1.0",
9
9
  type: "source",
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
18
  lists: {
19
19
  propDefinition: [
20
- common.props.trello,
20
+ common.props.app,
21
21
  "lists",
22
22
  (c) => ({
23
23
  board: c.board,
@@ -26,7 +26,7 @@ export default {
26
26
  },
27
27
  cards: {
28
28
  propDefinition: [
29
- common.props.trello,
29
+ common.props.app,
30
30
  "cards",
31
31
  (c) => ({
32
32
  board: c.board,
@@ -43,12 +43,16 @@ export default {
43
43
  }
44
44
  if (this.lists && this.lists.length > 0) {
45
45
  for (const listId of this.lists) {
46
- const cards = await this.trello.getCardsInList(listId);
46
+ const cards = await this.app.getCardsInList({
47
+ listId,
48
+ });
47
49
  await this.emitLabelsFromCards(cards);
48
50
  }
49
51
  return;
50
52
  }
51
- const cards = await this.trello.getCards(this.board);
53
+ const cards = await this.app.getCards({
54
+ boardId: this.board,
55
+ });
52
56
  await this.emitLabelsFromCards(cards);
53
57
  },
54
58
  },
@@ -58,7 +62,9 @@ export default {
58
62
  for (const card of cards) {
59
63
  const labelIds = card.idLabels;
60
64
  for (const labelId of labelIds) {
61
- const label = await this.trello.getLabel(labelId);
65
+ const label = await this.app.getLabel({
66
+ labelId,
67
+ });
62
68
  let summary = label.color;
63
69
  summary += label.name
64
70
  ? ` - ${label.name}`
@@ -74,8 +80,10 @@ export default {
74
80
  },
75
81
  async emitLabelsFromCardIds(cardIds) {
76
82
  const cards = [];
77
- for (const id of cardIds) {
78
- const card = await this.trello.getCard(id);
83
+ for (const cardId of cardIds) {
84
+ const card = await this.app.getCard({
85
+ cardId,
86
+ });
79
87
  cards.push(card);
80
88
  }
81
89
  await this.emitLabelsFromCards(cards);
@@ -103,7 +111,9 @@ export default {
103
111
  /** Record labelName & labelColor to use in generateMeta() */
104
112
  this._setLabelName(labelName);
105
113
  this._setLabelColor(labelColor);
106
- return this.trello.getCard(cardId);
114
+ return this.app.getCard({
115
+ cardId,
116
+ });
107
117
  },
108
118
  isRelevant({ result: card }) {
109
119
  return (
@@ -5,13 +5,15 @@ export default {
5
5
  key: "trello-new-list",
6
6
  name: "New List (Instant)",
7
7
  description: "Emit new event for each new list added to a board.",
8
- version: "0.0.14",
8
+ version: "0.1.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
13
13
  async getSampleEvents() {
14
- const lists = await this.trello.getLists(this.board);
14
+ const lists = await this.app.getLists({
15
+ boardId: this.board,
16
+ });
15
17
  return {
16
18
  sampleEvents: lists,
17
19
  sortField: "id",
@@ -23,7 +25,9 @@ export default {
23
25
  },
24
26
  async getResult(event) {
25
27
  const listId = event.body?.action?.data?.list?.id;
26
- return await this.trello.getList(listId);
28
+ return await this.app.getList({
29
+ listId,
30
+ });
27
31
  },
28
32
  },
29
33
  };
@@ -5,13 +5,23 @@ export default {
5
5
  key: "trello-new-member-on-card",
6
6
  name: "New Member on Card (Instant)",
7
7
  description: "Emit new event for each member that join in a card.",
8
- version: "0.0.15",
8
+ version: "0.1.0",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
13
+ getMemberCards({
14
+ userId, ...args
15
+ } = {}) {
16
+ return this.app._makeRequest({
17
+ path: `/members/${userId}/cards`,
18
+ ...args,
19
+ });
20
+ },
13
21
  async getSampleEvents() {
14
- const cards = await this.trello.getMemberCards("me");
22
+ const cards = await this.getMemberCards({
23
+ userId: "me",
24
+ });
15
25
  return {
16
26
  sampleEvents: cards,
17
27
  sortField: "dateLastActivity",
@@ -23,7 +33,9 @@ export default {
23
33
  },
24
34
  async getResult(event) {
25
35
  const cardId = event.body?.action?.data?.card?.id;
26
- return this.trello.getCard(cardId);
36
+ return this.app.getCard({
37
+ cardId,
38
+ });
27
39
  },
28
40
  generateMeta({
29
41
  id, name: summary, dateLastActivity,