diff --git a/lib/http/converter/capabilities_converter.dart b/lib/http/converter/capabilities_converter.dart index d8af6fc..12c6305 100644 --- a/lib/http/converter/capabilities_converter.dart +++ b/lib/http/converter/capabilities_converter.dart @@ -1,4 +1,5 @@ import 'package:built_collection/built_collection.dart'; +import 'package:jmap_dart_client/jmap/core/capability/calendar_event_capability.dart'; import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart'; import 'package:jmap_dart_client/jmap/core/capability/capability_properties.dart'; import 'package:jmap_dart_client/jmap/core/capability/core_capability.dart'; @@ -22,6 +23,7 @@ class CapabilitiesConverter { CapabilityIdentifier.jmapMail: MailCapability.deserialize, CapabilityIdentifier.jmapCore: CoreCapability.deserialize, CapabilityIdentifier.jmapSubmission: SubmissionCapability.deserialize, + CapabilityIdentifier.jamesCalendarEvent: CalendarEventCapability.deserialize, CapabilityIdentifier.jmapVacationResponse: VacationCapability.deserialize, CapabilityIdentifier.jmapWebSocket: WebSocketCapability.deserialize, CapabilityIdentifier.jmapMdn: MdnCapability.deserialize diff --git a/lib/jmap/core/capability/calendar_event_capability.dart b/lib/jmap/core/capability/calendar_event_capability.dart new file mode 100644 index 0000000..839fccb --- /dev/null +++ b/lib/jmap/core/capability/calendar_event_capability.dart @@ -0,0 +1,23 @@ +import 'package:jmap_dart_client/jmap/core/capability/capability_properties.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'calendar_event_capability.g.dart'; + +@JsonSerializable(includeIfNull: false) +class CalendarEventCapability extends CapabilityProperties { + final List? replySupportedLanguage; + + CalendarEventCapability({this.replySupportedLanguage}); + + factory CalendarEventCapability.fromJson(Map json) + => _$CalendarEventCapabilityFromJson(json); + + Map toJson() => _$CalendarEventCapabilityToJson(this); + + static CalendarEventCapability deserialize(Map json) { + return CalendarEventCapability.fromJson(json); + } + + @override + List get props => [replySupportedLanguage]; +} \ No newline at end of file diff --git a/lib/jmap/core/capability/calendar_event_capability.g.dart b/lib/jmap/core/capability/calendar_event_capability.g.dart new file mode 100644 index 0000000..0757001 --- /dev/null +++ b/lib/jmap/core/capability/calendar_event_capability.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'calendar_event_capability.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CalendarEventCapability _$CalendarEventCapabilityFromJson( + Map json) => + CalendarEventCapability( + replySupportedLanguage: (json['replySupportedLanguage'] as List?) + ?.map((e) => e as String) + .toList(), + ); + +Map _$CalendarEventCapabilityToJson( + CalendarEventCapability instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('replySupportedLanguage', instance.replySupportedLanguage); + return val; +} diff --git a/test/jmap/core/session/session_test.dart b/test/jmap/core/session/session_test.dart index 00bc5b5..e10e7d5 100644 --- a/test/jmap/core/session/session_test.dart +++ b/test/jmap/core/session/session_test.dart @@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:jmap_dart_client/http/converter/capabilities_converter.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/core/account/account.dart'; +import 'package:jmap_dart_client/jmap/core/capability/calendar_event_capability.dart'; import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart'; import 'package:jmap_dart_client/jmap/core/capability/core_capability.dart'; import 'package:jmap_dart_client/jmap/core/capability/default_capability.dart'; @@ -30,6 +31,12 @@ void main() { "maxDelayedSend": 0, "submissionExtensions": {} }, + "com:linagora:params:calendar:event": { + "replySupportedLanguage": [ + "en", + "fr" + ] + }, "urn:ietf:params:jmap:core": { "maxSizeUpload": 20971520, "maxConcurrentUpload": 4, @@ -116,6 +123,7 @@ void main() { }, "primaryAccounts": { "urn:ietf:params:jmap:submission": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6", + "com:linagora:params:calendar:event": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6", "urn:ietf:params:jmap:websocket": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6", "urn:ietf:params:jmap:core": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6", "urn:ietf:params:jmap:mail": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6", @@ -138,6 +146,9 @@ void main() { maxDelayedSend: UnsignedInt(0), submissionExtensions: {} ), + CapabilityIdentifier.jamesCalendarEvent: CalendarEventCapability( + replySupportedLanguage: ["en", "fr"] + ), CapabilityIdentifier.jmapCore: CoreCapability( maxSizeUpload: UnsignedInt(20971520), maxConcurrentUpload: UnsignedInt(4), @@ -204,6 +215,7 @@ void main() { }, { CapabilityIdentifier.jmapSubmission: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')), + CapabilityIdentifier.jamesCalendarEvent: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')), CapabilityIdentifier.jmapWebSocket: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')), CapabilityIdentifier.jmapCore: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')), CapabilityIdentifier.jmapMail: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),