# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule Spatio.Api.Slides do
@moduledoc """
API calls for all endpoints tagged `Slides`.
"""
alias Spatio.Connection
import Spatio.RequestBuilder
@doc """
Create a presentation.
Creates a new deck under the target account. Target resolution mirrors `POST /v1/notes` and `/v1/sheets`: body `accountId` → `?accountId=` → body `provider` → `?provider=` → caller's single connected account (errors with `ambiguous_account` otherwise). The new deck is auto-seeded with one blank slide so the renderer has something to display immediately.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `create_presentation_request` (CreatePresentationRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:provider` (String.t): Provider id (e.g. `native-notes`, `notion`). Selects every connected account for the provider. Mutually exclusive with `accountId`.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Presentation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_presentation(Tesla.Env.client, Spatio.Model.CreatePresentationRequest.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.CreateNote400Response.t} | {:ok, Spatio.Model.Presentation.t} | {:error, Tesla.Env.t}
def create_presentation(connection, create_presentation_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:provider => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/slides")
|> add_param(:body, :body, create_presentation_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, Spatio.Model.Presentation},
{400, Spatio.Model.CreateNote400Response},
{401, Spatio.Model.ApiError},
{500, Spatio.Model.ApiError}
])
end
@doc """
Insert a slide.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `create_slide_request` (CreateSlideRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Slide.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_slide(Tesla.Env.client, String.t, Spatio.Model.CreateSlideRequest.t, keyword()) :: {:ok, Spatio.Model.Slide.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_slide(connection, id, create_slide_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/slides/#{id}/slides")
|> add_param(:body, :body, create_slide_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, Spatio.Model.Slide},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Add a canvas element (text/shape/image) to a slide.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `create_slide_element_request` (CreateSlideElementRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SlideElement.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_slide_element(Tesla.Env.client, String.t, String.t, Spatio.Model.CreateSlideElementRequest.t, keyword()) :: {:ok, Spatio.Model.SlideElement.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_slide_element(connection, id, slide_id, create_slide_element_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/slides/#{id}/slides/#{slide_id}/elements")
|> add_param(:body, :body, create_slide_element_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, Spatio.Model.SlideElement},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Delete a presentation.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SuccessFlag.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_presentation(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.SuccessFlag.t} | {:error, Tesla.Env.t}
def delete_presentation(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:delete)
|> url("/v1/slides/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SuccessFlag},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Delete a slide.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SuccessFlag.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_slide(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.SuccessFlag.t} | {:error, Tesla.Env.t}
def delete_slide(connection, id, slide_id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:delete)
|> url("/v1/slides/#{id}/slides/#{slide_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SuccessFlag},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Delete a slide element.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `element_id` (String.t): Slide-element id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SuccessFlag.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_slide_element(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.SuccessFlag.t} | {:error, Tesla.Env.t}
def delete_slide_element(connection, id, slide_id, element_id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:delete)
|> url("/v1/slides/#{id}/slides/#{slide_id}/elements/#{element_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SuccessFlag},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Disable public sharing.
Owner-only. Subsequent public viewer requests 404.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec disable_presentation_share(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def disable_presentation_share(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:delete)
|> url("/v1/slides/#{id}/share")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Enable (or update password on) public sharing.
Owner-only. With `setPassword: false` (or empty body), flips the deck public without changing the password. With `setPassword: true`, applies `password` (empty clears).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
- `:body` (EnableShareRequest):
### Returns
- `{:ok, Spatio.Model.ShareSettings.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec enable_presentation_share(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ShareSettings.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def enable_presentation_share(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/slides/#{id}/share")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.ShareSettings},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Render the presentation as a PDF.
Proxies to the Spatio export sidecar (Playwright). Two response modes selected via `?storage=`: - `stream` (default) — response body is the PDF binary (`application/pdf`). - `r2` — uploads the rendered PDF to R2 storage and returns a JSON envelope with a 24-hour signed URL. Returns `503 Service Unavailable` when the export sidecar is not configured (dev fallback to the client-side exporter).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
- `:storage` (String.t):
- `:filename` (String.t): Sanitized base name for the downloaded PDF.
- `:body` (ExportPdfRequest):
### Returns
- `{:ok, String.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec export_presentation_pdf(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, String.t} | {:error, Tesla.Env.t}
def export_presentation_pdf(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers,
:storage => :query,
:filename => :query,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/slides/#{id}/export/pdf")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{502, Spatio.Model.ApiError},
{503, Spatio.Model.ApiError}
])
end
@doc """
Render the presentation as a PowerPoint (.pptx) file.
Proxies to the Spatio export sidecar (Playwright + pptxgenjs). Each slide is screenshotted at 2× device-pixel ratio and wrapped into a PowerPoint .pptx as a full-bleed image. Visual fidelity is preserved exactly — what renders in Spatio renders identically in PowerPoint, Keynote, Google Slides — at the cost of in-PowerPoint editability of slide content. Users edit slide content back in Spatio (the source of truth), not inside PowerPoint. Two response modes selected via `?storage=`: - `stream` (default) — response body is the PPTX binary (`application/vnd.openxmlformats-officedocument.presentationml.presentation`). - `r2` — uploads the rendered PPTX to R2 storage and returns a JSON envelope with a 24-hour signed URL. Returns `503 Service Unavailable` when the export sidecar is not configured.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
- `:storage` (String.t):
- `:filename` (String.t): Sanitized base name for the downloaded PPTX.
- `:body` (ExportPdfRequest):
### Returns
- `{:ok, String.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec export_presentation_pptx(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, String.t} | {:error, Tesla.Env.t}
def export_presentation_pptx(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers,
:storage => :query,
:filename => :query,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/slides/#{id}/export/pptx")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{502, Spatio.Model.ApiError},
{503, Spatio.Model.ApiError}
])
end
@doc """
Fetch one presentation.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Presentation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_presentation(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.CreateNote400Response.t} | {:ok, Spatio.Model.Presentation.t} | {:error, Tesla.Env.t}
def get_presentation(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/slides/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.Presentation},
{400, Spatio.Model.CreateNote400Response},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Fetch share settings for a presentation.
Owner-only. Mirror of `GET /v1/notes/{id}/share` — same shape, same fields. Returns the current public-share configuration, including the share token and computed public viewer URL when the deck is currently public.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.ShareSettings.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_presentation_share_settings(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ShareSettings.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_presentation_share_settings(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/slides/#{id}/share")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.ShareSettings},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Fetch a publicly shared presentation.
Unauthenticated. Mirror of `GET /public/notes/{token}`. The share token is the credential. For password-protected decks the password is supplied via `?password=`; the response distinguishes \"no password supplied\" from \"wrong password\" so the viewer can render the right prompt. Unknown tokens and disabled-share decks both return `404` to prevent enumeration.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `token` (String.t): Opaque public-share token.
- `opts` (keyword): Optional parameters
- `:password` (String.t): Optional viewer password.
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_public_presentation(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.PasswordRequiredError.t} | {:error, Tesla.Env.t}
def get_public_presentation(connection, token, opts \\ []) do
optional_params = %{
:password => :query
}
request =
%{}
|> method(:get)
|> url("/public/slides/#{token}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.PasswordRequiredError},
{404, Spatio.Model.ApiError},
{500, Spatio.Model.ApiError}
])
end
@doc """
Fetch one slide.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Slide.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_slide(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Spatio.Model.Slide.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_slide(connection, id, slide_id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/slides/#{id}/slides/#{slide_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.Slide},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Fetch one slide element.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `element_id` (String.t): Slide-element id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SlideElement.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_slide_element(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, Spatio.Model.SlideElement.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_slide_element(connection, id, slide_id, element_id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/slides/#{id}/slides/#{slide_id}/elements/#{element_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SlideElement},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
List presentations across connected accounts.
Fan-out list. Returns every presentation visible to the caller across every connected slides provider. Pass `?accountId=` or `?provider=` to scope to a single source.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:provider` (String.t): Provider id (e.g. `native-notes`, `notion`). Selects every connected account for the provider. Mutually exclusive with `accountId`.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
- `:limit` (integer()):
- `:offset` (integer()):
### Returns
- `{:ok, Spatio.Model.PresentationListEnvelope.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_presentations(Tesla.Env.client, keyword()) :: {:ok, Spatio.Model.PresentationListEnvelope.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_presentations(connection, opts \\ []) do
optional_params = %{
:accountId => :query,
:provider => :query,
:"X-Workspace-ID" => :headers,
:limit => :query,
:offset => :query
}
request =
%{}
|> method(:get)
|> url("/v1/slides")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.PresentationListEnvelope},
{401, Spatio.Model.ApiError},
{500, Spatio.Model.ApiError}
])
end
@doc """
List the canvas elements on a slide.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SlideElementList.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_slide_elements(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Spatio.Model.SlideElementList.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_slide_elements(connection, id, slide_id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/slides/#{id}/slides/#{slide_id}/elements")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SlideElementList},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
List slides in a presentation.
Single-account list. Returns slides in the order set by their `position` field.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SlideList.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_slides_in_presentation(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.SlideList.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_slides_in_presentation(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/slides/#{id}/slides")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SlideList},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Rotate the share token, invalidating outstanding URLs.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.ShareSettings.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec rotate_presentation_share_token(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ShareSettings.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def rotate_presentation_share_token(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/slides/#{id}/share/rotate")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.ShareSettings},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Update presentation metadata (partial).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `update_presentation_request` (UpdatePresentationRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Presentation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_presentation(Tesla.Env.client, String.t, Spatio.Model.UpdatePresentationRequest.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.Presentation.t} | {:error, Tesla.Env.t}
def update_presentation(connection, id, update_presentation_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:patch)
|> url("/v1/slides/#{id}")
|> add_param(:body, :body, update_presentation_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.Presentation},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Update a slide (partial).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `update_slide_request` (UpdateSlideRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Slide.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_slide(Tesla.Env.client, String.t, String.t, Spatio.Model.UpdateSlideRequest.t, keyword()) :: {:ok, Spatio.Model.Slide.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def update_slide(connection, id, slide_id, update_slide_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:patch)
|> url("/v1/slides/#{id}/slides/#{slide_id}")
|> add_param(:body, :body, update_slide_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.Slide},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Update a slide element (partial).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Presentation id.
- `slide_id` (String.t): Slide id within the presentation.
- `element_id` (String.t): Slide-element id.
- `update_slide_element_request` (UpdateSlideElementRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SlideElement.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_slide_element(Tesla.Env.client, String.t, String.t, String.t, Spatio.Model.UpdateSlideElementRequest.t, keyword()) :: {:ok, Spatio.Model.SlideElement.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def update_slide_element(connection, id, slide_id, element_id, update_slide_element_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:patch)
|> url("/v1/slides/#{id}/slides/#{slide_id}/elements/#{element_id}")
|> add_param(:body, :body, update_slide_element_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SlideElement},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
end