TF-2802 Create calendar event accept interactor
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_reply_state.dart';
|
||||
|
||||
class CalendarEventAccepting extends CalendarEventReplying {}
|
||||
|
||||
class CalendarEventAccepted extends CalendarEventReplySuccess {
|
||||
|
||||
CalendarEventAccepted(super.calendarEventAcceptResponse);
|
||||
}
|
||||
|
||||
class CalendarEventAcceptFailure extends CalendarEventReplyFailure {
|
||||
CalendarEventAcceptFailure({super.exception});
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/method/response/calendar_event_reply_response.dart';
|
||||
|
||||
class CalendarEventReplying extends LoadingState {}
|
||||
|
||||
class CalendarEventReplySuccess extends UIState {
|
||||
final CalendarEventReplyResponse calendarEventReplyResponse;
|
||||
|
||||
CalendarEventReplySuccess(this.calendarEventReplyResponse);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [calendarEventReplyResponse];
|
||||
}
|
||||
|
||||
class CalendarEventReplyFailure extends FeatureFailure {
|
||||
CalendarEventReplyFailure({super.exception});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/repository/calendar_event_repository.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/calendar_event_accept_state.dart';
|
||||
|
||||
class AcceptCalendarEventInteractor {
|
||||
AcceptCalendarEventInteractor(this._calendarEventRepository);
|
||||
|
||||
final CalendarEventRepository _calendarEventRepository;
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
AccountId accountId,
|
||||
Set<Id> blobIds
|
||||
) async* {
|
||||
try {
|
||||
yield Right(CalendarEventAccepting());
|
||||
final result = await _calendarEventRepository.acceptEventInvitation(accountId, blobIds);
|
||||
yield Right(CalendarEventAccepted(result));
|
||||
} catch (e) {
|
||||
yield Left(CalendarEventAcceptFailure(exception: e));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user