Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-append-image",
name: "Append Image to Document",
description: "Appends an image to the end of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
googleDocs,
Expand Down
2 changes: 1 addition & 1 deletion components/google_docs/actions/append-text/append-text.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-append-text",
name: "Append Text",
description: "Append text to an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest)",
version: "0.1.6",
version: "0.1.7",
type: "action",
props: {
googleDocs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
...others,
key: "google_docs-create-document-from-template",
name: "Create New Document From Template",
version: "0.0.2",
version: "0.0.3",
description,
type,
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-create-document",
name: "Create a New Document",
description: "Create a new document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/create)",
version: "0.1.6",
version: "0.1.7",
type: "action",
props: {
googleDocs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
...others,
key: "google_docs-find-document",
name: "Find Document",
version: "0.0.2",
version: "0.0.3",
description,
type,
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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.6",
version: "0.1.7",
type: "action",
props: {
googleDocs,
Expand Down
37 changes: 37 additions & 0 deletions components/google_docs/actions/get-tab-content/get-tab-content.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import googleDocs from "../../google_docs.app.mjs";

export default {
key: "google_docs-get-tab-content",
name: "Get Tab Content",
description: "Get the content of a tab in a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)",
version: "0.0.1",
type: "action",
props: {
googleDocs,
docId: {
propDefinition: [
googleDocs,
"docId",
],
},
tabIds: {
type: "string[]",
label: "Tab IDs",
description: "Return content for the specified tabs",
async options() {
const { tabs } = await this.googleDocs.getDocument(this.docId, true);
if (!tabs?.length) return [];
return tabs.map((tab) => ({
label: tab.tabProperties.title,
value: tab.tabProperties.tabId,
}));
},
},
},
async run({ $ }) {
const response = await this.googleDocs.getDocument(this.docId, true);
const tabs = response.tabs.filter((tab) => this.tabIds.includes(tab.tabProperties.tabId));
$.export("$summary", `Successfully retrieved tab content for document with ID: ${this.docId}`);
return tabs;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import googleDocs from "../../google_docs.app.mjs";

export default {
key: "google_docs-insert-page-break",
name: "Insert Page Break",
description: "Insert a page break into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#insertpagebreakrequest)",
version: "0.0.1",
type: "action",
props: {
googleDocs,
docId: {
propDefinition: [
googleDocs,
"docId",
],
},
index: {
type: "integer",
label: "Index",
description: "The index to insert the page break at",
default: 1,
optional: true,
},
tabId: {
propDefinition: [
googleDocs,
"tabId",
(c) => ({
documentId: c.docId,
}),
],
},
},
async run({ $ }) {
const pageBreak = {
location: {
index: this.index,
tabId: this.tabId,
},
};
await this.googleDocs.insertPageBreak(this.docId, pageBreak);
$.export("$summary", "Successfully inserted page break");
return this.googleDocs.getDocument(this.docId, !!this.tabId);
},
};
57 changes: 57 additions & 0 deletions components/google_docs/actions/insert-table/insert-table.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import googleDocs from "../../google_docs.app.mjs";

export default {
key: "google_docs-insert-table",
name: "Insert Table",
description: "Insert a table into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttablerequest)",
version: "0.0.1",
type: "action",
props: {
googleDocs,
docId: {
propDefinition: [
googleDocs,
"docId",
],
},
rows: {
type: "integer",
label: "Rows",
description: "The number of rows in the table",
},
columns: {
type: "integer",
label: "Columns",
description: "The number of columns in the table",
},
index: {
type: "integer",
label: "Index",
description: "The index to insert the table at",
default: 1,
optional: true,
},
tabId: {
propDefinition: [
googleDocs,
"tabId",
(c) => ({
documentId: c.docId,
}),
],
},
},
async run({ $ }) {
const table = {
rows: this.rows,
columns: this.columns,
location: {
index: this.index,
tabId: this.tabId,
},
};
await this.googleDocs.insertTable(this.docId, table);
$.export("$summary", "Successfully inserted table");
return this.googleDocs.getDocument(this.docId, !!this.tabId);
},
};
52 changes: 52 additions & 0 deletions components/google_docs/actions/insert-text/insert-text.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import googleDocs from "../../google_docs.app.mjs";

export default {
key: "google_docs-insert-text",
name: "Insert Text",
description: "Insert text into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttextrequest)",
version: "0.0.1",
type: "action",
props: {
googleDocs,
docId: {
propDefinition: [
googleDocs,
"docId",
],
},
text: {
propDefinition: [
googleDocs,
"text",
],
},
index: {
type: "integer",
label: "Index",
description: "The index to insert the text at",
default: 1,
optional: true,
},
tabId: {
propDefinition: [
googleDocs,
"tabId",
(c) => ({
documentId: c.docId,
}),
],
},
},
async run({ $ }) {
const text = {
text: this.text,
location: {
index: this.index,
tabId: this.tabId,
},
};
await this.googleDocs._batchUpdate(this.docId, "insertText", text);
$.export("$summary", "Successfully inserted text");
return this.googleDocs.getDocument(this.docId, !!this.tabId);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-replace-image",
name: "Replace Image",
description: "Replace image in a existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceImageRequest)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
googleDocs,
Expand Down
20 changes: 19 additions & 1 deletion components/google_docs/actions/replace-text/replace-text.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-replace-text",
name: "Replace Text",
description: "Replace all instances of matched text in an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceAllTextRequest)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
googleDocs,
Expand Down Expand Up @@ -35,6 +35,19 @@ export default {
"matchCase",
],
},
tabIds: {
propDefinition: [
googleDocs,
"tabId",
(c) => ({
documentId: c.docId,
}),
],
type: "string[]",
label: "Tab IDs",
description: "The tab IDs to replace the text in",
optional: true,
},
},
async run({ $ }) {
const text = {
Expand All @@ -43,6 +56,11 @@ export default {
text: this.replaced,
matchCase: this.matchCase,
},
tabsCriteria: this.tabIds
? {
tabIds: this.tabIds,
}
: undefined,
};
await this.googleDocs.replaceText(this.docId, text);
const doc = this.googleDocs.getDocument(this.docId);
Expand Down
25 changes: 25 additions & 0 deletions components/google_docs/google_docs.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ export default {
.filter((image) => image.label);
},
},
tabId: {
type: "string",
label: "Tab ID",
description: "The Tab ID",
optional: true,
async options({ documentId }) {
const { tabs } = await this.getDocument(documentId, true);
return Object.values(tabs).map(({ tabProperties }) => ({
label: tabProperties.title,
value: tabProperties.tabId,
}));
},
},
imageUri: {
type: "string",
label: "Image URL",
Expand Down Expand Up @@ -134,6 +147,18 @@ export default {
async replaceImage(documentId, image) {
return this._batchUpdate(documentId, "replaceImage", image);
},
async insertTable(documentId, table) {
return this._batchUpdate(documentId, "insertTable", table);
},
async insertPageBreak(documentId, request) {
return this._batchUpdate(documentId, "insertPageBreak", request);
},
async createDocument(request) {
const { data } = await this.docs().documents.create({
requestBody: request,
});
return data;
},
async listDocsOptions(driveId, query, pageToken = null) {
let q = "mimeType='application/vnd.google-apps.document'";
if (query) {
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.4",
"version": "0.5.0",
"description": "Pipedream Google_docs Components",
"main": "google_docs.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_docs-new-document-created",
name: "New Document Created (Instant)",
description: "Emit new event when a new document is created in Google Docs. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/changes/watch)",
version: "0.0.4",
version: "0.0.5",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "google_docs-new-or-updated-document",
name: "New or Updated Document (Instant)",
description: "Emit new event when a document is created or updated in Google Docs. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/changes/watch)",
version: "0.0.4",
version: "0.0.5",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Loading
Loading