@pipedream/google_slides 0.1.2 → 0.3.0

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.
@@ -0,0 +1,97 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-create-image",
5
+ name: "Create Image",
6
+ description: "Creates an image in a slide. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#CreateImageRequest)",
7
+ version: "0.0.2",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ url: {
27
+ type: "string",
28
+ label: "URL",
29
+ description: "The URL of the image to insert",
30
+ },
31
+ height: {
32
+ type: "integer",
33
+ label: "Height",
34
+ description: "The height of the shape in points (1/72 of an inch)",
35
+ },
36
+ width: {
37
+ type: "integer",
38
+ label: "Width",
39
+ description: "The width of the shape in points (1/72 of an inch)",
40
+ },
41
+ scaleX: {
42
+ type: "integer",
43
+ label: "Scale X",
44
+ description: "The scale of the shape on the x-axis",
45
+ default: 1,
46
+ optional: true,
47
+ },
48
+ scaleY: {
49
+ type: "integer",
50
+ label: "Scale Y",
51
+ description: "The scale of the shape on the y-axis",
52
+ default: 1,
53
+ optional: true,
54
+ },
55
+ translateX: {
56
+ type: "integer",
57
+ label: "Translate X",
58
+ description: "The translation of the shape on the x-axis",
59
+ default: 0,
60
+ optional: true,
61
+ },
62
+ translateY: {
63
+ type: "integer",
64
+ label: "Translate Y",
65
+ description: "The translation of the shape on the y-axis",
66
+ default: 0,
67
+ optional: true,
68
+ },
69
+ },
70
+ async run({ $ }) {
71
+ const response = await this.googleSlides.createImage(this.presentationId, {
72
+ url: this.url,
73
+ elementProperties: {
74
+ pageObjectId: this.slideId,
75
+ size: {
76
+ height: {
77
+ magnitude: this.height,
78
+ unit: "PT",
79
+ },
80
+ width: {
81
+ magnitude: this.width,
82
+ unit: "PT",
83
+ },
84
+ },
85
+ transform: {
86
+ scaleX: this.scaleX,
87
+ scaleY: this.scaleY,
88
+ translateX: this.translateX,
89
+ translateY: this.translateY,
90
+ unit: "PT",
91
+ },
92
+ },
93
+ });
94
+ $.export("$summary", `Successfully created image with ID: ${response.data.replies[0].createImage.objectId}`);
95
+ return response.data;
96
+ },
97
+ };
@@ -0,0 +1,99 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+ import { SHAPE_TYPES } from "../../common/constants.mjs";
3
+
4
+ export default {
5
+ key: "google_slides-create-page-element",
6
+ name: "Create Page Element",
7
+ 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)",
8
+ version: "0.0.2",
9
+ type: "action",
10
+ props: {
11
+ googleSlides,
12
+ presentationId: {
13
+ propDefinition: [
14
+ googleSlides,
15
+ "presentationId",
16
+ ],
17
+ },
18
+ slideId: {
19
+ propDefinition: [
20
+ googleSlides,
21
+ "slideId",
22
+ (c) => ({
23
+ presentationId: c.presentationId,
24
+ }),
25
+ ],
26
+ },
27
+ type: {
28
+ type: "string",
29
+ label: "Type",
30
+ description: "The type of the shape",
31
+ options: SHAPE_TYPES,
32
+ },
33
+ height: {
34
+ type: "integer",
35
+ label: "Height",
36
+ description: "The height of the shape in points (1/72 of an inch)",
37
+ },
38
+ width: {
39
+ type: "integer",
40
+ label: "Width",
41
+ description: "The width of the shape in points (1/72 of an inch)",
42
+ },
43
+ scaleX: {
44
+ type: "integer",
45
+ label: "Scale X",
46
+ description: "The scale of the shape on the x-axis",
47
+ default: 1,
48
+ optional: true,
49
+ },
50
+ scaleY: {
51
+ type: "integer",
52
+ label: "Scale Y",
53
+ description: "The scale of the shape on the y-axis",
54
+ default: 1,
55
+ optional: true,
56
+ },
57
+ translateX: {
58
+ type: "integer",
59
+ label: "Translate X",
60
+ description: "The translation of the shape on the x-axis",
61
+ default: 0,
62
+ optional: true,
63
+ },
64
+ translateY: {
65
+ type: "integer",
66
+ label: "Translate Y",
67
+ description: "The translation of the shape on the y-axis",
68
+ default: 0,
69
+ optional: true,
70
+ },
71
+ },
72
+ async run({ $ }) {
73
+ const response = await this.googleSlides.createShape(this.presentationId, {
74
+ shapeType: this.type,
75
+ elementProperties: {
76
+ pageObjectId: this.slideId,
77
+ size: {
78
+ height: {
79
+ magnitude: this.height,
80
+ unit: "PT",
81
+ },
82
+ width: {
83
+ magnitude: this.width,
84
+ unit: "PT",
85
+ },
86
+ },
87
+ transform: {
88
+ scaleX: this.scaleX,
89
+ scaleY: this.scaleY,
90
+ translateX: this.translateX,
91
+ translateY: this.translateY,
92
+ unit: "PT",
93
+ },
94
+ },
95
+ });
96
+ $.export("$summary", `Successfully created shape with ID: ${response.data.replies[0].createShape.objectId}`);
97
+ return response.data;
98
+ },
99
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_slides-create-presentation",
5
5
  name: "Create Presentation",
