Files
eatvio_app/lib/features/chat/repositories/chat_repository.dart

40 lines
970 B
Dart

import 'package:eatvio_app/features/chat/models/chat_messages_model.dart';
import 'package:eatvio_app/features/chat/models/chat_room_model.dart';
import 'package:eatvio_app/features/chat/models/websocket_info_model.dart';
import 'package:eatvio_app/features/chat/services/chat_service.dart';
class ChatRepository {
final ChatService chatService;
ChatRepository({
required this.chatService,
});
Future<ChatRoomModel> getChatRoom(String chatId) async {
try {
return (await chatService.getChatRoom(chatId))['chatRoom']!;
} catch (e) {
print(e);
rethrow;
}
}
Future<ChatMessagesModel> getChatMessages(String chatId) async {
try {
return (await chatService.getChatMessages(chatId));
} catch (e) {
print(e);
rethrow;
}
}
Future<WebsocketInfoModel> getWebsocket() async {
try {
return (await chatService.getWebsocket());
} catch (e) {
print(e);
rethrow;
}
}
}