@pipedream/asana 0.6.0 → 0.6.2
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/actions/add-task-to-section/add-task-to-section.mjs +6 -4
- package/actions/common/common.mjs +3 -2
- package/actions/create-project/create-project.mjs +6 -4
- package/actions/create-subtask/create-subtask.mjs +6 -4
- package/actions/create-task/create-task.mjs +6 -4
- package/actions/create-task-comment/create-task-comment.mjs +6 -4
- package/actions/delete-task/delete-task.mjs +6 -4
- package/actions/find-task-by-id/find-task-by-id.mjs +6 -3
- package/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs +9 -7
- package/actions/search-projects/search-projects.mjs +9 -5
- package/actions/search-sections/search-sections.mjs +6 -3
- package/actions/search-tasks/search-tasks.mjs +6 -5
- package/actions/search-user-projects/search-user-projects.mjs +13 -5
- package/actions/update-task/update-task.mjs +7 -5
- package/asana.app.mjs +292 -145
- package/package.json +3 -2
- package/sources/common/common.mjs +5 -4
- package/sources/new-completed-task/new-completed-task.mjs +4 -2
- package/sources/new-project/new-project.mjs +4 -2
- package/sources/new-story/new-story.mjs +4 -2
- package/sources/new-subtask/new-subtask.mjs +4 -2
- package/sources/new-tag/new-tag.mjs +6 -4
- package/sources/new-task/new-task.mjs +8 -3
- package/sources/new-team/new-team.mjs +5 -3
- package/sources/new-user/new-user.mjs +7 -3
- package/sources/new-workspace/new-workspace.mjs +6 -5
- package/sources/tag-added-to-task/tag-added-to-task.mjs +7 -3
- package/sources/tags-added-to-any-task/tags-added-to-any-task.mjs +8 -7
- package/sources/task-assigned-in-project/task-assigned-in-project.mjs +5 -3
- package/sources/task-field-updated-in-project/task-field-updated-in-project.mjs +5 -3
- package/sources/task-updated-in-project/task-updated-in-project.mjs +4 -2
package/asana.app.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { axios } from "@pipedream/platform";
|
|
2
|
+
const DEFAULT_LIMIT = 25;
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
type: "app",
|
|
@@ -6,115 +7,211 @@ export default {
|
|
|
6
7
|
propDefinitions: {
|
|
7
8
|
organizations: {
|
|
8
9
|
label: "Organizations",
|
|
9
|
-
description: "List of organizations. This field
|
|
10
|
+
description: "List of organizations. This field uses the organization GID.",
|
|
10
11
|
type: "string[]",
|
|
11
12
|
async options() {
|
|
12
13
|
const organizations = await this.getOrganizations();
|
|
13
|
-
|
|
14
|
-
return organizations.map((organization) => ({
|
|
14
|
+
return organizations?.map((organization) => ({
|
|
15
15
|
label: organization.name,
|
|
16
16
|
value: organization.gid,
|
|
17
|
-
}));
|
|
17
|
+
})) || [];
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
workspaces: {
|
|
21
21
|
label: "Workspaces",
|
|
22
|
-
description: "List of workspaces. This field
|
|
22
|
+
description: "List of workspaces. This field uses the workspace GID.",
|
|
23
23
|
type: "string[]",
|
|
24
|
-
async options() {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
async options({ prevContext }) {
|
|
25
|
+
const params = {
|
|
26
|
+
limit: DEFAULT_LIMIT,
|
|
27
|
+
};
|
|
28
|
+
if (prevContext?.offset) {
|
|
29
|
+
params.offset = prevContext.offset;
|
|
30
|
+
}
|
|
31
|
+
const {
|
|
32
|
+
data: workspaces, next_page: next,
|
|
33
|
+
} = await this.getWorkspaces({
|
|
34
|
+
params,
|
|
35
|
+
});
|
|
36
|
+
const options = workspaces?.map((workspace) => ({
|
|
28
37
|
label: workspace.name,
|
|
29
38
|
value: workspace.gid,
|
|
30
|
-
}));
|
|
39
|
+
})) || [];
|
|
40
|
+
return {
|
|
41
|
+
options,
|
|
42
|
+
context: {
|
|
43
|
+
offset: next?.offset,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
31
46
|
},
|
|
32
47
|
},
|
|
33
48
|
teams: {
|
|
34
49
|
label: "Teams",
|
|
35
|
-
description: "List of teams. This field
|
|
50
|
+
description: "List of teams. This field uses the team GID.",
|
|
36
51
|
type: "string[]",
|
|
37
|
-
async options() {
|
|
38
|
-
const teams = await this.getTeams();
|
|
39
|
-
|
|
40
|
-
return teams.map((team) => ({
|
|
52
|
+
async options({ workspaces }) {
|
|
53
|
+
const teams = await this.getTeams(workspaces);
|
|
54
|
+
return teams?.map((team) => ({
|
|
41
55
|
label: team.name,
|
|
42
56
|
value: team.gid,
|
|
43
|
-
}));
|
|
57
|
+
})) || [];
|
|
44
58
|
},
|
|
45
59
|
},
|
|
46
60
|
projects: {
|
|
47
61
|
label: "Projects",
|
|
48
|
-
description: "List of projects. This field
|
|
62
|
+
description: "List of projects. This field uses the project GID.",
|
|
49
63
|
type: "string[]",
|
|
50
|
-
async options({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
async options({
|
|
65
|
+
workspace, prevContext,
|
|
66
|
+
}) {
|
|
67
|
+
const params = {
|
|
68
|
+
workspace,
|
|
69
|
+
limit: DEFAULT_LIMIT,
|
|
70
|
+
};
|
|
71
|
+
if (prevContext?.offset) {
|
|
72
|
+
params.offset = prevContext.offset;
|
|
73
|
+
}
|
|
74
|
+
const {
|
|
75
|
+
data: projects, next_page: next,
|
|
76
|
+
} = await this.getProjects({
|
|
77
|
+
params,
|
|
78
|
+
});
|
|
79
|
+
const options = projects?.map((tag) => ({
|
|
54
80
|
label: tag.name,
|
|
55
81
|
value: tag.gid,
|
|
56
|
-
}));
|
|
82
|
+
})) || [];
|
|
83
|
+
return {
|
|
84
|
+
options,
|
|
85
|
+
context: {
|
|
86
|
+
offset: next?.offset,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
57
89
|
},
|
|
58
90
|
},
|
|
59
91
|
tags: {
|
|
60
92
|
label: "Tags",
|
|
61
|
-
description: "List of tags. This field
|
|
93
|
+
description: "List of tags. This field uses the tag GID.",
|
|
62
94
|
type: "string[]",
|
|
63
|
-
async options() {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
95
|
+
async options({ prevContext }) {
|
|
96
|
+
const params = {
|
|
97
|
+
limit: DEFAULT_LIMIT,
|
|
98
|
+
};
|
|
99
|
+
if (prevContext?.offset) {
|
|
100
|
+
params.offset = prevContext.offset;
|
|
101
|
+
}
|
|
102
|
+
const {
|
|
103
|
+
data: tags, next_page: next,
|
|
104
|
+
} = await this.getTags({
|
|
105
|
+
params,
|
|
71
106
|
});
|
|
107
|
+
const options = tags?.map((tag) => ({
|
|
108
|
+
label: tag.name,
|
|
109
|
+
value: tag.gid,
|
|
110
|
+
})) || [];
|
|
111
|
+
return {
|
|
112
|
+
options,
|
|
113
|
+
context: {
|
|
114
|
+
offset: next?.offset,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
72
117
|
},
|
|
73
118
|
},
|
|
74
119
|
users: {
|
|
75
120
|
label: "Users",
|
|
76
|
-
description: "List of users. This field
|
|
121
|
+
description: "List of users. This field uses the user GID.",
|
|
77
122
|
type: "string[]",
|
|
78
|
-
async options() {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
123
|
+
async options({ prevContext }) {
|
|
124
|
+
const params = {
|
|
125
|
+
limit: DEFAULT_LIMIT,
|
|
126
|
+
};
|
|
127
|
+
if (prevContext?.offset) {
|
|
128
|
+
params.offset = prevContext.offset;
|
|
129
|
+
}
|
|
130
|
+
const {
|
|
131
|
+
data: users, next_page: next,
|
|
132
|
+
} = await this.getUsers({
|
|
133
|
+
params,
|
|
134
|
+
});
|
|
135
|
+
const options = users?.map((user) => ({
|
|
82
136
|
label: user.name,
|
|
83
137
|
value: user.gid,
|
|
84
|
-
}));
|
|
138
|
+
})) || [];
|
|
139
|
+
return {
|
|
140
|
+
options,
|
|
141
|
+
context: {
|
|
142
|
+
offset: next?.offset,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
85
145
|
},
|
|
86
146
|
},
|
|
87
147
|
tasks: {
|
|
88
148
|
label: "Tasks",
|
|
89
|
-
description: "List of tasks. This field
|
|
149
|
+
description: "List of tasks. This field uses the task GID.",
|
|
90
150
|
type: "string[]",
|
|
91
|
-
async options({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
151
|
+
async options({
|
|
152
|
+
project, prevContext,
|
|
153
|
+
}) {
|
|
154
|
+
if (!project) {
|
|
155
|
+
return [];
|
|
156
|
+
}
|
|
157
|
+
const params = {
|
|
158
|
+
project,
|
|
159
|
+
limit: DEFAULT_LIMIT,
|
|
160
|
+
};
|
|
161
|
+
if (prevContext?.offset) {
|
|
162
|
+
params.offset = prevContext.offset;
|
|
163
|
+
}
|
|
164
|
+
const {
|
|
165
|
+
data: tasks, next_page: next,
|
|
166
|
+
} = await this.getTasks({
|
|
167
|
+
params,
|
|
96
168
|
});
|
|
97
|
-
|
|
169
|
+
const options = tasks?.map(({
|
|
98
170
|
name: label, gid: value,
|
|
99
171
|
}) => ({
|
|
100
172
|
label,
|
|
101
173
|
value,
|
|
102
|
-
}));
|
|
174
|
+
})) || [];
|
|
175
|
+
return {
|
|
176
|
+
options,
|
|
177
|
+
context: {
|
|
178
|
+
offset: next?.offset,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
103
181
|
},
|
|
104
182
|
},
|
|
105
183
|
sections: {
|
|
106
184
|
label: "Sections",
|
|
107
|
-
description: "List of sections. This field
|
|
185
|
+
description: "List of sections. This field uses the section GID.",
|
|
108
186
|
type: "string[]",
|
|
109
|
-
async options({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
187
|
+
async options({
|
|
188
|
+
project, prevContext,
|
|
189
|
+
}) {
|
|
190
|
+
if (!project) {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
const params = {
|
|
194
|
+
limit: DEFAULT_LIMIT,
|
|
195
|
+
};
|
|
196
|
+
if (prevContext?.offset) {
|
|
197
|
+
params.offset = prevContext.offset;
|
|
198
|
+
}
|
|
199
|
+
const {
|
|
200
|
+
data: sections, next_page: next,
|
|
201
|
+
} = await this.getSections({
|
|
202
|
+
project,
|
|
203
|
+
params,
|
|
117
204
|
});
|
|
205
|
+
const options = sections?.map((section) => ({
|
|
206
|
+
label: section.name,
|
|
207
|
+
value: section.gid,
|
|
208
|
+
})) || [];
|
|
209
|
+
return {
|
|
210
|
+
options,
|
|
211
|
+
context: {
|
|
212
|
+
offset: next?.offset,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
118
215
|
},
|
|
119
216
|
},
|
|
120
217
|
taskFields: {
|
|
@@ -128,12 +225,10 @@ export default {
|
|
|
128
225
|
limit: 1,
|
|
129
226
|
},
|
|
130
227
|
});
|
|
131
|
-
|
|
132
228
|
if (!tasks || tasks.length === 0) {
|
|
133
229
|
return [];
|
|
134
230
|
}
|
|
135
231
|
const task = await this.getTask(tasks[0].gid);
|
|
136
|
-
|
|
137
232
|
return Object.keys(task);
|
|
138
233
|
},
|
|
139
234
|
},
|
|
@@ -165,32 +260,33 @@ export default {
|
|
|
165
260
|
* Make a requests with pre defined options.
|
|
166
261
|
*
|
|
167
262
|
* @param {string} path - The path to make the request.
|
|
168
|
-
* @param {object}
|
|
263
|
+
* @param {object} opts - A default Axios options object.
|
|
169
264
|
*
|
|
170
265
|
* @returns {string} The request result data.
|
|
171
266
|
*/
|
|
172
|
-
|
|
267
|
+
_makeRequest({
|
|
268
|
+
path, $ = this, ...opts
|
|
269
|
+
}) {
|
|
173
270
|
const config = {
|
|
174
271
|
url: `${this._apiUrl()}/${path}`,
|
|
175
272
|
headers: this._headers(),
|
|
176
|
-
...
|
|
273
|
+
...opts,
|
|
177
274
|
};
|
|
178
275
|
return axios($, config);
|
|
179
276
|
},
|
|
180
277
|
/**
|
|
181
278
|
* Create a webhook
|
|
182
279
|
*
|
|
183
|
-
* @param {string}
|
|
280
|
+
* @param {string} opts.data - The body that will be send on request.
|
|
184
281
|
*
|
|
185
|
-
* @returns {object}
|
|
282
|
+
* @returns {object} An Asana Webhook.
|
|
186
283
|
*/
|
|
187
|
-
async createWebHook(
|
|
188
|
-
|
|
284
|
+
async createWebHook(opts = {}) {
|
|
285
|
+
return this._makeRequest({
|
|
286
|
+
path: "webhooks",
|
|
189
287
|
method: "post",
|
|
190
|
-
|
|
288
|
+
...opts,
|
|
191
289
|
});
|
|
192
|
-
|
|
193
|
-
return authorization.data;
|
|
194
290
|
},
|
|
195
291
|
/**
|
|
196
292
|
* Remove a Webhook.
|
|
@@ -198,7 +294,8 @@ export default {
|
|
|
198
294
|
* @param {string} hookId - The Asana Webhook GID.
|
|
199
295
|
*/
|
|
200
296
|
async deleteWebhook(hookId) {
|
|
201
|
-
await this._makeRequest(
|
|
297
|
+
await this._makeRequest({
|
|
298
|
+
path: `webhooks/${hookId}`,
|
|
202
299
|
method: "delete",
|
|
203
300
|
});
|
|
204
301
|
},
|
|
@@ -209,16 +306,24 @@ export default {
|
|
|
209
306
|
*
|
|
210
307
|
* @returns {string} An Asana Workspace.
|
|
211
308
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
309
|
+
getWorkspace({
|
|
310
|
+
workspaceId, ...opts
|
|
311
|
+
}) {
|
|
312
|
+
return this._makeRequest({
|
|
313
|
+
path: `workspaces/${workspaceId}`,
|
|
314
|
+
...opts,
|
|
315
|
+
});
|
|
214
316
|
},
|
|
215
317
|
/**
|
|
216
318
|
* Get an Asana Workspace list.
|
|
217
319
|
*
|
|
218
320
|
* @returns {string} An Asana Workspace object list.
|
|
219
321
|
*/
|
|
220
|
-
|
|
221
|
-
return
|
|
322
|
+
getWorkspaces(opts = {}) {
|
|
323
|
+
return this._makeRequest({
|
|
324
|
+
path: "workspaces",
|
|
325
|
+
...opts,
|
|
326
|
+
});
|
|
222
327
|
},
|
|
223
328
|
/**
|
|
224
329
|
* Get an Asana Organizations list.
|
|
@@ -226,14 +331,24 @@ export default {
|
|
|
226
331
|
* @returns {string} An Asana Organizations list.
|
|
227
332
|
*/
|
|
228
333
|
async getOrganizations() {
|
|
229
|
-
const
|
|
334
|
+
const params = {};
|
|
335
|
+
const workspaces = [];
|
|
336
|
+
do {
|
|
337
|
+
const {
|
|
338
|
+
data, next_page: next,
|
|
339
|
+
} = await this.getWorkspaces({
|
|
340
|
+
params,
|
|
341
|
+
});
|
|
342
|
+
workspaces.push(...data);
|
|
343
|
+
params.offset = next?.offset;
|
|
344
|
+
} while (params.offset);
|
|
230
345
|
|
|
231
346
|
const organizations = workspaces.filter(async (workspace) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
347
|
+
const { data } = await this.getWorkspace({
|
|
348
|
+
workspaceId: workspace.gid,
|
|
349
|
+
});
|
|
350
|
+
return data?.is_organization;
|
|
235
351
|
});
|
|
236
|
-
|
|
237
352
|
return organizations;
|
|
238
353
|
},
|
|
239
354
|
/**
|
|
@@ -243,23 +358,24 @@ export default {
|
|
|
243
358
|
*
|
|
244
359
|
* @returns {string} An Asana Project.
|
|
245
360
|
*/
|
|
246
|
-
|
|
247
|
-
|
|
361
|
+
getProject({
|
|
362
|
+
projectId, ...opts
|
|
363
|
+
}) {
|
|
364
|
+
return this._makeRequest({
|
|
365
|
+
path: `projects/${projectId}`,
|
|
366
|
+
...opts,
|
|
367
|
+
});
|
|
248
368
|
},
|
|
249
369
|
/**
|
|
250
370
|
* Get an Asana Project list.
|
|
251
371
|
*
|
|
252
|
-
* @param {string} workspaceId - The Workspace GID.
|
|
253
|
-
*
|
|
254
372
|
* @returns {string} An Asana Project list.
|
|
255
373
|
*/
|
|
256
|
-
|
|
257
|
-
return
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
}, $)).data;
|
|
374
|
+
getProjects(opts = {}) {
|
|
375
|
+
return this._makeRequest({
|
|
376
|
+
path: "projects",
|
|
377
|
+
...opts,
|
|
378
|
+
});
|
|
263
379
|
},
|
|
264
380
|
/**
|
|
265
381
|
* Get an Asana Story.
|
|
@@ -268,8 +384,13 @@ export default {
|
|
|
268
384
|
*
|
|
269
385
|
* @returns {string} An Asana Story.
|
|
270
386
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
387
|
+
getStory({
|
|
388
|
+
storyId, ...opts
|
|
389
|
+
}) {
|
|
390
|
+
return this._makeRequest({
|
|
391
|
+
path: `stories/${storyId}`,
|
|
392
|
+
...opts,
|
|
393
|
+
});
|
|
273
394
|
},
|
|
274
395
|
/**
|
|
275
396
|
* Get an Asana Task.
|
|
@@ -278,33 +399,41 @@ export default {
|
|
|
278
399
|
*
|
|
279
400
|
* @returns {string} An Asana Task.
|
|
280
401
|
*/
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
402
|
+
getTask({
|
|
403
|
+
taskId, ...opts
|
|
404
|
+
}) {
|
|
405
|
+
return this._makeRequest({
|
|
406
|
+
path: `tasks/${taskId}`,
|
|
407
|
+
...opts,
|
|
408
|
+
});
|
|
284
409
|
},
|
|
285
410
|
/**
|
|
286
411
|
* Get an Asana Task list.
|
|
287
412
|
*
|
|
288
|
-
* @param {string}
|
|
413
|
+
* @param {string} opts - The params to filter tasks.
|
|
289
414
|
*
|
|
290
415
|
* @returns {string} An Asana Task list.
|
|
291
416
|
*/
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
417
|
+
getTasks(opts = {}) {
|
|
418
|
+
return this._makeRequest({
|
|
419
|
+
path: "tasks",
|
|
420
|
+
...opts,
|
|
421
|
+
});
|
|
296
422
|
},
|
|
297
423
|
/**
|
|
298
424
|
* Get an Asana Section list.
|
|
299
425
|
*
|
|
300
|
-
* @param {string}
|
|
426
|
+
* @param {string} projectId - A Project GID.
|
|
301
427
|
*
|
|
302
428
|
* @returns {string} An Asana Section list.
|
|
303
429
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return
|
|
430
|
+
getSections({
|
|
431
|
+
project, ...opts
|
|
432
|
+
}) {
|
|
433
|
+
return this._makeRequest({
|
|
434
|
+
path: `projects/${project}/sections`,
|
|
435
|
+
...opts,
|
|
436
|
+
});
|
|
308
437
|
},
|
|
309
438
|
/**
|
|
310
439
|
* Get an Asana Tag.
|
|
@@ -313,16 +442,24 @@ export default {
|
|
|
313
442
|
*
|
|
314
443
|
* @returns {string} An Asana Tag.
|
|
315
444
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
445
|
+
getTag({
|
|
446
|
+
tagId, ...opts
|
|
447
|
+
}) {
|
|
448
|
+
return this._makeRequest({
|
|
449
|
+
path: `tags/${tagId}`,
|
|
450
|
+
opts,
|
|
451
|
+
});
|
|
318
452
|
},
|
|
319
453
|
/**
|
|
320
454
|
* Get an Asana Tag list.
|
|
321
455
|
*
|
|
322
456
|
* @returns {string} An Asana Tag list.
|
|
323
457
|
*/
|
|
324
|
-
|
|
325
|
-
return
|
|
458
|
+
getTags(opts = {}) {
|
|
459
|
+
return this._makeRequest({
|
|
460
|
+
path: "tags",
|
|
461
|
+
...opts,
|
|
462
|
+
});
|
|
326
463
|
},
|
|
327
464
|
/**
|
|
328
465
|
* Get an Asana Team.
|
|
@@ -331,8 +468,13 @@ export default {
|
|
|
331
468
|
*
|
|
332
469
|
* @returns {string} An Asana Team.
|
|
333
470
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
471
|
+
getTeam({
|
|
472
|
+
teamId, ...opts
|
|
473
|
+
}) {
|
|
474
|
+
return this._makeRequest({
|
|
475
|
+
path: `teams/${teamId}`,
|
|
476
|
+
...opts,
|
|
477
|
+
});
|
|
336
478
|
},
|
|
337
479
|
/**
|
|
338
480
|
* Get an Asana Team list.
|
|
@@ -349,9 +491,8 @@ export default {
|
|
|
349
491
|
let teams = [];
|
|
350
492
|
|
|
351
493
|
for (const workspace of workspaces) {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
teams = teams.concat(response.data);
|
|
494
|
+
const { data } = (await this._makeRequest(`organizations/${workspace}/teams`));
|
|
495
|
+
teams = teams.concat(data);
|
|
355
496
|
}
|
|
356
497
|
|
|
357
498
|
return teams;
|
|
@@ -359,12 +500,17 @@ export default {
|
|
|
359
500
|
/**
|
|
360
501
|
* Get an Asana Workspace Membership.
|
|
361
502
|
*
|
|
362
|
-
* @param {string}
|
|
503
|
+
* @param {string} membershipId - A Workspace Membership GID.
|
|
363
504
|
*
|
|
364
505
|
* @returns {string} A Workspace Membership.
|
|
365
506
|
*/
|
|
366
|
-
|
|
367
|
-
|
|
507
|
+
getWorkspaceMembership({
|
|
508
|
+
membershipId, ...opts
|
|
509
|
+
}) {
|
|
510
|
+
return this._makeRequest({
|
|
511
|
+
path: `workspace_memberships/${membershipId}`,
|
|
512
|
+
...opts,
|
|
513
|
+
});
|
|
368
514
|
},
|
|
369
515
|
/**
|
|
370
516
|
* Get an Asana User.
|
|
@@ -373,46 +519,47 @@ export default {
|
|
|
373
519
|
*
|
|
374
520
|
* @returns {string} An Asana User.
|
|
375
521
|
*/
|
|
376
|
-
|
|
377
|
-
|
|
522
|
+
getUser({
|
|
523
|
+
userId, ...opts
|
|
524
|
+
}) {
|
|
525
|
+
return this._makeRequest({
|
|
526
|
+
path: `users/${userId}`,
|
|
527
|
+
...opts,
|
|
528
|
+
});
|
|
378
529
|
},
|
|
379
530
|
/**
|
|
380
531
|
* Get an Asana User list.
|
|
381
532
|
*
|
|
382
|
-
* @param {string} params - The params to filter the users.
|
|
533
|
+
* @param {string} opts.params - The params to filter the users.
|
|
383
534
|
*
|
|
384
535
|
* @returns {string} An Asana User list.
|
|
385
536
|
*/
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return (await this._makeRequest("users", {
|
|
393
|
-
params: {
|
|
394
|
-
workspace,
|
|
395
|
-
team,
|
|
396
|
-
},
|
|
397
|
-
})).data;
|
|
537
|
+
getUsers(opts = {}) {
|
|
538
|
+
return this._makeRequest({
|
|
539
|
+
path: "users",
|
|
540
|
+
...opts,
|
|
541
|
+
});
|
|
398
542
|
},
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
return
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
const taskList = await this.getUserTaskList({
|
|
411
|
-
...params,
|
|
543
|
+
getUserTaskList({
|
|
544
|
+
userId, ...opts
|
|
545
|
+
}) {
|
|
546
|
+
return this._makeRequest({
|
|
547
|
+
path: `users/${userId}/user_task_list`,
|
|
548
|
+
...opts,
|
|
549
|
+
});
|
|
550
|
+
},
|
|
551
|
+
async getTasksFromUserTaskList({
|
|
552
|
+
params, $,
|
|
553
|
+
}) {
|
|
554
|
+
const { data: taskList } = await this.getUserTaskList({
|
|
412
555
|
userId: "me",
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
556
|
+
params,
|
|
557
|
+
$,
|
|
558
|
+
});
|
|
559
|
+
return this._makeRequest({
|
|
560
|
+
path: `user_task_lists/${taskList.gid}/tasks`,
|
|
561
|
+
$,
|
|
562
|
+
});
|
|
416
563
|
},
|
|
417
564
|
},
|
|
418
565
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/asana",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Pipedream Asana Components",
|
|
5
5
|
"main": "asana.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@pipedream/platform": "^1.2.0",
|
|
14
|
-
"axios": "^0.21.1"
|
|
14
|
+
"axios": "^0.21.1",
|
|
15
|
+
"lodash": "^4.17.21"
|
|
15
16
|
},
|
|
16
17
|
"gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
|
|
17
18
|
"publishConfig": {
|
|
@@ -16,7 +16,6 @@ export default {
|
|
|
16
16
|
asana,
|
|
17
17
|
"workspaces",
|
|
18
18
|
],
|
|
19
|
-
optional: true,
|
|
20
19
|
},
|
|
21
20
|
},
|
|
22
21
|
methods: {
|
|
@@ -43,10 +42,12 @@ export default {
|
|
|
43
42
|
},
|
|
44
43
|
hooks: {
|
|
45
44
|
async activate() {
|
|
46
|
-
const response = await this.asana.createWebHook({
|
|
45
|
+
const { data: response } = await this.asana.createWebHook({
|
|
47
46
|
data: {
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
data: {
|
|
48
|
+
...this.getWebhookFilter(),
|
|
49
|
+
target: this.http.endpoint,
|
|
50
|
+
},
|
|
50
51
|
},
|
|
51
52
|
});
|
|
52
53
|
|