Added unread list api in notification
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
// notification_service.dart
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:tm_app/core/utils/result.dart';
|
||||
import 'package:tm_app/data/services/api/notification_api.dart';
|
||||
import 'package:tm_app/data/services/model/notification__response/notification_response_model.dart';
|
||||
|
||||
import 'package:tm_app/core/utils/result.dart';
|
||||
import '../../core/network/network_manager.dart';
|
||||
|
||||
class NotificationsService {
|
||||
NotificationsService({required NetworkManager networkManager})
|
||||
: _networkManager = networkManager;
|
||||
: _networkManager = networkManager;
|
||||
final NetworkManager _networkManager;
|
||||
|
||||
Future<Result<NotificationResponseModel>> getNotifications({
|
||||
@@ -24,15 +25,14 @@ class NotificationsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Result<Map<String, dynamic>>> markAllAsRead() async {
|
||||
final result = await _networkManager.makeRequest(
|
||||
NotificationApi.markAllAsRead,
|
||||
method: 'GET',
|
||||
(json) => json,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Result<Map<String, dynamic>>> markAllAsRead() async {
|
||||
final result = await _networkManager.makeRequest(
|
||||
NotificationApi.markAllAsRead,
|
||||
method: 'GET',
|
||||
(json) => json,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Result<NotificationResponseModel>> markAsRead({
|
||||
required String notificationId,
|
||||
@@ -46,4 +46,16 @@ Future<Result<Map<String, dynamic>>> markAllAsRead() async {
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Result<NotificationResponseModel>> getUnreadNotifications({
|
||||
required int limit,
|
||||
required int offset,
|
||||
}) async {
|
||||
final result = await _networkManager.makeRequest(
|
||||
NotificationApi.unreadNotifications,
|
||||
method: 'GET',
|
||||
(json) => NotificationResponseModel.fromJson(json),
|
||||
);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user