Skip to content

Commit 6ff1e37

Browse files
[Box] get comments action (#14145)
* initial action get comments * add optional parent folder prop * bump version * bump versions
1 parent afa8fb1 commit 6ff1e37

File tree

10 files changed

+65
-8
lines changed

10 files changed

+65
-8
lines changed

components/box/actions/download-file/download-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: "Download File",
88
description: "Downloads a file from Box to your workflow's `/tmp` directory. [See the documentation](https://developer.box.com/reference/get-files-id-content/)",
99
key: "box-download-file",
10-
version: "0.0.2",
10+
version: "0.0.3",
1111
type: "action",
1212
props: {
1313
app,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import app from "../../box.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
name: "Get Comments",
6+
description: "Fetches comments for a file. [See the documentation](https://developer.box.com/reference/get-files-id-comments/).",
7+
key: "box-get-comments",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
folderId: {
13+
propDefinition: [
14+
app,
15+
"parentId",
16+
],
17+
label: "Parent Folder",
18+
description: "Use this option to select your File ID from a dropdown list.",
19+
},
20+
fileId: {
21+
propDefinition: [
22+
app,
23+
"fileId",
24+
(c) => ({
25+
folderId: c.folderId,
26+
}),
27+
],
28+
label: "File ID",
29+
description: "The file ID to get comments from. Use a custom expression to reference a file from your workflow or select it from the dropdown list.",
30+
},
31+
},
32+
async run({ $ }) {
33+
const results = [];
34+
const resourcesStream = utils.getResourcesStream({
35+
resourceFn: this.app.getComments,
36+
resourceFnArgs: {
37+
$,
38+
fileId: this.fileId,
39+
},
40+
});
41+
for await (const resource of resourcesStream) {
42+
results.push(resource);
43+
}
44+
// eslint-disable-next-line multiline-ternary
45+
$.export("$summary", results.length ? `Successfully fetched ${results.length} comment${results.length === 1 ? "" : "s"}.` : "No comments found.");
46+
return results;
47+
},
48+
};

components/box/actions/search-content/search-content.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "Search Content",
77
description: "Searches for files, folders, web links, and shared files across the users content or across the entire enterprise. [See the documentation](https://developer.box.com/reference/get-search/).",
88
key: "box-search-content",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
type: "action",
1111
props: {
1212
app,

components/box/actions/upload-file-version/upload-file-version.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Upload File Version",
66
description: "Update a file's content. [See the documentation](https://developer.box.com/reference/post-files-id-content/).",
77
key: "box-upload-file-version",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
app,

components/box/actions/upload-file/upload-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Upload a File",
66
description: "Uploads a small file to Box. [See the documentation](https://developer.box.com/reference/post-files-content/).",
77
key: "box-upload-file",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
type: "action",
1010
props: {
1111
app,

components/box/box.app.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,5 +310,14 @@ export default {
310310
...args,
311311
});
312312
},
313+
async getComments({
314+
fileId, ...args
315+
} = {}) {
316+
return this._makeRequest({
317+
method: "GET",
318+
path: `/files/${fileId}/comments`,
319+
...args,
320+
});
321+
},
313322
},
314323
};

components/box/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/box",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Pipedream Box Components",
55
"main": "box.app.mjs",
66
"keywords": [

components/box/sources/new-event/new-event.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "box-new-event",
66
name: "New Event",
77
description: "Emit new event when an event with subscribed event source triggered on a target. [See the documentation](https://developer.box.com/reference/post-webhooks)",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
type: "source",
1010
dedupe: "unique",
1111
...common,

components/box/sources/new-file/new-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "box-new-file",
55
name: "New File Event",
66
description: "Emit new event when a new file uploaded on a target. [See the documentation](https://developer.box.com/reference/post-webhooks)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "source",
99
dedupe: "unique",
1010
...common,

components/box/sources/new-folder/new-folder.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "box-new-folder",
55
name: "New Folder Event",
66
description: "Emit new event when a new folder created on a target. [See the documentation](https://developer.box.com/reference/post-webhooks)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "source",
99
dedupe: "unique",
1010
...common,

0 commit comments

Comments
 (0)