/*
* SpatioAPI
*
* 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.
*
* The version of the OpenAPI document: v1
* Contact: hello@spatio.app
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Note : A markdown note. Notes belong to exactly one connected account (`accountId` + `provider`). The native provider stores notes in the Spatio database; external providers (Notion, Google Keep, etc.) store them upstream and round-trip through Spatio.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Note {
/// Stable provider id for the note.
#[serde(rename = "id")]
pub id: String,
/// Registered provider id (e.g. `native-notes`).
#[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
pub provider: Option<String>,
/// Connected-account row this note belongs to.
#[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
/// User id of the note's owner. Surfaced so the renderer can show \"Shared with you\" when `ownerUserId` differs from the viewer's id. Empty for non-native providers.
#[serde(rename = "ownerUserId", skip_serializing_if = "Option::is_none")]
pub owner_user_id: Option<String>,
#[serde(rename = "title")]
pub title: String,
/// Markdown body. The block tree at `/v1/notes/{id}/blocks` is the canonical structured representation; `content` is a flattened markdown view kept for clients that don't render blocks.
#[serde(rename = "content")]
pub content: String,
/// Emoji or short string used as the note's icon.
#[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
pub icon: Option<String>,
/// URL of the note's cover image.
#[serde(rename = "coverImage", skip_serializing_if = "Option::is_none")]
pub cover_image: Option<String>,
/// Parent note id when notes are nested.
#[serde(rename = "parentId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub parent_id: Option<Option<String>>,
/// Free-form provider-specific properties (tags, etc.).
#[serde(rename = "properties", skip_serializing_if = "Option::is_none")]
pub properties: Option<std::collections::HashMap<String, serde_json::Value>>,
#[serde(rename = "archived")]
pub archived: bool,
#[serde(rename = "createdAt")]
pub created_at: chrono::DateTime<chrono::FixedOffset>,
#[serde(rename = "updatedAt")]
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
/// User id of the most recent editor.
#[serde(rename = "lastEditedBy", skip_serializing_if = "Option::is_none")]
pub last_edited_by: Option<String>,
}
impl Note {
/// A markdown note. Notes belong to exactly one connected account (`accountId` + `provider`). The native provider stores notes in the Spatio database; external providers (Notion, Google Keep, etc.) store them upstream and round-trip through Spatio.
pub fn new(id: String, title: String, content: String, archived: bool, created_at: chrono::DateTime<chrono::FixedOffset>, updated_at: chrono::DateTime<chrono::FixedOffset>) -> Note {
Note {
id,
provider: None,
account_id: None,
owner_user_id: None,
title,
content,
icon: None,
cover_image: None,
parent_id: None,
properties: None,
archived,
created_at,
updated_at,
last_edited_by: None,
}
}
}