getEmailHTMLQuery method

Future<EmailTextLinesResult?> getEmailHTMLQuery(
  1. String emailId,
  2. String htmlSelector
)

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 text. HTML parsing uses JSoup which supports JQuery/CSS style selectors

Parameters:

Implementation

Future<EmailTextLinesResult?> getEmailHTMLQuery(String emailId, String htmlSelector,) async {
  final response = await getEmailHTMLQueryWithHttpInfo(emailId, htmlSelector,);
  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;
}