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
97 changes: 97 additions & 0 deletions components/google_slides/actions/create-image/create-image.mjs
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;
},
};
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;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_slides-create-presentation",
name: "Create Presentation",
description: "Create a blank presentation or duplicate an existing presentation. [See the docs here](https://developers.google.com/slides/api/guides/presentations#copy_an_existing_presentation)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
app,
Expand Down
48 changes: 48 additions & 0 deletions components/google_slides/actions/create-slide/create-slide.mjs
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.`);
}
},
};
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,
}),
],
},
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;
},
};
32 changes: 32 additions & 0 deletions components/google_slides/actions/delete-slide/delete-slide.mjs
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;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_slides-find-presentation",
name: "Find a Presentation",
description: "Find a presentation on Google Drive. [See the docs here](https://developers.google.com/slides/api/samples/presentation#list_existing_presentation_files)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
app,
Expand Down
58 changes: 58 additions & 0 deletions components/google_slides/actions/insert-text/insert-text.mjs
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;
},
};
Loading
Loading