Pure builders for presentations.batchUpdate requests. Each returns
one request Map; pass a Vec of them to
::google::slides::presentations/batch-update, which applies them
atomically in order.
Object ids you choose must be 5 to 50 characters; new-object-id
makes one. Positions and sizes are frames in points, {x, y, width, height}; a default slide is 720 by 405 points.
::req ::google::slides::requests
slide ::req/new-object-id()
box ::req/new-object-id()
::google::slides::presentations/batch-update("1AbCdEf", [
::req/create-slide("BLANK", {objectId: slide}),
::req/create-text-box(box, slide, {x: 40, y: 40, width: 400, height: 80}),
::req/insert-text(box, "Hello"),
::req/bold(box)
])
Values
BULLET_DISC
BULLET_DISC: Str "BULLET_DISC_CIRCLE_SQUARE"
NUMBERED
NUMBERED: Str "NUMBERED_DIGIT_ALPHA_ROMAN"
Functions
background
fn (page-id: Str, color: Map): Map
updatePageProperties: a solid page background from an RgbColor.
Example
req ::google::slides::requests/background("p1", ::google::slides::requests/rgb(255, 255, 255))
req.updatePageProperties.fields // "pageBackgroundFill.solidFill.color"
bold
fn (object-id: Str): Map
fn (object-id: Str, opts: Map): Map
Make a shape's text bold.
Example
::google::slides::requests/bold("box1").updateTextStyle.style // {bold: true}
// One table cell
::google::slides::requests/bold("t1", {rowIndex: 0, columnIndex: 1}).updateTextStyle.cellLocation // {rowIndex: 0, columnIndex: 1}
bullets
fn (object-id: Str): Map
fn (object-id: Str, preset: Str): Map
fn (object-id: Str, preset: Str, opts: Map): Map
createParagraphBullets on a shape's paragraphs. preset defaults to
BULLET_DISC_CIRCLE_SQUARE; NUMBERED holds the usual numbered preset.
Example
::google::slides::requests/bullets("box1").createParagraphBullets.bulletPreset // "BULLET_DISC_CIRCLE_SQUARE"
::google::slides::requests/bullets("box1", ::google::slides::requests/NUMBERED).createParagraphBullets.bulletPreset // "NUMBERED_DIGIT_ALPHA_ROMAN"
cell-location
fn (row: Int, column: Int): Map
A TableCellLocation, 0-based.
Example
::google::slides::requests/cell-location(1, 2) // {rowIndex: 1, columnIndex: 2}
create-image
fn (object-id: Str, url: Str, page-id: Str, frame: Map): Map
createImage from a public URL (PNG, JPEG or GIF under 50 MB, at most
25 megapixels) on page-id at a frame.
Example
frame {x: 10, y: 20, width: 300, height: 40}
req ::google::slides::requests/create-image("img1", "https://example.com/logo.png", "p1", frame)
req.createImage.url // "https://example.com/logo.png"
create-shape
fn (object-id: Str, shape-type: Str, page-id: Str, frame: Map): Map
createShape of shape-type (TEXT_BOX, RECTANGLE,
ROUND_RECTANGLE, ELLIPSE, ARROW_EAST, ...) on page-id at a
frame.
Example
frame {x: 10, y: 20, width: 300, height: 40}
req ::google::slides::requests/create-shape("shape1", "RECTANGLE", "p1", frame)
req.createShape.shapeType // "RECTANGLE"
req.createShape.elementProperties.pageObjectId // "p1"
create-slide
fn (): Map
fn (layout: Str): Map
fn (layout: Str, opts: Map): Map
createSlide. layout is a predefined layout (BLANK, TITLE,
TITLE_AND_BODY, TITLE_AND_TWO_COLUMNS, TITLE_ONLY,
SECTION_HEADER, ONE_COLUMN_TEXT, MAIN_POINT, BIG_NUMBER, ...).
Options: objectId, insertionIndex, placeholders (from
placeholder) and layoutId (a layout in this deck, used instead of
layout).
Example
::google::slides::requests/create-slide() // {createSlide: {slideLayoutReference: {predefinedLayout: "BLANK"}}}
req ::google::slides::requests/create-slide("TITLE", {objectId: "slide1", insertionIndex: 1})
req.createSlide.insertionIndex // 1
// A layout from this deck
::google::slides::requests/create-slide("BLANK", {layoutId: "L1"}).createSlide.slideLayoutReference // {layoutId: "L1"}
create-table
fn (object-id: Str, page-id: Str, rows: Int, columns: Int): Map
fn (object-id: Str, page-id: Str, rows: Int, columns: Int, frame: Map): Map
createTable on page-id, centered at the default size unless a
frame is given.
Example
::google::slides::requests/create-table("t1", "p1", 2, 3)
// {createTable: {objectId: "t1", elementProperties: {pageObjectId: "p1"}, rows: 2, columns: 3}}
// Placed at a frame
sized ::google::slides::requests/create-table("t1", "p1", 2, 3, {x: 10, y: 20, width: 300, height: 90})
sized.createTable.elementProperties.transform.translateY // 20
create-text-box
fn (object-id: Str, page-id: Str, frame: Map): Map
createShape of a TEXT_BOX.
Example
frame {x: 10, y: 20, width: 300, height: 40}
::google::slides::requests/create-text-box("box1", "p1", frame).createShape.shapeType // "TEXT_BOX"
delete-object
fn (object-id: Str): Map
deleteObject: a slide or a page element.
Example
::google::slides::requests/delete-object("s1") // {deleteObject: {objectId: "s1"}}
delete-text
fn (object-id: Str): Map
fn (object-id: Str, opts: Map): Map
deleteText: all of it, or opts.textRange (from text-range).
opts.rowIndex and opts.columnIndex address a table cell.
Example
::google::slides::requests/delete-text("box1") // {deleteText: {objectId: "box1", textRange: {type: "ALL"}}}
req ::google::slides::requests/delete-text("box1", {textRange: ::google::slides::requests/text-range(0, 5)})
req.deleteText.textRange.endIndex // 5
duplicate-object
fn (object-id: Str): Map
fn (object-id: Str, id-map: Map): Map
duplicateObject: a slide or a page element. id-map chooses ids for
the copies, keyed by original id.
Example
::google::slides::requests/duplicate-object("s1") // {duplicateObject: {objectId: "s1"}}
::google::slides::requests/duplicate-object("s1", {s1: "copy1"}) // {duplicateObject: {objectId: "s1", objectIds: {s1: "copy1"}}}
element-properties
fn (page-id: Str, frame: Map): Map
PageElementProperties placing an element on page-id at a frame,
{x, y, width, height} in points.
Example
frame {x: 10, y: 20, width: 300, height: 40}
props ::google::slides::requests/element-properties("p1", frame)
props.size.width // {magnitude: 300, unit: "PT"}
props.transform // {scaleX: 1, scaleY: 1, translateX: 10, translateY: 20, unit: "PT"}
field-mask
fn (style: Map): Str
A style's top-level keys as a field mask, so only the fields you pass change.
Example
::google::slides::requests/field-mask({bold: true, italic: false}) // "bold,italic"
fill-template
fn (values: Map): Vec
fn (values: Map, opts: Map): Vec
One replaceAllText per entry of values, replacing {{key}} with the
value as text. Null values are skipped.
Example
requests ::google::slides::requests/fill-template({name: "Ada", skip: null})
length(requests) // 1
requests[0].replaceAllText.containsText.text // "{{name}}"
requests[0].replaceAllText.replaceText // "Ada"
font-size
fn (object-id: Str, size: Int | Dec): Map
fn (object-id: Str, size: Int | Dec, opts: Map): Map
Set a shape's font size in points.
Example
::google::slides::requests/font-size("box1", 18).updateTextStyle.style.fontSize // {magnitude: 18, unit: "PT"}
::google::slides::requests/font-size("box1", 18).updateTextStyle.fields // "fontSize"
hex-color
fn (hex: Str): Map
A Slides RgbColor from a hex string ("#1a73e8" or "1a73e8"); an
Err for anything else.
Example
::google::slides::requests/hex-color("#ff0000") // {red: 1.0, green: 0.0, blue: 0.0}
is-err(::google::slides::requests/hex-color("red")) // true
insert-text
fn (object-id: Str, text: Str): Map
fn (object-id: Str, text: Str, opts: Map): Map
insertText into a shape, or a table cell with opts.rowIndex and
opts.columnIndex. opts.insertionIndex picks the position (default
0).
Example
::google::slides::requests/insert-text("box1", "Hello") // {insertText: {objectId: "box1", text: "Hello"}}
// Into a table cell, at position 3
cell ::google::slides::requests/insert-text("t1", "Hello", {insertionIndex: 3, rowIndex: 1, columnIndex: 2})
cell.insertText.cellLocation // {rowIndex: 1, columnIndex: 2}
move-slides
fn (slide-ids: Vec, insertion-index: Int): Map
updateSlidesPosition: move slides, keeping their relative order, to
before the slide at insertion-index.
Example
::google::slides::requests/move-slides(["s2", "s3"], 0)
// {updateSlidesPosition: {slideObjectIds: ["s2", "s3"], insertionIndex: 0}}
new-object-id
fn (): Str
A fresh object id for objectId fields.
Example
starts-with(::google::slides::requests/new-object-id(), "hot_") // true
length(::google::slides::requests/new-object-id()) // 36
optional-color
fn (color: Map): Map
An OptionalColor wrapping an RgbColor, for foregroundColor and
backgroundColor.
Example
::google::slides::requests/optional-color(::google::slides::requests/rgb(0, 0, 255))
// {opaqueColor: {rgbColor: {red: 0.0, green: 0.0, blue: 1.0}}}
paragraph-style
fn (object-id: Str, style: Map): Map
fn (object-id: Str, style: Map, opts: Map): Map
updateParagraphStyle with any ParagraphStyle (alignment,
lineSpacing, spaceAbove, ...). The field mask is the keys you pass.
Example
req ::google::slides::requests/paragraph-style("box1", {alignment: "CENTER"})
req.updateParagraphStyle.style // {alignment: "CENTER"}
req.updateParagraphStyle.fields // "alignment"
placeholder
fn (kind: Str, index: Int, object-id: Str): Map
A LayoutPlaceholderIdMapping for create-slide: give the layout's
placeholder of kind and index the id object-id.
Example
::google::slides::requests/placeholder("TITLE", 0, "title1")
// {layoutPlaceholder: {type: "TITLE", index: 0}, objectId: "title1"}
points
fn (value: Int | Dec): Map
A Dimension in points.
Example
::google::slides::requests/points(18) // {magnitude: 18, unit: "PT"}
replace-all-text
fn (search: Str, replacement: Str): Map
fn (search: Str, replacement: Str, opts: Map): Map
replaceAllText: every occurrence, on every page unless
opts.pageObjectIds. Case-sensitive unless opts.matchCase is false.
Example
::google::slides::requests/replace-all-text("2025", "2026")
// {replaceAllText: {replaceText: "2026", containsText: {text: "2025", matchCase: true}}}
req ::google::slides::requests/replace-all-text("acme", "Hot", {matchCase: false, pageObjectIds: ["p1"]})
req.replaceAllText.pageObjectIds // ["p1"]
replace-shapes-with-image
fn (search: Str, image-url: Str): Map
fn (search: Str, image-url: Str, opts: Map): Map
replaceAllShapesWithImage: swap every shape containing search for
the image at a public URL, on every page unless opts.pageObjectIds.
opts.imageReplaceMethod is CENTER_INSIDE (default) or CENTER_CROP.
Example
req ::google::slides::requests/replace-shapes-with-image("{{logo}}", "https://example.com/logo.png")
req.replaceAllShapesWithImage.imageReplaceMethod // "CENTER_INSIDE"
crop ::google::slides::requests/replace-shapes-with-image("{{logo}}", "https://example.com/logo.png", {imageReplaceMethod: "CENTER_CROP"})
crop.replaceAllShapesWithImage.imageReplaceMethod // "CENTER_CROP"
rgb
fn (red: Int, green: Int, blue: Int): Map
A Slides RgbColor from 0-255 channels.
Example
::google::slides::requests/rgb(255, 0, 0) // {red: 1.0, green: 0.0, blue: 0.0}
text-color
fn (object-id: Str, color: Map): Map
fn (object-id: Str, color: Map, opts: Map): Map
Set a shape's text color from an RgbColor (rgb or hex-color).
Example
req ::google::slides::requests/text-color("box1", ::google::slides::requests/hex-color("#ff0000"))
req.updateTextStyle.style.foregroundColor.opaqueColor.rgbColor // {red: 1.0, green: 0.0, blue: 0.0}
text-range
fn (): Map
fn (start: Int, end: Int): Map
A text Range: ALL by default, or start inclusive to end
exclusive.
Example
::google::slides::requests/text-range() // {type: "ALL"}
::google::slides::requests/text-range(0, 5) // {type: "FIXED_RANGE", startIndex: 0, endIndex: 5}
text-style
fn (object-id: Str, style: Map): Map
fn (object-id: Str, style: Map, opts: Map): Map
updateTextStyle with any TextStyle (bold, italic, underline,
fontSize, fontFamily, foregroundColor, link, ...). The field
mask is the keys you pass. Applies to all the text unless
opts.textRange; opts.rowIndex and opts.columnIndex address a table
cell.
Example
req ::google::slides::requests/text-style("box1", {italic: true, underline: true})
req.updateTextStyle.fields // "italic,underline"
// Only the first five characters
part ::google::slides::requests/text-style("box1", {italic: true}, {textRange: ::google::slides::requests/text-range(0, 5)})
part.updateTextStyle.textRange.endIndex // 5