blob: 702e37cc8639d08a0bcbedad5883083e3a2a6bfc [file] [log] [blame]
Craig Citro065b5302014-08-14 00:47:23 -07001<html><body>
2<style>
3
4body, 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
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, 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="#create">create(userId, body=None, media_body=None)</a></code></p>
79<p class="firstline">Creates a new draft with the DRAFT label.</p>
80<p class="toc_element">
81 <code><a href="#delete">delete(userId, id)</a></code></p>
82<p class="firstline">Immediately and permanently deletes the specified draft. Does not simply trash it.</p>
83<p class="toc_element">
84 <code><a href="#get">get(userId, id, format=None)</a></code></p>
85<p class="firstline">Gets the specified draft.</p>
86<p class="toc_element">
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -070087 <code><a href="#list">list(userId, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070088<p class="firstline">Lists the drafts in the user's mailbox.</p>
89<p class="toc_element">
90 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
91<p class="firstline">Retrieves the next page of results.</p>
92<p class="toc_element">
93 <code><a href="#send">send(userId, body=None, media_body=None)</a></code></p>
94<p class="firstline">Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.</p>
95<p class="toc_element">
96 <code><a href="#update">update(userId, id, body=None, media_body=None)</a></code></p>
97<p class="firstline">Replaces a draft's content.</p>
98<h3>Method Details</h3>
99<div class="method">
100 <code class="details" id="create">create(userId, body=None, media_body=None)</code>
101 <pre>Creates a new draft with the DRAFT label.
102
103Args:
104 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
105 body: object, The request body.
106 The object takes the form of:
107
108{ # A draft email in the user's mailbox.
109 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700110 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700111 "historyId": "A String", # The ID of the last history record that modified this message.
112 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
113 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
114 "data": "A String", # The body data of a MIME message part. 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.
115 "attachmentId": "A String", # 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.
116 "size": 42, # Total number of bytes in the body of the message part.
117 },
118 "mimeType": "A String", # The MIME type of the message part.
119 "partId": "A String", # The immutable ID of the message part.
120 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
121 "headers": [ # 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.
122 {
123 "name": "A String", # The name of the header before the : separator. For example, To.
124 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
125 },
126 ],
127 "parts": [ # 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.
128 # Object with schema name: MessagePart
129 ],
130 },
131 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800132 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700133 "sizeEstimate": 42, # Estimated size in bytes of the message.
134 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
135 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700136 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700137 # - The Subject headers must match.
138 "labelIds": [ # List of IDs of labels applied to this message.
139 "A String",
140 ],
141 "id": "A String", # The immutable ID of the message.
142 },
143 "id": "A String", # The immutable ID of the draft.
144}
145
146 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
147
148Returns:
149 An object of the form:
150
151 { # A draft email in the user's mailbox.
152 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700153 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700154 "historyId": "A String", # The ID of the last history record that modified this message.
155 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
156 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
157 "data": "A String", # The body data of a MIME message part. 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.
158 "attachmentId": "A String", # 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.
159 "size": 42, # Total number of bytes in the body of the message part.
160 },
161 "mimeType": "A String", # The MIME type of the message part.
162 "partId": "A String", # The immutable ID of the message part.
163 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
164 "headers": [ # 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.
165 {
166 "name": "A String", # The name of the header before the : separator. For example, To.
167 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
168 },
169 ],
170 "parts": [ # 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.
171 # Object with schema name: MessagePart
172 ],
173 },
174 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800175 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700176 "sizeEstimate": 42, # Estimated size in bytes of the message.
177 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
178 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700179 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700180 # - The Subject headers must match.
181 "labelIds": [ # List of IDs of labels applied to this message.
182 "A String",
183 ],
184 "id": "A String", # The immutable ID of the message.
185 },
186 "id": "A String", # The immutable ID of the draft.
187 }</pre>
188</div>
189
190<div class="method">
191 <code class="details" id="delete">delete(userId, id)</code>
192 <pre>Immediately and permanently deletes the specified draft. Does not simply trash it.
193
194Args:
195 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
196 id: string, The ID of the draft to delete. (required)
197</pre>
198</div>
199
200<div class="method">
201 <code class="details" id="get">get(userId, id, format=None)</code>
202 <pre>Gets the specified draft.
203
204Args:
205 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
206 id: string, The ID of the draft to retrieve. (required)
207 format: string, The format to return the draft in.
208 Allowed values
209 full -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700210 metadata -
Craig Citro065b5302014-08-14 00:47:23 -0700211 minimal -
212 raw -
213
214Returns:
215 An object of the form:
216
217 { # A draft email in the user's mailbox.
218 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700219 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700220 "historyId": "A String", # The ID of the last history record that modified this message.
221 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
222 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
223 "data": "A String", # The body data of a MIME message part. 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.
224 "attachmentId": "A String", # 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.
225 "size": 42, # Total number of bytes in the body of the message part.
226 },
227 "mimeType": "A String", # The MIME type of the message part.
228 "partId": "A String", # The immutable ID of the message part.
229 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
230 "headers": [ # 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.
231 {
232 "name": "A String", # The name of the header before the : separator. For example, To.
233 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
234 },
235 ],
236 "parts": [ # 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.
237 # Object with schema name: MessagePart
238 ],
239 },
240 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800241 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700242 "sizeEstimate": 42, # Estimated size in bytes of the message.
243 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
244 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700245 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700246 # - The Subject headers must match.
247 "labelIds": [ # List of IDs of labels applied to this message.
248 "A String",
249 ],
250 "id": "A String", # The immutable ID of the message.
251 },
252 "id": "A String", # The immutable ID of the draft.
253 }</pre>
254</div>
255
256<div class="method">
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700257 <code class="details" id="list">list(userId, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700258 <pre>Lists the drafts in the user's mailbox.
259
260Args:
261 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700262 q: string, Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread".
Craig Citro065b5302014-08-14 00:47:23 -0700263 pageToken: string, Page token to retrieve a specific page of results in the list.
264 maxResults: integer, Maximum number of drafts to return.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700265 includeSpamTrash: boolean, Include drafts from SPAM and TRASH in the results.
Craig Citro065b5302014-08-14 00:47:23 -0700266
267Returns:
268 An object of the form:
269
270 {
271 "nextPageToken": "A String", # Token to retrieve the next page of results in the list.
272 "resultSizeEstimate": 42, # Estimated total number of results.
273 "drafts": [ # List of drafts.
274 { # A draft email in the user's mailbox.
275 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700276 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700277 "historyId": "A String", # The ID of the last history record that modified this message.
278 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
279 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
280 "data": "A String", # The body data of a MIME message part. 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.
281 "attachmentId": "A String", # 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.
282 "size": 42, # Total number of bytes in the body of the message part.
283 },
284 "mimeType": "A String", # The MIME type of the message part.
285 "partId": "A String", # The immutable ID of the message part.
286 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
287 "headers": [ # 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.
288 {
289 "name": "A String", # The name of the header before the : separator. For example, To.
290 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
291 },
292 ],
293 "parts": [ # 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.
294 # Object with schema name: MessagePart
295 ],
296 },
297 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800298 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700299 "sizeEstimate": 42, # Estimated size in bytes of the message.
300 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
301 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700302 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700303 # - The Subject headers must match.
304 "labelIds": [ # List of IDs of labels applied to this message.
305 "A String",
306 ],
307 "id": "A String", # The immutable ID of the message.
308 },
309 "id": "A String", # The immutable ID of the draft.
310 },
311 ],
312 }</pre>
313</div>
314
315<div class="method">
316 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
317 <pre>Retrieves the next page of results.
318
319Args:
320 previous_request: The request for the previous page. (required)
321 previous_response: The response from the request for the previous page. (required)
322
323Returns:
324 A request object that you can call 'execute()' on to request the next
325 page. Returns None if there are no more items in the collection.
326 </pre>
327</div>
328
329<div class="method">
330 <code class="details" id="send">send(userId, body=None, media_body=None)</code>
331 <pre>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.
332
333Args:
334 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
335 body: object, The request body.
336 The object takes the form of:
337
338{ # A draft email in the user's mailbox.
339 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700340 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700341 "historyId": "A String", # The ID of the last history record that modified this message.
342 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
343 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
344 "data": "A String", # The body data of a MIME message part. 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 "attachmentId": "A String", # 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.
346 "size": 42, # Total number of bytes in the body of the message part.
347 },
348 "mimeType": "A String", # The MIME type of the message part.
349 "partId": "A String", # The immutable ID of the message part.
350 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
351 "headers": [ # 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.
352 {
353 "name": "A String", # The name of the header before the : separator. For example, To.
354 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
355 },
356 ],
357 "parts": [ # 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.
358 # Object with schema name: MessagePart
359 ],
360 },
361 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800362 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700363 "sizeEstimate": 42, # Estimated size in bytes of the message.
364 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
365 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700366 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700367 # - The Subject headers must match.
368 "labelIds": [ # List of IDs of labels applied to this message.
369 "A String",
370 ],
371 "id": "A String", # The immutable ID of the message.
372 },
373 "id": "A String", # The immutable ID of the draft.
374}
375
376 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
377
378Returns:
379 An object of the form:
380
381 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700382 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700383 "historyId": "A String", # The ID of the last history record that modified this message.
384 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
385 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
386 "data": "A String", # The body data of a MIME message part. 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.
387 "attachmentId": "A String", # 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.
388 "size": 42, # Total number of bytes in the body of the message part.
389 },
390 "mimeType": "A String", # The MIME type of the message part.
391 "partId": "A String", # The immutable ID of the message part.
392 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
393 "headers": [ # 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.
394 {
395 "name": "A String", # The name of the header before the : separator. For example, To.
396 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
397 },
398 ],
399 "parts": [ # 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.
400 # Object with schema name: MessagePart
401 ],
402 },
403 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800404 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700405 "sizeEstimate": 42, # Estimated size in bytes of the message.
406 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
407 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700408 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700409 # - The Subject headers must match.
410 "labelIds": [ # List of IDs of labels applied to this message.
411 "A String",
412 ],
413 "id": "A String", # The immutable ID of the message.
414 }</pre>
415</div>
416
417<div class="method">
418 <code class="details" id="update">update(userId, id, body=None, media_body=None)</code>
419 <pre>Replaces a draft's content.
420
421Args:
422 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
423 id: string, The ID of the draft to update. (required)
424 body: object, The request body.
425 The object takes the form of:
426
427{ # A draft email in the user's mailbox.
428 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700429 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700430 "historyId": "A String", # The ID of the last history record that modified this message.
431 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
432 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
433 "data": "A String", # The body data of a MIME message part. 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.
434 "attachmentId": "A String", # 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.
435 "size": 42, # Total number of bytes in the body of the message part.
436 },
437 "mimeType": "A String", # The MIME type of the message part.
438 "partId": "A String", # The immutable ID of the message part.
439 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
440 "headers": [ # 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.
441 {
442 "name": "A String", # The name of the header before the : separator. For example, To.
443 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
444 },
445 ],
446 "parts": [ # 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.
447 # Object with schema name: MessagePart
448 ],
449 },
450 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800451 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700452 "sizeEstimate": 42, # Estimated size in bytes of the message.
453 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
454 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700455 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700456 # - The Subject headers must match.
457 "labelIds": [ # List of IDs of labels applied to this message.
458 "A String",
459 ],
460 "id": "A String", # The immutable ID of the message.
461 },
462 "id": "A String", # The immutable ID of the draft.
463}
464
465 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
466
467Returns:
468 An object of the form:
469
470 { # A draft email in the user's mailbox.
471 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700472 "internalDate": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700473 "historyId": "A String", # The ID of the last history record that modified this message.
474 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
475 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
476 "data": "A String", # The body data of a MIME message part. 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.
477 "attachmentId": "A String", # 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.
478 "size": 42, # Total number of bytes in the body of the message part.
479 },
480 "mimeType": "A String", # The MIME type of the message part.
481 "partId": "A String", # The immutable ID of the message part.
482 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
483 "headers": [ # 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.
484 {
485 "name": "A String", # The name of the header before the : separator. For example, To.
486 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
487 },
488 ],
489 "parts": [ # 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.
490 # Object with schema name: MessagePart
491 ],
492 },
493 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800494 "raw": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700495 "sizeEstimate": 42, # Estimated size in bytes of the message.
496 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
497 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700498 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700499 # - The Subject headers must match.
500 "labelIds": [ # List of IDs of labels applied to this message.
501 "A String",
502 ],
503 "id": "A String", # The immutable ID of the message.
504 },
505 "id": "A String", # The immutable ID of the draft.
506 }</pre>
507</div>
508
509</body></html>