TF-2800 Calendar event accept - API and data source implementation
This commit is contained in:
@@ -7,6 +7,8 @@ import 'package:jmap_dart_client/jmap/jmap_request.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/parse/calendar_event_parse_method.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/parse/calendar_event_parse_response.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_method.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_response.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/exceptions/calendar_event_exceptions.dart';
|
||||
|
||||
class CalendarEventAPI {
|
||||
@@ -38,4 +40,25 @@ class CalendarEventAPI {
|
||||
throw NotParsableCalendarEventException();
|
||||
}
|
||||
}
|
||||
|
||||
Future<CalendarEventAcceptResponse> acceptEventInvitation(AccountId accountId, Set<Id> blobIds) async {
|
||||
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
|
||||
final calendarEventAcceptMethod = CalendarEventAcceptMethod(
|
||||
accountId,
|
||||
blobIds: blobIds.toList());
|
||||
final calendarEventAcceptInvocation = requestBuilder.invocation(calendarEventAcceptMethod);
|
||||
final response = await (requestBuilder..usings(calendarEventAcceptMethod.requiredCapabilities))
|
||||
.build()
|
||||
.execute();
|
||||
|
||||
final calendarEventAcceptResponse = response.parse<CalendarEventAcceptResponse>(
|
||||
calendarEventAcceptInvocation.methodCallId,
|
||||
CalendarEventAcceptResponse.deserialize);
|
||||
|
||||
if (calendarEventAcceptResponse == null) {
|
||||
throw NotAcceptableCalendarEventException();
|
||||
}
|
||||
|
||||
return calendarEventAcceptResponse;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user