waitForMatchingEmailsWithHttpInfo method

Future<Response> waitForMatchingEmailsWithHttpInfo(
  1. String inboxId,
  2. int count,
  3. MatchOptions matchOptions, {
  4. DateTime? before,
  5. DateTime? since,
  6. String? sort,
  7. int? delay,
  8. int? timeout,
  9. bool? unreadOnly,
})

Wait or return list of emails that match simple matching patterns

Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the MatchOptions object for options. An example payload is { matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController getEmailContentMatch method.

Note: This method returns the HTTP Response.

Parameters:

  • String inboxId (required): Id of the inbox we are fetching emails from

  • int count (required): Number of emails to wait for. Must be greater or equal to 1

  • MatchOptions matchOptions (required):

  • DateTime before: Filter for emails that were received before the given timestamp

  • DateTime since: Filter for emails that were received after the given timestamp

  • String sort: Sort direction

  • int delay: Max milliseconds delay between calls

  • int timeout: Max milliseconds to wait

  • bool unreadOnly: Optional filter for unread only

Implementation

Future<Response> waitForMatchingEmailsWithHttpInfo(String inboxId, int count, MatchOptions matchOptions, { DateTime? before, DateTime? since, String? sort, int? delay, int? timeout, bool? unreadOnly, }) async {
  // ignore: prefer_const_declarations
  final path = r'/waitForMatchingEmails';

  // ignore: prefer_final_locals
  Object? postBody = matchOptions;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

    queryParams.addAll(_queryParams('', 'inboxId', inboxId));
    queryParams.addAll(_queryParams('', 'count', count));
  if (before != null) {
    queryParams.addAll(_queryParams('', 'before', before));
  }
  if (since != null) {
    queryParams.addAll(_queryParams('', 'since', since));
  }
  if (sort != null) {
    queryParams.addAll(_queryParams('', 'sort', sort));
  }
  if (delay != null) {
    queryParams.addAll(_queryParams('', 'delay', delay));
  }
  if (timeout != null) {
    queryParams.addAll(_queryParams('', 'timeout', timeout));
  }
  if (unreadOnly != null) {
    queryParams.addAll(_queryParams('', 'unreadOnly', unreadOnly));
  }

  const contentTypes = <String>['application/json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}