getEmailTextLines method

Future<EmailTextLinesResult?> getEmailTextLines(
  1. String emailId, {
  2. bool? decodeHtmlEntities,
  3. String? lineSeparator,
})

Parse and return text from an email, stripping HTML and decoding encoded characters

Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.

Parameters:

  • String emailId (required): ID of email to fetch text for

  • bool decodeHtmlEntities: Decode HTML entities

  • String lineSeparator: Line separator character

Implementation

Future<EmailTextLinesResult?> getEmailTextLines(String emailId, { bool? decodeHtmlEntities, String? lineSeparator, }) async {
  final response = await getEmailTextLinesWithHttpInfo(emailId,  decodeHtmlEntities: decodeHtmlEntities, lineSeparator: lineSeparator, );
  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), 'EmailTextLinesResult',) as EmailTextLinesResult;

  }
  return null;
}