1<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="#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 new draft with the `DRAFT` label.</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.</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.</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.</p>
92<p class="toc_element">
93  <code><a href="#list_next">list_next(previous_request, previous_response)</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.</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.</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 new draft with the `DRAFT` label.
110
111Args:
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;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
120    &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
121    &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.
122    &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
123      &quot;A String&quot;,
124    ],
125    &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
126      &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.
127        &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.
128        &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.
129        &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
130      },
131      &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
132      &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`.
133        {
134          &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
135          &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
136        },
137      ],
138      &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
139      &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
140      &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.
141        # Object with schema name: MessagePart
142      ],
143    },
144    &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.
145    &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
146    &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
147    &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.
148  },
149}
150
151  media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
152  media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
153  x__xgafv: string, V1 error format.
154    Allowed values
155      1 - v1 error format
156      2 - v2 error format
157
158Returns:
159  An object of the form:
160
161    { # A draft email in the user&#x27;s mailbox.
162  &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
163  &quot;message&quot;: { # An email message. # The message content of the draft.
164    &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
165    &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
166    &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.
167    &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
168      &quot;A String&quot;,
169    ],
170    &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
171      &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.
172        &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.
173        &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.
174        &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
175      },
176      &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
177      &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`.
178        {
179          &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
180          &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
181        },
182      ],
183      &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
184      &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
185      &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.
186        # Object with schema name: MessagePart
187      ],
188    },
189    &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.
190    &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
191    &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
192    &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.
193  },
194}</pre>
195</div>
196
197<div class="method">
198    <code class="details" id="delete">delete(userId, id, x__xgafv=None)</code>
199  <pre>Immediately and permanently deletes the specified draft. Does not simply trash it.
200
201Args:
202  userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
203  id: string, The ID of the draft to delete. (required)
204  x__xgafv: string, V1 error format.
205    Allowed values
206      1 - v1 error format
207      2 - v2 error format
208</pre>
209</div>
210
211<div class="method">
212    <code class="details" id="get">get(userId, id, format=None, x__xgafv=None)</code>
213  <pre>Gets the specified draft.
214
215Args:
216  userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
217  id: string, The ID of the draft to retrieve. (required)
218  format: string, The format to return the draft in.
219    Allowed values
220      minimal - Returns only email message ID and labels; does not return the email headers, body, or payload.
221      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.
222      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.
223      metadata - Returns only email message ID, labels, and email headers.
224  x__xgafv: string, V1 error format.
225    Allowed values
226      1 - v1 error format
227      2 - v2 error format
228
229Returns:
230  An object of the form:
231
232    { # A draft email in the user&#x27;s mailbox.
233  &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
234  &quot;message&quot;: { # An email message. # The message content of the draft.
235    &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
236    &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
237    &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.
238    &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
239      &quot;A String&quot;,
240    ],
241    &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
242      &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.
243        &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.
244        &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.
245        &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
246      },
247      &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
248      &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`.
249        {
250          &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
251          &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
252        },
253      ],
254      &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
255      &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
256      &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.
257        # Object with schema name: MessagePart
258      ],
259    },
260    &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.
261    &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
262    &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
263    &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.
264  },
265}</pre>
266</div>
267
268<div class="method">
269    <code class="details" id="list">list(userId, includeSpamTrash=None, maxResults=None, pageToken=None, q=None, x__xgafv=None)</code>
270  <pre>Lists the drafts in the user&#x27;s mailbox.
271
272Args:
273  userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
274  includeSpamTrash: boolean, Include drafts from `SPAM` and `TRASH` in the results.
275  maxResults: integer, Maximum number of drafts to return. This field defaults to 100. The maximum allowed value for this field is 500.
276  pageToken: string, Page token to retrieve a specific page of results in the list.
277  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;`.
278  x__xgafv: string, V1 error format.
279    Allowed values
280      1 - v1 error format
281      2 - v2 error format
282
283Returns:
284  An object of the form:
285
286    {
287  &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 method can fetch additional message details.
288    { # A draft email in the user&#x27;s mailbox.
289      &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
290      &quot;message&quot;: { # An email message. # The message content of the draft.
291        &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
292        &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
293        &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.
294        &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
295          &quot;A String&quot;,
296        ],
297        &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
298          &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.
299            &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.
300            &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.
301            &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
302          },
303          &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
304          &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`.
305            {
306              &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
307              &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
308            },
309          ],
310          &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
311          &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
312          &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.
313            # Object with schema name: MessagePart
314          ],
315        },
316        &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.
317        &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
318        &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
319        &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.
320      },
321    },
322  ],
323  &quot;nextPageToken&quot;: &quot;A String&quot;, # Token to retrieve the next page of results in the list.
324  &quot;resultSizeEstimate&quot;: 42, # Estimated total number of results.
325}</pre>
326</div>
327
328<div class="method">
329    <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
330  <pre>Retrieves the next page of results.
331
332Args:
333  previous_request: The request for the previous page. (required)
334  previous_response: The response from the request for the previous page. (required)
335
336Returns:
337  A request object that you can call &#x27;execute()&#x27; on to request the next
338  page. Returns None if there are no more items in the collection.
339    </pre>
340</div>
341
342<div class="method">
343    <code class="details" id="send">send(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code>
344  <pre>Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers.
345
346Args:
347  userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
348  body: object, The request body.
349    The object takes the form of:
350
351{ # A draft email in the user&#x27;s mailbox.
352  &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
353  &quot;message&quot;: { # An email message. # The message content of the draft.
354    &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
355    &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
356    &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.
357    &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
358      &quot;A String&quot;,
359    ],
360    &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
361      &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.
362        &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.
363        &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.
364        &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
365      },
366      &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
367      &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`.
368        {
369          &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
370          &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
371        },
372      ],
373      &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
374      &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
375      &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.
376        # Object with schema name: MessagePart
377      ],
378    },
379    &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.
380    &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
381    &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
382    &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.
383  },
384}
385
386  media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
387  media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
388  x__xgafv: string, V1 error format.
389    Allowed values
390      1 - v1 error format
391      2 - v2 error format
392
393Returns:
394  An object of the form:
395
396    { # An email message.
397  &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
398  &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
399  &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.
400  &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
401    &quot;A String&quot;,
402  ],
403  &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
404    &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.
405      &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.
406      &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.
407      &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
408    },
409    &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
410    &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`.
411      {
412        &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
413        &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
414      },
415    ],
416    &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
417    &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
418    &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.
419      # Object with schema name: MessagePart
420    ],
421  },
422  &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.
423  &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
424  &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
425  &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.
426}</pre>
427</div>
428
429<div class="method">
430    <code class="details" id="update">update(userId, id, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code>
431  <pre>Replaces a draft&#x27;s content.
432
433Args:
434  userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
435  id: string, The ID of the draft to update. (required)
436  body: object, The request body.
437    The object takes the form of:
438
439{ # A draft email in the user&#x27;s mailbox.
440  &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
441  &quot;message&quot;: { # An email message. # The message content of the draft.
442    &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
443    &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
444    &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.
445    &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
446      &quot;A String&quot;,
447    ],
448    &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
449      &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.
450        &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.
451        &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.
452        &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
453      },
454      &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
455      &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`.
456        {
457          &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
458          &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
459        },
460      ],
461      &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
462      &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
463      &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.
464        # Object with schema name: MessagePart
465      ],
466    },
467    &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.
468    &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
469    &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
470    &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.
471  },
472}
473
474  media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
475  media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
476  x__xgafv: string, V1 error format.
477    Allowed values
478      1 - v1 error format
479      2 - v2 error format
480
481Returns:
482  An object of the form:
483
484    { # A draft email in the user&#x27;s mailbox.
485  &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the draft.
486  &quot;message&quot;: { # An email message. # The message content of the draft.
487    &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
488    &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
489    &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.
490    &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
491      &quot;A String&quot;,
492    ],
493    &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
494      &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.
495        &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.
496        &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.
497        &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
498      },
499      &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
500      &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`.
501        {
502          &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
503          &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
504        },
505      ],
506      &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
507      &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
508      &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.
509        # Object with schema name: MessagePart
510      ],
511    },
512    &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.
513    &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
514    &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
515    &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.
516  },
517}</pre>
518</div>
519
520</body></html>