messages method

Future<Iterable<HeaderModel>> messages({
  1. String? folderId,
  2. String? contains,
  3. QueryType? queryType,
  4. int? skip,
  5. int take = 20,
})

Implementation

Future<Iterable<HeaderModel>> messages(
    {String? folderId,
    String? contains,
    QueryType? queryType,
    int? skip,
    int take = 20}) async {
  final Map<String, dynamic> queryParameters = {
    'folderId': folderId,
    'contains': contains,
    'take': take,
    'skip': skip
  };
  if (queryType != null) {
    queryParameters['type'] = queryType.toString().split('.').last;
  }
  final response = await dio.get('/mail', queryParameters: queryParameters);
  final data = List<HeaderModel>.from(
      response.data.map((e) => HeaderModel.fromJson(e)));
  return data;
}