6
6
  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)",
7
- version: "0.0.3",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -0,0 +1,48 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+ import { ConfigurationError } from "@pipedream/platform";
3
+
4
+ export default {
5
+ key: "google_slides-create-slide",
6
+ name: "Create Slide",
7
+ description: "Create a new slide in a presentation. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#CreateSlideRequest)",
8
+ version: "0.0.2",
9
+ type: "action",
10
+ props: {
11
+ googleSlides,
12
+ presentationId: {
13
+ propDefinition: [
14
+ googleSlides,
15
+ "presentationId",
16
+ ],
17
+ },
18
+ layoutId: {
19
+ propDefinition: [
20
+ googleSlides,
21
+ "layoutId",
22
+ (c) => ({
23
+ presentationId: c.presentationId,
24
+ }),
25
+ ],
26
+ },
27
+ insertionIndex: {
28
+ type: "integer",
29
+ label: "Insertion Index",
30
+ 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.",
31
+ optional: true,
32
+ },
33
+ },
34
+ async run({ $ }) {
35
+ try {
36
+ const response = await this.googleSlides.createSlide(this.presentationId, {
37
+ insertionIndex: this.insertionIndex,
38
+ slideLayoutReference: {
39
+ layoutId: this.layoutId,
40
+ },
41
+ });
42
+ $.export("$summary", `Successfully created slide with ID: ${response.data.replies[0].createSlide.objectId}`);
43
+ return response.data;
44
+ } catch (error) {
45
+ throw new ConfigurationError(`Failed to create slide: ${error.message}. Make sure you have permission to edit the presentation.`);
46
+ }
47
+ },
48
+ };
@@ -0,0 +1,88 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-create-table",
5
+ name: "Create Table",
6
+ description: "Create a new table in a slide. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#CreateTableRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ rows: {
27
+ type: "integer",
28
+ label: "Rows",
29
+ description: "The number of rows in the table",
30
+ },
31
+ columns: {
32
+ type: "integer",
33
+ label: "Columns",
34
+ description: "The number of columns in the table",
35
+ },
36
+ height: {
37
+ type: "integer",
38
+ label: "Height",
39
+ description: "The height of the shape in points (1/72 of an inch)",
40
+ },
41
+ width: {
42
+ type: "integer",
43
+ label: "Width",
44
+ description: "The width of the shape in points (1/72 of an inch)",
45
+ },
46
+ translateX: {
47
+ type: "integer",
48
+ label: "Translate X",
49
+ description: "The translation of the table on the x-axis",
50
+ optional: true,
51
+ },
52
+ translateY: {
53
+ type: "integer",
54
+ label: "Translate Y",
55
+ description: "The translation of the table on the y-axis",
56
+ optional: true,
57
+ },
58
+ },
59
+ async run({ $ }) {
60
+ const response = await this.googleSlides.createTable(this.presentationId, {
61
+ elementProperties: {
62
+ pageObjectId: this.slideId,
63
+ size: {
64
+ height: {
65
+ magnitude: this.height,
66
+ unit: "PT",
67
+ },
68
+ width: {
69
+ magnitude: this.width,
70
+ unit: "PT",
71
+ },
72
+ },
73
+ transform: {
74
+ scaleX: 1,
75
+ scaleY: 1,
76
+ translateX: this.translateX,
77
+ translateY: this.translateY,
78
+ unit: "PT",
79
+ },
80
+ },
81
+ rows: this.rows,
82
+ columns: this.columns,
83
+ });
84
+
85
+ $.export("$summary", "Successfully created table in the slide");
86
+ return response.data;
87
+ },
88
+ };
@@ -0,0 +1,42 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-delete-page-element",
5
+ name: "Delete Page Element",
6
+ description: "Deletes a page element from a slide. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#DeleteObjectRequest)",
7
+ version: "0.0.2",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ pageElementId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "shapeId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ }),
34
+ ],
35
+ },
36
+ },
37
+ async run({ $ }) {
38
+ const response = await this.googleSlides.deleteObject(this.presentationId, this.pageElementId);
39
+ $.export("$summary", `Successfully deleted page element with ID: ${this.pageElementId}`);
40
+ return response.data;
41
+ },
42
+ };
@@ -0,0 +1,32 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-delete-slide",
5
+ name: "Delete Slide",
6
+ description: "Deletes a slide from a presentation. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#DeleteObjectRequest)",
7
+ version: "0.0.2",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ },
27
+ async run({ $ }) {
28
+ const response = await this.googleSlides.deleteObject(this.presentationId, this.slideId);
29
+ $.export("$summary", `Successfully deleted slide with ID: ${this.slideId}`);
30
+ return response.data;
31
+ },
32
+ };
@@ -0,0 +1,52 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-delete-table-column",
5
+ name: "Delete Table Column",
6
+ description: "Delete column from a table. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#DeleteTableColumnRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ tableId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "tableId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ }),
34
+ ],
35
+ },
36
+ columnIndex: {
37
+ type: "integer",
38
+ label: "Column Index",
39
+ description: "The index of the column to delete",
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ const response = await this.googleSlides.deleteTableColumn(this.presentationId, {
44
+ tableObjectId: this.tableId,
45
+ cellLocation: {
46
+ columnIndex: this.columnIndex,
47
+ },
48
+ });
49
+ $.export("$summary", "Successfully deleted table column");
50
+ return response.data;
51
+ },
52
+ };
@@ -0,0 +1,52 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-delete-table-row",
5
+ name: "Delete Table Row",
6
+ description: "Delete row from a table. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#DeleteTableRowRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ tableId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "tableId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ }),
34
+ ],
35
+ },
36
+ rowIndex: {
37
+ type: "integer",
38
+ label: "Row Index",
39
+ description: "The index of the row to delete",
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ const response = await this.googleSlides.deleteTableRow(this.presentationId, {
44
+ tableObjectId: this.tableId,
45
+ cellLocation: {
46
+ rowIndex: this.rowIndex,
47
+ },
48
+ });
49
+ $.export("$summary", "Successfully deleted table row");
50
+ return response.data;
51
+ },
52
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_slides-find-presentation",
5
5
  name: "Find a Presentation",
