getInAppNotifications method

Future<PaginatedResponse<Notification>> getInAppNotifications(
  1. String subscriberId, {
  2. int? page,
  3. int? limit,
  4. bool? read,
  5. bool? seen,
})

Implementation

Future<PaginatedResponse<Notification>> getInAppNotifications(String subscriberId, {int? page, int? limit, bool? read, bool? seen}) async {
  Map<String, dynamic> response = await request(method: ApiMethod.GET, endpoint: 'subscribers/$subscriberId/notifications/feed', query: {
    if (page != null) 'page': page,
    if (limit != null) 'limit': limit,
    if (read != null) 'read': read,
    if (seen != null) 'seen': seen,
  });
  return PaginatedResponse<Notification>(
    page: response['page'],
    totalCount: response['totalCount'],
    pageSize: response['pageSize'],
    hasMore: response['hasMore'],
    data: response['data'].map<Notification>((var r) => Notification.fromJson(r)).toList(),
  );
}