Google Slides API v1 bindings: read a presentation as slide text and speaker notes, create decks and text slides, fill {{placeholder}} templates, fetch page thumbnails, and run batchUpdate with builders for slides, shapes, images, tables, text and styles. Credentials and scopes come from google-core.

Namespaces

  • ::google::slides::presentations - get, create, batch-update, pages, thumbnails, outline, add-text-slide, replace-text, fill-template
  • ::google::slides::requests - pure builders for batchUpdate requests
  • ::google::slides::content - pure readers over a fetched presentation: slide titles, text, speaker notes, placeholders

Every function that calls the API has an options arity taking an opts Map. Slides parameters use the API's own names (fields, writeControl); credential keys (token, refresh-token, service-account, subject, scopes, retry) are handled by google-core and override context for that call.

Quick start

::decks ::google::slides::presentations

deck ::decks/create-presentation("Q3 review")
::decks/add-text-slide(deck.presentationId, "Highlights", "Revenue up 12%")
::decks/outline(deck.presentationId)

Values

API_ROOT

API_ROOT: Str "https://slides.googleapis.com"

FILE_SCOPE

FILE_SCOPE: Str "https://www.googleapis.com/auth/drive.file"

READ_SCOPE

READ_SCOPE: Str "https://www.googleapis.com/auth/presentations.readonly"

SCOPE

SCOPE: Str "https://www.googleapis.com/auth/presentations"

Functions

add-text-slide alias of ::google::slides::presentations/add-text-slide

fn (presentation-id: Str, title: Str, body: Str): Map
fn (presentation-id: Str, title: Str, body: Str, opts: Map): Map

Add a title-and-body slide, at the end unless opts.insertionIndex. Returns {slide, title, body}, the new object ids, for further edits. Scope: presentations (or drive.file).

Example

ids ::google::slides::presentations/add-text-slide("1AbCdEf", "Highlights", "Revenue up 12%")
ids.body

// As the second slide
::google::slides::presentations/add-text-slide("1AbCdEf", "Agenda", "Intro\nDemo", {insertionIndex: 1})

api-root

fn (): Str

The API root, https://slides.googleapis.com unless the google.slides.api-root context variable points at a proxy or emulator.

Example

::google::slides/api-root()  // "https://slides.googleapis.com"
Context Vars: google.slides.api-root

batch-update alias of ::google::slides::presentations/batch-update

fn (presentation-id: Str, requests: Vec): Map
fn (presentation-id: Str, requests: Vec, opts: Map): Map

POST /{id}:batchUpdate - apply a Vec of requests atomically, in order: if one is invalid, none apply. Returns {presentationId, replies, writeControl}. Later requests can use object ids chosen in earlier ones. ::google::slides::requests builds requests; any request as a plain Map works too. Scope: presentations (or drive.file).

Example

::req ::google::slides::requests

reply ::google::slides::presentations/batch-update("1AbCdEf", [
  ::req/replace-all-text("2025", "2026"),
  ::req/delete-object("old_slide")
])
reply.replies[0].replaceAllText.occurrencesChanged

// Fails instead of applying if someone edited the deck first
::google::slides::presentations/batch-update("1AbCdEf", [::req/delete-object("old_slide")], {
  writeControl: {requiredRevisionId: "AOV_f4..."}
})

compact

fn (body: Map): Map

Drop null values from a request body (Slides bodies never carry JSON null for unset fields).

Example

::google::slides/compact({title: "Q3 review", locale: null})  // {title: "Q3 review"}

create-presentation alias of ::google::slides::presentations/create-presentation

fn (title: Str): Map
fn (title: Str, opts: Map): Map

POST /v1/presentations - create a presentation with one title slide. Returns the resource with presentationId. It lands in the authenticated user's My Drive root (move it with google-drive's move-file); a service account without domain-wide delegation owns it alone, so share it before anyone else can open it. Scope: presentations (or drive.file).

Example

deck ::google::slides::presentations/create-presentation("Q3 review")
deck.presentationId

// Choose the id
::google::slides::presentations/create-presentation("Q3 review", {presentationId: "q3-review-2026"})

creds

fn (opts: Map): Map

The google-core part of opts (credentials, scopes, retry), passed through to ::google::api.