6
6
  description: "Find a presentation on Google Drive. [See the docs here](https://developers.google.com/slides/api/samples/presentation#list_existing_presentation_files)",
7
- version: "0.0.3",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -0,0 +1,68 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-insert-table-columns",
5
+ name: "Insert Table Columns",
6
+ description: "Insert new columns into a table. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#InsertTableColumnsRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ tableId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "tableId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ }),
34
+ ],
35
+ },
36
+ columnIndex: {
37
+ type: "integer",
38
+ label: "Column Index",
39
+ description: "The column index of an existing cell used as the insertion reference point",
40
+ optional: true,
41
+ },
42
+ insertRight: {
43
+ type: "boolean",
44
+ label: "Insert Right",
45
+ description: "Whether to insert the column to the right of the specified cell location",
46
+ optional: true,
47
+ },
48
+ number: {
49
+ type: "integer",
50
+ label: "Number",
51
+ description: "The number of columns to be inserted. Maximum 20 per request.",
52
+ default: 1,
53
+ optional: true,
54
+ },
55
+ },
56
+ async run({ $ }) {
57
+ const response = await this.googleSlides.insertTableColumns(this.presentationId, {
58
+ tableObjectId: this.tableId,
59
+ cellLocation: {
60
+ columnIndex: this.columnIndex,
61
+ },
62
+ insertRight: this.insertRight,
63
+ number: this.number,
64
+ });
65
+ $.export("$summary", "Successfully inserted table column");
66
+ return response.data;
67
+ },
68
+ };
@@ -0,0 +1,68 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-insert-table-rows",
5
+ name: "Insert Table Rows",
6
+ description: "Insert new rows into a table. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#InsertTableRowsRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ tableId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "tableId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ }),
34
+ ],
35
+ },
36
+ rowIndex: {
37
+ type: "integer",
38
+ label: "Row Index",
39
+ description: "The row index of an existing cell used as the insertion reference point",
40
+ optional: true,
41
+ },
42
+ insertBelow: {
43
+ type: "boolean",
44
+ label: "Insert Below",
45
+ description: "Whether to insert the row below the specified cell location",
46
+ optional: true,
47
+ },
48
+ number: {
49
+ type: "integer",
50
+ label: "Number",
51
+ description: "The number of rows to be inserted. Maximum 20 per request.",
52
+ default: 1,
53
+ optional: true,
54
+ },
55
+ },
56
+ async run({ $ }) {
57
+ const response = await this.googleSlides.insertTableRows(this.presentationId, {
58
+ tableObjectId: this.tableId,
59
+ cellLocation: {
60
+ rowIndex: this.rowIndex,
61
+ },
62
+ insertBelow: this.insertBelow,
63
+ number: this.number,
64
+ });
65
+ $.export("$summary", "Successfully inserted table row");
66
+ return response.data;
67
+ },
68
+ };
@@ -0,0 +1,58 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-insert-text",
5
+ name: "Insert Text",
6
+ description: "Insert text into a shape. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#InsertTextRequest)",
7
+ version: "0.0.2",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ shapeId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "shapeId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ textOnly: true,
34
+ }),
35
+ ],
36
+ },
37
+ text: {
38
+ type: "string",
39
+ label: "Text",
40
+ description: "The text to insert",
41
+ },
42
+ insertionIndex: {
43
+ type: "integer",
44
+ label: "Insertion Index",
45
+ description: "The index where the text will be inserted",
46
+ optional: true,
47
+ },
48
+ },
49
+ async run({ $ }) {
50
+ const response = await this.googleSlides.insertText(this.presentationId, {
51
+ objectId: this.shapeId,
52
+ text: this.text,
53
+ insertionIndex: this.insertionIndex,
54
+ });
55
+ $.export("$summary", `Successfully inserted text into shape with ID: ${this.shapeId}`);
56
+ return response.data;
57
+ },
58
+ };
@@ -0,0 +1,73 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-insert-text-into-table",
5
+ name: "Insert Text into Table",
6
+ description: "Insert text into a table cell. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#InsertTextRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ slideId: {
18
+ propDefinition: [
19
+ googleSlides,
20
+ "slideId",
21
+ (c) => ({
22
+ presentationId: c.presentationId,
23
+ }),
24
+ ],
25
+ },
26
+ tableId: {
27
+ propDefinition: [
28
+ googleSlides,
29
+ "tableId",
30
+ (c) => ({
31
+ presentationId: c.presentationId,
32
+ slideId: c.slideId,
33
+ }),
34
+ ],
35
+ },
36
+ rowIndex: {
37
+ type: "integer",
38
+ label: "Row Index",
39
+ description: "The 0-based table row index of the target cell",
40
+ optional: true,
41
+ },
42
+ columnIndex: {
43
+ type: "integer",
44
+ label: "Column Index",
45
+ description: "The 0-based table column index of the target cell",
46
+ optional: true,
47
+ },
48
+ text: {
49
+ type: "string",
50
+ label: "Text",
51
+ description: "The text to insert",
52
+ },
53
+ insertionIndex: {
54
+ type: "integer",
55
+ label: "Insertion Index",
56
+ description: "The index where the text will be inserted",
57
+ optional: true,
58
+ },
59
+ },
60
+ async run({ $ }) {
61
+ const response = await this.googleSlides.insertText(this.presentationId, {
62
+ objectId: this.tableId,
63
+ cellLocation: {
64
+ rowIndex: this.rowIndex,
65
+ columnIndex: this.columnIndex,
66
+ },
67
+ text: this.text,
68
+ insertionIndex: this.insertionIndex,
69
+ });
70
+ $.export("$summary", "Successfully inserted text into table cell");
71
+ return response.data;
72
+ },
73
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_slides-merge-data",
5
5
  name: "Merge Data",
