get method
Gets the specified message.
Request parameters:
userId
- The user's email address. The special value me
can be used to
indicate the authenticated user.
id
- The ID of the message to retrieve. This ID is usually retrieved
using messages.list
. The ID is also contained in the result when a
message is inserted (messages.insert
) or imported (messages.import
).
format
- The format to return the message in.
Possible string values are:
- "minimal" : Returns only email message ID and labels; does not return the email headers, body, or payload.
- "full" : Returns the full email message data with body content parsed in
the
payload
field; theraw
field is not used. Format cannot be used when accessing the api using the gmail.metadata scope. - "raw" : Returns the full email message data with body content in the
raw
field as a base64url encoded string; thepayload
field is not used. Format cannot be used when accessing the api using the gmail.metadata scope. - "metadata" : Returns only email message ID, labels, and email headers.
metadataHeaders
- When given and format is METADATA
, only include
headers specified.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Message.
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<Message> get(
core.String userId,
core.String id, {
core.String? format,
core.List<core.String>? metadataHeaders,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (format != null) 'format': [format],
if (metadataHeaders != null) 'metadataHeaders': metadataHeaders,
if ($fields != null) 'fields': [$fields],
};
final url_ = 'gmail/v1/users/' +
commons.escapeVariable('$userId') +
'/messages/' +
commons.escapeVariable('$id');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Message.fromJson(response_ as core.Map<core.String, core.dynamic>);
}