getNotifications method
Implementation
Future<PaginatedResponse<InboxNotification>> getNotifications({
bool archived = false,
int page = 0,
int limit = 10,
List<String>? tags,
}) async {
Map<String, dynamic> response = await request(
method: ApiMethod.GET,
endpoint: 'inbox/notifications',
query: {
'offset': page * limit,
'limit': limit,
'archived': archived,
if (tags?.isNotEmpty == true) 'tags': tags!.join(','),
}
);
return PaginatedResponse<InboxNotification>(
page: response['page'] ?? page,
totalCount: response['totalCount'] ?? 0,
pageSize: limit,
hasMore: response['hasMore'],
data: response['data'].map<InboxNotification>((var r) => InboxNotification.fromJson(r)).toList(),
);
}