notifications method
Future<List<Notification> >
notifications({
- String? maxId,
- String? sinceId,
- String? minId,
- int limit = 20,
- List<
NotificationType> ? excludeTypes, - String? accountId,
inherited
GET /api/v1/notifications
- authentication (requires user)
- read read:notifications
Implementation
Future<List<Notification>> notifications({
String? maxId,
String? sinceId,
String? minId,
int limit = 20,
List<NotificationType>? excludeTypes,
String? accountId,
}) async {
final response = await request(
Method.get,
"/api/v1/notifications",
authenticated: true,
payload: {
"max_id": maxId,
"since_id": sinceId,
"min_id": minId,
"limit": limit.toString(),
"exclude_types": excludeTypes?.map((e) => e.toString().split(".").last),
"account_id": accountId,
}..removeWhere((_, value) => value == null),
);
final body = List<Map<String, dynamic>>.from(json.decode(response.body));
/// TODO: implement link headers for pagination
return body.map((m) => Notification.fromJson(m)).toList();
}