waitForNthEmailWithHttpInfo method

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

Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.

If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.

Note: This method returns the HTTP Response.

Parameters:

  • String inboxId: Id of the inbox you are fetching emails from

  • int index: Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1

  • int timeout: Max milliseconds to wait for the nth email if not already present

  • bool unreadOnly: Optional filter for unread only

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

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

  • String sort: Sort direction

  • int delay: Max milliseconds delay between calls

Implementation

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

  // ignore: prefer_final_locals
  Object? postBody;

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

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

  const contentTypes = <String>[];


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