From 1643de7639e9f989ac5ff12ddfcad9ffe7c39cf3 Mon Sep 17 00:00:00 2001 From: hieubt Date: Thu, 2 May 2024 16:48:56 +0700 Subject: [PATCH] TW-1690: Add public room repository --- .../public_room_repository_impl.dart | 23 +++++++++++++++++++ .../repository/public_room_reposity.dart | 10 ++++++++ 2 files changed, 33 insertions(+) create mode 100644 lib/data/repository/public_room_repository_impl.dart create mode 100644 lib/domain/repository/public_room_reposity.dart diff --git a/lib/data/repository/public_room_repository_impl.dart b/lib/data/repository/public_room_repository_impl.dart new file mode 100644 index 0000000000..61f5cf67c0 --- /dev/null +++ b/lib/data/repository/public_room_repository_impl.dart @@ -0,0 +1,23 @@ +import 'package:fluffychat/data/datasource/pubic_room_datasource.dart'; +import 'package:fluffychat/data/model/search/public_room_response.dart'; +import 'package:fluffychat/di/global/get_it_initializer.dart'; +import 'package:fluffychat/domain/repository/public_room_reposity.dart'; +import 'package:matrix/matrix.dart'; + +class PublicRoomRepositoryImpl extends PublicRoomRepository { + final PublicRoomDatasource _publicRoomDatasource = + getIt.get(); + + @override + Future search({ + PublicRoomQueryFilter? filter, + String? server, + int? limit, + }) { + return _publicRoomDatasource.search( + filter: filter, + server: server, + limit: limit, + ); + } +} diff --git a/lib/domain/repository/public_room_reposity.dart b/lib/domain/repository/public_room_reposity.dart new file mode 100644 index 0000000000..7f119c7962 --- /dev/null +++ b/lib/domain/repository/public_room_reposity.dart @@ -0,0 +1,10 @@ +import 'package:fluffychat/data/model/search/public_room_response.dart'; +import 'package:matrix/matrix.dart'; + +abstract class PublicRoomRepository { + Future search({ + PublicRoomQueryFilter? filter, + String? server, + int? limit, + }); +}