6
6
  description: "Merge data into a presentation. [See the docs here](https://developers.google.com/slides/api/guides/merge)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_slides-refresh-chart",
5
5
  name: "Refresh a chart",
6
6
  description: "Refresh a chart from Sheets. [See the docs here](https://developers.google.com/slides/api/samples/elements#refresh_a_chart_from_sheets)",
7
- version: "0.0.3",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -0,0 +1,59 @@
1
+ import googleSlides from "../../google_slides.app.mjs";
2
+
3
+ export default {
4
+ key: "google_slides-replace-all-text",
5
+ name: "Replace All Text",
6
+ description: "Replace all text in a presentation. [See the documentation](https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request#ReplaceAllTextRequest)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleSlides,
11
+ presentationId: {
12
+ propDefinition: [
13
+ googleSlides,
14
+ "presentationId",
15
+ ],
16
+ },
17
+ text: {
18
+ type: "string",
19
+ label: "Text",
20
+ description: "The text to replace",
21
+ },
22
+ replaceText: {
23
+ type: "string",
24
+ label: "Replace Text",
25
+ description: "The text that will replace the matched text",
26
+ },
27
+ slideIds: {
28
+ propDefinition: [
29
+ googleSlides,
30
+ "slideId",
31
+ (c) => ({
32
+ presentationId: c.presentationId,
33
+ }),
34
+ ],
35
+ type: "string[]",
36
+ label: "Slide IDs",
37
+ description: "Limits the matches to page elements only on the given pages",
38
+ optional: true,
39
+ },
40
+ matchCase: {
41
+ type: "boolean",
42
+ label: "Match Case",
43
+ description: "Whether to match case",
44
+ optional: true,
45
+ },
46
+ },
47
+ async run({ $ }) {
48
+ const response = await this.googleSlides.replaceAllText(this.presentationId, {
49
+ replaceText: this.replaceText,
50
+ pageObjectIds: this.slideIds,
51
+ containsText: {
52
+ text: this.text,
53
+ matchCase: this.matchCase,
54
+ },
55
+ });
56
+ $.export("$summary", "Successfully replaced text in the presentation");
57
+ return response.data;
58
+ },
59
+ };
@@ -0,0 +1,143 @@
1
+ export const SHAPE_TYPES = [
2
+ "TEXT_BOX",
3
+ "RECTANGLE",
4
+ "ROUND_RECTANGLE",
5
+ "ELLIPSE",
6
+ "ARC",
7
+ "BENT_ARROW",
8
+ "BENT_UP_ARROW",
9
+ "BEVEL",
10
+ "BLOCK_ARC",
11
+ "BRACE_PAIR",
12
+ "BRACKET_PAIR",
13
+ "CAN",
14
+ "CHEVRON",
15
+ "CHORD",
16
+ "CLOUD",
17
+ "CORNER",
18
+ "CUBE",
19
+ "CURVED_DOWN_ARROW",
20
+ "CURVED_LEFT_ARROW",
21
+ "CURVED_RIGHT_ARROW",
22
+ "CURVED_UP_ARROW",
23
+ "DECAGON",
24
+ "DIAGONAL_STRIPE",
25
+ "DIAMOND",
26
+ "DODECAGON",
27
+ "DONUT",
28
+ "DOUBLE_WAVE",
29
+ "DOWN_ARROW",
30
+ "DOWN_ARROW_CALLOUT",
31
+ "FOLDED_CORNER",
32
+ "FRAME",
33
+ "HALF_FRAME",
34
+ "HEART",
35
+ "HEPTAGON",
36
+ "HEXAGON",
37
+ "HOME_PLATE",
38
+ "HORIZONTAL_SCROLL",
39
+ "IRREGULAR_SEAL_1",
40
+ "IRREGULAR_SEAL_2",
41
+ "LEFT_ARROW",
42
+ "LEFT_ARROW_CALLOUT",
43
+ "LEFT_BRACE",
44
+ "LEFT_BRACKET",
45
+ "LEFT_RIGHT_ARROW",
46
+ "LEFT_RIGHT_ARROW_CALLOUT",
47
+ "LEFT_RIGHT_UP_ARROW",
48
+ "LEFT_UP_ARROW",
49
+ "LIGHTNING_BOLT",
50
+ "MATH_DIVIDE",
51
+ "MATH_EQUAL",
52
+ "MATH_MINUS",
53
+ "MATH_MULTIPLY",
54
+ "MATH_NOT_EQUAL",
55
+ "MATH_PLUS",
56
+ "MOON",
57
+ "NO_SMOKING",
58
+ "NOTCHED_RIGHT_ARROW",
59
+ "OCTAGON",
60
+ "PARALLELOGRAM",
61
+ "PENTAGON",
62
+ "PIE",
63
+ "PLAQUE",
64
+ "PLUS",
65
+ "QUAD_ARROW",
66
+ "QUAD_ARROW_CALLOUT",
67
+ "RIBBON",
68
+ "RIBBON_2",
69
+ "RIGHT_ARROW",
70
+ "RIGHT_ARROW_CALLOUT",
71
+ "RIGHT_BRACE",
72
+ "RIGHT_BRACKET",
73
+ "ROUND_1_RECTANGLE",
74
+ "ROUND_2_DIAGONAL_RECTANGLE",
75
+ "ROUND_2_SAME_RECTANGLE",
76
+ "RIGHT_TRIANGLE",
77
+ "SMILEY_FACE",
78
+ "SNIP_1_RECTANGLE",
79
+ "SNIP_2_DIAGONAL_RECTANGLE",
80
+ "SNIP_2_SAME_RECTANGLE",
81
+ "SNIP_ROUND_RECTANGLE",
82
+ "STAR_10",
83
+ "STAR_12",
84
+ "STAR_16",
85
+ "STAR_24",
86
+ "STAR_32",
87
+ "STAR_4",
88
+ "STAR_5",
89
+ "STAR_6",
90
+ "STAR_7",
91
+ "STAR_8",
92
+ "STRIPED_RIGHT_ARROW",
93
+ "SUN",
94
+ "TRAPEZOID",
95
+ "TRIANGLE",
96
+ "UP_ARROW",
97
+ "UP_ARROW_CALLOUT",
98
+ "UP_DOWN_ARROW",
99
+ "UTURN_ARROW",
100
+ "VERTICAL_SCROLL",
101
+ "WAVE",
102
+ "WEDGE_ELLIPSE_CALLOUT",
103
+ "WEDGE_RECTANGLE_CALLOUT",
104
+ "WEDGE_ROUND_RECTANGLE_CALLOUT",
105
+ "FLOW_CHART_ALTERNATE_PROCESS",
106
+ "FLOW_CHART_COLLATE",
107
+ "FLOW_CHART_CONNECTOR",
108
+ "FLOW_CHART_DECISION",
109
+ "FLOW_CHART_DELAY",
110
+ "FLOW_CHART_DISPLAY",
111
+ "FLOW_CHART_DOCUMENT",
112
+ "FLOW_CHART_EXTRACT",
113
+ "FLOW_CHART_INPUT_OUTPUT",
114
+ "FLOW_CHART_INTERNAL_STORAGE",
115
+ "FLOW_CHART_MAGNETIC_DISK",
116
+ "FLOW_CHART_MAGNETIC_DRUM",
117
+ "FLOW_CHART_MAGNETIC_TAPE",
118
+ "FLOW_CHART_MANUAL_INPUT",
119
+ "FLOW_CHART_MANUAL_OPERATION",
120
+ "FLOW_CHART_MERGE",
121
+ "FLOW_CHART_MULTIDOCUMENT",
122
+ "FLOW_CHART_OFFLINE_STORAGE",
123
+ "FLOW_CHART_OFFPAGE_CONNECTOR",
124
+ "FLOW_CHART_ONLINE_STORAGE",
125
+ "FLOW_CHART_OR",
126
+ "FLOW_CHART_PREDEFINED_PROCESS",
127
+ "FLOW_CHART_PREPARATION",
128
+ "FLOW_CHART_PROCESS",
129
+ "FLOW_CHART_PUNCHED_CARD",
130
+ "FLOW_CHART_PUNCHED_TAPE",
131
+ "FLOW_CHART_SORT",
132
+ "FLOW_CHART_SUMMING_JUNCTION",
133
+ "FLOW_CHART_TERMINATOR",
134
+ "ARROW_EAST",
135
+ "ARROW_NORTH_EAST",
136
+ "ARROW_NORTH",
137
+ "SPEECH",
138
+ "STARBURST",
139
+ "TEARDROP",
140
+ "ELLIPSE_RIBBON",
141
+ "ELLIPSE_RIBBON_2",
142
+ "CLOUD_CALLOUT",
143
+ ];
@@ -19,6 +19,64 @@ export default {
19
19
  return this.listPresentationsOptions(driveId, nextPageToken);
20
20
  },
