getEmailContentMatch method
Future<EmailContentMatchResult?>
getEmailContentMatch(
- String emailId,
- ContentMatchOptions contentMatchOptions
Get email content regex pattern match results. Runs regex against email body and returns match groups.
Return the matches for a given Java style regex pattern. Do not include the typical /
at start or end of regex in some languages. Given an example your code is: 12345
the pattern to extract match looks like code is: (\\d{6})
. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: ['code is: 123456', '123456']
See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns.
Parameters:
-
String emailId (required): ID of email to match against
-
ContentMatchOptions contentMatchOptions (required):
Implementation
Future<EmailContentMatchResult?> getEmailContentMatch(String emailId, ContentMatchOptions contentMatchOptions,) async {
final response = await getEmailContentMatchWithHttpInfo(emailId, contentMatchOptions,);
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), 'EmailContentMatchResult',) as EmailContentMatchResult;
}
return null;
}