markAsRead method

Future<EmailPreview?> markAsRead(
  1. String emailId, {
  2. bool? read,
})

Mark an email as read on unread

Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread

Parameters:

  • String emailId (required):

  • bool read: What value to assign to email read property. Default true.

Implementation

Future<EmailPreview?> markAsRead(String emailId, { bool? read, }) async {
  final response = await markAsReadWithHttpInfo(emailId,  read: read, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'EmailPreview',) as EmailPreview;

  }
  return null;
}