Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
25 changes: 24 additions & 1 deletion components/google_docs/actions/get-document/get-document.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import googleDocs from "../../google_docs.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "google_docs-get-document",
name: "Get Document",
description: "Get the contents of the latest version of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)",
version: "0.1.5",
version: "0.1.6",
type: "action",
props: {
googleDocs,
Expand All @@ -21,10 +22,32 @@ export default {
optional: true,
default: false,
},
tabIds: {
type: "string[]",
label: "Tab IDs",
description: "Only return content for the specified tabs",
optional: true,
async options() {
const { tabs } = await this.googleDocs.getDocument(this.docId, this.includeTabsContent);
if (!tabs?.length) return [];
return tabs.map((tab) => ({
label: tab.tabProperties.title,
value: tab.tabProperties.tabId,
}));
},
},
},
async run({ $ }) {
if (this.tabIds?.length && !this.includeTabsContent) {
throw new ConfigurationError("Include Tabs Content must be true if tabIds are provided");
}

const response = await this.googleDocs.getDocument(this.docId, this.includeTabsContent);

if (this.tabIds?.length) {
response.tabs = response.tabs.filter((tab) => this.tabIds.includes(tab.tabProperties.tabId));
}

$.export("$summary", `Successfully retrieved document with ID: ${this.docId}`);

return response;
Expand Down
2 changes: 1 addition & 1 deletion components/google_docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/google_docs",
"version": "0.4.3",
"version": "0.4.4",
"description": "Pipedream Google_docs Components",
"main": "google_docs.app.mjs",
"keywords": [
Expand Down
5 changes: 3 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading