get method

Future<Thread> get(
  1. String userId,
  2. String id, {
  3. String? format,
  4. List<String>? metadataHeaders,
  5. String? $fields,
})

Gets the specified thread.

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 thread to retrieve.

format - The format to return the messages in. Possible string values are:

  • "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.
  • "metadata" : Returns only email message IDs, labels, and email headers.
  • "minimal" : Returns only email message IDs and labels; does not return the email headers, body, or payload.

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 Thread.

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<Thread> 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') +
      '/threads/' +
      commons.escapeVariable('$id');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Thread.fromJson(response_ as core.Map<core.String, core.dynamic>);
}