Debian Codegraph @

docs/dyn/gmail_v1.users.drafts.html

raw
1 <html><body>
2 <style>
3
4 body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13 }
14
15 body {
16 font-size: 13px;
17 padding: 1em;
18 }
19
20 h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23 }
24
25 h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28 }
29
30 h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34 }
35
36 pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39 }
40
41 pre {
42 margin-top: 0.5em;
43 }
44
45 h1, h2, h3, p {
46 font-family: Arial, sans serif;
47 }
48
49 h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51 }
52
53 .toc_element {
54 margin-top: 0.5em;
55 }
56
57 .firstline {
58 margin-left: 2 em;
59 }
60
61 .method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66 }
67
68 .details {
69 font-weight: bold;
70 font-size: 14px;
71 }
72
73 </style>
74
75 <h1><a href="gmail_v1.html">Gmail API</a> . <a href="gmail_v1.users.html">users</a> . <a href="gmail_v1.users.drafts.html">drafts</a></h1>
76 <h2>Instance Methods</h2>
77 <p class="toc_element">
78 <code><a href="#close">close()</a></code></p>
79 <p class="firstline">Close httplib2 connections.</p>
80 <p class="toc_element">
81 <code><a href="#create">create(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</a></code></p>
82 <p class="firstline">Creates a draft with the `DRAFT` label. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).</p>
83 <p class="toc_element">
84 <code><a href="#delete">delete(userId, id, x__xgafv=None)</a></code></p>
85 <p class="firstline">Immediately and permanently deletes the specified draft. Does not simply trash it. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).</p>
86 <p class="toc_element">
87 <code><a href="#get">get(userId, id, format=None, x__xgafv=None)</a></code></p>
88 <p class="firstline">Gets the specified draft. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).</p>
89 <p class="toc_element">
90 <code><a href="#list">list(userId, includeSpamTrash=None, maxResults=None, pageToken=None, q=None, x__xgafv=None)</a></code></p>
91 <p class="firstline">Lists the drafts in the user's mailbox. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).</p>
92 <p class="toc_element">
93 <code><a href="#list_next">list_next()</a></code></p>
94 <p class="firstline">Retrieves the next page of results.</p>
95 <p class="toc_element">
96 <code><a href="#send">send(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</a></code></p>
97 <p class="firstline">Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).</p>
98 <p class="toc_element">
99 <code><a href="#update">update(userId, id, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</a></code></p>
100 <p class="firstline">Replaces a draft's content. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).</p>
101 <h3>Method Details</h3>
102 <div class="method">
103 <code class="details" id="close">close()</code>
104 <pre>Close httplib2 connections.</pre>
105 </div>
106
107 <div class="method">
108 <code class="details" id="create">create(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code>
109 <pre>Creates a draft with the `DRAFT` label. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).
110
111 Args:
112 userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
113 body: object, The request body.
114 The object takes the form of:
115
116 { # A draft email in the user&#x27;s mailbox.
117 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
118 &quot;message&quot;: { # An email message. # The message content of the draft.
119 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
120 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
121 &quot;fields&quot;: [ # Field values for the given classification label ID.
122 { # Field values for a classification label.
123 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
124 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
125 },
126 ],
127 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
128 },
129 ],
130 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
131 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
132 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
133 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
134 &quot;A String&quot;,
135 ],
136 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
137 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
138 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
139 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
140 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
141 },
142 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
143 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
144 {
145 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
146 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
147 },
148 ],
149 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
150 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
151 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
152 # Object with schema name: MessagePart
153 ],
154 },
155 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
156 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
157 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
158 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
159 },
160 }
161
162 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
163 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
164 x__xgafv: string, V1 error format.
165 Allowed values
166 1 - v1 error format
167 2 - v2 error format
168
169 Returns:
170 An object of the form:
171
172 { # A draft email in the user&#x27;s mailbox.
173 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
174 &quot;message&quot;: { # An email message. # The message content of the draft.
175 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
176 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
177 &quot;fields&quot;: [ # Field values for the given classification label ID.
178 { # Field values for a classification label.
179 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
180 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
181 },
182 ],
183 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
184 },
185 ],
186 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
187 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
188 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
189 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
190 &quot;A String&quot;,
191 ],
192 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
193 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
194 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
195 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
196 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
197 },
198 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
199 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
200 {
201 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
202 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
203 },
204 ],
205 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
206 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
207 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
208 # Object with schema name: MessagePart
209 ],
210 },
211 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
212 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
213 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
214 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
215 },
216 }</pre>
217 </div>
218
219 <div class="method">
220 <code class="details" id="delete">delete(userId, id, x__xgafv=None)</code>
221 <pre>Immediately and permanently deletes the specified draft. Does not simply trash it. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).
222
223 Args:
224 userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
225 id: string, The ID of the draft to delete. (required)
226 x__xgafv: string, V1 error format.
227 Allowed values
228 1 - v1 error format
229 2 - v2 error format
230 </pre>
231 </div>
232
233 <div class="method">
234 <code class="details" id="get">get(userId, id, format=None, x__xgafv=None)</code>
235 <pre>Gets the specified draft. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).
236
237 Args:
238 userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
239 id: string, The ID of the draft to retrieve. (required)
240 format: string, The format to return the draft in.
241 Allowed values
242 minimal - Returns only email message ID and labels; does not return the email headers, body, or payload.
243 full - Returns the full email message data with body content parsed in the `payload` field; the `raw` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.
244 raw - Returns the full email message data with body content in the `raw` field as a base64url encoded string; the `payload` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.
245 metadata - Returns only email message ID, labels, and email headers.
246 x__xgafv: string, V1 error format.
247 Allowed values
248 1 - v1 error format
249 2 - v2 error format
250
251 Returns:
252 An object of the form:
253
254 { # A draft email in the user&#x27;s mailbox.
255 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
256 &quot;message&quot;: { # An email message. # The message content of the draft.
257 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
258 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
259 &quot;fields&quot;: [ # Field values for the given classification label ID.
260 { # Field values for a classification label.
261 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
262 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
263 },
264 ],
265 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
266 },
267 ],
268 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
269 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
270 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
271 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
272 &quot;A String&quot;,
273 ],
274 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
275 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
276 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
277 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
278 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
279 },
280 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
281 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
282 {
283 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
284 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
285 },
286 ],
287 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
288 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
289 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
290 # Object with schema name: MessagePart
291 ],
292 },
293 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
294 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
295 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
296 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
297 },
298 }</pre>
299 </div>
300
301 <div class="method">
302 <code class="details" id="list">list(userId, includeSpamTrash=None, maxResults=None, pageToken=None, q=None, x__xgafv=None)</code>
303 <pre>Lists the drafts in the user&#x27;s mailbox. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).
304
305 Args:
306 userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
307 includeSpamTrash: boolean, Include drafts from `SPAM` and `TRASH` in the results.
308 maxResults: integer, Maximum number of drafts to return. This field defaults to 100. The maximum allowed value for this field is 500.
309 pageToken: string, Page token to retrieve a specific page of results in the list.
310 q: string, Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, `&quot;from:[email protected] rfc822msgid: is:unread&quot;`.
311 x__xgafv: string, V1 error format.
312 Allowed values
313 1 - v1 error format
314 2 - v2 error format
315
316 Returns:
317 An object of the form:
318
319 {
320 &quot;drafts&quot;: [ # List of drafts. Note that the `Message` property in each `Draft` resource only contains an `id` and a `threadId`. The [`messages.get`](https://developers.google.com/workspace/gmail/api/v1/reference/users/messages/get) method can fetch additional message details.
321 { # A draft email in the user&#x27;s mailbox.
322 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
323 &quot;message&quot;: { # An email message. # The message content of the draft.
324 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
325 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
326 &quot;fields&quot;: [ # Field values for the given classification label ID.
327 { # Field values for a classification label.
328 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
329 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
330 },
331 ],
332 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
333 },
334 ],
335 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
336 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
337 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
338 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
339 &quot;A String&quot;,
340 ],
341 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
342 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
343 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
344 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
345 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
346 },
347 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
348 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
349 {
350 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
351 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
352 },
353 ],
354 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
355 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
356 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
357 # Object with schema name: MessagePart
358 ],
359 },
360 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
361 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
362 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
363 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
364 },
365 },
366 ],
367 &quot;nextPageToken&quot;: &quot;A String&quot;, # Token to retrieve the next page of results in the list.
368 &quot;resultSizeEstimate&quot;: 42, # Estimated total number of results.
369 }</pre>
370 </div>
371
372 <div class="method">
373 <code class="details" id="list_next">list_next()</code>
374 <pre>Retrieves the next page of results.
375
376 Args:
377 previous_request: The request for the previous page. (required)
378 previous_response: The response from the request for the previous page. (required)
379
380 Returns:
381 A request object that you can call &#x27;execute()&#x27; on to request the next
382 page. Returns None if there are no more items in the collection.
383 </pre>
384 </div>
385
386 <div class="method">
387 <code class="details" id="send">send(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code>
388 <pre>Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).
389
390 Args:
391 userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
392 body: object, The request body.
393 The object takes the form of:
394
395 { # A draft email in the user&#x27;s mailbox.
396 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
397 &quot;message&quot;: { # An email message. # The message content of the draft.
398 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
399 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
400 &quot;fields&quot;: [ # Field values for the given classification label ID.
401 { # Field values for a classification label.
402 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
403 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
404 },
405 ],
406 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
407 },
408 ],
409 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
410 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
411 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
412 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
413 &quot;A String&quot;,
414 ],
415 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
416 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
417 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
418 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
419 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
420 },
421 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
422 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
423 {
424 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
425 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
426 },
427 ],
428 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
429 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
430 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
431 # Object with schema name: MessagePart
432 ],
433 },
434 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
435 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
436 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
437 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
438 },
439 }
440
441 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
442 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
443 x__xgafv: string, V1 error format.
444 Allowed values
445 1 - v1 error format
446 2 - v2 error format
447
448 Returns:
449 An object of the form:
450
451 { # An email message.
452 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
453 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
454 &quot;fields&quot;: [ # Field values for the given classification label ID.
455 { # Field values for a classification label.
456 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
457 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
458 },
459 ],
460 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
461 },
462 ],
463 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
464 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
465 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
466 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
467 &quot;A String&quot;,
468 ],
469 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
470 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
471 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
472 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
473 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
474 },
475 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
476 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
477 {
478 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
479 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
480 },
481 ],
482 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
483 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
484 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
485 # Object with schema name: MessagePart
486 ],
487 },
488 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
489 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
490 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
491 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
492 }</pre>
493 </div>
494
495 <div class="method">
496 <code class="details" id="update">update(userId, id, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code>
497 <pre>Replaces a draft&#x27;s content. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts).
498
499 Args:
500 userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
501 id: string, The ID of the draft to update. (required)
502 body: object, The request body.
503 The object takes the form of:
504
505 { # A draft email in the user&#x27;s mailbox.
506 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
507 &quot;message&quot;: { # An email message. # The message content of the draft.
508 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
509 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
510 &quot;fields&quot;: [ # Field values for the given classification label ID.
511 { # Field values for a classification label.
512 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
513 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
514 },
515 ],
516 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
517 },
518 ],
519 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
520 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
521 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
522 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
523 &quot;A String&quot;,
524 ],
525 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
526 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
527 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
528 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
529 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
530 },
531 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
532 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
533 {
534 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
535 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
536 },
537 ],
538 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
539 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
540 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
541 # Object with schema name: MessagePart
542 ],
543 },
544 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
545 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
546 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
547 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
548 },
549 }
550
551 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
552 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
553 x__xgafv: string, V1 error format.
554 Allowed values
555 1 - v1 error format
556 2 - v2 error format
557
558 Returns:
559 An object of the form:
560
561 { # A draft email in the user&#x27;s mailbox.
562 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
563 &quot;message&quot;: { # An email message. # The message content of the draft.
564 &quot;classificationLabelValues&quot;: [ # Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There&#x27;s a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails.
565 { # Classification Labels applied to the email message. Classification Labels are different from Gmail inbox labels. Only used for Google Workspace accounts. [Learn more about classification labels](https://support.google.com/a/answer/9292382).
566 &quot;fields&quot;: [ # Field values for the given classification label ID.
567 { # Field values for a classification label.
568 &quot;fieldId&quot;: &quot;A String&quot;, # Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object.
569 &quot;selection&quot;: &quot;A String&quot;, # Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource.
570 },
571 ],
572 &quot;labelId&quot;: &quot;A String&quot;, # Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource.
573 },
574 ],
575 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
576 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
577 &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
578 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
579 &quot;A String&quot;,
580 ],
581 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
582 &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
583 &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
584 &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
585 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
586 },
587 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
588 &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
589 {
590 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
591 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
592 },
593 ],
594 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
595 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
596 &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
597 # Object with schema name: MessagePart
598 ],
599 },
600 &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update
601 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
602 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
603 &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
604 },
605 }</pre>
606 </div>
607
608 </body></html>