waitForLatestEmailWithHttpInfo method

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

Fetch inbox's latest email or if empty wait for an email to arrive

Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set unreadOnly=true or see the other receive methods such as waitForNthEmail or waitForEmailCount.

Note: This method returns the HTTP Response.

Parameters:

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

  • int timeout: Max milliseconds to wait

  • bool unreadOnly: Optional filter for unread only.

  • DateTime before: Filter for emails that were before after 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

Implementation

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

  // 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 (timeout != null) {
    queryParams.addAll(_queryParams('', 'timeout', timeout));
  }
  if (unreadOnly != null) {
    queryParams.addAll(_queryParams('', 'unreadOnly', unreadOnly));
  }
  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));
  }

  const contentTypes = <String>[];


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