21
21
  },
22
+ layoutId: {
23
+ type: "string",
24
+ label: "Layout ID",
25
+ description: "The ID of a slide layout",
26
+ optional: true,
27
+ async options({ presentationId }) {
28
+ const { layouts } = await this.getPresentation(presentationId);
29
+ return layouts.map((layout) => ({
30
+ label: layout.layoutProperties.name,
31
+ value: layout.objectId,
32
+ }));
33
+ },
34
+ },
35
+ slideId: {
36
+ type: "string",
37
+ label: "Slide ID",
38
+ description: "The ID of a slide",
39
+ async options({ presentationId }) {
40
+ const { slides } = await this.getPresentation(presentationId);
41
+ return slides.map((slide) => ({
42
+ label: slide.slideProperties.layoutObjectId,
43
+ value: slide.objectId,
44
+ }));
45
+ },
46
+ },
47
+ shapeId: {
48
+ type: "string",
49
+ label: "Shape ID",
50
+ description: "The ID of a shape",
51
+ async options({
52
+ presentationId, slideId, textOnly = false,
53
+ }) {
54
+ const { pageElements } = await this.getSlide(presentationId, slideId);
55
+ let shapes = pageElements;
56
+ if (textOnly) {
57
+ shapes = shapes.filter((element) => element?.shape?.shapeType === "TEXT_BOX");
58
+ }
59
+ return shapes.map((element) => ({
60
+ label: element.shape?.placeholder?.type || element?.shape?.shapeType || element.objectId,
61
+ value: element.objectId,
62
+ }));
63
+ },
64
+ },
65
+ tableId: {
66
+ type: "string",
67
+ label: "Table ID",
68
+ description: "The ID of a table",
69
+ async options({
70
+ presentationId, slideId,
71
+ }) {
72
+ const { pageElements } = await this.getSlide(presentationId, slideId);
73
+ let tables = pageElements.filter((element) => element?.table);
74
+ return tables.map((element) => ({
75
+ label: `${element.table.rows} x ${element.table.columns} Table`,
76
+ value: element.objectId,
77
+ }));
78
+ },
79
+ },
22
80
  },
