gws-cli 1.0.0__py3-none-any.whl

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.
gws/commands/slides.py ADDED
@@ -0,0 +1,1107 @@
1
+ """Slides CLI commands."""
2
+
3
+ import typer
4
+ from typing import Annotated, Optional
5
+
6
+ from gws.commands._account import account_callback
7
+ from gws.services.slides import SlidesService
8
+
9
+ app = typer.Typer(
10
+ name="slides",
11
+ help="Google Slides presentation operations.",
12
+ no_args_is_help=True,
13
+ callback=account_callback,
14
+ )
15
+
16
+
17
+ @app.command("metadata")
18
+ def get_metadata(
19
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
20
+ ) -> None:
21
+ """Get presentation metadata."""
22
+ service = SlidesService()
23
+ service.metadata(presentation_id=presentation_id)
24
+
25
+
26
+ @app.command("read")
27
+ def read_presentation(
28
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
29
+ page_id: Annotated[
30
+ Optional[str],
31
+ typer.Option("--page", "-p", help="Specific page/slide object ID to read."),
32
+ ] = None,
33
+ ) -> None:
34
+ """Read presentation content."""
35
+ service = SlidesService()
36
+ service.read(presentation_id=presentation_id, page_object_id=page_id)
37
+
38
+
39
+ @app.command("create")
40
+ def create_presentation(
41
+ title: Annotated[str, typer.Argument(help="Presentation title.")],
42
+ folder_id: Annotated[
43
+ Optional[str],
44
+ typer.Option("--folder", "-f", help="Folder ID to create presentation in."),
45
+ ] = None,
46
+ ) -> None:
47
+ """Create a new presentation."""
48
+ service = SlidesService()
49
+ service.create(title=title, folder_id=folder_id)
50
+
51
+
52
+ @app.command("add-slide")
53
+ def add_slide(
54
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
55
+ layout: Annotated[
56
+ str,
57
+ typer.Option(
58
+ "--layout",
59
+ "-l",
60
+ help="Layout: BLANK, TITLE, TITLE_AND_BODY, TITLE_ONLY, etc.",
61
+ ),
62
+ ] = "BLANK",
63
+ index: Annotated[
64
+ Optional[int],
65
+ typer.Option("--index", "-i", help="Index to insert slide at."),
66
+ ] = None,
67
+ ) -> None:
68
+ """Add a new slide."""
69
+ service = SlidesService()
70
+ service.add_slide(
71
+ presentation_id=presentation_id,
72
+ layout=layout,
73
+ insertion_index=index,
74
+ )
75
+
76
+
77
+ @app.command("delete-slide")
78
+ def delete_slide(
79
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
80
+ slide_id: Annotated[str, typer.Argument(help="Slide object ID to delete.")],
81
+ ) -> None:
82
+ """Delete a slide."""
83
+ service = SlidesService()
84
+ service.delete_slide(presentation_id=presentation_id, slide_id=slide_id)
85
+
86
+
87
+ @app.command("duplicate-slide")
88
+ def duplicate_slide(
89
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
90
+ slide_id: Annotated[str, typer.Argument(help="Slide object ID to duplicate.")],
91
+ ) -> None:
92
+ """Duplicate a slide."""
93
+ service = SlidesService()
94
+ service.duplicate_slide(presentation_id=presentation_id, slide_id=slide_id)
95
+
96
+
97
+ @app.command("insert-text")
98
+ def insert_text(
99
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
100
+ object_id: Annotated[str, typer.Argument(help="Shape object ID.")],
101
+ text: Annotated[str, typer.Argument(help="Text to insert.")],
102
+ index: Annotated[
103
+ int,
104
+ typer.Option("--index", "-i", help="Character index to insert at."),
105
+ ] = 0,
106
+ ) -> None:
107
+ """Insert text into a shape."""
108
+ service = SlidesService()
109
+ service.insert_text(
110
+ presentation_id=presentation_id,
111
+ object_id=object_id,
112
+ text=text,
113
+ insertion_index=index,
114
+ )
115
+
116
+
117
+ @app.command("replace-text")
118
+ def replace_text(
119
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
120
+ find: Annotated[str, typer.Argument(help="Text to find.")],
121
+ replace_with: Annotated[str, typer.Argument(help="Replacement text.")],
122
+ match_case: Annotated[
123
+ bool,
124
+ typer.Option("--match-case", "-m", help="Case-sensitive matching."),
125
+ ] = False,
126
+ ) -> None:
127
+ """Replace text throughout the presentation."""
128
+ service = SlidesService()
129
+ service.replace_text(
130
+ presentation_id=presentation_id,
131
+ find=find,
132
+ replace_with=replace_with,
133
+ match_case=match_case,
134
+ )
135
+
136
+
137
+ @app.command("create-textbox")
138
+ def create_textbox(
139
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
140
+ page_id: Annotated[str, typer.Argument(help="Page/slide object ID.")],
141
+ text: Annotated[str, typer.Argument(help="Text content.")],
142
+ x: Annotated[float, typer.Option("--x", help="X position in points.")],
143
+ y: Annotated[float, typer.Option("--y", help="Y position in points.")],
144
+ width: Annotated[float, typer.Option("--width", "-w", help="Width in points.")],
145
+ height: Annotated[float, typer.Option("--height", "-h", help="Height in points.")],
146
+ ) -> None:
147
+ """Create a text box on a slide."""
148
+ service = SlidesService()
149
+ service.create_textbox(
150
+ presentation_id=presentation_id,
151
+ page_object_id=page_id,
152
+ text=text,
153
+ x=x,
154
+ y=y,
155
+ width=width,
156
+ height=height,
157
+ )
158
+
159
+
160
+ @app.command("insert-image")
161
+ def insert_image(
162
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
163
+ page_id: Annotated[str, typer.Argument(help="Page/slide object ID.")],
164
+ image_url: Annotated[str, typer.Argument(help="Image URL (publicly accessible).")],
165
+ x: Annotated[float, typer.Option("--x", help="X position in points.")] = 0,
166
+ y: Annotated[float, typer.Option("--y", help="Y position in points.")] = 0,
167
+ width: Annotated[
168
+ Optional[float],
169
+ typer.Option("--width", "-w", help="Width in points."),
170
+ ] = None,
171
+ height: Annotated[
172
+ Optional[float],
173
+ typer.Option("--height", "-h", help="Height in points."),
174
+ ] = None,
175
+ ) -> None:
176
+ """Insert an image on a slide."""
177
+ service = SlidesService()
178
+ service.insert_image(
179
+ presentation_id=presentation_id,
180
+ page_object_id=page_id,
181
+ image_url=image_url,
182
+ x=x,
183
+ y=y,
184
+ width=width,
185
+ height=height,
186
+ )
187
+
188
+
189
+ @app.command("delete-element")
190
+ def delete_element(
191
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
192
+ object_id: Annotated[str, typer.Argument(help="Element object ID to delete.")],
193
+ ) -> None:
194
+ """Delete an element from a slide."""
195
+ service = SlidesService()
196
+ service.delete_element(presentation_id=presentation_id, object_id=object_id)
197
+
198
+
199
+ @app.command("format-text")
200
+ def format_text(
201
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
202
+ object_id: Annotated[str, typer.Argument(help="Shape object ID.")],
203
+ bold: Annotated[
204
+ Optional[bool],
205
+ typer.Option("--bold/--no-bold", "-b", help="Bold formatting."),
206
+ ] = None,
207
+ italic: Annotated[
208
+ Optional[bool],
209
+ typer.Option("--italic/--no-italic", "-i", help="Italic formatting."),
210
+ ] = None,
211
+ underline: Annotated[
212
+ Optional[bool],
213
+ typer.Option("--underline/--no-underline", "-u", help="Underline formatting."),
214
+ ] = None,
215
+ font_size: Annotated[
216
+ Optional[int],
217
+ typer.Option("--font-size", "-s", help="Font size in points."),
218
+ ] = None,
219
+ color: Annotated[
220
+ Optional[str],
221
+ typer.Option("--color", help="Text color (hex, e.g., #FF0000)."),
222
+ ] = None,
223
+ ) -> None:
224
+ """Apply formatting to text in an element."""
225
+ service = SlidesService()
226
+ service.format_text(
227
+ presentation_id=presentation_id,
228
+ object_id=object_id,
229
+ bold=bold,
230
+ italic=italic,
231
+ underline=underline,
232
+ font_size=font_size,
233
+ foreground_color=color,
234
+ )
235
+
236
+
237
+ @app.command("format-text-extended")
238
+ def format_text_extended(
239
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
240
+ object_id: Annotated[str, typer.Argument(help="Shape object ID.")],
241
+ start_index: Annotated[
242
+ Optional[int],
243
+ typer.Option("--start", help="Start character index (0-based)."),
244
+ ] = None,
245
+ end_index: Annotated[
246
+ Optional[int],
247
+ typer.Option("--end", help="End character index (exclusive)."),
248
+ ] = None,
249
+ bold: Annotated[
250
+ Optional[bool],
251
+ typer.Option("--bold/--no-bold", "-b", help="Bold formatting."),
252
+ ] = None,
253
+ italic: Annotated[
254
+ Optional[bool],
255
+ typer.Option("--italic/--no-italic", "-i", help="Italic formatting."),
256
+ ] = None,
257
+ underline: Annotated[
258
+ Optional[bool],
259
+ typer.Option("--underline/--no-underline", "-u", help="Underline formatting."),
260
+ ] = None,
261
+ strikethrough: Annotated[
262
+ Optional[bool],
263
+ typer.Option("--strikethrough/--no-strikethrough", help="Strikethrough."),
264
+ ] = None,
265
+ small_caps: Annotated[
266
+ Optional[bool],
267
+ typer.Option("--small-caps/--no-small-caps", help="Small caps."),
268
+ ] = None,
269
+ font_family: Annotated[
270
+ Optional[str],
271
+ typer.Option("--font", "-f", help="Font family (e.g., Arial, Roboto)."),
272
+ ] = None,
273
+ font_weight: Annotated[
274
+ Optional[int],
275
+ typer.Option("--weight", "-w", help="Font weight (100-900)."),
276
+ ] = None,
277
+ font_size: Annotated[
278
+ Optional[int],
279
+ typer.Option("--size", "-s", help="Font size in points."),
280
+ ] = None,
281
+ foreground_color: Annotated[
282
+ Optional[str],
283
+ typer.Option("--color", help="Text color (hex, e.g., #FF0000)."),
284
+ ] = None,
285
+ background_color: Annotated[
286
+ Optional[str],
287
+ typer.Option("--bg-color", help="Background/highlight color (hex)."),
288
+ ] = None,
289
+ baseline_offset: Annotated[
290
+ Optional[str],
291
+ typer.Option("--baseline", help="Baseline offset (SUPERSCRIPT, SUBSCRIPT)."),
292
+ ] = None,
293
+ link_url: Annotated[
294
+ Optional[str],
295
+ typer.Option("--link", help="URL to link the text to."),
296
+ ] = None,
297
+ ) -> None:
298
+ """Apply extended formatting to text with all options."""
299
+ service = SlidesService()
300
+ service.format_text_extended(
301
+ presentation_id=presentation_id,
302
+ object_id=object_id,
303
+ start_index=start_index,
304
+ end_index=end_index,
305
+ bold=bold,
306
+ italic=italic,
307
+ underline=underline,
308
+ strikethrough=strikethrough,
309
+ small_caps=small_caps,
310
+ font_family=font_family,
311
+ font_weight=font_weight,
312
+ font_size=font_size,
313
+ foreground_color=foreground_color,
314
+ background_color=background_color,
315
+ baseline_offset=baseline_offset,
316
+ link_url=link_url,
317
+ )
318
+
319
+
320
+ @app.command("format-paragraph")
321
+ def format_paragraph(
322
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
323
+ object_id: Annotated[str, typer.Argument(help="Shape object ID.")],
324
+ start_index: Annotated[
325
+ Optional[int],
326
+ typer.Option("--start", help="Start character index (0-based)."),
327
+ ] = None,
328
+ end_index: Annotated[
329
+ Optional[int],
330
+ typer.Option("--end", help="End character index (exclusive)."),
331
+ ] = None,
332
+ alignment: Annotated[
333
+ Optional[str],
334
+ typer.Option("--align", "-a", help="Alignment (START, CENTER, END, JUSTIFIED)."),
335
+ ] = None,
336
+ line_spacing: Annotated[
337
+ Optional[float],
338
+ typer.Option("--line-spacing", help="Line spacing as percentage (100=single)."),
339
+ ] = None,
340
+ space_above: Annotated[
341
+ Optional[float],
342
+ typer.Option("--space-above", help="Space above paragraph in points."),
343
+ ] = None,
344
+ space_below: Annotated[
345
+ Optional[float],
346
+ typer.Option("--space-below", help="Space below paragraph in points."),
347
+ ] = None,
348
+ indent_first_line: Annotated[
349
+ Optional[float],
350
+ typer.Option("--indent-first", help="First line indent in points."),
351
+ ] = None,
352
+ indent_start: Annotated[
353
+ Optional[float],
354
+ typer.Option("--indent-start", help="Start (left) indent in points."),
355
+ ] = None,
356
+ indent_end: Annotated[
357
+ Optional[float],
358
+ typer.Option("--indent-end", help="End (right) indent in points."),
359
+ ] = None,
360
+ ) -> None:
361
+ """Apply paragraph formatting (alignment, spacing, indentation)."""
362
+ service = SlidesService()
363
+ service.format_paragraph(
364
+ presentation_id=presentation_id,
365
+ object_id=object_id,
366
+ start_index=start_index,
367
+ end_index=end_index,
368
+ alignment=alignment,
369
+ line_spacing=line_spacing,
370
+ space_above=space_above,
371
+ space_below=space_below,
372
+ indent_first_line=indent_first_line,
373
+ indent_start=indent_start,
374
+ indent_end=indent_end,
375
+ )
376
+
377
+
378
+ @app.command("create-shape")
379
+ def create_shape(
380
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
381
+ page_id: Annotated[str, typer.Argument(help="Page/slide object ID.")],
382
+ shape_type: Annotated[
383
+ str, typer.Argument(help="Shape type (RECTANGLE, ELLIPSE, etc.).")
384
+ ],
385
+ x: Annotated[float, typer.Option("--x", help="X position in points.")],
386
+ y: Annotated[float, typer.Option("--y", help="Y position in points.")],
387
+ width: Annotated[float, typer.Option("--width", "-w", help="Width in points.")],
388
+ height: Annotated[float, typer.Option("--height", "-h", help="Height in points.")],
389
+ ) -> None:
390
+ """Create a shape on a slide."""
391
+ service = SlidesService()
392
+ service.create_shape(
393
+ presentation_id=presentation_id,
394
+ page_object_id=page_id,
395
+ shape_type=shape_type,
396
+ x=x,
397
+ y=y,
398
+ width=width,
399
+ height=height,
400
+ )
401
+
402
+
403
+ @app.command("format-shape")
404
+ def format_shape(
405
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
406
+ object_id: Annotated[str, typer.Argument(help="Shape object ID.")],
407
+ fill_color: Annotated[
408
+ Optional[str],
409
+ typer.Option("--fill", help="Fill color (hex, e.g., #FF0000)."),
410
+ ] = None,
411
+ outline_color: Annotated[
412
+ Optional[str],
413
+ typer.Option("--outline-color", help="Outline color (hex)."),
414
+ ] = None,
415
+ outline_weight: Annotated[
416
+ Optional[float],
417
+ typer.Option("--outline-weight", help="Outline weight in points."),
418
+ ] = None,
419
+ outline_dash_style: Annotated[
420
+ Optional[str],
421
+ typer.Option("--outline-style", help="Dash style (SOLID, DOT, DASH, etc.)."),
422
+ ] = None,
423
+ ) -> None:
424
+ """Format a shape's fill and outline."""
425
+ service = SlidesService()
426
+ service.format_shape(
427
+ presentation_id=presentation_id,
428
+ object_id=object_id,
429
+ fill_color=fill_color,
430
+ outline_color=outline_color,
431
+ outline_weight=outline_weight,
432
+ outline_dash_style=outline_dash_style,
433
+ )
434
+
435
+
436
+ @app.command("insert-table")
437
+ def insert_table(
438
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
439
+ page_id: Annotated[str, typer.Argument(help="Page/slide object ID.")],
440
+ rows: Annotated[int, typer.Argument(help="Number of rows.")],
441
+ columns: Annotated[int, typer.Argument(help="Number of columns.")],
442
+ x: Annotated[float, typer.Option("--x", help="X position in points.")],
443
+ y: Annotated[float, typer.Option("--y", help="Y position in points.")],
444
+ width: Annotated[float, typer.Option("--width", "-w", help="Width in points.")],
445
+ height: Annotated[float, typer.Option("--height", "-h", help="Height in points.")],
446
+ ) -> None:
447
+ """Insert a table on a slide."""
448
+ service = SlidesService()
449
+ service.insert_table(
450
+ presentation_id=presentation_id,
451
+ page_object_id=page_id,
452
+ rows=rows,
453
+ columns=columns,
454
+ x=x,
455
+ y=y,
456
+ width=width,
457
+ height=height,
458
+ )
459
+
460
+
461
+ @app.command("insert-table-row")
462
+ def insert_table_row(
463
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
464
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
465
+ row_index: Annotated[int, typer.Argument(help="Row index to insert at.")],
466
+ below: Annotated[
467
+ bool,
468
+ typer.Option("--below/--above", help="Insert below (default) or above."),
469
+ ] = True,
470
+ ) -> None:
471
+ """Insert a row in a table."""
472
+ service = SlidesService()
473
+ service.insert_table_row(
474
+ presentation_id=presentation_id,
475
+ table_id=table_id,
476
+ row_index=row_index,
477
+ insert_below=below,
478
+ )
479
+
480
+
481
+ @app.command("insert-table-column")
482
+ def insert_table_column(
483
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
484
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
485
+ column_index: Annotated[int, typer.Argument(help="Column index to insert at.")],
486
+ right: Annotated[
487
+ bool,
488
+ typer.Option("--right/--left", help="Insert right (default) or left."),
489
+ ] = True,
490
+ ) -> None:
491
+ """Insert a column in a table."""
492
+ service = SlidesService()
493
+ service.insert_table_column(
494
+ presentation_id=presentation_id,
495
+ table_id=table_id,
496
+ column_index=column_index,
497
+ insert_right=right,
498
+ )
499
+
500
+
501
+ @app.command("delete-table-row")
502
+ def delete_table_row(
503
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
504
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
505
+ row_index: Annotated[int, typer.Argument(help="Row index to delete.")],
506
+ ) -> None:
507
+ """Delete a row from a table."""
508
+ service = SlidesService()
509
+ service.delete_table_row(
510
+ presentation_id=presentation_id,
511
+ table_id=table_id,
512
+ row_index=row_index,
513
+ )
514
+
515
+
516
+ @app.command("delete-table-column")
517
+ def delete_table_column(
518
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
519
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
520
+ column_index: Annotated[int, typer.Argument(help="Column index to delete.")],
521
+ ) -> None:
522
+ """Delete a column from a table."""
523
+ service = SlidesService()
524
+ service.delete_table_column(
525
+ presentation_id=presentation_id,
526
+ table_id=table_id,
527
+ column_index=column_index,
528
+ )
529
+
530
+
531
+ @app.command("style-table-cell")
532
+ def style_table_cell(
533
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
534
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
535
+ row_index: Annotated[int, typer.Argument(help="Starting row index.")],
536
+ column_index: Annotated[int, typer.Argument(help="Starting column index.")],
537
+ background_color: Annotated[
538
+ Optional[str],
539
+ typer.Option("--bg-color", help="Background color (hex)."),
540
+ ] = None,
541
+ end_row_index: Annotated[
542
+ Optional[int],
543
+ typer.Option("--end-row", help="Ending row index (exclusive)."),
544
+ ] = None,
545
+ end_column_index: Annotated[
546
+ Optional[int],
547
+ typer.Option("--end-col", help="Ending column index (exclusive)."),
548
+ ] = None,
549
+ ) -> None:
550
+ """Style table cells (background color)."""
551
+ service = SlidesService()
552
+ service.style_table_cell(
553
+ presentation_id=presentation_id,
554
+ table_id=table_id,
555
+ row_index=row_index,
556
+ column_index=column_index,
557
+ background_color=background_color,
558
+ end_row_index=end_row_index,
559
+ end_column_index=end_column_index,
560
+ )
561
+
562
+
563
+ @app.command("insert-table-text")
564
+ def insert_table_text(
565
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
566
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
567
+ row_index: Annotated[int, typer.Argument(help="Row index.")],
568
+ column_index: Annotated[int, typer.Argument(help="Column index.")],
569
+ text: Annotated[str, typer.Argument(help="Text to insert.")],
570
+ ) -> None:
571
+ """Insert text into a table cell."""
572
+ service = SlidesService()
573
+ service.insert_text_in_table_cell(
574
+ presentation_id=presentation_id,
575
+ table_id=table_id,
576
+ row_index=row_index,
577
+ column_index=column_index,
578
+ text=text,
579
+ )
580
+
581
+
582
+ # ===== Phase 6: Slides Enhancements =====
583
+
584
+
585
+ @app.command("set-background")
586
+ def set_background(
587
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
588
+ slide_id: Annotated[str, typer.Argument(help="Slide object ID.")],
589
+ color: Annotated[
590
+ Optional[str],
591
+ typer.Option("--color", "-c", help="Background color (hex, e.g., #FFFFFF)."),
592
+ ] = None,
593
+ image_url: Annotated[
594
+ Optional[str],
595
+ typer.Option("--image", "-i", help="Background image URL."),
596
+ ] = None,
597
+ ) -> None:
598
+ """Set slide background to a color or image."""
599
+ service = SlidesService()
600
+ service.set_slide_background(
601
+ presentation_id=presentation_id,
602
+ slide_id=slide_id,
603
+ color=color,
604
+ image_url=image_url,
605
+ )
606
+
607
+
608
+ @app.command("create-bullets")
609
+ def create_bullets(
610
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
611
+ object_id: Annotated[str, typer.Argument(help="Shape/text box object ID.")],
612
+ bullet_preset: Annotated[
613
+ str,
614
+ typer.Option(
615
+ "--preset", "-p",
616
+ help="Bullet preset (BULLET_DISC_CIRCLE_SQUARE, NUMBERED_DIGIT_ALPHA_ROMAN, etc.).",
617
+ ),
618
+ ] = "BULLET_DISC_CIRCLE_SQUARE",
619
+ start_index: Annotated[
620
+ Optional[int],
621
+ typer.Option("--start", help="Start character index (0-based)."),
622
+ ] = None,
623
+ end_index: Annotated[
624
+ Optional[int],
625
+ typer.Option("--end", help="End character index (exclusive)."),
626
+ ] = None,
627
+ ) -> None:
628
+ """Add bullet list formatting to text."""
629
+ service = SlidesService()
630
+ service.create_bullets(
631
+ presentation_id=presentation_id,
632
+ object_id=object_id,
633
+ bullet_preset=bullet_preset,
634
+ start_index=start_index,
635
+ end_index=end_index,
636
+ )
637
+
638
+
639
+ @app.command("remove-bullets")
640
+ def remove_bullets(
641
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
642
+ object_id: Annotated[str, typer.Argument(help="Shape/text box object ID.")],
643
+ start_index: Annotated[
644
+ Optional[int],
645
+ typer.Option("--start", help="Start character index (0-based)."),
646
+ ] = None,
647
+ end_index: Annotated[
648
+ Optional[int],
649
+ typer.Option("--end", help="End character index (exclusive)."),
650
+ ] = None,
651
+ ) -> None:
652
+ """Remove bullet list formatting from text."""
653
+ service = SlidesService()
654
+ service.remove_bullets(
655
+ presentation_id=presentation_id,
656
+ object_id=object_id,
657
+ start_index=start_index,
658
+ end_index=end_index,
659
+ )
660
+
661
+
662
+ @app.command("style-table-borders")
663
+ def style_table_borders(
664
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
665
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
666
+ row_index: Annotated[int, typer.Argument(help="Starting row index.")],
667
+ column_index: Annotated[int, typer.Argument(help="Starting column index.")],
668
+ row_span: Annotated[
669
+ int,
670
+ typer.Option("--rows", "-r", help="Number of rows to style."),
671
+ ] = 1,
672
+ column_span: Annotated[
673
+ int,
674
+ typer.Option("--cols", "-c", help="Number of columns to style."),
675
+ ] = 1,
676
+ color: Annotated[
677
+ str,
678
+ typer.Option("--color", help="Border color (hex)."),
679
+ ] = "#000000",
680
+ weight: Annotated[
681
+ float,
682
+ typer.Option("--weight", "-w", help="Border weight in points."),
683
+ ] = 1.0,
684
+ dash_style: Annotated[
685
+ str,
686
+ typer.Option("--style", "-s", help="Dash style (SOLID, DOT, DASH, etc.)."),
687
+ ] = "SOLID",
688
+ border_position: Annotated[
689
+ str,
690
+ typer.Option("--position", "-p", help="Border position (ALL, INNER, OUTER, etc.)."),
691
+ ] = "ALL",
692
+ ) -> None:
693
+ """Style table cell borders."""
694
+ service = SlidesService()
695
+ service.style_table_borders(
696
+ presentation_id=presentation_id,
697
+ table_id=table_id,
698
+ row_index=row_index,
699
+ column_index=column_index,
700
+ row_span=row_span,
701
+ column_span=column_span,
702
+ color=color,
703
+ weight=weight,
704
+ dash_style=dash_style,
705
+ border_position=border_position,
706
+ )
707
+
708
+
709
+ @app.command("merge-table-cells")
710
+ def merge_table_cells(
711
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
712
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
713
+ row_index: Annotated[int, typer.Argument(help="Starting row index.")],
714
+ column_index: Annotated[int, typer.Argument(help="Starting column index.")],
715
+ row_span: Annotated[int, typer.Argument(help="Number of rows to merge.")],
716
+ column_span: Annotated[int, typer.Argument(help="Number of columns to merge.")],
717
+ ) -> None:
718
+ """Merge table cells into one."""
719
+ service = SlidesService()
720
+ service.merge_table_cells(
721
+ presentation_id=presentation_id,
722
+ table_id=table_id,
723
+ row_index=row_index,
724
+ column_index=column_index,
725
+ row_span=row_span,
726
+ column_span=column_span,
727
+ )
728
+
729
+
730
+ @app.command("unmerge-table-cells")
731
+ def unmerge_table_cells(
732
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
733
+ table_id: Annotated[str, typer.Argument(help="Table object ID.")],
734
+ row_index: Annotated[int, typer.Argument(help="Starting row index.")],
735
+ column_index: Annotated[int, typer.Argument(help="Starting column index.")],
736
+ row_span: Annotated[int, typer.Argument(help="Number of rows in merged region.")],
737
+ column_span: Annotated[int, typer.Argument(help="Number of columns in merged region.")],
738
+ ) -> None:
739
+ """Unmerge previously merged table cells."""
740
+ service = SlidesService()
741
+ service.unmerge_table_cells(
742
+ presentation_id=presentation_id,
743
+ table_id=table_id,
744
+ row_index=row_index,
745
+ column_index=column_index,
746
+ row_span=row_span,
747
+ column_span=column_span,
748
+ )
749
+
750
+
751
+ @app.command("create-line")
752
+ def create_line(
753
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
754
+ page_id: Annotated[str, typer.Argument(help="Page/slide object ID.")],
755
+ start_x: Annotated[float, typer.Option("--start-x", help="Start X position in points.")],
756
+ start_y: Annotated[float, typer.Option("--start-y", help="Start Y position in points.")],
757
+ end_x: Annotated[float, typer.Option("--end-x", help="End X position in points.")],
758
+ end_y: Annotated[float, typer.Option("--end-y", help="End Y position in points.")],
759
+ line_category: Annotated[
760
+ str,
761
+ typer.Option("--category", "-c", help="Line category (STRAIGHT, BENT, CURVED)."),
762
+ ] = "STRAIGHT",
763
+ color: Annotated[
764
+ str,
765
+ typer.Option("--color", help="Line color (hex)."),
766
+ ] = "#000000",
767
+ weight: Annotated[
768
+ float,
769
+ typer.Option("--weight", "-w", help="Line weight in points."),
770
+ ] = 1.0,
771
+ dash_style: Annotated[
772
+ str,
773
+ typer.Option("--style", "-s", help="Dash style (SOLID, DOT, DASH, etc.)."),
774
+ ] = "SOLID",
775
+ start_arrow: Annotated[
776
+ Optional[str],
777
+ typer.Option("--start-arrow", help="Start arrow type (FILL_ARROW, OPEN_ARROW, etc.)."),
778
+ ] = None,
779
+ end_arrow: Annotated[
780
+ Optional[str],
781
+ typer.Option("--end-arrow", help="End arrow type (FILL_ARROW, OPEN_ARROW, etc.)."),
782
+ ] = None,
783
+ ) -> None:
784
+ """Create a line or arrow on a slide."""
785
+ service = SlidesService()
786
+ service.create_line(
787
+ presentation_id=presentation_id,
788
+ page_object_id=page_id,
789
+ start_x=start_x,
790
+ start_y=start_y,
791
+ end_x=end_x,
792
+ end_y=end_y,
793
+ line_category=line_category,
794
+ color=color,
795
+ weight=weight,
796
+ dash_style=dash_style,
797
+ start_arrow=start_arrow,
798
+ end_arrow=end_arrow,
799
+ )
800
+
801
+
802
+ @app.command("reorder-slides")
803
+ def reorder_slides(
804
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
805
+ slide_ids: Annotated[str, typer.Argument(help="Comma-separated slide object IDs to move.")],
806
+ insertion_index: Annotated[int, typer.Argument(help="Target index (0-based).")],
807
+ ) -> None:
808
+ """Move slides to a new position."""
809
+ slide_id_list = [s.strip() for s in slide_ids.split(",")]
810
+
811
+ service = SlidesService()
812
+ service.reorder_slides(
813
+ presentation_id=presentation_id,
814
+ slide_ids=slide_id_list,
815
+ insertion_index=insertion_index,
816
+ )
817
+
818
+
819
+ # ===== Speaker Notes =====
820
+
821
+
822
+ @app.command("get-speaker-notes")
823
+ def get_speaker_notes(
824
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
825
+ slide_id: Annotated[str, typer.Argument(help="Slide object ID.")],
826
+ ) -> None:
827
+ """Get speaker notes for a slide."""
828
+ service = SlidesService()
829
+ service.get_speaker_notes(
830
+ presentation_id=presentation_id,
831
+ slide_id=slide_id,
832
+ )
833
+
834
+
835
+ @app.command("set-speaker-notes")
836
+ def set_speaker_notes(
837
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
838
+ slide_id: Annotated[str, typer.Argument(help="Slide object ID.")],
839
+ notes_text: Annotated[str, typer.Argument(help="Speaker notes text content.")],
840
+ ) -> None:
841
+ """Set speaker notes for a slide."""
842
+ service = SlidesService()
843
+ service.set_speaker_notes(
844
+ presentation_id=presentation_id,
845
+ slide_id=slide_id,
846
+ notes_text=notes_text,
847
+ )
848
+
849
+
850
+ # ===== Video =====
851
+
852
+
853
+ @app.command("insert-video")
854
+ def insert_video(
855
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
856
+ page_id: Annotated[str, typer.Argument(help="Slide/page object ID.")],
857
+ video_url: Annotated[str, typer.Argument(help="YouTube video URL.")],
858
+ x: Annotated[float, typer.Argument(help="X position in points.")],
859
+ y: Annotated[float, typer.Argument(help="Y position in points.")],
860
+ width: Annotated[float, typer.Argument(help="Width in points.")],
861
+ height: Annotated[float, typer.Argument(help="Height in points.")],
862
+ ) -> None:
863
+ """Insert a YouTube video on a slide."""
864
+ service = SlidesService()
865
+ service.insert_video(
866
+ presentation_id=presentation_id,
867
+ page_object_id=page_id,
868
+ video_url=video_url,
869
+ x=x,
870
+ y=y,
871
+ width=width,
872
+ height=height,
873
+ )
874
+
875
+
876
+ @app.command("update-video-properties")
877
+ def update_video_properties(
878
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
879
+ video_object_id: Annotated[str, typer.Argument(help="Video object ID.")],
880
+ autoplay: Annotated[
881
+ Optional[bool],
882
+ typer.Option("--autoplay", help="Autoplay when presenting."),
883
+ ] = None,
884
+ start_time: Annotated[
885
+ Optional[int],
886
+ typer.Option("--start", "-s", help="Start time in seconds."),
887
+ ] = None,
888
+ end_time: Annotated[
889
+ Optional[int],
890
+ typer.Option("--end", "-e", help="End time in seconds."),
891
+ ] = None,
892
+ mute: Annotated[
893
+ Optional[bool],
894
+ typer.Option("--mute", "-m", help="Mute video."),
895
+ ] = None,
896
+ ) -> None:
897
+ """Update video playback properties."""
898
+ service = SlidesService()
899
+ service.update_video_properties(
900
+ presentation_id=presentation_id,
901
+ video_object_id=video_object_id,
902
+ autoplay=autoplay,
903
+ start_time=start_time,
904
+ end_time=end_time,
905
+ mute=mute,
906
+ )
907
+
908
+
909
+ # ===== Element Transforms =====
910
+
911
+
912
+ @app.command("transform-element")
913
+ def transform_element(
914
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
915
+ object_id: Annotated[str, typer.Argument(help="Element object ID.")],
916
+ scale_x: Annotated[
917
+ Optional[float],
918
+ typer.Option("--scale-x", help="Horizontal scale factor."),
919
+ ] = None,
920
+ scale_y: Annotated[
921
+ Optional[float],
922
+ typer.Option("--scale-y", help="Vertical scale factor."),
923
+ ] = None,
924
+ translate_x: Annotated[
925
+ Optional[float],
926
+ typer.Option("--translate-x", help="Horizontal translation in EMU."),
927
+ ] = None,
928
+ translate_y: Annotated[
929
+ Optional[float],
930
+ typer.Option("--translate-y", help="Vertical translation in EMU."),
931
+ ] = None,
932
+ rotate: Annotated[
933
+ Optional[float],
934
+ typer.Option("--rotate", "-r", help="Rotation angle in degrees."),
935
+ ] = None,
936
+ apply_mode: Annotated[
937
+ str,
938
+ typer.Option("--mode", "-m", help="'RELATIVE' or 'ABSOLUTE'."),
939
+ ] = "RELATIVE",
940
+ ) -> None:
941
+ """Transform an element (scale, translate, rotate)."""
942
+ service = SlidesService()
943
+ service.transform_element(
944
+ presentation_id=presentation_id,
945
+ object_id=object_id,
946
+ scale_x=scale_x,
947
+ scale_y=scale_y,
948
+ translate_x=translate_x,
949
+ translate_y=translate_y,
950
+ rotate=rotate,
951
+ apply_mode=apply_mode,
952
+ )
953
+
954
+
955
+ # ===== Image Properties =====
956
+
957
+
958
+ @app.command("update-image")
959
+ def update_image_properties(
960
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
961
+ object_id: Annotated[str, typer.Argument(help="Image element object ID.")],
962
+ transparency: Annotated[
963
+ Optional[float],
964
+ typer.Option("--transparency", "-t", help="Transparency (0.0=opaque, 1.0=transparent)."),
965
+ ] = None,
966
+ outline_color: Annotated[
967
+ Optional[str],
968
+ typer.Option("--outline-color", help="Outline color (hex, e.g., '#000000')."),
969
+ ] = None,
970
+ outline_weight: Annotated[
971
+ Optional[float],
972
+ typer.Option("--outline-weight", help="Outline weight in points."),
973
+ ] = None,
974
+ ) -> None:
975
+ """Update image properties (transparency, outline)."""
976
+ service = SlidesService()
977
+ service.update_image_properties(
978
+ presentation_id=presentation_id,
979
+ object_id=object_id,
980
+ transparency=transparency,
981
+ outline_color=outline_color,
982
+ outline_weight=outline_weight,
983
+ )
984
+
985
+
986
+ # ===== Grouping =====
987
+
988
+
989
+ @app.command("group")
990
+ def group_objects(
991
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
992
+ object_ids: Annotated[str, typer.Argument(help="Comma-separated object IDs to group.")],
993
+ group_id: Annotated[
994
+ Optional[str],
995
+ typer.Option("--group-id", help="Optional ID for the new group."),
996
+ ] = None,
997
+ ) -> None:
998
+ """Group multiple page elements."""
999
+ ids = [o.strip() for o in object_ids.split(",")]
1000
+ service = SlidesService()
1001
+ service.group_objects(
1002
+ presentation_id=presentation_id,
1003
+ children_object_ids=ids,
1004
+ group_object_id=group_id,
1005
+ )
1006
+
1007
+
1008
+ @app.command("ungroup")
1009
+ def ungroup_objects(
1010
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
1011
+ group_ids: Annotated[str, typer.Argument(help="Comma-separated group IDs to ungroup.")],
1012
+ ) -> None:
1013
+ """Ungroup one or more groups."""
1014
+ ids = [g.strip() for g in group_ids.split(",")]
1015
+ service = SlidesService()
1016
+ service.ungroup_objects(
1017
+ presentation_id=presentation_id,
1018
+ group_object_ids=ids,
1019
+ )
1020
+
1021
+
1022
+ # ===== Shape Replacement =====
1023
+
1024
+
1025
+ @app.command("replace-shapes-with-image")
1026
+ def replace_shapes_with_image(
1027
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
1028
+ contains_text: Annotated[str, typer.Argument(help="Text to search for in shapes.")],
1029
+ image_url: Annotated[str, typer.Argument(help="URL of the image to insert.")],
1030
+ replace_method: Annotated[
1031
+ str,
1032
+ typer.Option("--method", "-m", help="'CENTER_INSIDE' or 'CENTER_CROP'."),
1033
+ ] = "CENTER_INSIDE",
1034
+ page_ids: Annotated[
1035
+ Optional[str],
1036
+ typer.Option("--pages", "-p", help="Comma-separated page IDs to limit search."),
1037
+ ] = None,
1038
+ ) -> None:
1039
+ """Replace all shapes containing specific text with an image."""
1040
+ page_object_ids = [p.strip() for p in page_ids.split(",")] if page_ids else None
1041
+ service = SlidesService()
1042
+ service.replace_shapes_with_image(
1043
+ presentation_id=presentation_id,
1044
+ contains_text=contains_text,
1045
+ image_url=image_url,
1046
+ image_replace_method=replace_method,
1047
+ page_object_ids=page_object_ids,
1048
+ )
1049
+
1050
+
1051
+ # ===== Accessibility =====
1052
+
1053
+
1054
+ @app.command("set-alt-text")
1055
+ def set_alt_text(
1056
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
1057
+ object_id: Annotated[str, typer.Argument(help="Element object ID.")],
1058
+ title: Annotated[
1059
+ Optional[str],
1060
+ typer.Option("--title", "-t", help="Brief title for the element."),
1061
+ ] = None,
1062
+ description: Annotated[
1063
+ Optional[str],
1064
+ typer.Option("--description", "-d", help="Detailed description for screen readers."),
1065
+ ] = None,
1066
+ ) -> None:
1067
+ """Set alt text (accessibility text) on a page element."""
1068
+ service = SlidesService()
1069
+ service.set_alt_text(
1070
+ presentation_id=presentation_id,
1071
+ object_id=object_id,
1072
+ title=title,
1073
+ description=description,
1074
+ )
1075
+
1076
+
1077
+ # ===== Embedded Charts =====
1078
+
1079
+
1080
+ @app.command("insert-sheets-chart")
1081
+ def insert_sheets_chart(
1082
+ presentation_id: Annotated[str, typer.Argument(help="Presentation ID.")],
1083
+ page_object_id: Annotated[str, typer.Argument(help="Page (slide) object ID.")],
1084
+ spreadsheet_id: Annotated[str, typer.Argument(help="Source spreadsheet ID.")],
1085
+ chart_id: Annotated[int, typer.Argument(help="Chart ID in the spreadsheet.")],
1086
+ x: Annotated[float, typer.Option("--x", help="X position in points.")] = 100,
1087
+ y: Annotated[float, typer.Option("--y", help="Y position in points.")] = 100,
1088
+ width: Annotated[float, typer.Option("--width", "-w", help="Width in points.")] = 400,
1089
+ height: Annotated[float, typer.Option("--height", "-h", help="Height in points.")] = 300,
1090
+ linking_mode: Annotated[
1091
+ str,
1092
+ typer.Option("--linking", "-l", help="'LINKED' or 'NOT_LINKED_IMAGE'."),
1093
+ ] = "LINKED",
1094
+ ) -> None:
1095
+ """Insert a chart from Google Sheets."""
1096
+ service = SlidesService()
1097
+ service.insert_sheets_chart(
1098
+ presentation_id=presentation_id,
1099
+ page_object_id=page_object_id,
1100
+ spreadsheet_id=spreadsheet_id,
1101
+ chart_id=chart_id,
1102
+ x=x,
1103
+ y=y,
1104
+ width=width,
1105
+ height=height,
1106
+ linking_mode=linking_mode,
1107
+ )