1#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12pub struct Email {
13 #[serde(rename = "object")]
14 pub object: Object,
15 #[serde(rename = "id")]
16 pub id: String,
17 #[serde(
18 rename = "slug",
19 default,
20 with = "::serde_with::rust::double_option",
21 skip_serializing_if = "Option::is_none"
22 )]
23 pub slug: Option<Option<String>>,
24 #[serde(rename = "from_email_name")]
25 pub from_email_name: String,
26 #[serde(rename = "email_address_id", deserialize_with = "Option::deserialize")]
27 pub email_address_id: Option<String>,
28 #[serde(rename = "to_email_address")]
29 pub to_email_address: String,
30 #[serde(
31 rename = "user_id",
32 default,
33 with = "::serde_with::rust::double_option",
34 skip_serializing_if = "Option::is_none"
35 )]
36 pub user_id: Option<Option<String>>,
37 #[serde(rename = "subject")]
38 pub subject: String,
39 #[serde(rename = "body")]
40 pub body: String,
41 #[serde(
42 rename = "body_plain",
43 default,
44 with = "::serde_with::rust::double_option",
45 skip_serializing_if = "Option::is_none"
46 )]
47 pub body_plain: Option<Option<String>>,
48 #[serde(rename = "status")]
49 pub status: String,
50 #[serde(
51 rename = "data",
52 default,
53 with = "::serde_with::rust::double_option",
54 skip_serializing_if = "Option::is_none"
55 )]
56 pub data: Option<Option<serde_json::Value>>,
57 #[serde(rename = "delivered_by_clerk")]
58 pub delivered_by_clerk: bool,
59}
60
61impl Email {
62 pub fn new(
63 object: Object,
64 id: String,
65 from_email_name: String,
66 email_address_id: Option<String>,
67 to_email_address: String,
68 subject: String,
69 body: String,
70 status: String,
71 delivered_by_clerk: bool,
72 ) -> Email {
73 Email {
74 object,
75 id,
76 slug: None,
77 from_email_name,
78 email_address_id,
79 to_email_address,
80 user_id: None,
81 subject,
82 body,
83 body_plain: None,
84 status,
85 data: None,
86 delivered_by_clerk,
87 }
88 }
89}
90
91#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
93pub enum Object {
94 #[serde(rename = "email")]
95 Email,
96}
97
98impl Default for Object {
99 fn default() -> Object {
100 Self::Email
101 }
102}