getEmailHTMLQuery method
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:
-
String emailId (required): ID of email to perform HTML query on
-
String htmlSelector (required): HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.
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;
}