madfun 0.1.2

Autogenerate Atlassian Document Format (ADF) from Markdown
Documentation
use buildstructor::Builder;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Mark {
    /// <https://developer.atlassian.com/cloud/jira/platform/apis/document/marks/code/>
    Code,

    /// <https://developer.atlassian.com/cloud/jira/platform/apis/document/marks/link/>
    ///
    /// ```json
    /// {
    ///   "type": "text",
    ///   "text": "Hello world",
    ///   "marks": [
    ///     {
    ///       "type": "link",
    ///       "attrs": {
    ///         "href": "http://atlassian.com",
    ///         "title": "Atlassian"
    ///       }
    ///     }
    ///   ]
    /// }
    /// ```
    Link {
        attrs: LinkAttrs,
    },
}

#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct LinkAttrs {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub collection: Option<String>,

    pub href: String,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub occurrence_key: Option<String>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
}