TF-816: get list email forward
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
class NotFoundForwardException implements Exception {
|
||||
NotFoundForwardException();
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:forward/forward/tmail_forward.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
@@ -29,4 +30,6 @@ abstract class ManageAccountRepository {
|
||||
Future<List<TMailRule>> createNewEmailRuleFilter(AccountId accountId, CreateNewEmailRuleFilterRequest ruleFilterRequest);
|
||||
|
||||
Future<List<TMailRule>> editEmailRuleFilter(AccountId accountId, EditEmailRuleFilterRequest ruleFilterRequest);
|
||||
|
||||
Future<TMailForward> getForward(AccountId accountId);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:forward/forward/tmail_forward.dart';
|
||||
|
||||
class GetForwardSuccess extends UIState {
|
||||
final TMailForward forward;
|
||||
|
||||
GetForwardSuccess(this.forward);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [forward];
|
||||
}
|
||||
|
||||
class GetForwardFailure extends FeatureFailure {
|
||||
final dynamic exception;
|
||||
|
||||
GetForwardFailure(this.exception);
|
||||
|
||||
@override
|
||||
List<Object> get props => [exception];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_forward_state.dart';
|
||||
|
||||
class GetForwardInteractor {
|
||||
final ManageAccountRepository manageAccountRepository;
|
||||
|
||||
GetForwardInteractor(this.manageAccountRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingState());
|
||||
final response = await manageAccountRepository.getForward(accountId);
|
||||
yield Right(GetForwardSuccess(response));
|
||||
} catch (exception) {
|
||||
yield Left(GetForwardFailure(exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user