@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.
- package/README.md +9 -10
- package/actions/add-attachment-to-card/add-attachment-to-card.mjs +124 -0
- package/actions/add-checklist/add-checklist.mjs +56 -38
- package/actions/add-comment/add-comment.mjs +44 -34
- package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +26 -11
- package/actions/add-member-to-card/add-member-to-card.mjs +26 -11
- package/actions/archive-card/archive-card.mjs +13 -7
- package/actions/close-board/close-board.mjs +10 -4
- package/actions/common.mjs +2 -2
- package/actions/complete-checklist-item/complete-checklist-item.mjs +61 -31
- package/actions/create-board/create-board.mjs +96 -61
- package/actions/create-card/create-card.mjs +83 -39
- package/actions/create-checklist/create-checklist.mjs +26 -14
- package/actions/create-checklist-item/create-checklist-item.mjs +64 -39
- package/actions/create-comment-on-card/create-comment-on-card.mjs +26 -9
- package/actions/create-label/create-label.mjs +37 -36
- package/actions/create-list/create-list.mjs +51 -42
- package/actions/delete-checklist/delete-checklist.mjs +24 -11
- package/actions/find-labels/find-labels.mjs +13 -10
- package/actions/find-list/find-list.mjs +12 -9
- package/actions/get-card/get-card.mjs +12 -8
- package/actions/get-list/get-list.mjs +29 -15
- package/actions/move-card-to-list/move-card-to-list.mjs +16 -12
- package/actions/remove-label-from-card/remove-label-from-card.mjs +26 -10
- package/actions/rename-list/rename-list.mjs +23 -9
- package/actions/search-boards/search-boards.mjs +17 -15
- package/actions/search-cards/search-cards.mjs +17 -15
- package/actions/search-checklists/search-checklists.mjs +102 -46
- package/actions/search-members/search-members.mjs +48 -28
- package/actions/update-card/update-card.mjs +64 -47
- package/package.json +5 -5
- package/sources/card-archived/card-archived.mjs +21 -5
- package/sources/card-due-date-reminder/card-due-date-reminder.mjs +31 -30
- package/sources/card-moved/card-moved.mjs +12 -6
- package/sources/card-updates/card-updates.mjs +19 -10
- package/sources/common/common-board-based.mjs +4 -2
- package/sources/common/common-webhook.mjs +63 -20
- package/sources/common/common.mjs +2 -2
- package/sources/custom-webhook-events/custom-webhook-events.mjs +30 -11
- package/sources/new-activity/new-activity.mjs +5 -3
- package/sources/new-attachment/new-attachment.mjs +20 -4
- package/sources/new-board/new-board.mjs +5 -3
- package/sources/new-card/new-card.mjs +19 -10
- package/sources/new-checklist/new-checklist.mjs +15 -3
- package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +30 -9
- package/sources/new-label/new-label.mjs +7 -3
- package/sources/new-label-added-to-card/new-label-added-to-card.mjs +20 -10
- package/sources/new-list/new-list.mjs +7 -3
- package/sources/new-member-on-card/new-member-on-card.mjs +15 -3
- package/sources/new-notification/new-notification.mjs +15 -5
- package/trello.app.mjs +269 -487
- package/actions/add-attachment-to-card-via-url/add-attachment-to-card-via-url.mjs +0 -73
- package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +0 -72
- package/actions/add-image-attachment/add-image-attachment.mjs +0 -75
- package/actions/add-label-to-card/add-label-to-card.mjs +0 -55
- package/actions/copy-board/copy-board.mjs +0 -174
- /package/{common → sources/common}/events.mjs +0 -0
@@ -1,49 +1,79 @@
|
|
1
|
-
|
2
|
-
import { axios } from "@pipedream/platform";
|
1
|
+
import app from "../../trello.app.mjs";
|
3
2
|
|
4
3
|
export default {
|
5
4
|
key: "trello-complete-checklist-item",
|
6
5
|
name: "Complete a Checklist Item",
|
7
|
-
description: "Completes an existing checklist item in a card.",
|
8
|
-
version: "0.
|
6
|
+
description: "Completes an existing checklist item in a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-checkitem-idcheckitem-put).",
|
7
|
+
version: "0.2.0",
|
9
8
|
type: "action",
|
10
9
|
props: {
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
app,
|
11
|
+
board: {
|
12
|
+
propDefinition: [
|
13
|
+
app,
|
14
|
+
"board",
|
15
|
+
],
|
14
16
|
},
|
15
|
-
|
17
|
+
cardId: {
|
18
|
+
propDefinition: [
|
19
|
+
app,
|
20
|
+
"cards",
|
21
|
+
(c) => ({
|
22
|
+
board: c.board,
|
23
|
+
}),
|
24
|
+
],
|
16
25
|
type: "string",
|
26
|
+
label: "Card ID",
|
17
27
|
description: "The ID of the card.",
|
28
|
+
optional: false,
|
18
29
|
},
|
19
|
-
|
20
|
-
|
21
|
-
|
30
|
+
checklistId: {
|
31
|
+
propDefinition: [
|
32
|
+
app,
|
33
|
+
"checklist",
|
34
|
+
({ cardId }) => ({
|
35
|
+
card: cardId,
|
36
|
+
}),
|
37
|
+
],
|
38
|
+
},
|
39
|
+
checklistItemId: {
|
40
|
+
propDefinition: [
|
41
|
+
app,
|
42
|
+
"checklistItemId",
|
43
|
+
({ checklistId }) => ({
|
44
|
+
checklistId,
|
45
|
+
}),
|
46
|
+
],
|
47
|
+
},
|
48
|
+
},
|
49
|
+
methods: {
|
50
|
+
completeChecklistItem({
|
51
|
+
cardId, checklistItemId, ...args
|
52
|
+
} = {}) {
|
53
|
+
return this.app.put({
|
54
|
+
path: `/cards/${cardId}/checkItem/${checklistItemId}`,
|
55
|
+
...args,
|
56
|
+
});
|
22
57
|
},
|
23
58
|
},
|
24
59
|
async run({ $ }) {
|
25
|
-
const
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
const config = {
|
31
|
-
url: `https://api.trello.com/1/cards/${id}/checkItem/${idCheckItem}?state=complete`,
|
32
|
-
method: "PUT",
|
33
|
-
data: "",
|
34
|
-
};
|
60
|
+
const {
|
61
|
+
completeChecklistItem,
|
62
|
+
cardId,
|
63
|
+
checklistItemId,
|
64
|
+
} = this;
|
35
65
|
|
36
|
-
const
|
37
|
-
|
38
|
-
|
39
|
-
|
66
|
+
const response = await completeChecklistItem({
|
67
|
+
$,
|
68
|
+
cardId,
|
69
|
+
checklistItemId,
|
70
|
+
params: {
|
71
|
+
state: "complete",
|
72
|
+
},
|
73
|
+
});
|
40
74
|
|
41
|
-
|
42
|
-
token,
|
43
|
-
oauthSignerUri,
|
44
|
-
};
|
75
|
+
$.export("$summary", "Successfully completed checklist item.");
|
45
76
|
|
46
|
-
|
47
|
-
return resp;
|
77
|
+
return response;
|
48
78
|
},
|
49
79
|
};
|
@@ -1,49 +1,59 @@
|
|
1
|
-
|
2
|
-
import { axios } from "@pipedream/platform";
|
1
|
+
import app from "../../trello.app.mjs";
|
3
2
|
|
4
3
|
export default {
|
5
4
|
key: "trello-create-board",
|
6
5
|
name: "Create a Board",
|
7
|
-
description: "Creates a new Trello board.",
|
8
|
-
version: "0.
|
6
|
+
description: "Creates a new Trello board. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-post).",
|
7
|
+
version: "0.2.0",
|
9
8
|
type: "action",
|
10
9
|
props: {
|
11
|
-
|
12
|
-
type: "app",
|
13
|
-
app: "trello",
|
14
|
-
},
|
10
|
+
app,
|
15
11
|
name: {
|
16
12
|
type: "string",
|
13
|
+
label: "Name",
|
17
14
|
description: "The new name for the board. 1 to 16384 characters long.",
|
18
15
|
},
|
19
16
|
defaultLabels: {
|
20
17
|
type: "boolean",
|
18
|
+
label: "Default Labels",
|
21
19
|
description: "Determines whether to use the default set of labels.",
|
22
20
|
optional: true,
|
23
21
|
},
|
24
22
|
defaultLists: {
|
25
23
|
type: "boolean",
|
24
|
+
label: "Default Lists",
|
26
25
|
description: "Determines whether to add the default set of lists to a board (To Do, Doing, Done). It is ignored if idBoardSource is provided.",
|
27
26
|
optional: true,
|
28
27
|
},
|
29
28
|
desc: {
|
30
29
|
type: "string",
|
30
|
+
label: "Description",
|
31
31
|
description: "A new description for the board, 0 to 16384 characters long",
|
32
32
|
optional: true,
|
33
33
|
},
|
34
34
|
idOrganization: {
|
35
35
|
type: "string",
|
36
|
+
label: "Organization ID",
|
36
37
|
description: "The id or name of the team the board should belong to.",
|
37
|
-
optional:
|
38
|
+
optional: false,
|
39
|
+
propDefinition: [
|
40
|
+
app,
|
41
|
+
"idOrganizations",
|
42
|
+
],
|
38
43
|
},
|
39
44
|
idBoardSource: {
|
40
|
-
|
45
|
+
label: "Board Source ID",
|
41
46
|
description: "The id of a board to copy into the new board.",
|
42
47
|
optional: true,
|
48
|
+
propDefinition: [
|
49
|
+
app,
|
50
|
+
"board",
|
51
|
+
],
|
43
52
|
},
|
44
53
|
keepFromSource: {
|
45
54
|
type: "string",
|
46
|
-
|
55
|
+
label: "Keep From Source",
|
56
|
+
description: "To keep cards from the original board pass in the value `cards`.",
|
47
57
|
optional: true,
|
48
58
|
options: [
|
49
59
|
"none",
|
@@ -52,12 +62,21 @@ export default {
|
|
52
62
|
},
|
53
63
|
powerUps: {
|
54
64
|
type: "string",
|
55
|
-
|
65
|
+
label: "Power-Ups",
|
66
|
+
description: "The Power-Ups that should be enabled on the new board. One of: `all`, `calendar`, `cardAging`, `recap`, `voting`.",
|
56
67
|
optional: true,
|
68
|
+
options: [
|
69
|
+
"all",
|
70
|
+
"calendar",
|
71
|
+
"cardAging",
|
72
|
+
"recap",
|
73
|
+
"voting",
|
74
|
+
],
|
57
75
|
},
|
58
|
-
|
76
|
+
prefsPermissionLevel: {
|
59
77
|
type: "string",
|
60
78
|
description: "The permissions level of the board. One of: org, private, public.",
|
79
|
+
label: "Prefs Permission Level",
|
61
80
|
optional: true,
|
62
81
|
options: [
|
63
82
|
"org",
|
@@ -65,7 +84,7 @@ export default {
|
|
65
84
|
"public",
|
66
85
|
],
|
67
86
|
},
|
68
|
-
|
87
|
+
prefsVoting: {
|
69
88
|
type: "string",
|
70
89
|
label: "Prefs Voting",
|
71
90
|
description: "Who can vote on this board. One of disabled, members, observers, org, public.",
|
@@ -78,7 +97,7 @@ export default {
|
|
78
97
|
"public",
|
79
98
|
],
|
80
99
|
},
|
81
|
-
|
100
|
+
prefsComments: {
|
82
101
|
type: "string",
|
83
102
|
label: "Prefs Comments",
|
84
103
|
description: "Who can comment on cards on this board. One of: disabled, members, observers, org, public.",
|
@@ -91,7 +110,7 @@ export default {
|
|
91
110
|
"public",
|
92
111
|
],
|
93
112
|
},
|
94
|
-
|
113
|
+
prefsInvitations: {
|
95
114
|
type: "string",
|
96
115
|
label: "Prefs Invitations",
|
97
116
|
description: "Determines what types of members can invite users to join. One of: admins, members.",
|
@@ -101,24 +120,38 @@ export default {
|
|
101
120
|
"members",
|
102
121
|
],
|
103
122
|
},
|
104
|
-
|
123
|
+
prefsSelfJoin: {
|
105
124
|
type: "boolean",
|
125
|
+
label: "Prefs Self Join",
|
106
126
|
description: "Determines whether users can join the boards themselves or whether they have to be invited.",
|
107
127
|
optional: true,
|
108
128
|
},
|
109
|
-
|
129
|
+
prefsCardCovers: {
|
110
130
|
type: "boolean",
|
131
|
+
label: "Prefs Card Covers",
|
111
132
|
description: "Determines whether card covers are enabled.",
|
112
133
|
optional: true,
|
113
134
|
},
|
114
|
-
|
135
|
+
prefsBackground: {
|
115
136
|
type: "string",
|
116
137
|
label: "Prefs Background",
|
117
|
-
description: "The id of a custom background or one of: blue
|
138
|
+
description: "The id of a custom background or one of: `blue`, `orange`, `green`, `red`, `purple`, `pink`, `lime`, `sky`, `grey`.",
|
118
139
|
optional: true,
|
140
|
+
options: [
|
141
|
+
"blue",
|
142
|
+
"orange",
|
143
|
+
"green",
|
144
|
+
"red",
|
145
|
+
"purple",
|
146
|
+
"pink",
|
147
|
+
"lime",
|
148
|
+
"sky",
|
149
|
+
"grey",
|
150
|
+
],
|
119
151
|
},
|
120
|
-
|
152
|
+
prefsCardAging: {
|
121
153
|
type: "string",
|
154
|
+
label: "Prefs Card Aging",
|
122
155
|
description: "Determines the type of card aging that should take place on the board if card aging is enabled. One of: pirate, regular.",
|
123
156
|
optional: true,
|
124
157
|
options: [
|
@@ -128,48 +161,50 @@ export default {
|
|
128
161
|
},
|
129
162
|
},
|
130
163
|
async run({ $ }) {
|
131
|
-
const
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
];
|
151
|
-
let p = this;
|
152
|
-
|
153
|
-
const queryString = trelloParams.filter((param) => p[param]).map((param) => `${param}=${p[param]}`)
|
154
|
-
.join("&");
|
155
|
-
|
156
|
-
const config = {
|
157
|
-
url: `https://api.trello.com/1/boards?${queryString}`,
|
158
|
-
method: "POST",
|
159
|
-
data: "",
|
160
|
-
};
|
164
|
+
const {
|
165
|
+
app,
|
166
|
+
name,
|
167
|
+
defaultLabels,
|
168
|
+
defaultLists,
|
169
|
+
desc,
|
170
|
+
idOrganization,
|
171
|
+
idBoardSource,
|
172
|
+
keepFromSource,
|
173
|
+
powerUps,
|
174
|
+
prefsPermissionLevel,
|
175
|
+
prefsVoting,
|
176
|
+
prefsComments,
|
177
|
+
prefsInvitations,
|
178
|
+
prefsSelfJoin,
|
179
|
+
prefsCardCovers,
|
180
|
+
prefsBackground,
|
181
|
+
prefsCardAging,
|
182
|
+
} = this;
|
161
183
|
|
162
|
-
const
|
163
|
-
|
164
|
-
|
165
|
-
|
184
|
+
const response = await app.createBoard({
|
185
|
+
$,
|
186
|
+
params: {
|
187
|
+
name,
|
188
|
+
defaultLabels,
|
189
|
+
defaultLists,
|
190
|
+
desc,
|
191
|
+
idOrganization,
|
192
|
+
idBoardSource,
|
193
|
+
keepFromSource,
|
194
|
+
powerUps,
|
195
|
+
prefs_permissionLevel: prefsPermissionLevel,
|
196
|
+
prefs_voting: prefsVoting,
|
197
|
+
prefs_comments: prefsComments,
|
198
|
+
prefs_invitations: prefsInvitations,
|
199
|
+
prefs_selfJoin: prefsSelfJoin,
|
200
|
+
prefs_cardCovers: prefsCardCovers,
|
201
|
+
prefs_background: prefsBackground,
|
202
|
+
prefs_cardAging: prefsCardAging,
|
203
|
+
},
|
204
|
+
});
|
166
205
|
|
167
|
-
|
168
|
-
token,
|
169
|
-
oauthSignerUri,
|
170
|
-
};
|
206
|
+
$.export("$summary", `Successfully created board with ID \`${response.id}\`.`);
|
171
207
|
|
172
|
-
|
173
|
-
return resp;
|
208
|
+
return response;
|
174
209
|
},
|
175
210
|
};
|
@@ -1,23 +1,26 @@
|
|
1
|
+
import fs from "fs";
|
2
|
+
import FormData from "form-data";
|
3
|
+
import { ConfigurationError } from "@pipedream/platform";
|
1
4
|
import common from "../common.mjs";
|
2
5
|
|
3
6
|
export default {
|
4
7
|
...common,
|
5
8
|
key: "trello-create-card",
|
6
9
|
name: "Create Card",
|
7
|
-
description: "Creates a new card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post)",
|
8
|
-
version: "0.0
|
10
|
+
description: "Creates a new card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post).",
|
11
|
+
version: "0.1.0",
|
9
12
|
type: "action",
|
10
13
|
props: {
|
11
14
|
...common.props,
|
12
15
|
board: {
|
13
16
|
propDefinition: [
|
14
|
-
common.props.
|
17
|
+
common.props.app,
|
15
18
|
"board",
|
16
19
|
],
|
17
20
|
},
|
18
21
|
name: {
|
19
22
|
propDefinition: [
|
20
|
-
common.props.
|
23
|
+
common.props.app,
|
21
24
|
"name",
|
22
25
|
],
|
23
26
|
description: "The name of the card.",
|
@@ -25,31 +28,31 @@ export default {
|
|
25
28
|
},
|
26
29
|
desc: {
|
27
30
|
propDefinition: [
|
28
|
-
common.props.
|
31
|
+
common.props.app,
|
29
32
|
"desc",
|
30
33
|
],
|
31
34
|
},
|
32
35
|
pos: {
|
33
36
|
propDefinition: [
|
34
|
-
common.props.
|
37
|
+
common.props.app,
|
35
38
|
"pos",
|
36
39
|
],
|
37
40
|
},
|
38
41
|
due: {
|
39
42
|
propDefinition: [
|
40
|
-
common.props.
|
43
|
+
common.props.app,
|
41
44
|
"due",
|
42
45
|
],
|
43
46
|
},
|
44
47
|
dueComplete: {
|
45
48
|
propDefinition: [
|
46
|
-
common.props.
|
49
|
+
common.props.app,
|
47
50
|
"dueComplete",
|
48
51
|
],
|
49
52
|
},
|
50
53
|
idList: {
|
51
54
|
propDefinition: [
|
52
|
-
common.props.
|
55
|
+
common.props.app,
|
53
56
|
"lists",
|
54
57
|
(c) => ({
|
55
58
|
board: c.board,
|
@@ -62,7 +65,7 @@ export default {
|
|
62
65
|
},
|
63
66
|
idMembers: {
|
64
67
|
propDefinition: [
|
65
|
-
common.props.
|
68
|
+
common.props.app,
|
66
69
|
"member",
|
67
70
|
(c) => ({
|
68
71
|
board: c.board,
|
@@ -75,7 +78,7 @@ export default {
|
|
75
78
|
},
|
76
79
|
idLabels: {
|
77
80
|
propDefinition: [
|
78
|
-
common.props.
|
81
|
+
common.props.app,
|
79
82
|
"label",
|
80
83
|
(c) => ({
|
81
84
|
board: c.board,
|
@@ -88,26 +91,25 @@ export default {
|
|
88
91
|
},
|
89
92
|
urlSource: {
|
90
93
|
propDefinition: [
|
91
|
-
common.props.
|
94
|
+
common.props.app,
|
92
95
|
"url",
|
93
96
|
],
|
94
|
-
optional: true,
|
95
|
-
},
|
96
|
-
fileSource: {
|
97
|
-
type: "string",
|
98
|
-
label: "File Attachment Contents",
|
99
|
-
description: "Value must be in binary format",
|
100
|
-
optional: true,
|
101
97
|
},
|
102
98
|
mimeType: {
|
103
99
|
propDefinition: [
|
104
|
-
common.props.
|
100
|
+
common.props.app,
|
105
101
|
"mimeType",
|
106
102
|
],
|
107
103
|
},
|
104
|
+
file: {
|
105
|
+
propDefinition: [
|
106
|
+
common.props.app,
|
107
|
+
"file",
|
108
|
+
],
|
109
|
+
},
|
108
110
|
idCardSource: {
|
109
111
|
propDefinition: [
|
110
|
-
common.props.
|
112
|
+
common.props.app,
|
111
113
|
"cards",
|
112
114
|
(c) => ({
|
113
115
|
board: c.board,
|
@@ -115,7 +117,7 @@ export default {
|
|
115
117
|
],
|
116
118
|
type: "string",
|
117
119
|
label: "Copy Card",
|
118
|
-
description: "Specify an existing card to copy contents from",
|
120
|
+
description: "Specify an existing card to copy contents from. Keep in mind that if you copy a card, the **File Attachment Path**, **File Attachment URL** and **File Attachment Type** fields will be ignored.",
|
119
121
|
},
|
120
122
|
keepFromSource: {
|
121
123
|
type: "string[]",
|
@@ -135,25 +137,25 @@ export default {
|
|
135
137
|
},
|
136
138
|
address: {
|
137
139
|
propDefinition: [
|
138
|
-
common.props.
|
140
|
+
common.props.app,
|
139
141
|
"address",
|
140
142
|
],
|
141
143
|
},
|
142
144
|
locationName: {
|
143
145
|
propDefinition: [
|
144
|
-
common.props.
|
146
|
+
common.props.app,
|
145
147
|
"locationName",
|
146
148
|
],
|
147
149
|
},
|
148
150
|
coordinates: {
|
149
151
|
propDefinition: [
|
150
|
-
common.props.
|
152
|
+
common.props.app,
|
151
153
|
"coordinates",
|
152
154
|
],
|
153
155
|
},
|
154
156
|
customFieldIds: {
|
155
157
|
propDefinition: [
|
156
|
-
common.props.
|
158
|
+
common.props.app,
|
157
159
|
"customFieldIds",
|
158
160
|
(c) => ({
|
159
161
|
boardId: c.board,
|
@@ -168,7 +170,9 @@ export default {
|
|
168
170
|
return props;
|
169
171
|
}
|
170
172
|
for (const customFieldId of this.customFieldIds) {
|
171
|
-
const customField = await this.
|
173
|
+
const customField = await this.app.getCustomField({
|
174
|
+
customFieldId,
|
175
|
+
});
|
172
176
|
props[customFieldId] = {
|
173
177
|
type: "string",
|
174
178
|
label: `Value for Custom Field - ${customField.name}`,
|
@@ -187,7 +191,10 @@ export default {
|
|
187
191
|
async getCustomFieldItems($) {
|
188
192
|
const customFieldItems = [];
|
189
193
|
for (const customFieldId of this.customFieldIds) {
|
190
|
-
const customField = await this.
|
194
|
+
const customField = await this.app.getCustomField({
|
195
|
+
$,
|
196
|
+
customFieldId,
|
197
|
+
});
|
191
198
|
const customFieldItem = {
|
192
199
|
idCustomField: customFieldId,
|
193
200
|
};
|
@@ -206,9 +213,16 @@ export default {
|
|
206
213
|
}
|
207
214
|
return customFieldItems;
|
208
215
|
},
|
216
|
+
createCard(args = {}) {
|
217
|
+
return this.app.post({
|
218
|
+
path: "/cards",
|
219
|
+
...args,
|
220
|
+
});
|
221
|
+
},
|
209
222
|
},
|
210
223
|
async run({ $ }) {
|
211
224
|
const {
|
225
|
+
createCard,
|
212
226
|
name,
|
213
227
|
desc,
|
214
228
|
pos,
|
@@ -218,8 +232,8 @@ export default {
|
|
218
232
|
idMembers,
|
219
233
|
idLabels,
|
220
234
|
urlSource,
|
221
|
-
fileSource,
|
222
235
|
mimeType,
|
236
|
+
file,
|
223
237
|
idCardSource,
|
224
238
|
keepFromSource,
|
225
239
|
address,
|
@@ -227,7 +241,9 @@ export default {
|
|
227
241
|
coordinates,
|
228
242
|
customFieldIds,
|
229
243
|
} = this;
|
230
|
-
|
244
|
+
|
245
|
+
let response;
|
246
|
+
const params = {
|
231
247
|
name,
|
232
248
|
desc,
|
233
249
|
pos,
|
@@ -236,25 +252,53 @@ export default {
|
|
236
252
|
idList,
|
237
253
|
idMembers,
|
238
254
|
idLabels,
|
239
|
-
urlSource,
|
240
|
-
fileSource,
|
241
255
|
mimeType,
|
242
256
|
idCardSource,
|
243
257
|
keepFromSource: keepFromSource?.join(","),
|
244
258
|
address,
|
245
259
|
locationName,
|
246
260
|
coordinates,
|
247
|
-
}
|
261
|
+
};
|
262
|
+
|
263
|
+
if (file && !file?.startsWith("/tmp")) {
|
264
|
+
throw new ConfigurationError("The file path must be in the `/tmp` directory");
|
265
|
+
}
|
266
|
+
|
267
|
+
if (file) {
|
268
|
+
const form = new FormData();
|
269
|
+
form.append("fileSource", fs.createReadStream(file));
|
270
|
+
|
271
|
+
response = await createCard({
|
272
|
+
$,
|
273
|
+
params,
|
274
|
+
headers: form.getHeaders(),
|
275
|
+
data: form,
|
276
|
+
});
|
277
|
+
|
278
|
+
} else {
|
279
|
+
response = await createCard({
|
280
|
+
$,
|
281
|
+
params: {
|
282
|
+
...params,
|
283
|
+
urlSource,
|
284
|
+
},
|
285
|
+
});
|
286
|
+
}
|
248
287
|
|
249
288
|
if (customFieldIds) {
|
250
289
|
const customFieldItems = await this.getCustomFieldItems($);
|
251
|
-
const customFields = await this.
|
252
|
-
|
253
|
-
|
254
|
-
|
290
|
+
const customFields = await this.app.updateCustomFields({
|
291
|
+
$,
|
292
|
+
cardId: response.id,
|
293
|
+
data: {
|
294
|
+
customFieldItems,
|
295
|
+
},
|
296
|
+
});
|
297
|
+
response.customFields = customFields;
|
255
298
|
}
|
256
299
|
|
257
|
-
$.export("$summary", `Successfully created card
|
258
|
-
|
300
|
+
$.export("$summary", `Successfully created card \`${response.id}\`.`);
|
301
|
+
|
302
|
+
return response;
|
259
303
|
},
|
260
304
|
};
|