Skip to content

Commit

Permalink
Merge pull request #4430 from AbdullahBitar/appendtext
Browse files Browse the repository at this point in the history
feat: added append text action to google docs piece.
  • Loading branch information
abuaboud committed Apr 12, 2024
2 parents 97e68de + ebf530a commit 0e3492b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/pieces/community/google-docs/package.json
@@ -1,4 +1,4 @@
{
"name": "@activepieces/piece-google-docs",
"version": "0.1.6"
"version": "0.1.7"
}
4 changes: 3 additions & 1 deletion packages/pieces/community/google-docs/src/index.ts
Expand Up @@ -9,6 +9,7 @@ import { PieceCategory } from '@activepieces/shared';
import { createDocument } from './lib/actions/create-document';
import { createDocumentBasedOnTemplate } from './lib/actions/create-document-based-on-template.action';
import { readDocument } from './lib/actions/read-document.action';
import { appendText } from './lib/actions/append-text';

export const googleDocsAuth = PieceAuth.OAuth2({
authUrl: 'https://accounts.google.com/o/oauth2/auth',
Expand All @@ -24,7 +25,7 @@ export const googleDocs = createPiece({
minimumSupportedRelease: '0.5.0',
logoUrl: 'https://cdn.activepieces.com/pieces/google-docs.png',
categories: [PieceCategory.CONTENT_AND_FILES],
authors: ["pfernandez98","kishanprmr","MoShizzle","khaledmashaly","abuaboud"],
authors: ["pfernandez98","kishanprmr","MoShizzle","khaledmashaly","abuaboud","AbdullahBitar"],
auth: googleDocsAuth,
actions: [
createDocument,
Expand All @@ -37,6 +38,7 @@ export const googleDocs = createPiece({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
appendText,
],
triggers: [],
});
@@ -0,0 +1,29 @@
import { docsCommon } from '../common';
import { googleDocsAuth } from '../..';
import { Property, createAction } from "@activepieces/pieces-framework";

export const appendText = createAction({
auth: googleDocsAuth,
name: 'append_text',
description: 'Appends text to google docs',
displayName: 'Append text to google docs',
props: {
text: Property.LongText({
displayName: 'Text to append',
description: 'The text to append to the document',
required: true,
}),
documentId: Property.ShortText({
displayName: 'Document ID',
description: 'The ID of the document to append text to',
required: true,
})
},
async run(context) {
return await docsCommon.writeToDocument(
context.propsValue.documentId,
context.propsValue.text,
context.auth.access_token
);
},
});
Expand Up @@ -36,7 +36,7 @@ export const docsCommon = {

// Writes provided content to the end of an existing document
writeToDocument: async (
documentId: number,
documentId: string,
body: string,
accessToken: string
) => {
Expand Down

0 comments on commit 0e3492b

Please sign in to comment.