Line data Source code
1 : final class ReactionPayload {
2 : final String key;
3 : final bool isEphemeral;
4 : final String callId;
5 : final String deviceId;
6 : final String relType;
7 : final String eventId;
8 :
9 2 : ReactionPayload({
10 : required this.key,
11 : required this.isEphemeral,
12 : required this.callId,
13 : required this.deviceId,
14 : required this.relType,
15 : required this.eventId,
16 : });
17 :
18 2 : Map<String, dynamic> toJson() {
19 2 : return {
20 2 : 'key': key,
21 2 : 'is_ephemeral': isEphemeral,
22 2 : 'call_id': callId,
23 2 : 'device_id': deviceId,
24 2 : 'm.relates_to': {
25 2 : 'rel_type': relType,
26 2 : 'event_id': eventId,
27 : },
28 : };
29 : }
30 :
31 0 : factory ReactionPayload.fromJson(Map<String, dynamic> map) {
32 0 : return ReactionPayload(
33 0 : key: map['key'] as String,
34 0 : isEphemeral: map['is_ephemeral'] as bool,
35 0 : callId: map['call_id'] as String,
36 0 : deviceId: map['device_id'] as String,
37 0 : relType: map['m.relates_to']['rel_type'] as String,
38 0 : eventId: map['m.relates_to']['event_id'] as String,
39 : );
40 : }
41 : }
|