getMessages method

Future<PaginatedResponse<Message>> getMessages(
  1. List<String> channels, [
  2. String? subscriberId
])

Implementation

Future<PaginatedResponse<Message>> getMessages(List<String> channels, [String? subscriberId]) async {
  Map<String, dynamic> response = await request(method: ApiMethod.GET, endpoint: 'messages', query: {'subscriberId': subscriberId, 'channels': channels.join(',')});
  return PaginatedResponse<Message>(
    page: response['page'],
    totalCount: response['totalCount'],
    pageSize: response['pageSize'],
    hasMore: response['hasMore'],
    data: response['data'].map<Message>((var r) => Message.fromJson(r)).toList(),
  );
}