@pipedream/google_slides 0.0.4 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,11 @@
1
1
  # Overview
2
2
 
3
- Using the Google Slides API, you can build applications that do the following:
4
-
5
- - Create new presentations or edit existing ones
6
- - Add or remove slides
7
- - Add or remove slide content
8
- - Change slide layouts
9
- - Format text
10
- - Insert or delete images
11
- - Crop images
12
- - Add or remove comments
13
- - And more!
3
+ The Google Slides API allows you to create, read, and edit Google Slides presentations programmatically. With Pipedream's integration, you can automate your slide workflows, enabling dynamic content updates, collaboration enhancements, and streamlined reporting. By plugging into Pipedream's serverless platform, you can trigger slide creation or updates based on events from other apps, process data for presentations, and handle sharing and publishing tasks—all with minimal fuss.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Automated Data Visualization Updates**: Create a workflow that pulls the latest sales data from a Google Sheets document. With the Google Slides API, you can update charts and tables in your company's weekly report presentation with fresh data, without manual intervention.
8
+
9
+ - **Event-triggered Slideshow Creation**: Set up a trigger that listens for new product launches from your e-commerce platform. Once a launch is detected, use the Google Slides API to generate a product overview presentation, populating it with images, descriptions, and specifications pulled from your CMS.
10
+
11
+ - **Collaboration and Sharing Workflow**: Implement a process where a new slide deck is crafted for each project kick-off. After the slides are created using the Google Slides API, integrate with Gmail or Slack to automatically notify team members, share the presentation, and collect feedback.
@@ -0,0 +1,110 @@
1
+ import app from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-merge-data",
5
+ name: "Merge Data",
6
+ description: "Merge data into a presentation. [See the docs here](https://developers.google.com/slides/api/guides/merge)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ app,
11
+ drive: {
12
+ propDefinition: [
13
+ app,
14
+ "watchedDrive",
15
+ ],
16
+ description: "The drive to select a presentation from. If you are connected with any [Google Shared Drives](https://support.google.com/a/users/answer/9310351), you can select it here.",
17
+ },
18
+ presentationId: {
19
+ propDefinition: [
20
+ app,
21
+ "presentationId",
22
+ (c) => ({
23
+ driveId: app.methods.getDriveId(c.drive),
24
+ }),
25
+ ],
26
+ description: "Select the presentation to make a copy of.",
27
+ },
28
+ title: {
29
+ type: "string",
30
+ label: "Title",
31
+ description: "The title of the new presentation.",
32
+ },
33
+ placeholdersAndTexts: {
34
+ type: "object",
35
+ label: "Placeholders And Texts",
36
+ description: "The placeholders and texts to be merged into the presentation. So the key should be the placeholder ID and the value should be the text to be merged. As a placeholder example you can use `{{name}}` and the value can be `John Doe`.",
37
+ },
38
+ placeholdersAndImageUrls: {
39
+ type: "object",
40
+ label: "Placeholders And Image URLs",
41
+ description: "The placeholders and image URLs to be merged into the presentation. So the key should be the placeholder ID and the value should be the image URL to be merged. As a placeholder example you can use `{{image}}` and the value can be `https://example.com/image.jpg`.",
42
+ optional: true,
43
+ },
44
+ },
45
+ methods: {
46
+ getTextRequests(placeholdersAndTexts = {}) {
47
+ return Object.entries(placeholdersAndTexts)
48
+ .map(([
49
+ key,
50
+ value,
51
+ ]) => ({
52
+ replaceAllText: {
53
+ containsText: {
54
+ text: key,
55
+ matchCase: true,
56
+ },
57
+ replaceText: value,
58
+ },
59
+ }));
60
+ },
61
+ getImageRequests(placeholdersAndImageUrls = {}) {
62
+ return Object.entries(placeholdersAndImageUrls)
63
+ .map(([
64
+ key,
65
+ value,
66
+ ]) => ({
67
+ replaceAllShapesWithImage: {
68
+ imageUrl: value,
69
+ replaceMethod: "CENTER_INSIDE",
70
+ containsText: {
71
+ text: key,
72
+ matchCase: true,
73
+ },
74
+ },
75
+ }));
76
+ },
77
+ batchUpdate(args = {}) {
78
+ const slides = this.app.slides();
79
+ return slides.presentations.batchUpdate(args);
80
+ },
81
+ },
82
+ async run({ $ }) {
83
+ const {
84
+ app,
85
+ batchUpdate,
86
+ presentationId,
87
+ title,
88
+ placeholdersAndTexts,
89
+ placeholdersAndImageUrls,
90
+ getTextRequests,
91
+ getImageRequests,
92
+ } = this;
93
+
94
+ const presentation = await app.copyPresentation(presentationId, title);
95
+
96
+ const { data: response } = await batchUpdate({
97
+ presentationId: presentation.id,
98
+ resource: {
99
+ requests: [
100
+ ...getTextRequests(placeholdersAndTexts),
101
+ ...getImageRequests(placeholdersAndImageUrls),
102
+ ],
103
+ },
104
+ });
105
+
106
+ $.export("$summary", `Successfully merged data into presentation with ID: ${response.presentationId}`);
107
+
108
+ return response;
109
+ },
110
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_slides",
3
- "version": "0.0.4",
3
+ "version": "0.1.1",
4
4
  "description": "Pipedream Google Slides Components",
5
5
  "main": "google_slides.app.mjs",
6
6
  "keywords": [
@@ -6,12 +6,12 @@ export default {
6
6
  type: "source",
7
7
  name: "New Presentation (Instant)",
8
8
  description: "Emit new event each time a new presentation is created in a drive.",
9
- version: "0.0.2",
9
+ version: "0.0.3",
10
10
  hooks: {
11
11
  ...newFilesInstant.hooks,
12
12
  async deploy() {
13
13
  // Emit sample records on the first run
14
- const slides = await this.getPresentations(10);
14
+ const slides = await this.getPresentations(5);
15
15
  for (const fileInfo of slides) {
16
16
  const createdTime = Date.parse(fileInfo.createdTime);
17
17
  this.$emit(fileInfo, {
@@ -22,6 +22,14 @@ export default {
22
22
  }
23
23
  },
24
24
  },
25
+ props: {
26
+ ...newFilesInstant.props,
27
+ folders: {
28
+ ...newFilesInstant.props.folders,
29
+ description:
30
+ "(Optional) The folders you want to watch. Leave blank to watch for any new presentation in the Drive.",
31
+ },
32
+ },
25
33
  methods: {
26
34
  ...newFilesInstant.methods,
27
35
  shouldProcess(file) {