1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
use super::{Attachment, SendAttachment};
use serde::{Deserialize, Serialize};
/// Request body for `create_draft`. At least one recipient or a
/// reply/forward-of reference and one of `text`/`html` are required by the
/// API.
#[derive(Clone, Debug, Default, Serialize)]
pub struct CreateDraft {
/// Primary recipients.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub to: Vec<String>,
/// Carbon-copy recipients.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub cc: Vec<String>,
/// Blind-carbon-copy recipients.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub bcc: Vec<String>,
/// Subject line.
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>,
/// Plain-text body.
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
/// HTML body.
#[serde(skip_serializing_if = "Option::is_none")]
pub html: Option<String>,
/// Message id this draft is in reply to.
#[serde(skip_serializing_if = "Option::is_none")]
pub in_reply_to: Option<String>,
/// Reply-To addresses to set on the sent message.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub reply_to: Vec<String>,
/// When creating a reply draft, set true to reply to all recipients of
/// the referenced message.
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_all: Option<bool>,
/// Message id this draft is a forward of.
#[serde(skip_serializing_if = "Option::is_none")]
pub forward_of: Option<String>,
/// Labels to attach to the draft.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub labels: Vec<String>,
/// Schedule send at this RFC 3339 timestamp.
#[serde(skip_serializing_if = "Option::is_none")]
pub send_at: Option<String>,
/// Your own idempotency/reference id for this draft.
#[serde(skip_serializing_if = "Option::is_none")]
pub client_id: Option<String>,
}
/// Request body for `update_draft`. Every field is optional;
/// omitted fields are left unchanged on the server. Pass `Some(vec![])`
/// to clear a recipient field; pass `None` to leave it alone.
#[derive(Clone, Debug, Default, Serialize)]
pub struct UpdateDraft {
/// Primary recipients.
#[serde(skip_serializing_if = "Option::is_none")]
pub to: Option<Vec<String>>,
/// Carbon-copy recipients.
#[serde(skip_serializing_if = "Option::is_none")]
pub cc: Option<Vec<String>>,
/// Blind-carbon-copy recipients.
#[serde(skip_serializing_if = "Option::is_none")]
pub bcc: Option<Vec<String>>,
/// Subject line.
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>,
/// Plain-text body.
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
/// HTML body.
#[serde(skip_serializing_if = "Option::is_none")]
pub html: Option<String>,
/// Labels to add.
#[serde(skip_serializing_if = "Option::is_none")]
pub add_labels: Option<Vec<String>>,
/// Labels to remove.
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_labels: Option<Vec<String>>,
/// Reply-To addresses to replace; `Some(vec![])` clears them.
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_to: Option<Vec<String>>,
/// Attachments to add to the draft.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub add_attachments: Vec<SendAttachment>,
/// Attachment ids to remove from the draft.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub remove_attachments: Vec<String>,
/// Schedule send at this RFC 3339 timestamp.
#[serde(skip_serializing_if = "Option::is_none")]
pub send_at: Option<String>,
}
/// A draft message, as the API returns it. List items are a subset of the
/// full get-draft shape; every optional field defaults so both parse.
#[derive(Clone, Debug, Deserialize)]
pub struct Draft {
/// Unique draft id.
pub draft_id: String,
/// Inbox the draft belongs to.
#[serde(default)]
pub inbox_id: Option<String>,
/// Your reference id from creation, when set.
#[serde(default)]
pub client_id: Option<String>,
/// Primary recipients.
#[serde(default)]
pub to: Vec<String>,
/// Carbon-copy recipients.
#[serde(default)]
pub cc: Vec<String>,
/// Blind-carbon-copy recipients.
#[serde(default)]
pub bcc: Vec<String>,
/// Reply-To addresses, when set.
#[serde(default)]
pub reply_to: Vec<String>,
/// Subject line.
#[serde(default)]
pub subject: Option<String>,
/// Short plain-text excerpt (list responses).
#[serde(default)]
pub preview: Option<String>,
/// Plain-text body.
#[serde(default)]
pub text: Option<String>,
/// HTML body.
#[serde(default)]
pub html: Option<String>,
/// Labels on the draft.
#[serde(default)]
pub labels: Vec<String>,
/// Message id this draft is replying to.
#[serde(default)]
pub in_reply_to: Option<String>,
/// Message id this draft is forwarding.
#[serde(default)]
pub forward_of: Option<String>,
/// `References` chain this draft continues, when replying.
#[serde(default)]
pub references: Vec<String>,
/// Send state once the draft is queued: `scheduled`, `sending`, or `failed`.
#[serde(default)]
pub send_status: Option<String>,
/// Scheduled send time (RFC 3339).
#[serde(default)]
pub send_at: Option<String>,
/// Timestamp the draft was created (RFC 3339).
#[serde(default)]
pub created_at: Option<String>,
/// Timestamp the draft was last updated (RFC 3339).
#[serde(default)]
pub updated_at: Option<String>,
/// Attachments on the draft.
#[serde(default)]
pub attachments: Vec<Attachment>,
}
/// One page of drafts from `list_drafts_page`.
#[derive(Clone, Debug, Deserialize)]
pub struct DraftList {
/// Total drafts in the inbox (not just this page).
pub count: u64,
/// This page of drafts.
#[serde(default)]
pub drafts: Vec<Draft>,
/// Cursor for the next page; `None` on the last page.
#[serde(default)]
pub next_page_token: Option<String>,
}