Skip to main content

spatio_sdk/models/
task.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/// Task : A to-do / reminder / issue. Tasks belong to one connected account (`accountId` + `provider`). Native tasks store in Spatio's DB; external providers (Linear, GitHub Issues, Todoist, etc.) round-trip through Spatio. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Task {
17    #[serde(rename = "id")]
18    pub id: String,
19    /// Registered provider id (e.g. `native-tasks`, `linear`).
20    #[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
21    pub provider: Option<String>,
22    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
23    pub account_id: Option<String>,
24    #[serde(rename = "ownerUserId", skip_serializing_if = "Option::is_none")]
25    pub owner_user_id: Option<String>,
26    #[serde(rename = "title")]
27    pub title: String,
28    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
29    pub description: Option<String>,
30    /// Free-form status string. Canonical values across most providers: `todo`, `in_progress`, `in_review`, `backlog`, `done`. The platform falls back to `done` when `completed` is true and `status` is empty, else `todo`. 
31    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
32    pub status: Option<String>,
33    #[serde(rename = "completed")]
34    pub completed: bool,
35    #[serde(rename = "dueDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub due_date: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
37    /// Priority bucket. Canonical values (mapped from a 0–4 integer): `none`, `low`, `medium`, `high`, `urgent`. 
38    #[serde(rename = "priority")]
39    pub priority: Priority,
40    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
41    pub labels: Option<Vec<String>>,
42    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
43    pub tags: Option<Vec<String>>,
44    #[serde(rename = "assigneeId", skip_serializing_if = "Option::is_none")]
45    pub assignee_id: Option<String>,
46    #[serde(rename = "createdAt")]
47    pub created_at: chrono::DateTime<chrono::FixedOffset>,
48    #[serde(rename = "updatedAt")]
49    pub updated_at: chrono::DateTime<chrono::FixedOffset>,
50    #[serde(rename = "completedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
51    pub completed_at: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
52    /// Parent task id when this is a subtask.
53    #[serde(rename = "parentTaskId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
54    pub parent_task_id: Option<Option<String>>,
55    /// Provider-specific extras.
56    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
57    pub metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
58    /// Discriminator. Canonical values: `todo`, `reminder`, `issue`. Empty defaults to `todo`. 
59    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
60    pub r#type: Option<String>,
61    /// When this task was auto-generated from another artifact (e.g. a calendar event reminder), the platform id of that artifact. 
62    #[serde(rename = "sourcePlatform", skip_serializing_if = "Option::is_none")]
63    pub source_platform: Option<String>,
64    /// Source artifact id paired with `sourcePlatform`.
65    #[serde(rename = "sourceId", skip_serializing_if = "Option::is_none")]
66    pub source_id: Option<String>,
67}
68
69impl Task {
70    /// A to-do / reminder / issue. Tasks belong to one connected account (`accountId` + `provider`). Native tasks store in Spatio's DB; external providers (Linear, GitHub Issues, Todoist, etc.) round-trip through Spatio. 
71    pub fn new(id: String, title: String, completed: bool, priority: Priority, created_at: chrono::DateTime<chrono::FixedOffset>, updated_at: chrono::DateTime<chrono::FixedOffset>) -> Task {
72        Task {
73            id,
74            provider: None,
75            account_id: None,
76            owner_user_id: None,
77            title,
78            description: None,
79            status: None,
80            completed,
81            due_date: None,
82            priority,
83            labels: None,
84            tags: None,
85            assignee_id: None,
86            created_at,
87            updated_at,
88            completed_at: None,
89            parent_task_id: None,
90            metadata: None,
91            r#type: None,
92            source_platform: None,
93            source_id: None,
94        }
95    }
96}
97/// Priority bucket. Canonical values (mapped from a 0–4 integer): `none`, `low`, `medium`, `high`, `urgent`. 
98#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
99pub enum Priority {
100    #[serde(rename = "none")]
101    None,
102    #[serde(rename = "low")]
103    Low,
104    #[serde(rename = "medium")]
105    Medium,
106    #[serde(rename = "high")]
107    High,
108    #[serde(rename = "urgent")]
109    Urgent,
110}
111
112impl Default for Priority {
113    fn default() -> Priority {
114        Self::None
115    }
116}
117