get method

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

Gets the specified draft.

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

format - The format to return the draft 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; the raw 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; the payload 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.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Draft.

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<Draft> get(
  core.String userId,
  core.String id, {
  core.String? format,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (format != null) 'format': [format],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'gmail/v1/users/' +
      commons.escapeVariable('$userId') +
      '/drafts/' +
      commons.escapeVariable('$id');

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