Example

::google::slides/creds({token: "ya29.abc", fields: "title"})  // {token: "ya29.abc"}

encode-id

fn (id: Str): Str

URL-encode a presentation or page id for a path segment.

Example

::google::slides/encode-id("a/b")  // "a%2Fb"

fill-template alias of ::google::slides::presentations/fill-template

fn (presentation-id: Str, values: Map): Map
fn (presentation-id: Str, values: Map, opts: Map): Map

Replace each {{key}} in the presentation with its value from values (values are converted with Str; null values are skipped). The usual template flow is google-drive's copy-file, then this on the copy. Scope: presentations (or drive.file).

Example

// The deck contains {{name}} and {{quarter}}
reply ::google::slides::presentations/fill-template("1AbCdEf", {name: "Ada", quarter: "Q3"})
length(reply.replies)

// Only on one slide
::google::slides::presentations/fill-template("1AbCdEf", {name: "Ada"}, {pageObjectIds: ["p1"]})

get-presentation alias of ::google::slides::presentations/get-presentation

fn (presentation-id: Str): Map
fn (presentation-id: Str, opts: Map): Map

GET /{id} - the presentation: presentationId, title, pageSize, slides, masters, layouts, revisionId. Pass fields to trim the response. Scope: presentations.readonly.

Example

deck ::google::slides::presentations/get-presentation("1AbCdEf")
length(deck.slides)

// Only the fields you need
::google::slides::presentations/get-presentation("1AbCdEf", {fields: "title,slides.objectId"})

json

fn (scope: Str, method: Str, full-url: Str, body: Any, opts: Map): Any

::google::api/json with this package's conventions: credential opts and a JSON (or empty) body.

Example

// Package internals: prefer the functions in ::google::slides::presentations
::google::slides/json(::google::slides/READ_SCOPE, "GET", ::google::slides/url("/abc"), "", {})

outline alias of ::google::slides::presentations/outline

fn (presentation-id: Str): Vec
fn (presentation-id: Str, opts: Map): Vec

Every slide as {id, title, text, notes}; see ::google::slides::content/outline. Scope: presentations.readonly.

Example

slides ::google::slides::presentations/outline("1AbCdEf")
map(slides, %.title)

// With an explicit token
::google::slides::presentations/outline("1AbCdEf", {token: "ya29.abc"})

query-params

fn (defaults: Map, opts: Map): Map
fn (defaults: Map, opts: Map, local-keys: Vec): Map

Build a call's query parameters: defaults, overridden by the Slides parameters in opts (credential keys and the function's own local-keys are removed), with nulls dropped. Pass a key as null in opts to drop a default.

Example

::google::slides/query-params({fields: "title"}, {token: "ya29.abc", fields: "slides"})
// {fields: "slides"}

// Null in opts drops a default
::google::slides/query-params({fields: "title"}, {fields: null})  // {}

// local-keys are removed too
::google::slides/query-params({}, {fields: "title", insertionIndex: 1}, ["insertionIndex"])
// {fields: "title"}

replace-text alias of ::google::slides::presentations/replace-text

fn (presentation-id: Str, search: Str, replacement: Str): Map
fn (presentation-id: Str, search: Str, replacement: Str, opts: Map): Map

Replace every occurrence of search with replacement, on every page unless {pageObjectIds: [...]}. Case-sensitive unless {matchCase: false}. The reply's replaceAllText.occurrencesChanged is the count. Scope: presentations (or drive.file).

Example

reply ::google::slides::presentations/replace-text("1AbCdEf", "2025", "2026")
reply.replies[0].replaceAllText.occurrencesChanged

// Case-insensitive, on one slide
::google::slides::presentations/replace-text("1AbCdEf", "acme", "Hot", {matchCase: false, pageObjectIds: ["p1"]})

url

fn (path: Str): Str
fn (path: Str, params: Map): Str

A Slides v1 URL: /v1/presentations + path with non-null params. url("/abc:batchUpdate").

Example

::google::slides/url("/abc:batchUpdate")
// "https://slides.googleapis.com/v1/presentations/abc:batchUpdate"

::google::slides/url("/abc", {fields: "title"})
// "https://slides.googleapis.com/v1/presentations/abc?fields=title"