Skip to main content

spatio_sdk/models/
block_content.rs

1/*
2 * SpatioAPI
3 *
4 * The REST API that owns every resource in your Spatio workspace: notes, sheets, slides, tasks, calendar events, mail, chat, files, and contacts. SpatioMCP wraps this API; Spatio Desktop reads from it. You can call it directly from your own code.  All requests must be authenticated with a Personal Access Token (`Authorization: Bearer pat_...`) or an OAuth 2.1 access token, and use HTTPS.  Official SDKs (MIT, generated from this spec on every release):  - TypeScript: https://github.com/spatio-labs/spatio-ts (`npm install @spatio-labs/spatio-ts`) - Python: https://github.com/spatio-labs/spatio-py (`pip install spatio-sdk`) - Go: https://github.com/spatio-labs/spatio-go (`go get github.com/spatio-labs/spatio-go`)  This specification is generated from the platform-service Go source on every push to `main`. The spec, not hand-written documentation, is the source of truth: server stubs and SDKs are generated from it, and any drift between the spec and the running service fails CI. 
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: hello@spatio.app
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// BlockContent : Type-specific payload for a block. Fields populated depend on `Block.type`. All fields are optional at the schema level; the runtime enforces the per-type contract.  Note: this object uses snake_case keys to match the JSON the Go `providers.BlockContent` struct emits and accepts. Other parts of the SpatioAPI use camelCase; blocks are the exception because the block model is shared with external Notion-like providers whose canonical wire format is snake_case. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BlockContent {
17    #[serde(rename = "rich_text", skip_serializing_if = "Option::is_none")]
18    pub rich_text: Option<Vec<models::RichTextObject>>,
19    /// Programming language for `code` blocks.
20    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
21    pub language: Option<String>,
22    /// Toggle state for `to_do` blocks.
23    #[serde(rename = "checked", skip_serializing_if = "Option::is_none")]
24    pub checked: Option<bool>,
25    /// Emoji or short string for `callout` blocks.
26    #[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
27    pub icon: Option<String>,
28    /// Theme color for `callout` blocks.
29    #[serde(rename = "color", skip_serializing_if = "Option::is_none")]
30    pub color: Option<String>,
31    /// Source URL for `image`, `video`, `file` blocks.
32    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
33    pub url: Option<String>,
34    /// Visible caption for media blocks.
35    #[serde(rename = "caption", skip_serializing_if = "Option::is_none")]
36    pub caption: Option<String>,
37    /// Screen-reader description for media blocks. Distinct from `caption` (visible to readers) — required for accessible notes when the image conveys meaning. 
38    #[serde(rename = "alt_text", skip_serializing_if = "Option::is_none")]
39    pub alt_text: Option<String>,
40    /// Source URL for `embed` blocks.
41    #[serde(rename = "embed_url", skip_serializing_if = "Option::is_none")]
42    pub embed_url: Option<String>,
43    /// 2D rich-text grid for `table` and `table_row` blocks.
44    #[serde(rename = "cells", skip_serializing_if = "Option::is_none")]
45    pub cells: Option<Vec<Vec<models::RichTextObject>>>,
46    /// TeX/MathJax expression for `equation` blocks.
47    #[serde(rename = "expression", skip_serializing_if = "Option::is_none")]
48    pub expression: Option<String>,
49}
50
51impl BlockContent {
52    /// Type-specific payload for a block. Fields populated depend on `Block.type`. All fields are optional at the schema level; the runtime enforces the per-type contract.  Note: this object uses snake_case keys to match the JSON the Go `providers.BlockContent` struct emits and accepts. Other parts of the SpatioAPI use camelCase; blocks are the exception because the block model is shared with external Notion-like providers whose canonical wire format is snake_case. 
53    pub fn new() -> BlockContent {
54        BlockContent {
55            rich_text: None,
56            language: None,
57            checked: None,
58            icon: None,
59            color: None,
60            url: None,
61            caption: None,
62            alt_text: None,
63            embed_url: None,
64            cells: None,
65            expression: None,
66        }
67    }
68}
69