getOlderList method

Future<GetEmailAddressResponse> getOlderList(
  1. int sequence,
  2. int limit
)

The idea of this function is to get some emails that are older (lower ID) than ‘seq’. How can this be useful? Say we have more than 1 page of emails. Then, we delete some emails from the first page, so we are left with some empty slots at the bottom. Instead of calling fetch_email_list, we call this to be more efficient and get exactly the number of email we need to fill.

Implementation

Future<GetEmailAddressResponse> getOlderList(
  /// get emails that have a lower id than the sequence
  int sequence,

  /// Integer how many emails to fetch max.
  int limit,
) async {
  final response = await _doRequest(
    call: 'get_older_list',
    queryParameters: {
      'seq': sequence,
      'limit': limit,
    },
  );
  return GetEmailAddressResponse.fromJson(jsonDecode(response.body));
}