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.history.html">history</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="#list">list(userId, historyTypes=None, labelId=None, maxResults=None, pageToken=None, startHistoryId=None, x__xgafv=None)</a></code></p> 82<p class="firstline">Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`).</p> 83<p class="toc_element"> 84 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 85<p class="firstline">Retrieves the next page of results.</p> 86<h3>Method Details</h3> 87<div class="method"> 88 <code class="details" id="close">close()</code> 89 <pre>Close httplib2 connections.</pre> 90</div> 91 92<div class="method"> 93 <code class="details" id="list">list(userId, historyTypes=None, labelId=None, maxResults=None, pageToken=None, startHistoryId=None, x__xgafv=None)</code> 94 <pre>Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`). 95 96Args: 97 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 98 historyTypes: string, History types to be returned by the function (repeated) 99 Allowed values 100 messageAdded - 101 messageDeleted - 102 labelAdded - 103 labelRemoved - 104 labelId: string, Only return messages with a label matching the ID. 105 maxResults: integer, Maximum number of history records to return. This field defaults to 100. The maximum allowed value for this field is 500. 106 pageToken: string, Page token to retrieve a specific page of results in the list. 107 startHistoryId: string, Required. Returns history records after the specified `startHistoryId`. The supplied `startHistoryId` should be obtained from the `historyId` of a message, thread, or previous `list` response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date `startHistoryId` typically returns an `HTTP 404` error code. A `historyId` is typically valid for at least a week, but in some rare circumstances may be valid for only a few hours. If you receive an `HTTP 404` error response, your application should perform a full sync. If you receive no `nextPageToken` in the response, there are no updates to retrieve and you can store the returned `historyId` for a future request. 108 x__xgafv: string, V1 error format. 109 Allowed values 110 1 - v1 error format 111 2 - v2 error format 112 113Returns: 114 An object of the form: 115 116 { 117 "history": [ # List of history records. Any `messages` contained in the response will typically only have `id` and `threadId` fields populated. 118 { # A record of a change to the user's mailbox. Each history change may affect multiple messages in multiple ways. 119 "id": "A String", # The mailbox sequence ID. 120 "labelsAdded": [ # Labels added to messages in this history record. 121 { 122 "labelIds": [ # Label IDs added to the message. 123 "A String", 124 ], 125 "message": { # An email message. 126 "historyId": "A String", # The ID of the last history record that modified this message. 127 "id": "A String", # The immutable ID of the message. 128 "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. 129 "labelIds": [ # List of IDs of labels applied to this message. 130 "A String", 131 ], 132 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 133 "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. 134 "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. 135 "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. 136 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 137 }, 138 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 139 "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`. 140 { 141 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 142 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 143 }, 144 ], 145 "mimeType": "A String", # The MIME type of the message part. 146 "partId": "A String", # The immutable ID of the message part. 147 "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. 148 # Object with schema name: MessagePart 149 ], 150 }, 151 "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. 152 "sizeEstimate": 42, # Estimated size in bytes of the message. 153 "snippet": "A String", # A short part of the message text. 154 "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: 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. 155 }, 156 }, 157 ], 158 "labelsRemoved": [ # Labels removed from messages in this history record. 159 { 160 "labelIds": [ # Label IDs removed from the message. 161 "A String", 162 ], 163 "message": { # An email message. 164 "historyId": "A String", # The ID of the last history record that modified this message. 165 "id": "A String", # The immutable ID of the message. 166 "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. 167 "labelIds": [ # List of IDs of labels applied to this message. 168 "A String", 169 ], 170 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 171 "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. 172 "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. 173 "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. 174 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 175 }, 176 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 177 "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`. 178 { 179 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 180 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 181 }, 182 ], 183 "mimeType": "A String", # The MIME type of the message part. 184 "partId": "A String", # The immutable ID of the message part. 185 "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. 186 # Object with schema name: MessagePart 187 ], 188 }, 189 "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. 190 "sizeEstimate": 42, # Estimated size in bytes of the message. 191 "snippet": "A String", # A short part of the message text. 192 "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: 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 }, 195 ], 196 "messages": [ # List of messages changed in this history record. The fields for specific change types, such as `messagesAdded` may duplicate messages in this field. We recommend using the specific change-type fields instead of this. 197 { # An email message. 198 "historyId": "A String", # The ID of the last history record that modified this message. 199 "id": "A String", # The immutable ID of the message. 200 "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. 201 "labelIds": [ # List of IDs of labels applied to this message. 202 "A String", 203 ], 204 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 205 "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. 206 "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. 207 "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. 208 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 209 }, 210 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 211 "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`. 212 { 213 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 214 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 215 }, 216 ], 217 "mimeType": "A String", # The MIME type of the message part. 218 "partId": "A String", # The immutable ID of the message part. 219 "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. 220 # Object with schema name: MessagePart 221 ], 222 }, 223 "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. 224 "sizeEstimate": 42, # Estimated size in bytes of the message. 225 "snippet": "A String", # A short part of the message text. 226 "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: 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. 227 }, 228 ], 229 "messagesAdded": [ # Messages added to the mailbox in this history record. 230 { 231 "message": { # An email message. 232 "historyId": "A String", # The ID of the last history record that modified this message. 233 "id": "A String", # The immutable ID of the message. 234 "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. 235 "labelIds": [ # List of IDs of labels applied to this message. 236 "A String", 237 ], 238 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 239 "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. 240 "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. 241 "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. 242 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 243 }, 244 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 245 "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`. 246 { 247 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 248 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 249 }, 250 ], 251 "mimeType": "A String", # The MIME type of the message part. 252 "partId": "A String", # The immutable ID of the message part. 253 "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. 254 # Object with schema name: MessagePart 255 ], 256 }, 257 "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. 258 "sizeEstimate": 42, # Estimated size in bytes of the message. 259 "snippet": "A String", # A short part of the message text. 260 "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: 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. 261 }, 262 }, 263 ], 264 "messagesDeleted": [ # Messages deleted (not Trashed) from the mailbox in this history record. 265 { 266 "message": { # An email message. 267 "historyId": "A String", # The ID of the last history record that modified this message. 268 "id": "A String", # The immutable ID of the message. 269 "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. 270 "labelIds": [ # List of IDs of labels applied to this message. 271 "A String", 272 ], 273 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 274 "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. 275 "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. 276 "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. 277 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 278 }, 279 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 280 "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`. 281 { 282 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 283 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 284 }, 285 ], 286 "mimeType": "A String", # The MIME type of the message part. 287 "partId": "A String", # The immutable ID of the message part. 288 "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. 289 # Object with schema name: MessagePart 290 ], 291 }, 292 "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. 293 "sizeEstimate": 42, # Estimated size in bytes of the message. 294 "snippet": "A String", # A short part of the message text. 295 "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: 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. 296 }, 297 }, 298 ], 299 }, 300 ], 301 "historyId": "A String", # The ID of the mailbox's current history record. 302 "nextPageToken": "A String", # Page token to retrieve the next page of results in the list. 303}</pre> 304</div> 305 306<div class="method"> 307 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 308 <pre>Retrieves the next page of results. 309 310Args: 311 previous_request: The request for the previous page. (required) 312 previous_response: The response from the request for the previous page. (required) 313 314Returns: 315 A request object that you can call 'execute()' on to request the next 316 page. Returns None if there are no more items in the collection. 317 </pre> 318</div> 319 320</body></html>