spatio-sdk 0.0.2

Rust SDK for the SpatioAPI. Generated from the official OpenAPI spec.
Documentation
/*
 * 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};

/// 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. 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Email {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "threadId", skip_serializing_if = "Option::is_none")]
    pub thread_id: Option<String>,
    #[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
    pub provider: Option<String>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "subject")]
    pub subject: String,
    #[serde(rename = "from")]
    pub from: String,
    #[serde(rename = "to")]
    pub to: Vec<String>,
    #[serde(rename = "cc", skip_serializing_if = "Option::is_none")]
    pub cc: Option<Vec<String>>,
    #[serde(rename = "bcc", skip_serializing_if = "Option::is_none")]
    pub bcc: Option<Vec<String>>,
    #[serde(rename = "body")]
    pub body: String,
    /// `true` when `body` contains HTML, `false` for plain text. 
    #[serde(rename = "html")]
    pub html: bool,
    #[serde(rename = "date")]
    pub date: chrono::DateTime<chrono::FixedOffset>,
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
    #[serde(rename = "isRead")]
    pub is_read: bool,
    #[serde(rename = "isStarred")]
    pub is_starred: bool,
    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")]
    pub attachments: Option<Vec<models::AttachmentMeta>>,
    #[serde(rename = "snippet", skip_serializing_if = "Option::is_none")]
    pub snippet: Option<String>,
    /// RFC 5322 Message-ID header.
    #[serde(rename = "messageId", skip_serializing_if = "Option::is_none")]
    pub message_id: Option<String>,
    /// RFC 5322 In-Reply-To header — the parent message id this message is a reply to. 
    #[serde(rename = "inReplyTo", skip_serializing_if = "Option::is_none")]
    pub in_reply_to: Option<String>,
    /// RFC 5322 References header (ancestor chain).
    #[serde(rename = "references", skip_serializing_if = "Option::is_none")]
    pub references: Option<Vec<String>>,
}

impl 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. 
    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 {
        Email {
            id,
            thread_id: None,
            provider: None,
            account_id: None,
            subject,
            from,
            to,
            cc: None,
            bcc: None,
            body,
            html,
            date,
            labels: None,
            is_read,
            is_starred,
            attachments: None,
            snippet: None,
            message_id: None,
            in_reply_to: None,
            references: None,
        }
    }
}