blob: a021d4578e156664d875bf6f038fe757a683d2de [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">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080078 <code><a href="#create">create(userId, body=None, media_body=None, media_mime_type=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070079<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">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080093 <code><a href="#send">send(userId, body=None, media_body=None, media_mime_type=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070094<p class="firstline">Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.</p>
95<p class="toc_element">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080096 <code><a href="#update">update(userId, id, body=None, media_body=None, media_mime_type=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070097<p class="firstline">Replaces a draft's content.</p>
98<h3>Method Details</h3>
99<div class="method">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800100 <code class="details" id="create">create(userId, body=None, media_body=None, media_mime_type=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700101 <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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800114 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700115 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800116 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700117 },
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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800147 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
Craig Citro065b5302014-08-14 00:47:23 -0700148
149Returns:
150 An object of the form:
151
152 { # A draft email in the user's mailbox.
153 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700154 "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 -0700155 "historyId": "A String", # The ID of the last history record that modified this message.
156 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
157 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800158 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700159 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800160 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700161 },
162 "mimeType": "A String", # The MIME type of the message part.
163 "partId": "A String", # The immutable ID of the message part.
164 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
165 "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.
166 {
167 "name": "A String", # The name of the header before the : separator. For example, To.
168 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
169 },
170 ],
171 "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.
172 # Object with schema name: MessagePart
173 ],
174 },
175 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800176 "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 -0700177 "sizeEstimate": 42, # Estimated size in bytes of the message.
178 "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:
179 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700180 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700181 # - The Subject headers must match.
182 "labelIds": [ # List of IDs of labels applied to this message.
183 "A String",
184 ],
185 "id": "A String", # The immutable ID of the message.
186 },
187 "id": "A String", # The immutable ID of the draft.
188 }</pre>
189</div>
190
191<div class="method">
192 <code class="details" id="delete">delete(userId, id)</code>
193 <pre>Immediately and permanently deletes the specified draft. Does not simply trash it.
194
195Args:
196 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
197 id: string, The ID of the draft to delete. (required)
198</pre>
199</div>
200
201<div class="method">
202 <code class="details" id="get">get(userId, id, format=None)</code>
203 <pre>Gets the specified draft.
204
205Args:
206 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
207 id: string, The ID of the draft to retrieve. (required)
208 format: string, The format to return the draft in.
209 Allowed values
210 full -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700211 metadata -
Craig Citro065b5302014-08-14 00:47:23 -0700212 minimal -
213 raw -
214
215Returns:
216 An object of the form:
217
218 { # A draft email in the user's mailbox.
219 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700220 "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 -0700221 "historyId": "A String", # The ID of the last history record that modified this message.
222 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
223 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800224 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700225 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800226 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700227 },
228 "mimeType": "A String", # The MIME type of the message part.
229 "partId": "A String", # The immutable ID of the message part.
230 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
231 "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.
232 {
233 "name": "A String", # The name of the header before the : separator. For example, To.
234 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
235 },
236 ],
237 "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.
238 # Object with schema name: MessagePart
239 ],
240 },
241 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800242 "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 -0700243 "sizeEstimate": 42, # Estimated size in bytes of the message.
244 "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:
245 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700246 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700247 # - The Subject headers must match.
248 "labelIds": [ # List of IDs of labels applied to this message.
249 "A String",
250 ],
251 "id": "A String", # The immutable ID of the message.
252 },
253 "id": "A String", # The immutable ID of the draft.
254 }</pre>
255</div>
256
257<div class="method">
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700258 <code class="details" id="list">list(userId, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700259 <pre>Lists the drafts in the user's mailbox.
260
261Args:
262 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 -0700263 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 -0700264 pageToken: string, Page token to retrieve a specific page of results in the list.
265 maxResults: integer, Maximum number of drafts to return.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700266 includeSpamTrash: boolean, Include drafts from SPAM and TRASH in the results.
Craig Citro065b5302014-08-14 00:47:23 -0700267
268Returns:
269 An object of the form:
270
271 {
272 "nextPageToken": "A String", # Token to retrieve the next page of results in the list.
273 "resultSizeEstimate": 42, # Estimated total number of results.
274 "drafts": [ # List of drafts.
275 { # A draft email in the user's mailbox.
276 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700277 "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 -0700278 "historyId": "A String", # The ID of the last history record that modified this message.
279 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
280 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800281 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700282 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800283 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700284 },
285 "mimeType": "A String", # The MIME type of the message part.
286 "partId": "A String", # The immutable ID of the message part.
287 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
288 "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.
289 {
290 "name": "A String", # The name of the header before the : separator. For example, To.
291 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
292 },
293 ],
294 "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.
295 # Object with schema name: MessagePart
296 ],
297 },
298 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800299 "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 -0700300 "sizeEstimate": 42, # Estimated size in bytes of the message.
301 "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:
302 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700303 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700304 # - The Subject headers must match.
305 "labelIds": [ # List of IDs of labels applied to this message.
306 "A String",
307 ],
308 "id": "A String", # The immutable ID of the message.
309 },
310 "id": "A String", # The immutable ID of the draft.
311 },
312 ],
313 }</pre>
314</div>
315
316<div class="method">
317 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
318 <pre>Retrieves the next page of results.
319
320Args:
321 previous_request: The request for the previous page. (required)
322 previous_response: The response from the request for the previous page. (required)
323
324Returns:
325 A request object that you can call 'execute()' on to request the next
326 page. Returns None if there are no more items in the collection.
327 </pre>
328</div>
329
330<div class="method">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800331 <code class="details" id="send">send(userId, body=None, media_body=None, media_mime_type=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700332 <pre>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.
333
334Args:
335 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
336 body: object, The request body.
337 The object takes the form of:
338
339{ # A draft email in the user's mailbox.
340 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700341 "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 -0700342 "historyId": "A String", # The ID of the last history record that modified this message.
343 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
344 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800345 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700346 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800347 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700348 },
349 "mimeType": "A String", # The MIME type of the message part.
350 "partId": "A String", # The immutable ID of the message part.
351 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
352 "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.
353 {
354 "name": "A String", # The name of the header before the : separator. For example, To.
355 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
356 },
357 ],
358 "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.
359 # Object with schema name: MessagePart
360 ],
361 },
362 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800363 "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 -0700364 "sizeEstimate": 42, # Estimated size in bytes of the message.
365 "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:
366 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700367 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700368 # - The Subject headers must match.
369 "labelIds": [ # List of IDs of labels applied to this message.
370 "A String",
371 ],
372 "id": "A String", # The immutable ID of the message.
373 },
374 "id": "A String", # The immutable ID of the draft.
375}
376
377 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800378 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
Craig Citro065b5302014-08-14 00:47:23 -0700379
380Returns:
381 An object of the form:
382
383 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700384 "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 -0700385 "historyId": "A String", # The ID of the last history record that modified this message.
386 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
387 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800388 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700389 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800390 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700391 },
392 "mimeType": "A String", # The MIME type of the message part.
393 "partId": "A String", # The immutable ID of the message part.
394 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
395 "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.
396 {
397 "name": "A String", # The name of the header before the : separator. For example, To.
398 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
399 },
400 ],
401 "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.
402 # Object with schema name: MessagePart
403 ],
404 },
405 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800406 "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 -0700407 "sizeEstimate": 42, # Estimated size in bytes of the message.
408 "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:
409 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700410 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700411 # - The Subject headers must match.
412 "labelIds": [ # List of IDs of labels applied to this message.
413 "A String",
414 ],
415 "id": "A String", # The immutable ID of the message.
416 }</pre>
417</div>
418
419<div class="method">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800420 <code class="details" id="update">update(userId, id, body=None, media_body=None, media_mime_type=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700421 <pre>Replaces a draft's content.
422
423Args:
424 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
425 id: string, The ID of the draft to update. (required)
426 body: object, The request body.
427 The object takes the form of:
428
429{ # A draft email in the user's mailbox.
430 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700431 "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 -0700432 "historyId": "A String", # The ID of the last history record that modified this message.
433 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
434 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800435 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700436 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800437 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700438 },
439 "mimeType": "A String", # The MIME type of the message part.
440 "partId": "A String", # The immutable ID of the message part.
441 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
442 "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.
443 {
444 "name": "A String", # The name of the header before the : separator. For example, To.
445 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
446 },
447 ],
448 "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.
449 # Object with schema name: MessagePart
450 ],
451 },
452 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800453 "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 -0700454 "sizeEstimate": 42, # Estimated size in bytes of the message.
455 "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:
456 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700457 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700458 # - The Subject headers must match.
459 "labelIds": [ # List of IDs of labels applied to this message.
460 "A String",
461 ],
462 "id": "A String", # The immutable ID of the message.
463 },
464 "id": "A String", # The immutable ID of the draft.
465}
466
467 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800468 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
Craig Citro065b5302014-08-14 00:47:23 -0700469
470Returns:
471 An object of the form:
472
473 { # A draft email in the user's mailbox.
474 "message": { # An email message. # The message content of the draft.
Takashi Matsuo06694102015-09-11 13:55:40 -0700475 "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 -0700476 "historyId": "A String", # The ID of the last history record that modified this message.
477 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
478 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800479 "data": "A String", # 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.
Craig Citro065b5302014-08-14 00:47:23 -0700480 "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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800481 "size": 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700482 },
483 "mimeType": "A String", # The MIME type of the message part.
484 "partId": "A String", # The immutable ID of the message part.
485 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
486 "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.
487 {
488 "name": "A String", # The name of the header before the : separator. For example, To.
489 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
490 },
491 ],
492 "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.
493 # Object with schema name: MessagePart
494 ],
495 },
496 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800497 "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 -0700498 "sizeEstimate": 42, # Estimated size in bytes of the message.
499 "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:
500 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700501 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700502 # - The Subject headers must match.
503 "labelIds": [ # List of IDs of labels applied to this message.
504 "A String",
505 ],
506 "id": "A String", # The immutable ID of the message.
507 },
508 "id": "A String", # The immutable ID of the draft.
509 }</pre>
510</div>
511
512</body></html>