23
81
  methods: {
24
82
  ...googleDrive.methods,
@@ -32,8 +90,16 @@ export default {
32
90
  auth,
33
91
  });
34
92
  },
35
- refreshChart(presentationId, chartId) {
93
+ batchUpdate(presentationId, requests) {
36
94
  const slides = this.slides();
95
+ return slides.presentations.batchUpdate({
96
+ presentationId,
97
+ requestBody: {
98
+ requests,
99
+ },
100
+ });
101
+ },
102
+ refreshChart(presentationId, chartId) {
37
103
  const requests = [
38
104
  {
39
105
  refreshSheetsChart: {
@@ -41,12 +107,117 @@ export default {
41
107
  },
42
108
  },
43
109
  ];
44
- return slides.presentations.batchUpdate({
45
- presentationId,
46
- requestBody: {
47
- requests,
110
+ return this.batchUpdate(presentationId, requests);
111
+ },
112
+ createSlide(presentationId, data) {
113
+ const requests = [
114
+ {
115
+ createSlide: {
116
+ ...data,
117
+ },
48
118
  },
49
- });
119
+ ];
120
+ return this.batchUpdate(presentationId, requests);
121
+ },
122
+ createShape(presentationId, data) {
123
+ const requests = [
124
+ {
125
+ createShape: {
126
+ ...data,
127
+ },
128
+ },
129
+ ];
130
+ return this.batchUpdate(presentationId, requests);
131
+ },
132
+ insertText(presentationId, data) {
133
+ const requests = [
134
+ {
135
+ insertText: {
136
+ ...data,
137
+ },
138
+ },
139
+ ];
140
+ return this.batchUpdate(presentationId, requests);
141
+ },
142
+ replaceAllText(presentationId, data) {
143
+ const requests = [
144
+ {
145
+ replaceAllText: {
146
+ ...data,
147
+ },
148
+ },
149
+ ];
150
+ return this.batchUpdate(presentationId, requests);
151
+ },
152
+ createTable(presentationId, data) {
153
+ const requests = [
154
+ {
155
+ createTable: {
156
+ ...data,
157
+ },
158
+ },
159
+ ];
160
+ return this.batchUpdate(presentationId, requests);
161
+ },
162
+ insertTableRows(presentationId, data) {
163
+ const requests = [
164
+ {
165
+ insertTableRows: {
166
+ ...data,
167
+ },
168
+ },
169
+ ];
170
+ return this.batchUpdate(presentationId, requests);
171
+ },
172
+ insertTableColumns(presentationId, data) {
173
+ const requests = [
174
+ {
175
+ insertTableColumns: {
176
+ ...data,
177
+ },
178
+ },
179
+ ];
180
+ return this.batchUpdate(presentationId, requests);
181
+ },
182
+ deleteTableRow(presentationId, data) {
183
+ const requests = [
184
+ {
185
+ deleteTableRow: {
186
+ ...data,
187
+ },
188
+ },
189
+ ];
190
+ return this.batchUpdate(presentationId, requests);
191
+ },
192
+ deleteTableColumn(presentationId, data) {
193
+ const requests = [
194
+ {
195
+ deleteTableColumn: {
196
+ ...data,
197
+ },
198
+ },
199
+ ];
200
+ return this.batchUpdate(presentationId, requests);
201
+ },
202
+ createImage(presentationId, data) {
203
+ const requests = [
204
+ {
205
+ createImage: {
206
+ ...data,
207
+ },
208
+ },
209
+ ];
210
+ return this.batchUpdate(presentationId, requests);
211
+ },
212
+ deleteObject(presentationId, objectId) {
213
+ const requests = [
214
+ {
215
+ deleteObject: {
216
+ objectId,
217
+ },
218
+ },
219
+ ];
220
+ return this.batchUpdate(presentationId, requests);
50
221
  },
51
222
  async createPresentation(title) {
52
223
  const slides = this.slides();
@@ -79,6 +250,14 @@ export default {
79
250
  };
80
251
  return (await slides.presentations.get(request)).data;
81
252
  },
253
+ async getSlide(presentationId, slideId) {
254
+ const slides = this.slides();
255
+ const request = {
256
+ presentationId,
257
+ pageObjectId: slideId,
258
+ };
259
+ return (await slides.presentations.pages.get(request)).data;
260
+ },
82
261
  async copyPresentation(fileId, name) {
83
262
  const drive = this.drive();
84
263
  const resource = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_slides",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Pipedream Google Slides Components",
5
5
  "main": "google_slides.app.mjs",
6
6
  "keywords": [
@@ -13,7 +13,7 @@
13
13
  "@googleapis/drive": "^2.3.0",
14
14
  "@googleapis/slides": "^0.7.1",
15
15
  "@pipedream/google_drive": "^1.0.3",
16
- "@pipedream/platform": "^0.9.0",
16
+ "@pipedream/platform": "^3.1.0",
17
17
  "mime-db": "^1.51.0",
18
18
  "uuid": "^8.3.2"
19
19
  },