list method
Lists the threads in the user's mailbox.
Request parameters:
userId - The user's email address. The special value me can be used to
indicate the authenticated user.
includeSpamTrash - Include threads from SPAM and TRASH in the
results.
labelIds - Only return threads with labels that match all of the
specified label IDs.
maxResults - Maximum number of threads 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.
q - Only return threads matching the specified query. Supports the same
query format as the Gmail search box. For example,
"from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be
used when accessing the api using the gmail.metadata scope.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a ListThreadsResponse.
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<ListThreadsResponse> list(
core.String userId, {
core.bool? includeSpamTrash,
core.List<core.String>? labelIds,
core.int? maxResults,
core.String? pageToken,
core.String? q,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'includeSpamTrash': ?includeSpamTrash == null
? null
: ['${includeSpamTrash}'],
'labelIds': ?labelIds,
'maxResults': ?maxResults == null ? null : ['${maxResults}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'q': ?q == null ? null : [q],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'gmail/v1/users/' + commons.escapeVariable('$userId') + '/threads';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListThreadsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}