102 lines
2.6 KiB
Rust
102 lines
2.6 KiB
Rust
use crate::common::{ActorPayload, AffectedObject, SourcePayload, TargetRef};
|
|||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct CommandEnvelope<T> {
|
||
|
|
pub name: String,
|
||
|
|
pub command_id: String,
|
||
|
|
pub idempotency_key: Option<String>,
|
||
|
|
pub actor: ActorPayload,
|
||
|
|
pub source: SourcePayload,
|
||
|
|
pub target: Option<TargetRef>,
|
||
|
|
pub payload: T,
|
||
|
|
pub reason: Option<String>,
|
||
|
|
pub refs: Vec<String>,
|
||
|
|
pub dry_run: bool,
|
||
|
|
pub validate_only: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct CommandResult {
|
||
|
|
pub ok: bool,
|
||
|
|
pub command_id: String,
|
||
|
|
pub event_ids: Vec<String>,
|
||
|
|
pub affected_objects: Vec<AffectedObject>,
|
||
|
|
pub revision: Option<u64>,
|
||
|
|
pub warnings: Vec<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct CreateWorkspace {
|
||
|
|
pub name: String,
|
||
|
|
pub slug: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct CreatePage {
|
||
|
|
pub title: String,
|
||
|
|
pub parent_page_id: Option<String>,
|
||
|
|
pub position: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct UpdatePageTitle {
|
||
|
|
pub page_id: String,
|
||
|
|
pub title: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct UpdatePageStats {
|
||
|
|
pub page_id: String,
|
||
|
|
pub word_count: i64,
|
||
|
|
pub character_count: i64,
|
||
|
|
pub block_count: i64,
|
||
|
|
pub todo_total: i64,
|
||
|
|
pub todo_done: i64,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct UpdatePageOptions {
|
||
|
|
pub page_id: String,
|
||
|
|
pub wide_layout: Option<bool>,
|
||
|
|
pub small_text: Option<bool>,
|
||
|
|
pub show_heading_numbers: Option<bool>,
|
||
|
|
pub show_toc: Option<bool>,
|
||
|
|
pub show_structure: Option<bool>,
|
||
|
|
pub protect_editing: Option<bool>,
|
||
|
|
pub show_word_count: Option<bool>,
|
||
|
|
pub collapse_backlinks: Option<bool>,
|
||
|
|
pub page_font: Option<String>,
|
||
|
|
pub layout_density: Option<String>,
|
||
|
|
pub hide_child_pages: Option<bool>,
|
||
|
|
pub show_block_ref_count: Option<bool>,
|
||
|
|
pub embed_default_block_id: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct InsertBlock {
|
||
|
|
pub page_id: String,
|
||
|
|
pub block_type: String,
|
||
|
|
pub content: String,
|
||
|
|
pub parent_block_id: Option<String>,
|
||
|
|
pub prev_block_id: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct UpdateBlock {
|
||
|
|
pub block_id: String,
|
||
|
|
pub patch_content: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct MoveBlock {
|
||
|
|
pub block_id: String,
|
||
|
|
pub new_parent_block_id: Option<String>,
|
||
|
|
pub new_page_id: Option<String>,
|
||
|
|
pub prev_block_id: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||
|
|
pub struct DeleteBlock {
|
||
|
|
pub block_id: String,
|
||
|
|
}
|