TF-4171 Add datasource/repository/interactor for get all labels
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:labels/model/label.dart';
|
||||
import 'package:tmail_ui_user/features/labels/data/datasource/label_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/labels/data/network/label_api.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class LabelDatasourceImpl extends LabelDatasource {
|
||||
final LabelApi _labelApi;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
LabelDatasourceImpl(this._labelApi, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<List<Label>> getAllLabels(AccountId accountId) {
|
||||
return Future.sync(() async {
|
||||
return await _labelApi.getAllLabels(accountId);
|
||||
}).catchError((error, stackTrace) async {
|
||||
await _exceptionThrower.throwException(error, stackTrace);
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user