Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions components/box/actions/get-comments/get-comments.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import app from "../../box.app.mjs";
import utils from "../../common/utils.mjs";

export default {
name: "Get Comments",
description: "Fetches comments for a file. [See the documentation](https://developer.box.com/reference/get-files-id-comments/).",
key: "box-get-comments",
version: "0.0.1",
type: "action",
props: {
app,
folderId: {
propDefinition: [
app,
"parentId",
],
label: "Parent Folder",
description: "Use this option to select your File ID from a dropdown list.",
},
fileId: {
propDefinition: [
app,
"fileId",
(c) => ({
folderId: c.folderId,
}),
],
label: "File ID",
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.",
},
},
async run({ $ }) {
const results = [];
const resourcesStream = utils.getResourcesStream({
resourceFn: this.app.getComments,
resourceFnArgs: {
$,
fileId: this.fileId,
},
});
for await (const resource of resourcesStream) {
results.push(resource);
}
// eslint-disable-next-line multiline-ternary
$.export("$summary", results.length ? `Successfully fetched ${results.length} comment${results.length === 1 ? "" : "s"}.` : "No comments found.");
return results;
},
};
9 changes: 9 additions & 0 deletions components/box/box.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,14 @@ export default {
...args,
});
},
async getComments({
fileId, ...args
} = {}) {
return this._makeRequest({
method: "GET",
path: `/files/${fileId}/comments`,
...args,
});
},
},
};
2 changes: 1 addition & 1 deletion components/box/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/box",
"version": "0.2.0",
"version": "0.3.0",
"description": "Pipedream Box Components",
"main": "box.app.mjs",
"keywords": [
Expand Down
Loading