Types
All types are in roam_sdk::types (re-exported from roam_sdk::api::types).
Data structures
Block
A block in the Roam graph. Blocks form a tree via children.
pub struct Block {
pub uid: String,
pub string: String,
pub order: i64,
pub children: Vec<Block>,
pub open: bool,
pub refs: Vec<RefEntity>,
}uid— unique block identifierstring— the block's text content (Roam markdown)order— sort position among siblingschildren— nested child blocks (recursive tree)open— whether children are expanded or collapsedrefs— page/block references contained in this block (not serialized to JSON)
RefEntity
A reference target found in a block.
DailyNote
A daily note page with its blocks.
Parse from a pull response:
Blocks are automatically sorted by order. Nested children are parsed recursively.
LinkedRefBlock / LinkedRefGroup
Results from a linked references query, grouped by source page.
Parse from a query response:
Self-references (blocks from the current page) are automatically filtered out. Groups are sorted alphabetically by page title, blocks within each group sorted by text.
Write actions
WriteAction
An enum representing mutations to the graph.
Serializes with a "action" tag: "create-block", "update-block", "delete-block", "move-block", "create-page", "batch-actions".
WriteAction implements both Serialize and Deserialize, so you can parse action JSON:
PageCreate
Data for creating a page.
BlockLocation
Where to place a block.
Serializes parent_uid as "parent-uid".
OrderValue
Position within siblings.
Serializes as either a number (0) or a string ("last").
NewBlock
Data for creating a block.
uid and open are omitted from JSON when None.
BlockUpdate
Data for updating a block's text.
BlockRef
A block reference (for delete and move).
API request/response types
PullResponse
The result is a raw JSON value matching the pull selector shape. Use .get(":attribute") to access fields.
QueryResponse
Each inner Vec is a result row. Values correspond to :find variables in order.
Error types
RoamError
Implements std::error::Error and Display. Conversions from reqwest::Error, std::io::Error, serde_json::Error, and toml::de::Error via From.
Result<T>
Last updated
Was this helpful?