Skip to main content

spatio_sdk/models/
workspace.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/// Workspace : A workspace within an organization. Returned in list responses (`GET /v1/workspaces`, `GET /v1/organizations/{id}/workspaces`) and the single-get response (`GET /v1/workspaces/{id}`, wrapped in `{workspace: ...}`).  `settings` shape varies by endpoint — sometimes a JSON object, sometimes a JSON-encoded string. Treat as opaque. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Workspace {
17    #[serde(rename = "id")]
18    pub id: String,
19    #[serde(rename = "name")]
20    pub name: String,
21    #[serde(rename = "slug")]
22    pub slug: String,
23    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub description: Option<Option<String>>,
25    #[serde(rename = "logoUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub logo_url: Option<Option<String>>,
27    #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")]
28    pub organization_id: Option<String>,
29    #[serde(rename = "organization", skip_serializing_if = "Option::is_none")]
30    pub organization: Option<Box<models::WorkspaceOrganization>>,
31    /// The caller's role in this workspace (`owner`, `admin`, `member`, `guest`).
32    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
33    pub role: Option<String>,
34    /// Per-workspace settings. Currently emitted as either an object (`{language, timezone, ...}`) on `GET /v1/workspaces/{id}` or a JSON-encoded string on `GET /v1/organizations/{id}/workspaces`. Treat as opaque and parse defensively. 
35    #[serde(rename = "settings", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub settings: Option<Option<serde_json::Value>>,
37    #[serde(rename = "isDefault", skip_serializing_if = "Option::is_none")]
38    pub is_default: Option<bool>,
39    #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")]
40    pub member_count: Option<i32>,
41    #[serde(rename = "billingTier", skip_serializing_if = "Option::is_none")]
42    pub billing_tier: Option<String>,
43    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
44    pub created_at: Option<chrono::DateTime<chrono::FixedOffset>>,
45    #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
46    pub updated_at: Option<chrono::DateTime<chrono::FixedOffset>>,
47}
48
49impl Workspace {
50    /// A workspace within an organization. Returned in list responses (`GET /v1/workspaces`, `GET /v1/organizations/{id}/workspaces`) and the single-get response (`GET /v1/workspaces/{id}`, wrapped in `{workspace: ...}`).  `settings` shape varies by endpoint — sometimes a JSON object, sometimes a JSON-encoded string. Treat as opaque. 
51    pub fn new(id: String, name: String, slug: String) -> Workspace {
52        Workspace {
53            id,
54            name,
55            slug,
56            description: None,
57            logo_url: None,
58            organization_id: None,
59            organization: None,
60            role: None,
61            settings: None,
62            is_default: None,
63            member_count: None,
64            billing_tier: None,
65            created_at: None,
66            updated_at: None,
67        }
68    }
69}
70