Line data Source code
1 : class ScheduledDelayedEventsResponse {
2 : final List<ScheduledDelayedEvent> scheduledEvents;
3 : final String? nextBatch;
4 :
5 0 : ScheduledDelayedEventsResponse({
6 : required this.scheduledEvents,
7 : this.nextBatch,
8 : });
9 :
10 0 : factory ScheduledDelayedEventsResponse.fromJson(Map<String, dynamic> json) {
11 0 : final list = json['delayed_events'] ?? json['scheduled'] as List;
12 : final scheduledEvents =
13 0 : list.map((e) => ScheduledDelayedEvent.fromJson(e)).toList();
14 :
15 0 : return ScheduledDelayedEventsResponse(
16 0 : scheduledEvents: List<ScheduledDelayedEvent>.from(scheduledEvents),
17 0 : nextBatch: json['next_batch'] as String?,
18 : );
19 : }
20 : }
21 :
22 : class ScheduledDelayedEvent {
23 : final String delayId;
24 : final String roomId;
25 : final String type;
26 : final String? stateKey;
27 : final int delay;
28 : final int runningSince;
29 : final Map<String, Object?> content;
30 :
31 0 : ScheduledDelayedEvent({
32 : required this.delayId,
33 : required this.roomId,
34 : required this.type,
35 : this.stateKey,
36 : required this.delay,
37 : required this.runningSince,
38 : required this.content,
39 : });
40 :
41 0 : factory ScheduledDelayedEvent.fromJson(Map<String, dynamic> json) {
42 0 : return ScheduledDelayedEvent(
43 0 : delayId: json['delay_id'] as String,
44 0 : roomId: json['room_id'] as String,
45 0 : type: json['type'] as String,
46 0 : stateKey: json['state_key'] as String?,
47 0 : delay: json['delay'] as int,
48 0 : runningSince: json['running_since'] as int,
49 0 : content: json['content'] as Map<String, Object?>,
50 : );
51 : }
52 :
53 0 : Map<String, dynamic> toJson() {
54 0 : return {
55 0 : 'delay_id': delayId,
56 0 : 'room_id': roomId,
57 0 : 'type': type,
58 0 : 'state_key': stateKey,
59 0 : 'delay': delay,
60 0 : 'running_since': runningSince,
61 0 : 'content': content,
62 : };
63 : }
64 : }
|