Skip to content

Commit

Permalink
Add calendar event capability properties
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed May 17, 2024
1 parent 76e83e4 commit 951ba34
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/http/converter/capabilities_converter.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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
Expand Down
23 changes: 23 additions & 0 deletions lib/jmap/core/capability/calendar_event_capability.dart
Original file line number Diff line number Diff line change
@@ -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<String>? replySupportedLanguage;

CalendarEventCapability({this.replySupportedLanguage});

factory CalendarEventCapability.fromJson(Map<String, dynamic> json)
=> _$CalendarEventCapabilityFromJson(json);

Map<String, dynamic> toJson() => _$CalendarEventCapabilityToJson(this);

static CalendarEventCapability deserialize(Map<String, dynamic> json) {
return CalendarEventCapability.fromJson(json);
}

@override
List<Object?> get props => [replySupportedLanguage];
}
29 changes: 29 additions & 0 deletions lib/jmap/core/capability/calendar_event_capability.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions test/jmap/core/session/session_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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),
Expand Down Expand Up @@ -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')),
Expand Down

0 comments on commit 951ba34

Please sign in to comment.