getEmailsPaginated method

Future<PageEmailProjection?> getEmailsPaginated({
  1. List<String>? inboxId,
  2. int? page,
  3. int? size,
  4. String? sort,
  5. bool? unreadOnly,
  6. String? searchFilter,
  7. DateTime? since,
  8. DateTime? before,
})

Get all emails in all inboxes in paginated form. Email API list all.

By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages

Parameters:

  • List<String> inboxId: Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • int page: Optional page index in email list pagination

  • int size: Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results

  • String sort: Optional createdAt sort direction ASC or DESC

  • bool unreadOnly: Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

  • String searchFilter: Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • DateTime since: Optional filter emails received after given date time

  • DateTime before: Optional filter emails received before given date time

Implementation

Future<PageEmailProjection?> getEmailsPaginated({ List<String>? inboxId, int? page, int? size, String? sort, bool? unreadOnly, String? searchFilter, DateTime? since, DateTime? before, }) async {
  final response = await getEmailsPaginatedWithHttpInfo( inboxId: inboxId, page: page, size: size, sort: sort, unreadOnly: unreadOnly, searchFilter: searchFilter, since: since, before: before, );
  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), 'PageEmailProjection',) as PageEmailProjection;

  }
  return null;
}