Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web socket ticket capability #98

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## [0.2.1] - 2024-09-16
## [0.2.3] - 2024-09-16
- Add web socket ticket capability

## [0.2.2] - 2024-09-16
- Add X-JMAP-Identity header

## [0.2.1] - 2024-08-28
Expand Down
2 changes: 2 additions & 0 deletions lib/http/converter/capabilities_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:jmap_dart_client/jmap/core/capability/mail_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/mdn_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/submission_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/vacation_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/web_socket_ticket_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/websocket_capability.dart';

class CapabilitiesConverter {
Expand All @@ -26,6 +27,7 @@ class CapabilitiesConverter {
CapabilityIdentifier.jamesCalendarEvent: CalendarEventCapability.deserialize,
CapabilityIdentifier.jmapVacationResponse: VacationCapability.deserialize,
CapabilityIdentifier.jmapWebSocket: WebSocketCapability.deserialize,
CapabilityIdentifier.jmapWebSocketTicket: WebSocketTicketCapability.deserialize,
CapabilityIdentifier.jmapMdn: MdnCapability.deserialize
});
}
Expand Down
1 change: 1 addition & 0 deletions lib/jmap/core/capability/capability_identifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CapabilityIdentifier with EquatableMixin {
static final jmapSubmission = CapabilityIdentifier(Uri.parse('urn:ietf:params:jmap:submission'));
static final jmapVacationResponse = CapabilityIdentifier(Uri.parse('urn:ietf:params:jmap:vacationresponse'));
static final jmapWebSocket = CapabilityIdentifier(Uri.parse('urn:ietf:params:jmap:websocket'));
static final jmapWebSocketTicket = CapabilityIdentifier(Uri.parse('com:linagora:params:jmap:ws:ticket'));
static final jmapMdn = CapabilityIdentifier(Uri.parse('urn:ietf:params:jmap:mdn'));
static final jmapQuota = CapabilityIdentifier(Uri.parse('urn:ietf:params:jmap:quota'));
static final jmapTeamMailboxes = CapabilityIdentifier(Uri.parse('urn:apache:james:params:jmap:mail:shares'));
Expand Down
21 changes: 21 additions & 0 deletions lib/jmap/core/capability/web_socket_ticket_capability.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:jmap_dart_client/jmap/core/capability/capability_properties.dart';
import 'package:json_annotation/json_annotation.dart';

part 'web_socket_ticket_capability.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class WebSocketTicketCapability extends CapabilityProperties {
final Uri? generationEndpoint;
final Uri? revocationEndpoint;

WebSocketTicketCapability({required this.generationEndpoint, required this.revocationEndpoint});

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

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

static WebSocketTicketCapability deserialize(Map<String, dynamic> json) => WebSocketTicketCapability.fromJson(json);

@override
List<Object?> get props => [generationEndpoint, revocationEndpoint];
}
33 changes: 33 additions & 0 deletions lib/jmap/core/capability/web_socket_ticket_capability.g.dart

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

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: jmap_dart_client
description: A JMAP client library to make JMAP method calls and process the responses.
version: 0.2.2
version: 0.2.3
homepage: https://github.com/linagora/jmap-dart-client.git

environment:
Expand Down
10 changes: 10 additions & 0 deletions test/jmap/core/session/session_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:jmap_dart_client/jmap/core/capability/mail_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/mdn_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/submission_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/vacation_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/web_socket_ticket_capability.dart';
import 'package:jmap_dart_client/jmap/core/capability/websocket_capability.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:jmap_dart_client/jmap/core/session/session.dart';
Expand Down Expand Up @@ -68,6 +69,10 @@ void main() {
"supportsPush": true,
"url": "ws://domain.com/jmap/ws"
},
"com:linagora:params:jmap:ws:ticket": {
"generationEndpoint": "http://localhost/jmap/ws/ticket",
"revocationEndpoint": "http://localhost/jmap/ws/ticket"
},
"urn:apache:james:params:jmap:mail:quota": {},
"urn:apache:james:params:jmap:mail:shares": {},
"urn:ietf:params:jmap:vacationresponse": {},
Expand Down Expand Up @@ -125,6 +130,7 @@ void main() {
"urn:ietf:params:jmap:submission": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"com:linagora:params:calendar:event": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"urn:ietf:params:jmap:websocket": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"com:linagora:params:jmap:ws:ticket": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"urn:ietf:params:jmap:core": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"urn:ietf:params:jmap:mail": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"urn:apache:james:params:jmap:mail:quota": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
Expand Down Expand Up @@ -170,6 +176,9 @@ void main() {
supportsPush: true,
url: Uri.parse('ws://domain.com/jmap/ws')
),
CapabilityIdentifier.jmapWebSocketTicket: WebSocketTicketCapability(
generationEndpoint: Uri.parse('http://localhost/jmap/ws/ticket'),
revocationEndpoint: Uri.parse('http://localhost/jmap/ws/ticket')),
CapabilityIdentifier(Uri.parse('urn:apache:james:params:jmap:mail:quota')): DefaultCapability(<String, dynamic>{}),
CapabilityIdentifier(Uri.parse('urn:apache:james:params:jmap:mail:shares')): DefaultCapability(<String, dynamic>{}),
CapabilityIdentifier.jmapVacationResponse: VacationCapability(),
Expand Down Expand Up @@ -217,6 +226,7 @@ void main() {
CapabilityIdentifier.jmapSubmission: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
CapabilityIdentifier.jamesCalendarEvent: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
CapabilityIdentifier.jmapWebSocket: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
CapabilityIdentifier.jmapWebSocketTicket: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
CapabilityIdentifier.jmapCore: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
CapabilityIdentifier.jmapMail: AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
CapabilityIdentifier(Uri.parse('urn:apache:james:params:jmap:mail:quota')): AccountId(Id('29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6')),
Expand Down
Loading