-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - google_slides #17812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
components/google_slides/actions/create-image/create-image.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import googleSlides from "../../google_slides.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_slides-create-image", | ||
| name: "Create Image", | ||
| description: "Creates an image in a slide. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#CreateImageRequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleSlides, | ||
| presentationId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "presentationId", | ||
| ], | ||
| }, | ||
| slideId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "slideId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| }), | ||
| ], | ||
| }, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "The URL of the image to insert", | ||
| }, | ||
| height: { | ||
| type: "integer", | ||
| label: "Height", | ||
| description: "The height of the shape in points (1/72 of an inch)", | ||
| }, | ||
| width: { | ||
| type: "integer", | ||
| label: "Width", | ||
| description: "The width of the shape in points (1/72 of an inch)", | ||
| }, | ||
| scaleX: { | ||
| type: "integer", | ||
| label: "Scale X", | ||
| description: "The scale of the shape on the x-axis", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| scaleY: { | ||
| type: "integer", | ||
| label: "Scale Y", | ||
| description: "The scale of the shape on the y-axis", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| translateX: { | ||
| type: "integer", | ||
| label: "Translate X", | ||
| description: "The translation of the shape on the x-axis", | ||
| default: 0, | ||
| optional: true, | ||
| }, | ||
| translateY: { | ||
| type: "integer", | ||
| label: "Translate Y", | ||
| description: "The translation of the shape on the y-axis", | ||
| default: 0, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.googleSlides.createImage(this.presentationId, { | ||
| url: this.url, | ||
| elementProperties: { | ||
| pageObjectId: this.slideId, | ||
| size: { | ||
| height: { | ||
| magnitude: this.height, | ||
| unit: "PT", | ||
| }, | ||
| width: { | ||
| magnitude: this.width, | ||
| unit: "PT", | ||
| }, | ||
| }, | ||
| transform: { | ||
| scaleX: this.scaleX, | ||
| scaleY: this.scaleY, | ||
| translateX: this.translateX, | ||
| translateY: this.translateY, | ||
| unit: "PT", | ||
| }, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created image with ID: ${response.data.replies[0].createImage.objectId}`); | ||
| return response.data; | ||
| }, | ||
| }; |
99 changes: 99 additions & 0 deletions
99
components/google_slides/actions/create-page-element/create-page-element.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import googleSlides from "../../google_slides.app.mjs"; | ||
| import { SHAPE_TYPES } from "../../common/constants.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_slides-create-page-element", | ||
| name: "Create Page Element", | ||
| description: "Create a new page element in a slide. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#CreateShapeRequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleSlides, | ||
| presentationId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "presentationId", | ||
| ], | ||
| }, | ||
| slideId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "slideId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| }), | ||
| ], | ||
| }, | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The type of the shape", | ||
| options: SHAPE_TYPES, | ||
| }, | ||
| height: { | ||
| type: "integer", | ||
| label: "Height", | ||
| description: "The height of the shape in points (1/72 of an inch)", | ||
| }, | ||
| width: { | ||
| type: "integer", | ||
| label: "Width", | ||
| description: "The width of the shape in points (1/72 of an inch)", | ||
| }, | ||
| scaleX: { | ||
| type: "integer", | ||
| label: "Scale X", | ||
| description: "The scale of the shape on the x-axis", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| scaleY: { | ||
| type: "integer", | ||
| label: "Scale Y", | ||
| description: "The scale of the shape on the y-axis", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| translateX: { | ||
| type: "integer", | ||
| label: "Translate X", | ||
| description: "The translation of the shape on the x-axis", | ||
| default: 0, | ||
| optional: true, | ||
| }, | ||
| translateY: { | ||
| type: "integer", | ||
| label: "Translate Y", | ||
| description: "The translation of the shape on the y-axis", | ||
| default: 0, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.googleSlides.createShape(this.presentationId, { | ||
| shapeType: this.type, | ||
| elementProperties: { | ||
| pageObjectId: this.slideId, | ||
| size: { | ||
| height: { | ||
| magnitude: this.height, | ||
| unit: "PT", | ||
| }, | ||
| width: { | ||
| magnitude: this.width, | ||
| unit: "PT", | ||
| }, | ||
| }, | ||
| transform: { | ||
| scaleX: this.scaleX, | ||
| scaleY: this.scaleY, | ||
| translateX: this.translateX, | ||
| translateY: this.translateY, | ||
| unit: "PT", | ||
| }, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created shape with ID: ${response.data.replies[0].createShape.objectId}`); | ||
| return response.data; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
components/google_slides/actions/create-slide/create-slide.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import googleSlides from "../../google_slides.app.mjs"; | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| key: "google_slides-create-slide", | ||
| name: "Create Slide", | ||
| description: "Create a new slide in a presentation. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#CreateSlideRequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleSlides, | ||
| presentationId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "presentationId", | ||
| ], | ||
| }, | ||
| layoutId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "layoutId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| }), | ||
| ], | ||
| }, | ||
| insertionIndex: { | ||
| type: "integer", | ||
| label: "Insertion Index", | ||
| description: "The optional zero-based index indicating where to insert the slides. If you don't specify an index, the slide is created at the end.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.googleSlides.createSlide(this.presentationId, { | ||
| insertionIndex: this.insertionIndex, | ||
| slideLayoutReference: { | ||
| layoutId: this.layoutId, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created slide with ID: ${response.data.replies[0].createSlide.objectId}`); | ||
| return response.data; | ||
| } catch (error) { | ||
| throw new ConfigurationError(`Failed to create slide: ${error.message}. Make sure you have permission to edit the presentation.`); | ||
| } | ||
| }, | ||
| }; |
42 changes: 42 additions & 0 deletions
42
components/google_slides/actions/delete-page-element/delete-page-element.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import googleSlides from "../../google_slides.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_slides-delete-page-element", | ||
| name: "Delete Page Element", | ||
| description: "Deletes a page element from a slide. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#DeleteObjectRequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleSlides, | ||
| presentationId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "presentationId", | ||
| ], | ||
| }, | ||
| slideId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "slideId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| }), | ||
| ], | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pageElementId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "shapeId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| slideId: c.slideId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.googleSlides.deleteObject(this.presentationId, this.pageElementId); | ||
| $.export("$summary", `Successfully deleted page element with ID: ${this.pageElementId}`); | ||
| return response.data; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
32 changes: 32 additions & 0 deletions
32
components/google_slides/actions/delete-slide/delete-slide.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import googleSlides from "../../google_slides.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_slides-delete-slide", | ||
| name: "Delete Slide", | ||
| description: "Deletes a slide from a presentation. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#DeleteObjectRequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleSlides, | ||
| presentationId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "presentationId", | ||
| ], | ||
| }, | ||
| slideId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "slideId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.googleSlides.deleteObject(this.presentationId, this.slideId); | ||
| $.export("$summary", `Successfully deleted slide with ID: ${this.slideId}`); | ||
| return response.data; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
components/google_slides/actions/insert-text/insert-text.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import googleSlides from "../../google_slides.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_slides-insert-text", | ||
| name: "Insert Text", | ||
| description: "Insert text into a shape. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#InsertTextRequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleSlides, | ||
| presentationId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "presentationId", | ||
| ], | ||
| }, | ||
| slideId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "slideId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| }), | ||
| ], | ||
| }, | ||
| shapeId: { | ||
| propDefinition: [ | ||
| googleSlides, | ||
| "shapeId", | ||
| (c) => ({ | ||
| presentationId: c.presentationId, | ||
| slideId: c.slideId, | ||
| textOnly: true, | ||
| }), | ||
| ], | ||
| }, | ||
| text: { | ||
| type: "string", | ||
| label: "Text", | ||
| description: "The text to insert", | ||
| }, | ||
| insertionIndex: { | ||
| type: "integer", | ||
| label: "Insertion Index", | ||
| description: "The index where the text will be inserted", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.googleSlides.insertText(this.presentationId, { | ||
| objectId: this.shapeId, | ||
| text: this.text, | ||
| insertionIndex: this.insertionIndex, | ||
| }); | ||
| $.export("$summary", `Successfully inserted text into shape with ID: ${this.shapeId}`); | ||
| return response.data; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.