late 0.0.1387

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.608.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// EmailDraft : A draft in the mailbox. Carries the message fields; `id` is the draft id the drafts endpoints take. Store `id`, not `messageId`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EmailDraft {
    /// The draft id: the Gmail draft id, or the Outlook message id.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "threadId", skip_serializing_if = "Option::is_none")]
    pub thread_id: Option<String>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
    pub provider: Option<Provider>,
    #[serde(rename = "folders", skip_serializing_if = "Option::is_none")]
    pub folders: Option<Vec<String>>,
    #[serde(rename = "from", skip_serializing_if = "Option::is_none")]
    pub from: Option<Box<models::EmailAddress>>,
    #[serde(rename = "sender", skip_serializing_if = "Option::is_none")]
    pub sender: Option<Box<models::EmailAddress>>,
    #[serde(rename = "to", skip_serializing_if = "Option::is_none")]
    pub to: Option<Vec<models::EmailAddress>>,
    #[serde(rename = "cc", skip_serializing_if = "Option::is_none")]
    pub cc: Option<Vec<models::EmailAddress>>,
    #[serde(rename = "bcc", skip_serializing_if = "Option::is_none")]
    pub bcc: Option<Vec<models::EmailAddress>>,
    #[serde(rename = "replyTo", skip_serializing_if = "Option::is_none")]
    pub reply_to: Option<Vec<models::EmailAddress>>,
    #[serde(rename = "subject", skip_serializing_if = "Option::is_none")]
    pub subject: Option<String>,
    #[serde(rename = "snippet", skip_serializing_if = "Option::is_none")]
    pub snippet: Option<String>,
    #[serde(rename = "text", skip_serializing_if = "Option::is_none")]
    pub text: Option<String>,
    #[serde(rename = "html", skip_serializing_if = "Option::is_none")]
    pub html: Option<String>,
    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")]
    pub attachments: Option<Vec<models::EmailAttachment>>,
    /// Only with `includeHeaders=true`.
    #[serde(rename = "headers", skip_serializing_if = "Option::is_none")]
    pub headers: Option<std::collections::HashMap<String, String>>,
    /// MIME source, only with `raw=true`.
    #[serde(rename = "raw", skip_serializing_if = "Option::is_none")]
    pub raw: Option<String>,
    #[serde(rename = "date", skip_serializing_if = "Option::is_none")]
    pub date: Option<String>,
    #[serde(rename = "unread", skip_serializing_if = "Option::is_none")]
    pub unread: Option<bool>,
    #[serde(rename = "starred", skip_serializing_if = "Option::is_none")]
    pub starred: Option<bool>,
    /// Gmail: the ids of the user labels on the message (names come from `GET /v1/email/labels`). Outlook: its category names.
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<std::collections::HashMap<String, String>>,
    /// Set when the draft was created with tracking.
    #[serde(
        rename = "trackingId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub tracking_id: Option<Option<String>>,
    #[serde(rename = "clean", skip_serializing_if = "Option::is_none")]
    pub clean: Option<Box<models::EmailClean>>,
    /// On a mail sent from a draft (`POST /v1/email/drafts/{draftId}/send`): the draft it was. The sent mail has a new id.
    #[serde(rename = "draftId", skip_serializing_if = "Option::is_none")]
    pub draft_id: Option<String>,
    /// On a forward: the message it forwarded.
    #[serde(rename = "forwardedFrom", skip_serializing_if = "Option::is_none")]
    pub forwarded_from: Option<String>,
    #[serde(rename = "object", skip_serializing_if = "Option::is_none")]
    pub object: Option<models::EmailDraftObject>,
    /// Fixed when the draft is created. A draft the user wrote in their mail client is read from its headers.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<Kind>,
    /// Changes on every edit, the user's in their mail app included. Pass it as `If-Match` to update or send only that version. Also the `ETag` response header.
    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
    /// The provider message behind the draft. Volatile: Gmail replaces it on every save.
    #[serde(rename = "messageId", skip_serializing_if = "Option::is_none")]
    pub message_id: Option<String>,
    /// The message a reply draft answers.
    #[serde(
        rename = "inReplyTo",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub in_reply_to: Option<Option<String>>,
    /// The message a forward draft forwards.
    #[serde(
        rename = "forwardOf",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub forward_of: Option<Option<String>>,
}

impl EmailDraft {
    /// A draft in the mailbox. Carries the message fields; `id` is the draft id the drafts endpoints take. Store `id`, not `messageId`.
    pub fn new() -> EmailDraft {
        EmailDraft {
            id: None,
            thread_id: None,
            account_id: None,
            provider: None,
            folders: None,
            from: None,
            sender: None,
            to: None,
            cc: None,
            bcc: None,
            reply_to: None,
            subject: None,
            snippet: None,
            text: None,
            html: None,
            attachments: None,
            headers: None,
            raw: None,
            date: None,
            unread: None,
            starred: None,
            labels: None,
            metadata: None,
            tracking_id: None,
            clean: None,
            draft_id: None,
            forwarded_from: None,
            object: None,
            kind: None,
            version: None,
            message_id: None,
            in_reply_to: None,
            forward_of: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Provider {
    #[serde(rename = "google")]
    Google,
    #[serde(rename = "microsoft")]
    Microsoft,
    #[serde(rename = "imap")]
    Imap,
}

impl Default for Provider {
    fn default() -> Provider {
        Self::Google
    }
}
/// Fixed when the draft is created. A draft the user wrote in their mail client is read from its headers.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Kind {
    #[serde(rename = "new")]
    New,
    #[serde(rename = "reply")]
    Reply,
    #[serde(rename = "forward")]
    Forward,
}

impl Default for Kind {
    fn default() -> Kind {
        Self::New
    }
}