Skip to main content

spatio_sdk/models/
email.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/// Email : A single email message. The `provider`/`accountId` provenance fields tell clients which connected mail account this row came from (Gmail, Outlook, etc.) so multi-account list responses can be merged sensibly client-side. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Email {
17    #[serde(rename = "id")]
18    pub id: String,
19    #[serde(rename = "threadId", skip_serializing_if = "Option::is_none")]
20    pub thread_id: Option<String>,
21    #[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
22    pub provider: Option<String>,
23    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
24    pub account_id: Option<String>,
25    #[serde(rename = "subject")]
26    pub subject: String,
27    #[serde(rename = "from")]
28    pub from: String,
29    #[serde(rename = "to")]
30    pub to: Vec<String>,
31    #[serde(rename = "cc", skip_serializing_if = "Option::is_none")]
32    pub cc: Option<Vec<String>>,
33    #[serde(rename = "bcc", skip_serializing_if = "Option::is_none")]
34    pub bcc: Option<Vec<String>>,
35    #[serde(rename = "body")]
36    pub body: String,
37    /// `true` when `body` contains HTML, `false` for plain text. 
38    #[serde(rename = "html")]
39    pub html: bool,
40    #[serde(rename = "date")]
41    pub date: chrono::DateTime<chrono::FixedOffset>,
42    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
43    pub labels: Option<Vec<String>>,
44    #[serde(rename = "isRead")]
45    pub is_read: bool,
46    #[serde(rename = "isStarred")]
47    pub is_starred: bool,
48    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")]
49    pub attachments: Option<Vec<models::AttachmentMeta>>,
50    #[serde(rename = "snippet", skip_serializing_if = "Option::is_none")]
51    pub snippet: Option<String>,
52    /// RFC 5322 Message-ID header.
53    #[serde(rename = "messageId", skip_serializing_if = "Option::is_none")]
54    pub message_id: Option<String>,
55    /// RFC 5322 In-Reply-To header — the parent message id this message is a reply to. 
56    #[serde(rename = "inReplyTo", skip_serializing_if = "Option::is_none")]
57    pub in_reply_to: Option<String>,
58    /// RFC 5322 References header (ancestor chain).
59    #[serde(rename = "references", skip_serializing_if = "Option::is_none")]
60    pub references: Option<Vec<String>>,
61}
62
63impl Email {
64    /// A single email message. The `provider`/`accountId` provenance fields tell clients which connected mail account this row came from (Gmail, Outlook, etc.) so multi-account list responses can be merged sensibly client-side. 
65    pub fn new(id: String, subject: String, from: String, to: Vec<String>, body: String, html: bool, date: chrono::DateTime<chrono::FixedOffset>, is_read: bool, is_starred: bool) -> Email {
66        Email {
67            id,
68            thread_id: None,
69            provider: None,
70            account_id: None,
71            subject,
72            from,
73            to,
74            cc: None,
75            bcc: None,
76            body,
77            html,
78            date,
79            labels: None,
80            is_read,
81            is_starred,
82            attachments: None,
83            snippet: None,
84            message_id: None,
85            in_reply_to: None,
86            references: None,
87        }
88    }
89}
90