list method
Lists the history of all changes to the given mailbox.
History results are returned in chronological order (increasing
historyId
).
Request parameters:
userId
- The user's email address. The special value me
can be used to
indicate the authenticated user.
historyTypes
- History types to be returned by the function
labelId
- Only return messages with a label matching the ID.
maxResults
- Maximum number of history records to return. This field
defaults to 100. The maximum allowed value for this field is 500.
pageToken
- Page token to retrieve a specific page of results in the
list.
startHistoryId
- 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.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ListHistoryResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<ListHistoryResponse> list(
core.String userId, {
core.List<core.String>? historyTypes,
core.String? labelId,
core.int? maxResults,
core.String? pageToken,
core.String? startHistoryId,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (historyTypes != null) 'historyTypes': historyTypes,
if (labelId != null) 'labelId': [labelId],
if (maxResults != null) 'maxResults': ['${maxResults}'],
if (pageToken != null) 'pageToken': [pageToken],
if (startHistoryId != null) 'startHistoryId': [startHistoryId],
if ($fields != null) 'fields': [$fields],
};
final url_ =
'gmail/v1/users/' + commons.escapeVariable('$userId') + '/history';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListHistoryResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}