Skip to main content

spatio_sdk/models/
sheet.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/// Sheet : A spreadsheet. Sheets belong to exactly one connected account (`accountId` + `provider`). The native provider stores sheets in the Spatio database; external providers (Google Sheets, Excel Online, etc.) round-trip through Spatio.  `data` is a free-form bag for provider-specific blobs (cell matrices, formulas, formatting). Clients that walk rows / cells should use the dedicated row + cell endpoints; `data` is only meaningful when round-tripping with an external provider that embeds its native format here. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Sheet {
17    #[serde(rename = "id")]
18    pub id: String,
19    /// Registered provider id (e.g. `native-sheets`).
20    #[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
21    pub provider: Option<String>,
22    /// Connected-account row this sheet belongs to.
23    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
24    pub account_id: Option<String>,
25    /// User id of the sheet owner; non-native providers leave empty.
26    #[serde(rename = "ownerUserId", skip_serializing_if = "Option::is_none")]
27    pub owner_user_id: Option<String>,
28    #[serde(rename = "name")]
29    pub name: String,
30    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub description: Option<Option<String>>,
32    /// Free-form provider blob. Treat as opaque.
33    #[serde(rename = "data", skip_serializing_if = "Option::is_none")]
34    pub data: Option<std::collections::HashMap<String, serde_json::Value>>,
35    #[serde(rename = "rowCount")]
36    pub row_count: i32,
37    #[serde(rename = "columnCount")]
38    pub column_count: i32,
39    /// Tab count when the file contains multiple sheets.
40    #[serde(rename = "sheetCount")]
41    pub sheet_count: i32,
42    #[serde(rename = "isPublic")]
43    pub is_public: bool,
44    #[serde(rename = "isReadOnly")]
45    pub is_read_only: bool,
46    #[serde(rename = "fileSize", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
47    pub file_size: Option<Option<i32>>,
48    #[serde(rename = "lastAccessedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub last_accessed_at: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
50    #[serde(rename = "createdAt")]
51    pub created_at: chrono::DateTime<chrono::FixedOffset>,
52    #[serde(rename = "updatedAt")]
53    pub updated_at: chrono::DateTime<chrono::FixedOffset>,
54}
55
56impl Sheet {
57    /// A spreadsheet. Sheets belong to exactly one connected account (`accountId` + `provider`). The native provider stores sheets in the Spatio database; external providers (Google Sheets, Excel Online, etc.) round-trip through Spatio.  `data` is a free-form bag for provider-specific blobs (cell matrices, formulas, formatting). Clients that walk rows / cells should use the dedicated row + cell endpoints; `data` is only meaningful when round-tripping with an external provider that embeds its native format here. 
58    pub fn new(id: String, name: String, row_count: i32, column_count: i32, sheet_count: i32, is_public: bool, is_read_only: bool, created_at: chrono::DateTime<chrono::FixedOffset>, updated_at: chrono::DateTime<chrono::FixedOffset>) -> Sheet {
59        Sheet {
60            id,
61            provider: None,
62            account_id: None,
63            owner_user_id: None,
64            name,
65            description: None,
66            data: None,
67            row_count,
68            column_count,
69            sheet_count,
70            is_public,
71            is_read_only,
72            file_size: None,
73            last_accessed_at: None,
74            created_at,
75            updated_at,
76        }
77    }
78}
79