LCOV - code coverage report
Current view: top level - lib/matrix_api_lite/generated - model.dart (source / functions) Hit Total Coverage
Test: merged.info Lines: 200 1416 14.1 %
Date: 2024-07-12 20:20:16 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:enhanced_enum/enhanced_enum.dart';
       2             : 
       3             : import 'package:matrix/matrix_api_lite/model/children_state.dart';
       4             : import 'package:matrix/matrix_api_lite/model/matrix_event.dart';
       5             : import 'package:matrix/matrix_api_lite/model/matrix_keys.dart';
       6             : 
       7             : part 'model.g.dart';
       8             : 
       9             : class _NameSource {
      10             :   final String source;
      11          82 :   const _NameSource(this.source);
      12             : }
      13             : 
      14             : ///
      15             : @_NameSource('spec')
      16             : class HomeserverInformation {
      17           0 :   HomeserverInformation({
      18             :     required this.baseUrl,
      19             :   });
      20             : 
      21           4 :   HomeserverInformation.fromJson(Map<String, Object?> json)
      22           8 :       : baseUrl = Uri.parse(json['base_url'] as String);
      23           0 :   Map<String, Object?> toJson() => {
      24           0 :         'base_url': baseUrl.toString(),
      25             :       };
      26             : 
      27             :   /// The base URL for the homeserver for client-server connections.
      28             :   Uri baseUrl;
      29             : }
      30             : 
      31             : ///
      32             : @_NameSource('spec')
      33             : class IdentityServerInformation {
      34           0 :   IdentityServerInformation({
      35             :     required this.baseUrl,
      36             :   });
      37             : 
      38           4 :   IdentityServerInformation.fromJson(Map<String, Object?> json)
      39           8 :       : baseUrl = Uri.parse(json['base_url'] as String);
      40           0 :   Map<String, Object?> toJson() => {
      41           0 :         'base_url': baseUrl.toString(),
      42             :       };
      43             : 
      44             :   /// The base URL for the identity server for client-server connections.
      45             :   Uri baseUrl;
      46             : }
      47             : 
      48             : /// Used by clients to determine the homeserver, identity server, and other
      49             : /// optional components they should be interacting with.
      50             : @_NameSource('spec')
      51             : class DiscoveryInformation {
      52           0 :   DiscoveryInformation({
      53             :     required this.mHomeserver,
      54             :     this.mIdentityServer,
      55             :     this.additionalProperties = const {},
      56             :   });
      57             : 
      58           4 :   DiscoveryInformation.fromJson(Map<String, Object?> json)
      59           4 :       : mHomeserver = HomeserverInformation.fromJson(
      60           4 :             json['m.homeserver'] as Map<String, Object?>),
      61           4 :         mIdentityServer = ((v) => v != null
      62           4 :             ? IdentityServerInformation.fromJson(v as Map<String, Object?>)
      63           8 :             : null)(json['m.identity_server']),
      64           8 :         additionalProperties = Map.fromEntries(json.entries
      65           4 :             .where(
      66          16 :                 (e) => !['m.homeserver', 'm.identity_server'].contains(e.key))
      67           4 :             .map((e) => MapEntry(e.key, e.value as Map<String, Object?>)));
      68           0 :   Map<String, Object?> toJson() {
      69           0 :     final mIdentityServer = this.mIdentityServer;
      70           0 :     return {
      71           0 :       ...additionalProperties,
      72           0 :       'm.homeserver': mHomeserver.toJson(),
      73             :       if (mIdentityServer != null)
      74           0 :         'm.identity_server': mIdentityServer.toJson(),
      75             :     };
      76             :   }
      77             : 
      78             :   /// Used by clients to discover homeserver information.
      79             :   HomeserverInformation mHomeserver;
      80             : 
      81             :   /// Used by clients to discover identity server information.
      82             :   IdentityServerInformation? mIdentityServer;
      83             : 
      84             :   Map<String, Map<String, Object?>> additionalProperties;
      85             : }
      86             : 
      87             : ///
      88             : @_NameSource('spec')
      89             : class PublicRoomsChunk {
      90           0 :   PublicRoomsChunk({
      91             :     this.avatarUrl,
      92             :     this.canonicalAlias,
      93             :     required this.guestCanJoin,
      94             :     this.joinRule,
      95             :     this.name,
      96             :     required this.numJoinedMembers,
      97             :     required this.roomId,
      98             :     this.roomType,
      99             :     this.topic,
     100             :     required this.worldReadable,
     101             :   });
     102             : 
     103           0 :   PublicRoomsChunk.fromJson(Map<String, Object?> json)
     104           0 :       : avatarUrl = ((v) =>
     105           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
     106             :         canonicalAlias =
     107           0 :             ((v) => v != null ? v as String : null)(json['canonical_alias']),
     108           0 :         guestCanJoin = json['guest_can_join'] as bool,
     109           0 :         joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
     110           0 :         name = ((v) => v != null ? v as String : null)(json['name']),
     111           0 :         numJoinedMembers = json['num_joined_members'] as int,
     112           0 :         roomId = json['room_id'] as String,
     113           0 :         roomType = ((v) => v != null ? v as String : null)(json['room_type']),
     114           0 :         topic = ((v) => v != null ? v as String : null)(json['topic']),
     115           0 :         worldReadable = json['world_readable'] as bool;
     116           0 :   Map<String, Object?> toJson() {
     117           0 :     final avatarUrl = this.avatarUrl;
     118           0 :     final canonicalAlias = this.canonicalAlias;
     119           0 :     final joinRule = this.joinRule;
     120           0 :     final name = this.name;
     121           0 :     final roomType = this.roomType;
     122           0 :     final topic = this.topic;
     123           0 :     return {
     124           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
     125           0 :       if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
     126           0 :       'guest_can_join': guestCanJoin,
     127           0 :       if (joinRule != null) 'join_rule': joinRule,
     128           0 :       if (name != null) 'name': name,
     129           0 :       'num_joined_members': numJoinedMembers,
     130           0 :       'room_id': roomId,
     131           0 :       if (roomType != null) 'room_type': roomType,
     132           0 :       if (topic != null) 'topic': topic,
     133           0 :       'world_readable': worldReadable,
     134             :     };
     135             :   }
     136             : 
     137             :   /// The URL for the room's avatar, if one is set.
     138             :   Uri? avatarUrl;
     139             : 
     140             :   /// The canonical alias of the room, if any.
     141             :   String? canonicalAlias;
     142             : 
     143             :   /// Whether guest users may join the room and participate in it.
     144             :   /// If they can, they will be subject to ordinary power level
     145             :   /// rules like any other user.
     146             :   bool guestCanJoin;
     147             : 
     148             :   /// The room's join rule. When not present, the room is assumed to
     149             :   /// be `public`.
     150             :   String? joinRule;
     151             : 
     152             :   /// The name of the room, if any.
     153             :   String? name;
     154             : 
     155             :   /// The number of members joined to the room.
     156             :   int numJoinedMembers;
     157             : 
     158             :   /// The ID of the room.
     159             :   String roomId;
     160             : 
     161             :   /// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
     162             :   String? roomType;
     163             : 
     164             :   /// The topic of the room, if any.
     165             :   String? topic;
     166             : 
     167             :   /// Whether the room may be viewed by guest users without joining.
     168             :   bool worldReadable;
     169             : }
     170             : 
     171             : ///
     172             : @_NameSource('spec')
     173             : class ChildRoomsChunk {
     174           0 :   ChildRoomsChunk({
     175             :     required this.childrenState,
     176             :     this.roomType,
     177             :   });
     178             : 
     179           0 :   ChildRoomsChunk.fromJson(Map<String, Object?> json)
     180           0 :       : childrenState = (json['children_state'] as List)
     181           0 :             .map((v) => ChildrenState.fromJson(v as Map<String, Object?>))
     182           0 :             .toList(),
     183           0 :         roomType = ((v) => v != null ? v as String : null)(json['room_type']);
     184           0 :   Map<String, Object?> toJson() {
     185           0 :     final roomType = this.roomType;
     186           0 :     return {
     187           0 :       'children_state': childrenState.map((v) => v.toJson()).toList(),
     188           0 :       if (roomType != null) 'room_type': roomType,
     189             :     };
     190             :   }
     191             : 
     192             :   /// The [`m.space.child`](#mspacechild) events of the space-room, represented
     193             :   /// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
     194             :   ///
     195             :   /// If the room is not a space-room, this should be empty.
     196             :   List<ChildrenState> childrenState;
     197             : 
     198             :   /// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
     199             :   String? roomType;
     200             : }
     201             : 
     202             : ///
     203             : @_NameSource('rule override generated')
     204             : class SpaceRoomsChunk implements PublicRoomsChunk, ChildRoomsChunk {
     205           0 :   SpaceRoomsChunk({
     206             :     this.avatarUrl,
     207             :     this.canonicalAlias,
     208             :     required this.guestCanJoin,
     209             :     this.joinRule,
     210             :     this.name,
     211             :     required this.numJoinedMembers,
     212             :     required this.roomId,
     213             :     this.roomType,
     214             :     this.topic,
     215             :     required this.worldReadable,
     216             :     required this.childrenState,
     217             :   });
     218             : 
     219           0 :   SpaceRoomsChunk.fromJson(Map<String, Object?> json)
     220           0 :       : avatarUrl = ((v) =>
     221           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
     222             :         canonicalAlias =
     223           0 :             ((v) => v != null ? v as String : null)(json['canonical_alias']),
     224           0 :         guestCanJoin = json['guest_can_join'] as bool,
     225           0 :         joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
     226           0 :         name = ((v) => v != null ? v as String : null)(json['name']),
     227           0 :         numJoinedMembers = json['num_joined_members'] as int,
     228           0 :         roomId = json['room_id'] as String,
     229           0 :         roomType = ((v) => v != null ? v as String : null)(json['room_type']),
     230           0 :         topic = ((v) => v != null ? v as String : null)(json['topic']),
     231           0 :         worldReadable = json['world_readable'] as bool,
     232           0 :         childrenState = (json['children_state'] as List)
     233           0 :             .map((v) => ChildrenState.fromJson(v as Map<String, Object?>))
     234           0 :             .toList();
     235           0 :   @override
     236             :   Map<String, Object?> toJson() {
     237           0 :     final avatarUrl = this.avatarUrl;
     238           0 :     final canonicalAlias = this.canonicalAlias;
     239           0 :     final joinRule = this.joinRule;
     240           0 :     final name = this.name;
     241           0 :     final roomType = this.roomType;
     242           0 :     final topic = this.topic;
     243           0 :     return {
     244           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
     245           0 :       if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
     246           0 :       'guest_can_join': guestCanJoin,
     247           0 :       if (joinRule != null) 'join_rule': joinRule,
     248           0 :       if (name != null) 'name': name,
     249           0 :       'num_joined_members': numJoinedMembers,
     250           0 :       'room_id': roomId,
     251           0 :       if (roomType != null) 'room_type': roomType,
     252           0 :       if (topic != null) 'topic': topic,
     253           0 :       'world_readable': worldReadable,
     254           0 :       'children_state': childrenState.map((v) => v.toJson()).toList(),
     255             :     };
     256             :   }
     257             : 
     258             :   /// The URL for the room's avatar, if one is set.
     259             :   @override
     260             :   Uri? avatarUrl;
     261             : 
     262             :   /// The canonical alias of the room, if any.
     263             :   @override
     264             :   String? canonicalAlias;
     265             : 
     266             :   /// Whether guest users may join the room and participate in it.
     267             :   /// If they can, they will be subject to ordinary power level
     268             :   /// rules like any other user.
     269             :   @override
     270             :   bool guestCanJoin;
     271             : 
     272             :   /// The room's join rule. When not present, the room is assumed to
     273             :   /// be `public`.
     274             :   @override
     275             :   String? joinRule;
     276             : 
     277             :   /// The name of the room, if any.
     278             :   @override
     279             :   String? name;
     280             : 
     281             :   /// The number of members joined to the room.
     282             :   @override
     283             :   int numJoinedMembers;
     284             : 
     285             :   /// The ID of the room.
     286             :   @override
     287             :   String roomId;
     288             : 
     289             :   /// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
     290             :   @override
     291             :   String? roomType;
     292             : 
     293             :   /// The topic of the room, if any.
     294             :   @override
     295             :   String? topic;
     296             : 
     297             :   /// Whether the room may be viewed by guest users without joining.
     298             :   @override
     299             :   bool worldReadable;
     300             : 
     301             :   /// The [`m.space.child`](#mspacechild) events of the space-room, represented
     302             :   /// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
     303             :   ///
     304             :   /// If the room is not a space-room, this should be empty.
     305             :   @override
     306             :   List<ChildrenState> childrenState;
     307             : }
     308             : 
     309             : ///
     310             : @_NameSource('generated')
     311             : class GetSpaceHierarchyResponse {
     312           0 :   GetSpaceHierarchyResponse({
     313             :     this.nextBatch,
     314             :     required this.rooms,
     315             :   });
     316             : 
     317           0 :   GetSpaceHierarchyResponse.fromJson(Map<String, Object?> json)
     318           0 :       : nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     319           0 :         rooms = (json['rooms'] as List)
     320           0 :             .map((v) => SpaceRoomsChunk.fromJson(v as Map<String, Object?>))
     321           0 :             .toList();
     322           0 :   Map<String, Object?> toJson() {
     323           0 :     final nextBatch = this.nextBatch;
     324           0 :     return {
     325           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     326           0 :       'rooms': rooms.map((v) => v.toJson()).toList(),
     327             :     };
     328             :   }
     329             : 
     330             :   /// A token to supply to `from` to keep paginating the responses. Not present when there are
     331             :   /// no further results.
     332             :   String? nextBatch;
     333             : 
     334             :   /// The rooms for the current page, with the current filters.
     335             :   List<SpaceRoomsChunk> rooms;
     336             : }
     337             : 
     338             : ///
     339             : @_NameSource('rule override generated')
     340             : @EnhancedEnum()
     341             : enum Direction {
     342             :   @EnhancedEnumValue(name: 'b')
     343             :   b,
     344             :   @EnhancedEnumValue(name: 'f')
     345             :   f
     346             : }
     347             : 
     348             : ///
     349             : @_NameSource('generated')
     350             : class GetRelatingEventsResponse {
     351           0 :   GetRelatingEventsResponse({
     352             :     required this.chunk,
     353             :     this.nextBatch,
     354             :     this.prevBatch,
     355             :   });
     356             : 
     357           0 :   GetRelatingEventsResponse.fromJson(Map<String, Object?> json)
     358           0 :       : chunk = (json['chunk'] as List)
     359           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     360           0 :             .toList(),
     361           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     362           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']);
     363           0 :   Map<String, Object?> toJson() {
     364           0 :     final nextBatch = this.nextBatch;
     365           0 :     final prevBatch = this.prevBatch;
     366           0 :     return {
     367           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     368           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     369           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
     370             :     };
     371             :   }
     372             : 
     373             :   /// The child events of the requested event, ordered topologically most-recent first.
     374             :   List<MatrixEvent> chunk;
     375             : 
     376             :   /// An opaque string representing a pagination token. The absence of this token
     377             :   /// means there are no more results to fetch and the client should stop paginating.
     378             :   String? nextBatch;
     379             : 
     380             :   /// An opaque string representing a pagination token. The absence of this token
     381             :   /// means this is the start of the result set, i.e. this is the first batch/page.
     382             :   String? prevBatch;
     383             : }
     384             : 
     385             : ///
     386             : @_NameSource('generated')
     387             : class GetRelatingEventsWithRelTypeResponse {
     388           0 :   GetRelatingEventsWithRelTypeResponse({
     389             :     required this.chunk,
     390             :     this.nextBatch,
     391             :     this.prevBatch,
     392             :   });
     393             : 
     394           0 :   GetRelatingEventsWithRelTypeResponse.fromJson(Map<String, Object?> json)
     395           0 :       : chunk = (json['chunk'] as List)
     396           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     397           0 :             .toList(),
     398           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     399           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']);
     400           0 :   Map<String, Object?> toJson() {
     401           0 :     final nextBatch = this.nextBatch;
     402           0 :     final prevBatch = this.prevBatch;
     403           0 :     return {
     404           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     405           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     406           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
     407             :     };
     408             :   }
     409             : 
     410             :   /// The child events of the requested event, ordered topologically
     411             :   /// most-recent first. The events returned will match the `relType`
     412             :   /// supplied in the URL.
     413             :   List<MatrixEvent> chunk;
     414             : 
     415             :   /// An opaque string representing a pagination token. The absence of this token
     416             :   /// means there are no more results to fetch and the client should stop paginating.
     417             :   String? nextBatch;
     418             : 
     419             :   /// An opaque string representing a pagination token. The absence of this token
     420             :   /// means this is the start of the result set, i.e. this is the first batch/page.
     421             :   String? prevBatch;
     422             : }
     423             : 
     424             : ///
     425             : @_NameSource('generated')
     426             : class GetRelatingEventsWithRelTypeAndEventTypeResponse {
     427           0 :   GetRelatingEventsWithRelTypeAndEventTypeResponse({
     428             :     required this.chunk,
     429             :     this.nextBatch,
     430             :     this.prevBatch,
     431             :   });
     432             : 
     433           0 :   GetRelatingEventsWithRelTypeAndEventTypeResponse.fromJson(
     434             :       Map<String, Object?> json)
     435           0 :       : chunk = (json['chunk'] as List)
     436           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     437           0 :             .toList(),
     438           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     439           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']);
     440           0 :   Map<String, Object?> toJson() {
     441           0 :     final nextBatch = this.nextBatch;
     442           0 :     final prevBatch = this.prevBatch;
     443           0 :     return {
     444           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     445           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     446           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
     447             :     };
     448             :   }
     449             : 
     450             :   /// The child events of the requested event, ordered topologically most-recent
     451             :   /// first. The events returned will match the `relType` and `eventType` supplied
     452             :   /// in the URL.
     453             :   List<MatrixEvent> chunk;
     454             : 
     455             :   /// An opaque string representing a pagination token. The absence of this token
     456             :   /// means there are no more results to fetch and the client should stop paginating.
     457             :   String? nextBatch;
     458             : 
     459             :   /// An opaque string representing a pagination token. The absence of this token
     460             :   /// means this is the start of the result set, i.e. this is the first batch/page.
     461             :   String? prevBatch;
     462             : }
     463             : 
     464             : ///
     465             : @_NameSource('generated')
     466             : @EnhancedEnum()
     467             : enum Include {
     468             :   @EnhancedEnumValue(name: 'all')
     469             :   all,
     470             :   @EnhancedEnumValue(name: 'participated')
     471             :   participated
     472             : }
     473             : 
     474             : ///
     475             : @_NameSource('generated')
     476             : class GetThreadRootsResponse {
     477           0 :   GetThreadRootsResponse({
     478             :     required this.chunk,
     479             :     this.nextBatch,
     480             :   });
     481             : 
     482           0 :   GetThreadRootsResponse.fromJson(Map<String, Object?> json)
     483           0 :       : chunk = (json['chunk'] as List)
     484           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     485           0 :             .toList(),
     486           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']);
     487           0 :   Map<String, Object?> toJson() {
     488           0 :     final nextBatch = this.nextBatch;
     489           0 :     return {
     490           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     491           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     492             :     };
     493             :   }
     494             : 
     495             :   /// The thread roots, ordered by the `latest_event` in each event's aggregation bundle. All events
     496             :   /// returned include bundled [aggregations](https://spec.matrix.org/unstable/client-server-api/#aggregations).
     497             :   ///
     498             :   /// If the thread root event was sent by an [ignored user](https://spec.matrix.org/unstable/client-server-api/#ignoring-users), the
     499             :   /// event is returned redacted to the caller. This is to simulate the same behaviour of a client doing
     500             :   /// aggregation locally on the thread.
     501             :   List<MatrixEvent> chunk;
     502             : 
     503             :   /// A token to supply to `from` to keep paginating the responses. Not present when there are
     504             :   /// no further results.
     505             :   String? nextBatch;
     506             : }
     507             : 
     508             : ///
     509             : @_NameSource('generated')
     510             : class GetEventByTimestampResponse {
     511           0 :   GetEventByTimestampResponse({
     512             :     required this.eventId,
     513             :     required this.originServerTs,
     514             :   });
     515             : 
     516           0 :   GetEventByTimestampResponse.fromJson(Map<String, Object?> json)
     517           0 :       : eventId = json['event_id'] as String,
     518           0 :         originServerTs = json['origin_server_ts'] as int;
     519           0 :   Map<String, Object?> toJson() => {
     520           0 :         'event_id': eventId,
     521           0 :         'origin_server_ts': originServerTs,
     522             :       };
     523             : 
     524             :   /// The ID of the event found
     525             :   String eventId;
     526             : 
     527             :   /// The event's timestamp, in milliseconds since the Unix epoch.
     528             :   /// This makes it easy to do a quick comparison to see if the
     529             :   /// `event_id` fetched is too far out of range to be useful for your
     530             :   /// use case.
     531             :   int originServerTs;
     532             : }
     533             : 
     534             : ///
     535             : @_NameSource('rule override generated')
     536             : @EnhancedEnum()
     537             : enum ThirdPartyIdentifierMedium {
     538             :   @EnhancedEnumValue(name: 'email')
     539             :   email,
     540             :   @EnhancedEnumValue(name: 'msisdn')
     541             :   msisdn
     542             : }
     543             : 
     544             : ///
     545             : @_NameSource('spec')
     546             : class ThirdPartyIdentifier {
     547           0 :   ThirdPartyIdentifier({
     548             :     required this.addedAt,
     549             :     required this.address,
     550             :     required this.medium,
     551             :     required this.validatedAt,
     552             :   });
     553             : 
     554           0 :   ThirdPartyIdentifier.fromJson(Map<String, Object?> json)
     555           0 :       : addedAt = json['added_at'] as int,
     556           0 :         address = json['address'] as String,
     557             :         medium = ThirdPartyIdentifierMedium.values
     558           0 :             .fromString(json['medium'] as String)!,
     559           0 :         validatedAt = json['validated_at'] as int;
     560           0 :   Map<String, Object?> toJson() => {
     561           0 :         'added_at': addedAt,
     562           0 :         'address': address,
     563           0 :         'medium': medium.name,
     564           0 :         'validated_at': validatedAt,
     565             :       };
     566             : 
     567             :   /// The timestamp, in milliseconds, when the homeserver associated the third party identifier with the user.
     568             :   int addedAt;
     569             : 
     570             :   /// The third party identifier address.
     571             :   String address;
     572             : 
     573             :   /// The medium of the third party identifier.
     574             :   ThirdPartyIdentifierMedium medium;
     575             : 
     576             :   /// The timestamp, in milliseconds, when the identifier was
     577             :   /// validated by the identity server.
     578             :   int validatedAt;
     579             : }
     580             : 
     581             : ///
     582             : @_NameSource('spec')
     583             : class ThreePidCredentials {
     584           0 :   ThreePidCredentials({
     585             :     required this.clientSecret,
     586             :     required this.idAccessToken,
     587             :     required this.idServer,
     588             :     required this.sid,
     589             :   });
     590             : 
     591           0 :   ThreePidCredentials.fromJson(Map<String, Object?> json)
     592           0 :       : clientSecret = json['client_secret'] as String,
     593           0 :         idAccessToken = json['id_access_token'] as String,
     594           0 :         idServer = json['id_server'] as String,
     595           0 :         sid = json['sid'] as String;
     596           0 :   Map<String, Object?> toJson() => {
     597           0 :         'client_secret': clientSecret,
     598           0 :         'id_access_token': idAccessToken,
     599           0 :         'id_server': idServer,
     600           0 :         'sid': sid,
     601             :       };
     602             : 
     603             :   /// The client secret used in the session with the identity server.
     604             :   String clientSecret;
     605             : 
     606             :   /// An access token previously registered with the identity server. Servers
     607             :   /// can treat this as optional to distinguish between r0.5-compatible clients
     608             :   /// and this specification version.
     609             :   String idAccessToken;
     610             : 
     611             :   /// The identity server to use.
     612             :   String idServer;
     613             : 
     614             :   /// The session identifier given by the identity server.
     615             :   String sid;
     616             : }
     617             : 
     618             : ///
     619             : @_NameSource('generated')
     620             : @EnhancedEnum()
     621             : enum IdServerUnbindResult {
     622             :   @EnhancedEnumValue(name: 'no-support')
     623             :   noSupport,
     624             :   @EnhancedEnumValue(name: 'success')
     625             :   success
     626             : }
     627             : 
     628             : ///
     629             : @_NameSource('spec')
     630             : class RequestTokenResponse {
     631           0 :   RequestTokenResponse({
     632             :     required this.sid,
     633             :     this.submitUrl,
     634             :   });
     635             : 
     636           0 :   RequestTokenResponse.fromJson(Map<String, Object?> json)
     637           0 :       : sid = json['sid'] as String,
     638           0 :         submitUrl = ((v) =>
     639           0 :             v != null ? Uri.parse(v as String) : null)(json['submit_url']);
     640           0 :   Map<String, Object?> toJson() {
     641           0 :     final submitUrl = this.submitUrl;
     642           0 :     return {
     643           0 :       'sid': sid,
     644           0 :       if (submitUrl != null) 'submit_url': submitUrl.toString(),
     645             :     };
     646             :   }
     647             : 
     648             :   /// The session ID. Session IDs are opaque strings that must consist entirely
     649             :   /// of the characters `[0-9a-zA-Z.=_-]`. Their length must not exceed 255
     650             :   /// characters and they must not be empty.
     651             :   String sid;
     652             : 
     653             :   /// An optional field containing a URL where the client must submit the
     654             :   /// validation token to, with identical parameters to the Identity Service
     655             :   /// API's `POST /validate/email/submitToken` endpoint (without the requirement
     656             :   /// for an access token). The homeserver must send this token to the user (if
     657             :   /// applicable), who should then be prompted to provide it to the client.
     658             :   ///
     659             :   /// If this field is not present, the client can assume that verification
     660             :   /// will happen without the client's involvement provided the homeserver
     661             :   /// advertises this specification version in the `/versions` response
     662             :   /// (ie: r0.5.0).
     663             :   Uri? submitUrl;
     664             : }
     665             : 
     666             : ///
     667             : @_NameSource('rule override generated')
     668             : class TokenOwnerInfo {
     669           0 :   TokenOwnerInfo({
     670             :     this.deviceId,
     671             :     this.isGuest,
     672             :     required this.userId,
     673             :   });
     674             : 
     675           0 :   TokenOwnerInfo.fromJson(Map<String, Object?> json)
     676           0 :       : deviceId = ((v) => v != null ? v as String : null)(json['device_id']),
     677           0 :         isGuest = ((v) => v != null ? v as bool : null)(json['is_guest']),
     678           0 :         userId = json['user_id'] as String;
     679           0 :   Map<String, Object?> toJson() {
     680           0 :     final deviceId = this.deviceId;
     681           0 :     final isGuest = this.isGuest;
     682           0 :     return {
     683           0 :       if (deviceId != null) 'device_id': deviceId,
     684           0 :       if (isGuest != null) 'is_guest': isGuest,
     685           0 :       'user_id': userId,
     686             :     };
     687             :   }
     688             : 
     689             :   /// Device ID associated with the access token. If no device
     690             :   /// is associated with the access token (such as in the case
     691             :   /// of application services) then this field can be omitted.
     692             :   /// Otherwise this is required.
     693             :   String? deviceId;
     694             : 
     695             :   /// When `true`, the user is a [Guest User](#guest-access). When
     696             :   /// not present or `false`, the user is presumed to be a non-guest
     697             :   /// user.
     698             :   bool? isGuest;
     699             : 
     700             :   /// The user ID that owns the access token.
     701             :   String userId;
     702             : }
     703             : 
     704             : ///
     705             : @_NameSource('spec')
     706             : class ConnectionInfo {
     707           0 :   ConnectionInfo({
     708             :     this.ip,
     709             :     this.lastSeen,
     710             :     this.userAgent,
     711             :   });
     712             : 
     713           0 :   ConnectionInfo.fromJson(Map<String, Object?> json)
     714           0 :       : ip = ((v) => v != null ? v as String : null)(json['ip']),
     715           0 :         lastSeen = ((v) => v != null ? v as int : null)(json['last_seen']),
     716           0 :         userAgent = ((v) => v != null ? v as String : null)(json['user_agent']);
     717           0 :   Map<String, Object?> toJson() {
     718           0 :     final ip = this.ip;
     719           0 :     final lastSeen = this.lastSeen;
     720           0 :     final userAgent = this.userAgent;
     721           0 :     return {
     722           0 :       if (ip != null) 'ip': ip,
     723           0 :       if (lastSeen != null) 'last_seen': lastSeen,
     724           0 :       if (userAgent != null) 'user_agent': userAgent,
     725             :     };
     726             :   }
     727             : 
     728             :   /// Most recently seen IP address of the session.
     729             :   String? ip;
     730             : 
     731             :   /// Unix timestamp that the session was last active.
     732             :   int? lastSeen;
     733             : 
     734             :   /// User agent string last seen in the session.
     735             :   String? userAgent;
     736             : }
     737             : 
     738             : ///
     739             : @_NameSource('spec')
     740             : class SessionInfo {
     741           0 :   SessionInfo({
     742             :     this.connections,
     743             :   });
     744             : 
     745           0 :   SessionInfo.fromJson(Map<String, Object?> json)
     746           0 :       : connections = ((v) => v != null
     747             :             ? (v as List)
     748           0 :                 .map((v) => ConnectionInfo.fromJson(v as Map<String, Object?>))
     749           0 :                 .toList()
     750           0 :             : null)(json['connections']);
     751           0 :   Map<String, Object?> toJson() {
     752           0 :     final connections = this.connections;
     753           0 :     return {
     754             :       if (connections != null)
     755           0 :         'connections': connections.map((v) => v.toJson()).toList(),
     756             :     };
     757             :   }
     758             : 
     759             :   /// Information particular connections in the session.
     760             :   List<ConnectionInfo>? connections;
     761             : }
     762             : 
     763             : ///
     764             : @_NameSource('spec')
     765             : class DeviceInfo {
     766           0 :   DeviceInfo({
     767             :     this.sessions,
     768             :   });
     769             : 
     770           0 :   DeviceInfo.fromJson(Map<String, Object?> json)
     771           0 :       : sessions = ((v) => v != null
     772             :             ? (v as List)
     773           0 :                 .map((v) => SessionInfo.fromJson(v as Map<String, Object?>))
     774           0 :                 .toList()
     775           0 :             : null)(json['sessions']);
     776           0 :   Map<String, Object?> toJson() {
     777           0 :     final sessions = this.sessions;
     778           0 :     return {
     779             :       if (sessions != null)
     780           0 :         'sessions': sessions.map((v) => v.toJson()).toList(),
     781             :     };
     782             :   }
     783             : 
     784             :   /// A user's sessions (i.e. what they did with an access token from one login).
     785             :   List<SessionInfo>? sessions;
     786             : }
     787             : 
     788             : ///
     789             : @_NameSource('rule override generated')
     790             : class WhoIsInfo {
     791           0 :   WhoIsInfo({
     792             :     this.devices,
     793             :     this.userId,
     794             :   });
     795             : 
     796           0 :   WhoIsInfo.fromJson(Map<String, Object?> json)
     797           0 :       : devices = ((v) => v != null
     798           0 :             ? (v as Map<String, Object?>).map((k, v) =>
     799           0 :                 MapEntry(k, DeviceInfo.fromJson(v as Map<String, Object?>)))
     800           0 :             : null)(json['devices']),
     801           0 :         userId = ((v) => v != null ? v as String : null)(json['user_id']);
     802           0 :   Map<String, Object?> toJson() {
     803           0 :     final devices = this.devices;
     804           0 :     final userId = this.userId;
     805           0 :     return {
     806             :       if (devices != null)
     807           0 :         'devices': devices.map((k, v) => MapEntry(k, v.toJson())),
     808           0 :       if (userId != null) 'user_id': userId,
     809             :     };
     810             :   }
     811             : 
     812             :   /// Each key is an identifier for one of the user's devices.
     813             :   Map<String, DeviceInfo>? devices;
     814             : 
     815             :   /// The Matrix user ID of the user.
     816             :   String? userId;
     817             : }
     818             : 
     819             : ///
     820             : @_NameSource('spec')
     821             : class ChangePasswordCapability {
     822           0 :   ChangePasswordCapability({
     823             :     required this.enabled,
     824             :   });
     825             : 
     826           0 :   ChangePasswordCapability.fromJson(Map<String, Object?> json)
     827           0 :       : enabled = json['enabled'] as bool;
     828           0 :   Map<String, Object?> toJson() => {
     829           0 :         'enabled': enabled,
     830             :       };
     831             : 
     832             :   /// True if the user can change their password, false otherwise.
     833             :   bool enabled;
     834             : }
     835             : 
     836             : /// The stability of the room version.
     837             : @_NameSource('rule override generated')
     838             : @EnhancedEnum()
     839             : enum RoomVersionAvailable {
     840             :   @EnhancedEnumValue(name: 'stable')
     841             :   stable,
     842             :   @EnhancedEnumValue(name: 'unstable')
     843             :   unstable
     844             : }
     845             : 
     846             : ///
     847             : @_NameSource('spec')
     848             : class RoomVersionsCapability {
     849           0 :   RoomVersionsCapability({
     850             :     required this.available,
     851             :     required this.default$,
     852             :   });
     853             : 
     854           0 :   RoomVersionsCapability.fromJson(Map<String, Object?> json)
     855           0 :       : available = (json['available'] as Map<String, Object?>).map((k, v) =>
     856           0 :             MapEntry(k, RoomVersionAvailable.values.fromString(v as String)!)),
     857           0 :         default$ = json['default'] as String;
     858           0 :   Map<String, Object?> toJson() => {
     859           0 :         'available': available.map((k, v) => MapEntry(k, v.name)),
     860           0 :         'default': default$,
     861             :       };
     862             : 
     863             :   /// A detailed description of the room versions the server supports.
     864             :   Map<String, RoomVersionAvailable> available;
     865             : 
     866             :   /// The default room version the server is using for new rooms.
     867             :   String default$;
     868             : }
     869             : 
     870             : ///
     871             : @_NameSource('spec')
     872             : class Capabilities {
     873           0 :   Capabilities({
     874             :     this.mChangePassword,
     875             :     this.mRoomVersions,
     876             :     this.additionalProperties = const {},
     877             :   });
     878             : 
     879           0 :   Capabilities.fromJson(Map<String, Object?> json)
     880           0 :       : mChangePassword = ((v) => v != null
     881           0 :             ? ChangePasswordCapability.fromJson(v as Map<String, Object?>)
     882           0 :             : null)(json['m.change_password']),
     883           0 :         mRoomVersions = ((v) => v != null
     884           0 :             ? RoomVersionsCapability.fromJson(v as Map<String, Object?>)
     885           0 :             : null)(json['m.room_versions']),
     886           0 :         additionalProperties = Map.fromEntries(json.entries
     887           0 :             .where((e) =>
     888           0 :                 !['m.change_password', 'm.room_versions'].contains(e.key))
     889           0 :             .map((e) => MapEntry(e.key, e.value as Map<String, Object?>)));
     890           0 :   Map<String, Object?> toJson() {
     891           0 :     final mChangePassword = this.mChangePassword;
     892           0 :     final mRoomVersions = this.mRoomVersions;
     893           0 :     return {
     894           0 :       ...additionalProperties,
     895             :       if (mChangePassword != null)
     896           0 :         'm.change_password': mChangePassword.toJson(),
     897           0 :       if (mRoomVersions != null) 'm.room_versions': mRoomVersions.toJson(),
     898             :     };
     899             :   }
     900             : 
     901             :   /// Capability to indicate if the user can change their password.
     902             :   ChangePasswordCapability? mChangePassword;
     903             : 
     904             :   /// The room versions the server supports.
     905             :   RoomVersionsCapability? mRoomVersions;
     906             : 
     907             :   Map<String, Map<String, Object?>> additionalProperties;
     908             : }
     909             : 
     910             : ///
     911             : @_NameSource('spec')
     912             : class StateEvent {
     913           2 :   StateEvent({
     914             :     required this.content,
     915             :     this.stateKey,
     916             :     required this.type,
     917             :   });
     918             : 
     919           0 :   StateEvent.fromJson(Map<String, Object?> json)
     920           0 :       : content = json['content'] as Map<String, Object?>,
     921           0 :         stateKey = ((v) => v != null ? v as String : null)(json['state_key']),
     922           0 :         type = json['type'] as String;
     923           2 :   Map<String, Object?> toJson() {
     924           2 :     final stateKey = this.stateKey;
     925           2 :     return {
     926           4 :       'content': content,
     927           0 :       if (stateKey != null) 'state_key': stateKey,
     928           4 :       'type': type,
     929             :     };
     930             :   }
     931             : 
     932             :   /// The content of the event.
     933             :   Map<String, Object?> content;
     934             : 
     935             :   /// The state_key of the state event. Defaults to an empty string.
     936             :   String? stateKey;
     937             : 
     938             :   /// The type of event to send.
     939             :   String type;
     940             : }
     941             : 
     942             : ///
     943             : @_NameSource('spec')
     944             : class Invite3pid {
     945           0 :   Invite3pid({
     946             :     required this.address,
     947             :     required this.idAccessToken,
     948             :     required this.idServer,
     949             :     required this.medium,
     950             :   });
     951             : 
     952           0 :   Invite3pid.fromJson(Map<String, Object?> json)
     953           0 :       : address = json['address'] as String,
     954           0 :         idAccessToken = json['id_access_token'] as String,
     955           0 :         idServer = json['id_server'] as String,
     956           0 :         medium = json['medium'] as String;
     957           0 :   Map<String, Object?> toJson() => {
     958           0 :         'address': address,
     959           0 :         'id_access_token': idAccessToken,
     960           0 :         'id_server': idServer,
     961           0 :         'medium': medium,
     962             :       };
     963             : 
     964             :   /// The invitee's third party identifier.
     965             :   String address;
     966             : 
     967             :   /// An access token previously registered with the identity server. Servers
     968             :   /// can treat this as optional to distinguish between r0.5-compatible clients
     969             :   /// and this specification version.
     970             :   String idAccessToken;
     971             : 
     972             :   /// The hostname+port of the identity server which should be used for third party identifier lookups.
     973             :   String idServer;
     974             : 
     975             :   /// The kind of address being passed in the address field, for example `email`
     976             :   /// (see [the list of recognised values](https://spec.matrix.org/unstable/appendices/#3pid-types)).
     977             :   String medium;
     978             : }
     979             : 
     980             : ///
     981             : @_NameSource('rule override generated')
     982             : @EnhancedEnum()
     983             : enum CreateRoomPreset {
     984             :   @EnhancedEnumValue(name: 'private_chat')
     985             :   privateChat,
     986             :   @EnhancedEnumValue(name: 'public_chat')
     987             :   publicChat,
     988             :   @EnhancedEnumValue(name: 'trusted_private_chat')
     989             :   trustedPrivateChat
     990             : }
     991             : 
     992             : ///
     993             : @_NameSource('generated')
     994             : @EnhancedEnum()
     995             : enum Visibility {
     996             :   @EnhancedEnumValue(name: 'private')
     997             :   private,
     998             :   @EnhancedEnumValue(name: 'public')
     999             :   public
    1000             : }
    1001             : 
    1002             : /// A client device
    1003             : @_NameSource('spec')
    1004             : class Device {
    1005           0 :   Device({
    1006             :     required this.deviceId,
    1007             :     this.displayName,
    1008             :     this.lastSeenIp,
    1009             :     this.lastSeenTs,
    1010             :   });
    1011             : 
    1012           0 :   Device.fromJson(Map<String, Object?> json)
    1013           0 :       : deviceId = json['device_id'] as String,
    1014             :         displayName =
    1015           0 :             ((v) => v != null ? v as String : null)(json['display_name']),
    1016             :         lastSeenIp =
    1017           0 :             ((v) => v != null ? v as String : null)(json['last_seen_ip']),
    1018           0 :         lastSeenTs = ((v) => v != null ? v as int : null)(json['last_seen_ts']);
    1019           0 :   Map<String, Object?> toJson() {
    1020           0 :     final displayName = this.displayName;
    1021           0 :     final lastSeenIp = this.lastSeenIp;
    1022           0 :     final lastSeenTs = this.lastSeenTs;
    1023           0 :     return {
    1024           0 :       'device_id': deviceId,
    1025           0 :       if (displayName != null) 'display_name': displayName,
    1026           0 :       if (lastSeenIp != null) 'last_seen_ip': lastSeenIp,
    1027           0 :       if (lastSeenTs != null) 'last_seen_ts': lastSeenTs,
    1028             :     };
    1029             :   }
    1030             : 
    1031             :   /// Identifier of this device.
    1032             :   String deviceId;
    1033             : 
    1034             :   /// Display name set by the user for this device. Absent if no name has been
    1035             :   /// set.
    1036             :   String? displayName;
    1037             : 
    1038             :   /// The IP address where this device was last seen. (May be a few minutes out
    1039             :   /// of date, for efficiency reasons).
    1040             :   String? lastSeenIp;
    1041             : 
    1042             :   /// The timestamp (in milliseconds since the unix epoch) when this devices
    1043             :   /// was last seen. (May be a few minutes out of date, for efficiency
    1044             :   /// reasons).
    1045             :   int? lastSeenTs;
    1046             : }
    1047             : 
    1048             : ///
    1049             : @_NameSource('generated')
    1050             : class GetRoomIdByAliasResponse {
    1051           0 :   GetRoomIdByAliasResponse({
    1052             :     this.roomId,
    1053             :     this.servers,
    1054             :   });
    1055             : 
    1056           0 :   GetRoomIdByAliasResponse.fromJson(Map<String, Object?> json)
    1057           0 :       : roomId = ((v) => v != null ? v as String : null)(json['room_id']),
    1058           0 :         servers = ((v) => v != null
    1059           0 :             ? (v as List).map((v) => v as String).toList()
    1060           0 :             : null)(json['servers']);
    1061           0 :   Map<String, Object?> toJson() {
    1062           0 :     final roomId = this.roomId;
    1063           0 :     final servers = this.servers;
    1064           0 :     return {
    1065           0 :       if (roomId != null) 'room_id': roomId,
    1066           0 :       if (servers != null) 'servers': servers.map((v) => v).toList(),
    1067             :     };
    1068             :   }
    1069             : 
    1070             :   /// The room ID for this room alias.
    1071             :   String? roomId;
    1072             : 
    1073             :   /// A list of servers that are aware of this room alias.
    1074             :   List<String>? servers;
    1075             : }
    1076             : 
    1077             : ///
    1078             : @_NameSource('generated')
    1079             : class GetEventsResponse {
    1080           0 :   GetEventsResponse({
    1081             :     this.chunk,
    1082             :     this.end,
    1083             :     this.start,
    1084             :   });
    1085             : 
    1086           0 :   GetEventsResponse.fromJson(Map<String, Object?> json)
    1087           0 :       : chunk = ((v) => v != null
    1088             :             ? (v as List)
    1089           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    1090           0 :                 .toList()
    1091           0 :             : null)(json['chunk']),
    1092           0 :         end = ((v) => v != null ? v as String : null)(json['end']),
    1093           0 :         start = ((v) => v != null ? v as String : null)(json['start']);
    1094           0 :   Map<String, Object?> toJson() {
    1095           0 :     final chunk = this.chunk;
    1096           0 :     final end = this.end;
    1097           0 :     final start = this.start;
    1098           0 :     return {
    1099           0 :       if (chunk != null) 'chunk': chunk.map((v) => v.toJson()).toList(),
    1100           0 :       if (end != null) 'end': end,
    1101           0 :       if (start != null) 'start': start,
    1102             :     };
    1103             :   }
    1104             : 
    1105             :   /// An array of events.
    1106             :   List<MatrixEvent>? chunk;
    1107             : 
    1108             :   /// A token which correlates to the end of `chunk`. This
    1109             :   /// token should be used in the next request to `/events`.
    1110             :   String? end;
    1111             : 
    1112             :   /// A token which correlates to the start of `chunk`. This
    1113             :   /// is usually the same token supplied to `from=`.
    1114             :   String? start;
    1115             : }
    1116             : 
    1117             : ///
    1118             : @_NameSource('generated')
    1119             : class PeekEventsResponse {
    1120           0 :   PeekEventsResponse({
    1121             :     this.chunk,
    1122             :     this.end,
    1123             :     this.start,
    1124             :   });
    1125             : 
    1126           0 :   PeekEventsResponse.fromJson(Map<String, Object?> json)
    1127           0 :       : chunk = ((v) => v != null
    1128             :             ? (v as List)
    1129           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    1130           0 :                 .toList()
    1131           0 :             : null)(json['chunk']),
    1132           0 :         end = ((v) => v != null ? v as String : null)(json['end']),
    1133           0 :         start = ((v) => v != null ? v as String : null)(json['start']);
    1134           0 :   Map<String, Object?> toJson() {
    1135           0 :     final chunk = this.chunk;
    1136           0 :     final end = this.end;
    1137           0 :     final start = this.start;
    1138           0 :     return {
    1139           0 :       if (chunk != null) 'chunk': chunk.map((v) => v.toJson()).toList(),
    1140           0 :       if (end != null) 'end': end,
    1141           0 :       if (start != null) 'start': start,
    1142             :     };
    1143             :   }
    1144             : 
    1145             :   /// An array of events.
    1146             :   List<MatrixEvent>? chunk;
    1147             : 
    1148             :   /// A token which correlates to the last value in `chunk`. This
    1149             :   /// token should be used in the next request to `/events`.
    1150             :   String? end;
    1151             : 
    1152             :   /// A token which correlates to the first value in `chunk`. This
    1153             :   /// is usually the same token supplied to `from=`.
    1154             :   String? start;
    1155             : }
    1156             : 
    1157             : /// A signature of an `m.third_party_invite` token to prove that this user
    1158             : /// owns a third party identity which has been invited to the room.
    1159             : @_NameSource('spec')
    1160             : class ThirdPartySigned {
    1161           0 :   ThirdPartySigned({
    1162             :     required this.mxid,
    1163             :     required this.sender,
    1164             :     required this.signatures,
    1165             :     required this.token,
    1166             :   });
    1167             : 
    1168           0 :   ThirdPartySigned.fromJson(Map<String, Object?> json)
    1169           0 :       : mxid = json['mxid'] as String,
    1170           0 :         sender = json['sender'] as String,
    1171           0 :         signatures = (json['signatures'] as Map<String, Object?>).map((k, v) =>
    1172           0 :             MapEntry(
    1173             :                 k,
    1174             :                 (v as Map<String, Object?>)
    1175           0 :                     .map((k, v) => MapEntry(k, v as String)))),
    1176           0 :         token = json['token'] as String;
    1177           0 :   Map<String, Object?> toJson() => {
    1178           0 :         'mxid': mxid,
    1179           0 :         'sender': sender,
    1180           0 :         'signatures': signatures
    1181           0 :             .map((k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v)))),
    1182           0 :         'token': token,
    1183             :       };
    1184             : 
    1185             :   /// The Matrix ID of the invitee.
    1186             :   String mxid;
    1187             : 
    1188             :   /// The Matrix ID of the user who issued the invite.
    1189             :   String sender;
    1190             : 
    1191             :   /// A signatures object containing a signature of the entire signed object.
    1192             :   Map<String, Map<String, String>> signatures;
    1193             : 
    1194             :   /// The state key of the m.third_party_invite event.
    1195             :   String token;
    1196             : }
    1197             : 
    1198             : ///
    1199             : @_NameSource('generated')
    1200             : class GetKeysChangesResponse {
    1201           0 :   GetKeysChangesResponse({
    1202             :     this.changed,
    1203             :     this.left,
    1204             :   });
    1205             : 
    1206           0 :   GetKeysChangesResponse.fromJson(Map<String, Object?> json)
    1207           0 :       : changed = ((v) => v != null
    1208           0 :             ? (v as List).map((v) => v as String).toList()
    1209           0 :             : null)(json['changed']),
    1210           0 :         left = ((v) => v != null
    1211           0 :             ? (v as List).map((v) => v as String).toList()
    1212           0 :             : null)(json['left']);
    1213           0 :   Map<String, Object?> toJson() {
    1214           0 :     final changed = this.changed;
    1215           0 :     final left = this.left;
    1216           0 :     return {
    1217           0 :       if (changed != null) 'changed': changed.map((v) => v).toList(),
    1218           0 :       if (left != null) 'left': left.map((v) => v).toList(),
    1219             :     };
    1220             :   }
    1221             : 
    1222             :   /// The Matrix User IDs of all users who updated their device
    1223             :   /// identity keys.
    1224             :   List<String>? changed;
    1225             : 
    1226             :   /// The Matrix User IDs of all users who may have left all
    1227             :   /// the end-to-end encrypted rooms they previously shared
    1228             :   /// with the user.
    1229             :   List<String>? left;
    1230             : }
    1231             : 
    1232             : ///
    1233             : @_NameSource('generated')
    1234             : class ClaimKeysResponse {
    1235           0 :   ClaimKeysResponse({
    1236             :     this.failures,
    1237             :     required this.oneTimeKeys,
    1238             :   });
    1239             : 
    1240          10 :   ClaimKeysResponse.fromJson(Map<String, Object?> json)
    1241          10 :       : failures = ((v) => v != null
    1242             :             ? (v as Map<String, Object?>)
    1243          10 :                 .map((k, v) => MapEntry(k, v as Map<String, Object?>))
    1244          20 :             : null)(json['failures']),
    1245          20 :         oneTimeKeys = (json['one_time_keys'] as Map<String, Object?>).map(
    1246          20 :             (k, v) => MapEntry(
    1247             :                 k,
    1248             :                 (v as Map<String, Object?>)
    1249          30 :                     .map((k, v) => MapEntry(k, v as Map<String, Object?>))));
    1250           0 :   Map<String, Object?> toJson() {
    1251           0 :     final failures = this.failures;
    1252           0 :     return {
    1253           0 :       if (failures != null) 'failures': failures.map((k, v) => MapEntry(k, v)),
    1254           0 :       'one_time_keys': oneTimeKeys
    1255           0 :           .map((k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v)))),
    1256             :     };
    1257             :   }
    1258             : 
    1259             :   /// If any remote homeservers could not be reached, they are
    1260             :   /// recorded here. The names of the properties are the names of
    1261             :   /// the unreachable servers.
    1262             :   ///
    1263             :   /// If the homeserver could be reached, but the user or device
    1264             :   /// was unknown, no failure is recorded. Instead, the corresponding
    1265             :   /// user or device is missing from the `one_time_keys` result.
    1266             :   Map<String, Map<String, Object?>>? failures;
    1267             : 
    1268             :   /// One-time keys for the queried devices. A map from user ID, to a
    1269             :   /// map from devices to a map from `<algorithm>:<key_id>` to the key object.
    1270             :   ///
    1271             :   /// See the [key algorithms](https://spec.matrix.org/unstable/client-server-api/#key-algorithms) section for information
    1272             :   /// on the Key Object format.
    1273             :   ///
    1274             :   /// If necessary, the claimed key might be a fallback key. Fallback
    1275             :   /// keys are re-used by the server until replaced by the device.
    1276             :   Map<String, Map<String, Map<String, Object?>>> oneTimeKeys;
    1277             : }
    1278             : 
    1279             : ///
    1280             : @_NameSource('generated')
    1281             : class QueryKeysResponse {
    1282           0 :   QueryKeysResponse({
    1283             :     this.deviceKeys,
    1284             :     this.failures,
    1285             :     this.masterKeys,
    1286             :     this.selfSigningKeys,
    1287             :     this.userSigningKeys,
    1288             :   });
    1289             : 
    1290          30 :   QueryKeysResponse.fromJson(Map<String, Object?> json)
    1291          30 :       : deviceKeys = ((v) => v != null
    1292          90 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    1293             :                 k,
    1294          90 :                 (v as Map<String, Object?>).map((k, v) => MapEntry(
    1295          30 :                     k, MatrixDeviceKeys.fromJson(v as Map<String, Object?>)))))
    1296          60 :             : null)(json['device_keys']),
    1297          30 :         failures = ((v) => v != null
    1298             :             ? (v as Map<String, Object?>)
    1299          30 :                 .map((k, v) => MapEntry(k, v as Map<String, Object?>))
    1300          60 :             : null)(json['failures']),
    1301          30 :         masterKeys = ((v) => v != null
    1302          90 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    1303          30 :                 k, MatrixCrossSigningKey.fromJson(v as Map<String, Object?>)))
    1304          60 :             : null)(json['master_keys']),
    1305          30 :         selfSigningKeys = ((v) => v != null
    1306          90 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    1307          30 :                 k, MatrixCrossSigningKey.fromJson(v as Map<String, Object?>)))
    1308          60 :             : null)(json['self_signing_keys']),
    1309          30 :         userSigningKeys = ((v) => v != null
    1310          90 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    1311          30 :                 k, MatrixCrossSigningKey.fromJson(v as Map<String, Object?>)))
    1312          60 :             : null)(json['user_signing_keys']);
    1313           0 :   Map<String, Object?> toJson() {
    1314           0 :     final deviceKeys = this.deviceKeys;
    1315           0 :     final failures = this.failures;
    1316           0 :     final masterKeys = this.masterKeys;
    1317           0 :     final selfSigningKeys = this.selfSigningKeys;
    1318           0 :     final userSigningKeys = this.userSigningKeys;
    1319           0 :     return {
    1320             :       if (deviceKeys != null)
    1321           0 :         'device_keys': deviceKeys.map(
    1322           0 :             (k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v.toJson())))),
    1323           0 :       if (failures != null) 'failures': failures.map((k, v) => MapEntry(k, v)),
    1324             :       if (masterKeys != null)
    1325           0 :         'master_keys': masterKeys.map((k, v) => MapEntry(k, v.toJson())),
    1326             :       if (selfSigningKeys != null)
    1327           0 :         'self_signing_keys':
    1328           0 :             selfSigningKeys.map((k, v) => MapEntry(k, v.toJson())),
    1329             :       if (userSigningKeys != null)
    1330           0 :         'user_signing_keys':
    1331           0 :             userSigningKeys.map((k, v) => MapEntry(k, v.toJson())),
    1332             :     };
    1333             :   }
    1334             : 
    1335             :   /// Information on the queried devices. A map from user ID, to a
    1336             :   /// map from device ID to device information.  For each device,
    1337             :   /// the information returned will be the same as uploaded via
    1338             :   /// `/keys/upload`, with the addition of an `unsigned`
    1339             :   /// property.
    1340             :   Map<String, Map<String, MatrixDeviceKeys>>? deviceKeys;
    1341             : 
    1342             :   /// If any remote homeservers could not be reached, they are
    1343             :   /// recorded here. The names of the properties are the names of
    1344             :   /// the unreachable servers.
    1345             :   ///
    1346             :   /// If the homeserver could be reached, but the user or device
    1347             :   /// was unknown, no failure is recorded. Instead, the corresponding
    1348             :   /// user or device is missing from the `device_keys` result.
    1349             :   Map<String, Map<String, Object?>>? failures;
    1350             : 
    1351             :   /// Information on the master cross-signing keys of the queried users.
    1352             :   /// A map from user ID, to master key information.  For each key, the
    1353             :   /// information returned will be the same as uploaded via
    1354             :   /// `/keys/device_signing/upload`, along with the signatures
    1355             :   /// uploaded via `/keys/signatures/upload` that the requesting user
    1356             :   /// is allowed to see.
    1357             :   Map<String, MatrixCrossSigningKey>? masterKeys;
    1358             : 
    1359             :   /// Information on the self-signing keys of the queried users. A map
    1360             :   /// from user ID, to self-signing key information.  For each key, the
    1361             :   /// information returned will be the same as uploaded via
    1362             :   /// `/keys/device_signing/upload`.
    1363             :   Map<String, MatrixCrossSigningKey>? selfSigningKeys;
    1364             : 
    1365             :   /// Information on the user-signing key of the user making the
    1366             :   /// request, if they queried their own device information. A map
    1367             :   /// from user ID, to user-signing key information.  The
    1368             :   /// information returned will be the same as uploaded via
    1369             :   /// `/keys/device_signing/upload`.
    1370             :   Map<String, MatrixCrossSigningKey>? userSigningKeys;
    1371             : }
    1372             : 
    1373             : ///
    1374             : @_NameSource('spec')
    1375             : class LoginFlow {
    1376           0 :   LoginFlow({
    1377             :     this.type,
    1378             :   });
    1379             : 
    1380          33 :   LoginFlow.fromJson(Map<String, Object?> json)
    1381          99 :       : type = ((v) => v != null ? v as String : null)(json['type']);
    1382           0 :   Map<String, Object?> toJson() {
    1383           0 :     final type = this.type;
    1384           0 :     return {
    1385           0 :       if (type != null) 'type': type,
    1386             :     };
    1387             :   }
    1388             : 
    1389             :   /// The login type. This is supplied as the `type` when
    1390             :   /// logging in.
    1391             :   String? type;
    1392             : }
    1393             : 
    1394             : ///
    1395             : @_NameSource('rule override generated')
    1396             : @EnhancedEnum()
    1397             : enum LoginType {
    1398             :   @EnhancedEnumValue(name: 'm.login.password')
    1399             :   mLoginPassword,
    1400             :   @EnhancedEnumValue(name: 'm.login.token')
    1401             :   mLoginToken,
    1402             :   @EnhancedEnumValue(name: 'org.matrix.login.jwt')
    1403             :   mLoginJWT
    1404             : }
    1405             : 
    1406             : ///
    1407             : @_NameSource('generated')
    1408             : class LoginResponse {
    1409           0 :   LoginResponse({
    1410             :     required this.accessToken,
    1411             :     required this.deviceId,
    1412             :     this.expiresInMs,
    1413             :     this.homeServer,
    1414             :     this.refreshToken,
    1415             :     required this.userId,
    1416             :     this.wellKnown,
    1417             :   });
    1418             : 
    1419           4 :   LoginResponse.fromJson(Map<String, Object?> json)
    1420           4 :       : accessToken = json['access_token'] as String,
    1421           4 :         deviceId = json['device_id'] as String,
    1422             :         expiresInMs =
    1423          12 :             ((v) => v != null ? v as int : null)(json['expires_in_ms']),
    1424             :         homeServer =
    1425          12 :             ((v) => v != null ? v as String : null)(json['home_server']),
    1426             :         refreshToken =
    1427          12 :             ((v) => v != null ? v as String : null)(json['refresh_token']),
    1428           4 :         userId = json['user_id'] as String,
    1429           4 :         wellKnown = ((v) => v != null
    1430           4 :             ? DiscoveryInformation.fromJson(v as Map<String, Object?>)
    1431           8 :             : null)(json['well_known']);
    1432           0 :   Map<String, Object?> toJson() {
    1433           0 :     final expiresInMs = this.expiresInMs;
    1434           0 :     final homeServer = this.homeServer;
    1435           0 :     final refreshToken = this.refreshToken;
    1436           0 :     final wellKnown = this.wellKnown;
    1437           0 :     return {
    1438           0 :       'access_token': accessToken,
    1439           0 :       'device_id': deviceId,
    1440           0 :       if (expiresInMs != null) 'expires_in_ms': expiresInMs,
    1441           0 :       if (homeServer != null) 'home_server': homeServer,
    1442           0 :       if (refreshToken != null) 'refresh_token': refreshToken,
    1443           0 :       'user_id': userId,
    1444           0 :       if (wellKnown != null) 'well_known': wellKnown.toJson(),
    1445             :     };
    1446             :   }
    1447             : 
    1448             :   /// An access token for the account.
    1449             :   /// This access token can then be used to authorize other requests.
    1450             :   String accessToken;
    1451             : 
    1452             :   /// ID of the logged-in device. Will be the same as the
    1453             :   /// corresponding parameter in the request, if one was specified.
    1454             :   String deviceId;
    1455             : 
    1456             :   /// The lifetime of the access token, in milliseconds. Once
    1457             :   /// the access token has expired a new access token can be
    1458             :   /// obtained by using the provided refresh token. If no
    1459             :   /// refresh token is provided, the client will need to re-log in
    1460             :   /// to obtain a new access token. If not given, the client can
    1461             :   /// assume that the access token will not expire.
    1462             :   int? expiresInMs;
    1463             : 
    1464             :   /// The server_name of the homeserver on which the account has
    1465             :   /// been registered.
    1466             :   ///
    1467             :   /// **Deprecated**. Clients should extract the server_name from
    1468             :   /// `user_id` (by splitting at the first colon) if they require
    1469             :   /// it. Note also that `homeserver` is not spelt this way.
    1470             :   String? homeServer;
    1471             : 
    1472             :   /// A refresh token for the account. This token can be used to
    1473             :   /// obtain a new access token when it expires by calling the
    1474             :   /// `/refresh` endpoint.
    1475             :   String? refreshToken;
    1476             : 
    1477             :   /// The fully-qualified Matrix ID for the account.
    1478             :   String userId;
    1479             : 
    1480             :   /// Optional client configuration provided by the server. If present,
    1481             :   /// clients SHOULD use the provided object to reconfigure themselves,
    1482             :   /// optionally validating the URLs within. This object takes the same
    1483             :   /// form as the one returned from .well-known autodiscovery.
    1484             :   DiscoveryInformation? wellKnown;
    1485             : }
    1486             : 
    1487             : ///
    1488             : @_NameSource('spec')
    1489             : class Notification {
    1490           0 :   Notification({
    1491             :     required this.actions,
    1492             :     required this.event,
    1493             :     this.profileTag,
    1494             :     required this.read,
    1495             :     required this.roomId,
    1496             :     required this.ts,
    1497             :   });
    1498             : 
    1499           0 :   Notification.fromJson(Map<String, Object?> json)
    1500           0 :       : actions = (json['actions'] as List).map((v) => v as Object?).toList(),
    1501           0 :         event = MatrixEvent.fromJson(json['event'] as Map<String, Object?>),
    1502             :         profileTag =
    1503           0 :             ((v) => v != null ? v as String : null)(json['profile_tag']),
    1504           0 :         read = json['read'] as bool,
    1505           0 :         roomId = json['room_id'] as String,
    1506           0 :         ts = json['ts'] as int;
    1507           0 :   Map<String, Object?> toJson() {
    1508           0 :     final profileTag = this.profileTag;
    1509           0 :     return {
    1510           0 :       'actions': actions.map((v) => v).toList(),
    1511           0 :       'event': event.toJson(),
    1512           0 :       if (profileTag != null) 'profile_tag': profileTag,
    1513           0 :       'read': read,
    1514           0 :       'room_id': roomId,
    1515           0 :       'ts': ts,
    1516             :     };
    1517             :   }
    1518             : 
    1519             :   /// The action(s) to perform when the conditions for this rule are met.
    1520             :   /// See [Push Rules: API](https://spec.matrix.org/unstable/client-server-api/#push-rules-api).
    1521             :   List<Object?> actions;
    1522             : 
    1523             :   /// The Event object for the event that triggered the notification.
    1524             :   MatrixEvent event;
    1525             : 
    1526             :   /// The profile tag of the rule that matched this event.
    1527             :   String? profileTag;
    1528             : 
    1529             :   /// Indicates whether the user has sent a read receipt indicating
    1530             :   /// that they have read this message.
    1531             :   bool read;
    1532             : 
    1533             :   /// The ID of the room in which the event was posted.
    1534             :   String roomId;
    1535             : 
    1536             :   /// The unix timestamp at which the event notification was sent,
    1537             :   /// in milliseconds.
    1538             :   int ts;
    1539             : }
    1540             : 
    1541             : ///
    1542             : @_NameSource('generated')
    1543             : class GetNotificationsResponse {
    1544           0 :   GetNotificationsResponse({
    1545             :     this.nextToken,
    1546             :     required this.notifications,
    1547             :   });
    1548             : 
    1549           0 :   GetNotificationsResponse.fromJson(Map<String, Object?> json)
    1550           0 :       : nextToken = ((v) => v != null ? v as String : null)(json['next_token']),
    1551           0 :         notifications = (json['notifications'] as List)
    1552           0 :             .map((v) => Notification.fromJson(v as Map<String, Object?>))
    1553           0 :             .toList();
    1554           0 :   Map<String, Object?> toJson() {
    1555           0 :     final nextToken = this.nextToken;
    1556           0 :     return {
    1557           0 :       if (nextToken != null) 'next_token': nextToken,
    1558           0 :       'notifications': notifications.map((v) => v.toJson()).toList(),
    1559             :     };
    1560             :   }
    1561             : 
    1562             :   /// The token to supply in the `from` param of the next
    1563             :   /// `/notifications` request in order to request more
    1564             :   /// events. If this is absent, there are no more results.
    1565             :   String? nextToken;
    1566             : 
    1567             :   /// The list of events that triggered notifications.
    1568             :   List<Notification> notifications;
    1569             : }
    1570             : 
    1571             : ///
    1572             : @_NameSource('rule override generated')
    1573             : @EnhancedEnum()
    1574             : enum PresenceType {
    1575             :   @EnhancedEnumValue(name: 'offline')
    1576             :   offline,
    1577             :   @EnhancedEnumValue(name: 'online')
    1578             :   online,
    1579             :   @EnhancedEnumValue(name: 'unavailable')
    1580             :   unavailable
    1581             : }
    1582             : 
    1583             : ///
    1584             : @_NameSource('generated')
    1585             : class GetPresenceResponse {
    1586           0 :   GetPresenceResponse({
    1587             :     this.currentlyActive,
    1588             :     this.lastActiveAgo,
    1589             :     required this.presence,
    1590             :     this.statusMsg,
    1591             :   });
    1592             : 
    1593           0 :   GetPresenceResponse.fromJson(Map<String, Object?> json)
    1594             :       : currentlyActive =
    1595           0 :             ((v) => v != null ? v as bool : null)(json['currently_active']),
    1596             :         lastActiveAgo =
    1597           0 :             ((v) => v != null ? v as int : null)(json['last_active_ago']),
    1598           0 :         presence = PresenceType.values.fromString(json['presence'] as String)!,
    1599           0 :         statusMsg = ((v) => v != null ? v as String : null)(json['status_msg']);
    1600           0 :   Map<String, Object?> toJson() {
    1601           0 :     final currentlyActive = this.currentlyActive;
    1602           0 :     final lastActiveAgo = this.lastActiveAgo;
    1603           0 :     final statusMsg = this.statusMsg;
    1604           0 :     return {
    1605           0 :       if (currentlyActive != null) 'currently_active': currentlyActive,
    1606           0 :       if (lastActiveAgo != null) 'last_active_ago': lastActiveAgo,
    1607           0 :       'presence': presence.name,
    1608           0 :       if (statusMsg != null) 'status_msg': statusMsg,
    1609             :     };
    1610             :   }
    1611             : 
    1612             :   /// Whether the user is currently active
    1613             :   bool? currentlyActive;
    1614             : 
    1615             :   /// The length of time in milliseconds since an action was performed
    1616             :   /// by this user.
    1617             :   int? lastActiveAgo;
    1618             : 
    1619             :   /// This user's presence.
    1620             :   PresenceType presence;
    1621             : 
    1622             :   /// The state message for this user if one was set.
    1623             :   String? statusMsg;
    1624             : }
    1625             : 
    1626             : ///
    1627             : @_NameSource('rule override generated')
    1628             : class ProfileInformation {
    1629           1 :   ProfileInformation({
    1630             :     this.avatarUrl,
    1631             :     this.displayname,
    1632             :   });
    1633             : 
    1634           3 :   ProfileInformation.fromJson(Map<String, Object?> json)
    1635           3 :       : avatarUrl = ((v) =>
    1636           9 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    1637             :         displayname =
    1638           9 :             ((v) => v != null ? v as String : null)(json['displayname']);
    1639           0 :   Map<String, Object?> toJson() {
    1640           0 :     final avatarUrl = this.avatarUrl;
    1641           0 :     final displayname = this.displayname;
    1642           0 :     return {
    1643           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    1644           0 :       if (displayname != null) 'displayname': displayname,
    1645             :     };
    1646             :   }
    1647             : 
    1648             :   /// The user's avatar URL if they have set one, otherwise not present.
    1649             :   Uri? avatarUrl;
    1650             : 
    1651             :   /// The user's display name if they have set one, otherwise not present.
    1652             :   String? displayname;
    1653             : }
    1654             : 
    1655             : /// A list of the rooms on the server.
    1656             : @_NameSource('generated')
    1657             : class GetPublicRoomsResponse {
    1658           0 :   GetPublicRoomsResponse({
    1659             :     required this.chunk,
    1660             :     this.nextBatch,
    1661             :     this.prevBatch,
    1662             :     this.totalRoomCountEstimate,
    1663             :   });
    1664             : 
    1665           0 :   GetPublicRoomsResponse.fromJson(Map<String, Object?> json)
    1666           0 :       : chunk = (json['chunk'] as List)
    1667           0 :             .map((v) => PublicRoomsChunk.fromJson(v as Map<String, Object?>))
    1668           0 :             .toList(),
    1669           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    1670           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
    1671           0 :         totalRoomCountEstimate = ((v) =>
    1672           0 :             v != null ? v as int : null)(json['total_room_count_estimate']);
    1673           0 :   Map<String, Object?> toJson() {
    1674           0 :     final nextBatch = this.nextBatch;
    1675           0 :     final prevBatch = this.prevBatch;
    1676           0 :     final totalRoomCountEstimate = this.totalRoomCountEstimate;
    1677           0 :     return {
    1678           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
    1679           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    1680           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
    1681             :       if (totalRoomCountEstimate != null)
    1682           0 :         'total_room_count_estimate': totalRoomCountEstimate,
    1683             :     };
    1684             :   }
    1685             : 
    1686             :   /// A paginated chunk of public rooms.
    1687             :   List<PublicRoomsChunk> chunk;
    1688             : 
    1689             :   /// A pagination token for the response. The absence of this token
    1690             :   /// means there are no more results to fetch and the client should
    1691             :   /// stop paginating.
    1692             :   String? nextBatch;
    1693             : 
    1694             :   /// A pagination token that allows fetching previous results. The
    1695             :   /// absence of this token means there are no results before this
    1696             :   /// batch, i.e. this is the first batch.
    1697             :   String? prevBatch;
    1698             : 
    1699             :   /// An estimate on the total number of public rooms, if the
    1700             :   /// server has an estimate.
    1701             :   int? totalRoomCountEstimate;
    1702             : }
    1703             : 
    1704             : ///
    1705             : @_NameSource('rule override spec')
    1706             : class PublicRoomQueryFilter {
    1707           0 :   PublicRoomQueryFilter({
    1708             :     this.genericSearchTerm,
    1709             :     this.roomTypes,
    1710             :   });
    1711             : 
    1712           0 :   PublicRoomQueryFilter.fromJson(Map<String, Object?> json)
    1713           0 :       : genericSearchTerm = ((v) =>
    1714           0 :             v != null ? v as String : null)(json['generic_search_term']),
    1715           0 :         roomTypes = ((v) => v != null
    1716           0 :             ? (v as List).map((v) => v as String).toList()
    1717           0 :             : null)(json['room_types']);
    1718           0 :   Map<String, Object?> toJson() {
    1719           0 :     final genericSearchTerm = this.genericSearchTerm;
    1720           0 :     final roomTypes = this.roomTypes;
    1721           0 :     return {
    1722           0 :       if (genericSearchTerm != null) 'generic_search_term': genericSearchTerm,
    1723           0 :       if (roomTypes != null) 'room_types': roomTypes.map((v) => v).toList(),
    1724             :     };
    1725             :   }
    1726             : 
    1727             :   /// An optional string to search for in the room metadata, e.g. name,
    1728             :   /// topic, canonical alias, etc.
    1729             :   String? genericSearchTerm;
    1730             : 
    1731             :   /// An optional list of [room types](https://spec.matrix.org/unstable/client-server-api/#types) to search
    1732             :   /// for. To include rooms without a room type, specify `null` within this
    1733             :   /// list. When not specified, all applicable rooms (regardless of type)
    1734             :   /// are returned.
    1735             :   List<String>? roomTypes;
    1736             : }
    1737             : 
    1738             : /// A list of the rooms on the server.
    1739             : @_NameSource('generated')
    1740             : class QueryPublicRoomsResponse {
    1741           0 :   QueryPublicRoomsResponse({
    1742             :     required this.chunk,
    1743             :     this.nextBatch,
    1744             :     this.prevBatch,
    1745             :     this.totalRoomCountEstimate,
    1746             :   });
    1747             : 
    1748           0 :   QueryPublicRoomsResponse.fromJson(Map<String, Object?> json)
    1749           0 :       : chunk = (json['chunk'] as List)
    1750           0 :             .map((v) => PublicRoomsChunk.fromJson(v as Map<String, Object?>))
    1751           0 :             .toList(),
    1752           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    1753           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
    1754           0 :         totalRoomCountEstimate = ((v) =>
    1755           0 :             v != null ? v as int : null)(json['total_room_count_estimate']);
    1756           0 :   Map<String, Object?> toJson() {
    1757           0 :     final nextBatch = this.nextBatch;
    1758           0 :     final prevBatch = this.prevBatch;
    1759           0 :     final totalRoomCountEstimate = this.totalRoomCountEstimate;
    1760           0 :     return {
    1761           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
    1762           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    1763           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
    1764             :       if (totalRoomCountEstimate != null)
    1765           0 :         'total_room_count_estimate': totalRoomCountEstimate,
    1766             :     };
    1767             :   }
    1768             : 
    1769             :   /// A paginated chunk of public rooms.
    1770             :   List<PublicRoomsChunk> chunk;
    1771             : 
    1772             :   /// A pagination token for the response. The absence of this token
    1773             :   /// means there are no more results to fetch and the client should
    1774             :   /// stop paginating.
    1775             :   String? nextBatch;
    1776             : 
    1777             :   /// A pagination token that allows fetching previous results. The
    1778             :   /// absence of this token means there are no results before this
    1779             :   /// batch, i.e. this is the first batch.
    1780             :   String? prevBatch;
    1781             : 
    1782             :   /// An estimate on the total number of public rooms, if the
    1783             :   /// server has an estimate.
    1784             :   int? totalRoomCountEstimate;
    1785             : }
    1786             : 
    1787             : ///
    1788             : @_NameSource('spec')
    1789             : class PusherData {
    1790           0 :   PusherData({
    1791             :     this.format,
    1792             :     this.url,
    1793             :     this.additionalProperties = const {},
    1794             :   });
    1795             : 
    1796           0 :   PusherData.fromJson(Map<String, Object?> json)
    1797           0 :       : format = ((v) => v != null ? v as String : null)(json['format']),
    1798           0 :         url = ((v) => v != null ? Uri.parse(v as String) : null)(json['url']),
    1799           0 :         additionalProperties = Map.fromEntries(json.entries
    1800           0 :             .where((e) => !['format', 'url'].contains(e.key))
    1801           0 :             .map((e) => MapEntry(e.key, e.value)));
    1802           0 :   Map<String, Object?> toJson() {
    1803           0 :     final format = this.format;
    1804           0 :     final url = this.url;
    1805           0 :     return {
    1806           0 :       ...additionalProperties,
    1807           0 :       if (format != null) 'format': format,
    1808           0 :       if (url != null) 'url': url.toString(),
    1809             :     };
    1810             :   }
    1811             : 
    1812             :   /// The format to use when sending notifications to the Push
    1813             :   /// Gateway.
    1814             :   String? format;
    1815             : 
    1816             :   /// Required if `kind` is `http`. The URL to use to send
    1817             :   /// notifications to.
    1818             :   Uri? url;
    1819             : 
    1820             :   Map<String, Object?> additionalProperties;
    1821             : }
    1822             : 
    1823             : ///
    1824             : @_NameSource('spec')
    1825             : class PusherId {
    1826           0 :   PusherId({
    1827             :     required this.appId,
    1828             :     required this.pushkey,
    1829             :   });
    1830             : 
    1831           0 :   PusherId.fromJson(Map<String, Object?> json)
    1832           0 :       : appId = json['app_id'] as String,
    1833           0 :         pushkey = json['pushkey'] as String;
    1834           0 :   Map<String, Object?> toJson() => {
    1835           0 :         'app_id': appId,
    1836           0 :         'pushkey': pushkey,
    1837             :       };
    1838             : 
    1839             :   /// This is a reverse-DNS style identifier for the application.
    1840             :   /// Max length, 64 chars.
    1841             :   String appId;
    1842             : 
    1843             :   /// This is a unique identifier for this pusher. See `/set` for
    1844             :   /// more detail.
    1845             :   /// Max length, 512 bytes.
    1846             :   String pushkey;
    1847             : }
    1848             : 
    1849             : ///
    1850             : @_NameSource('spec')
    1851             : class Pusher implements PusherId {
    1852           0 :   Pusher({
    1853             :     required this.appId,
    1854             :     required this.pushkey,
    1855             :     required this.appDisplayName,
    1856             :     required this.data,
    1857             :     required this.deviceDisplayName,
    1858             :     required this.kind,
    1859             :     required this.lang,
    1860             :     this.profileTag,
    1861             :   });
    1862             : 
    1863           0 :   Pusher.fromJson(Map<String, Object?> json)
    1864           0 :       : appId = json['app_id'] as String,
    1865           0 :         pushkey = json['pushkey'] as String,
    1866           0 :         appDisplayName = json['app_display_name'] as String,
    1867           0 :         data = PusherData.fromJson(json['data'] as Map<String, Object?>),
    1868           0 :         deviceDisplayName = json['device_display_name'] as String,
    1869           0 :         kind = json['kind'] as String,
    1870           0 :         lang = json['lang'] as String,
    1871             :         profileTag =
    1872           0 :             ((v) => v != null ? v as String : null)(json['profile_tag']);
    1873           0 :   @override
    1874             :   Map<String, Object?> toJson() {
    1875           0 :     final profileTag = this.profileTag;
    1876           0 :     return {
    1877           0 :       'app_id': appId,
    1878           0 :       'pushkey': pushkey,
    1879           0 :       'app_display_name': appDisplayName,
    1880           0 :       'data': data.toJson(),
    1881           0 :       'device_display_name': deviceDisplayName,
    1882           0 :       'kind': kind,
    1883           0 :       'lang': lang,
    1884           0 :       if (profileTag != null) 'profile_tag': profileTag,
    1885             :     };
    1886             :   }
    1887             : 
    1888             :   /// This is a reverse-DNS style identifier for the application.
    1889             :   /// Max length, 64 chars.
    1890             :   @override
    1891             :   String appId;
    1892             : 
    1893             :   /// This is a unique identifier for this pusher. See `/set` for
    1894             :   /// more detail.
    1895             :   /// Max length, 512 bytes.
    1896             :   @override
    1897             :   String pushkey;
    1898             : 
    1899             :   /// A string that will allow the user to identify what application
    1900             :   /// owns this pusher.
    1901             :   String appDisplayName;
    1902             : 
    1903             :   /// A dictionary of information for the pusher implementation
    1904             :   /// itself.
    1905             :   PusherData data;
    1906             : 
    1907             :   /// A string that will allow the user to identify what device owns
    1908             :   /// this pusher.
    1909             :   String deviceDisplayName;
    1910             : 
    1911             :   /// The kind of pusher. `"http"` is a pusher that
    1912             :   /// sends HTTP pokes.
    1913             :   String kind;
    1914             : 
    1915             :   /// The preferred language for receiving notifications (e.g. 'en'
    1916             :   /// or 'en-US')
    1917             :   String lang;
    1918             : 
    1919             :   /// This string determines which set of device specific rules this
    1920             :   /// pusher executes.
    1921             :   String? profileTag;
    1922             : }
    1923             : 
    1924             : ///
    1925             : @_NameSource('spec')
    1926             : class PushCondition {
    1927          31 :   PushCondition({
    1928             :     this.is$,
    1929             :     this.key,
    1930             :     required this.kind,
    1931             :     this.pattern,
    1932             :   });
    1933             : 
    1934          31 :   PushCondition.fromJson(Map<String, Object?> json)
    1935          93 :       : is$ = ((v) => v != null ? v as String : null)(json['is']),
    1936          93 :         key = ((v) => v != null ? v as String : null)(json['key']),
    1937          31 :         kind = json['kind'] as String,
    1938          93 :         pattern = ((v) => v != null ? v as String : null)(json['pattern']);
    1939           0 :   Map<String, Object?> toJson() {
    1940           0 :     final is$ = this.is$;
    1941           0 :     final key = this.key;
    1942           0 :     final pattern = this.pattern;
    1943           0 :     return {
    1944           0 :       if (is$ != null) 'is': is$,
    1945           0 :       if (key != null) 'key': key,
    1946           0 :       'kind': kind,
    1947           0 :       if (pattern != null) 'pattern': pattern,
    1948             :     };
    1949             :   }
    1950             : 
    1951             :   /// Required for `room_member_count` conditions. A decimal integer
    1952             :   /// optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches
    1953             :   /// rooms where the member count is strictly less than the given number and
    1954             :   /// so forth. If no prefix is present, this parameter defaults to ==.
    1955             :   String? is$;
    1956             : 
    1957             :   /// Required for `event_match` conditions. The dot-separated field of the
    1958             :   /// event to match.
    1959             :   ///
    1960             :   /// Required for `sender_notification_permission` conditions. The field in
    1961             :   /// the power level event the user needs a minimum power level for. Fields
    1962             :   /// must be specified under the `notifications` property in the power level
    1963             :   /// event's `content`.
    1964             :   String? key;
    1965             : 
    1966             :   /// The kind of condition to apply. See [conditions](https://spec.matrix.org/unstable/client-server-api/#conditions) for
    1967             :   /// more information on the allowed kinds and how they work.
    1968             :   String kind;
    1969             : 
    1970             :   /// Required for `event_match` conditions. The glob-style pattern to
    1971             :   /// match against.
    1972             :   String? pattern;
    1973             : }
    1974             : 
    1975             : ///
    1976             : @_NameSource('spec')
    1977             : class PushRule {
    1978          31 :   PushRule({
    1979             :     required this.actions,
    1980             :     this.conditions,
    1981             :     required this.default$,
    1982             :     required this.enabled,
    1983             :     this.pattern,
    1984             :     required this.ruleId,
    1985             :   });
    1986             : 
    1987          31 :   PushRule.fromJson(Map<String, Object?> json)
    1988         124 :       : actions = (json['actions'] as List).map((v) => v as Object?).toList(),
    1989          31 :         conditions = ((v) => v != null
    1990             :             ? (v as List)
    1991          93 :                 .map((v) => PushCondition.fromJson(v as Map<String, Object?>))
    1992          31 :                 .toList()
    1993          62 :             : null)(json['conditions']),
    1994          31 :         default$ = json['default'] as bool,
    1995          31 :         enabled = json['enabled'] as bool,
    1996          93 :         pattern = ((v) => v != null ? v as String : null)(json['pattern']),
    1997          31 :         ruleId = json['rule_id'] as String;
    1998           0 :   Map<String, Object?> toJson() {
    1999           0 :     final conditions = this.conditions;
    2000           0 :     final pattern = this.pattern;
    2001           0 :     return {
    2002           0 :       'actions': actions.map((v) => v).toList(),
    2003             :       if (conditions != null)
    2004           0 :         'conditions': conditions.map((v) => v.toJson()).toList(),
    2005           0 :       'default': default$,
    2006           0 :       'enabled': enabled,
    2007           0 :       if (pattern != null) 'pattern': pattern,
    2008           0 :       'rule_id': ruleId,
    2009             :     };
    2010             :   }
    2011             : 
    2012             :   /// The actions to perform when this rule is matched.
    2013             :   List<Object?> actions;
    2014             : 
    2015             :   /// The conditions that must hold true for an event in order for a rule to be
    2016             :   /// applied to an event. A rule with no conditions always matches. Only
    2017             :   /// applicable to `underride` and `override` rules.
    2018             :   List<PushCondition>? conditions;
    2019             : 
    2020             :   /// Whether this is a default rule, or has been set explicitly.
    2021             :   bool default$;
    2022             : 
    2023             :   /// Whether the push rule is enabled or not.
    2024             :   bool enabled;
    2025             : 
    2026             :   /// The glob-style pattern to match against.  Only applicable to `content`
    2027             :   /// rules.
    2028             :   String? pattern;
    2029             : 
    2030             :   /// The ID of this rule.
    2031             :   String ruleId;
    2032             : }
    2033             : 
    2034             : ///
    2035             : @_NameSource('rule override generated')
    2036             : class PushRuleSet {
    2037           2 :   PushRuleSet({
    2038             :     this.content,
    2039             :     this.override,
    2040             :     this.room,
    2041             :     this.sender,
    2042             :     this.underride,
    2043             :   });
    2044             : 
    2045          31 :   PushRuleSet.fromJson(Map<String, Object?> json)
    2046          31 :       : content = ((v) => v != null
    2047             :             ? (v as List)
    2048          93 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    2049          31 :                 .toList()
    2050          62 :             : null)(json['content']),
    2051          31 :         override = ((v) => v != null
    2052             :             ? (v as List)
    2053          93 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    2054          31 :                 .toList()
    2055          62 :             : null)(json['override']),
    2056          31 :         room = ((v) => v != null
    2057             :             ? (v as List)
    2058          93 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    2059          31 :                 .toList()
    2060          62 :             : null)(json['room']),
    2061          31 :         sender = ((v) => v != null
    2062             :             ? (v as List)
    2063          31 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    2064          31 :                 .toList()
    2065          62 :             : null)(json['sender']),
    2066          31 :         underride = ((v) => v != null
    2067             :             ? (v as List)
    2068          93 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    2069          31 :                 .toList()
    2070          62 :             : null)(json['underride']);
    2071           0 :   Map<String, Object?> toJson() {
    2072           0 :     final content = this.content;
    2073           0 :     final override = this.override;
    2074           0 :     final room = this.room;
    2075           0 :     final sender = this.sender;
    2076           0 :     final underride = this.underride;
    2077           0 :     return {
    2078           0 :       if (content != null) 'content': content.map((v) => v.toJson()).toList(),
    2079             :       if (override != null)
    2080           0 :         'override': override.map((v) => v.toJson()).toList(),
    2081           0 :       if (room != null) 'room': room.map((v) => v.toJson()).toList(),
    2082           0 :       if (sender != null) 'sender': sender.map((v) => v.toJson()).toList(),
    2083             :       if (underride != null)
    2084           0 :         'underride': underride.map((v) => v.toJson()).toList(),
    2085             :     };
    2086             :   }
    2087             : 
    2088             :   ///
    2089             :   List<PushRule>? content;
    2090             : 
    2091             :   ///
    2092             :   List<PushRule>? override;
    2093             : 
    2094             :   ///
    2095             :   List<PushRule>? room;
    2096             : 
    2097             :   ///
    2098             :   List<PushRule>? sender;
    2099             : 
    2100             :   ///
    2101             :   List<PushRule>? underride;
    2102             : }
    2103             : 
    2104             : ///
    2105             : @_NameSource('rule override generated')
    2106             : @EnhancedEnum()
    2107             : enum PushRuleKind {
    2108             :   @EnhancedEnumValue(name: 'content')
    2109             :   content,
    2110             :   @EnhancedEnumValue(name: 'override')
    2111             :   override,
    2112             :   @EnhancedEnumValue(name: 'room')
    2113             :   room,
    2114             :   @EnhancedEnumValue(name: 'sender')
    2115             :   sender,
    2116             :   @EnhancedEnumValue(name: 'underride')
    2117             :   underride
    2118             : }
    2119             : 
    2120             : ///
    2121             : @_NameSource('generated')
    2122             : class RefreshResponse {
    2123           0 :   RefreshResponse({
    2124             :     required this.accessToken,
    2125             :     this.expiresInMs,
    2126             :     this.refreshToken,
    2127             :   });
    2128             : 
    2129           1 :   RefreshResponse.fromJson(Map<String, Object?> json)
    2130           1 :       : accessToken = json['access_token'] as String,
    2131             :         expiresInMs =
    2132           3 :             ((v) => v != null ? v as int : null)(json['expires_in_ms']),
    2133             :         refreshToken =
    2134           3 :             ((v) => v != null ? v as String : null)(json['refresh_token']);
    2135           0 :   Map<String, Object?> toJson() {
    2136           0 :     final expiresInMs = this.expiresInMs;
    2137           0 :     final refreshToken = this.refreshToken;
    2138           0 :     return {
    2139           0 :       'access_token': accessToken,
    2140           0 :       if (expiresInMs != null) 'expires_in_ms': expiresInMs,
    2141           0 :       if (refreshToken != null) 'refresh_token': refreshToken,
    2142             :     };
    2143             :   }
    2144             : 
    2145             :   /// The new access token to use.
    2146             :   String accessToken;
    2147             : 
    2148             :   /// The lifetime of the access token, in milliseconds. If not
    2149             :   /// given, the client can assume that the access token will not
    2150             :   /// expire.
    2151             :   int? expiresInMs;
    2152             : 
    2153             :   /// The new refresh token to use when the access token needs to
    2154             :   /// be refreshed again. If not given, the old refresh token can
    2155             :   /// be re-used.
    2156             :   String? refreshToken;
    2157             : }
    2158             : 
    2159             : ///
    2160             : @_NameSource('rule override generated')
    2161             : @EnhancedEnum()
    2162             : enum AccountKind {
    2163             :   @EnhancedEnumValue(name: 'guest')
    2164             :   guest,
    2165             :   @EnhancedEnumValue(name: 'user')
    2166             :   user
    2167             : }
    2168             : 
    2169             : ///
    2170             : @_NameSource('generated')
    2171             : class RegisterResponse {
    2172           0 :   RegisterResponse({
    2173             :     this.accessToken,
    2174             :     this.deviceId,
    2175             :     this.expiresInMs,
    2176             :     this.homeServer,
    2177             :     this.refreshToken,
    2178             :     required this.userId,
    2179             :   });
    2180             : 
    2181           0 :   RegisterResponse.fromJson(Map<String, Object?> json)
    2182             :       : accessToken =
    2183           0 :             ((v) => v != null ? v as String : null)(json['access_token']),
    2184           0 :         deviceId = ((v) => v != null ? v as String : null)(json['device_id']),
    2185             :         expiresInMs =
    2186           0 :             ((v) => v != null ? v as int : null)(json['expires_in_ms']),
    2187             :         homeServer =
    2188           0 :             ((v) => v != null ? v as String : null)(json['home_server']),
    2189             :         refreshToken =
    2190           0 :             ((v) => v != null ? v as String : null)(json['refresh_token']),
    2191           0 :         userId = json['user_id'] as String;
    2192           0 :   Map<String, Object?> toJson() {
    2193           0 :     final accessToken = this.accessToken;
    2194           0 :     final deviceId = this.deviceId;
    2195           0 :     final expiresInMs = this.expiresInMs;
    2196           0 :     final homeServer = this.homeServer;
    2197           0 :     final refreshToken = this.refreshToken;
    2198           0 :     return {
    2199           0 :       if (accessToken != null) 'access_token': accessToken,
    2200           0 :       if (deviceId != null) 'device_id': deviceId,
    2201           0 :       if (expiresInMs != null) 'expires_in_ms': expiresInMs,
    2202           0 :       if (homeServer != null) 'home_server': homeServer,
    2203           0 :       if (refreshToken != null) 'refresh_token': refreshToken,
    2204           0 :       'user_id': userId,
    2205             :     };
    2206             :   }
    2207             : 
    2208             :   /// An access token for the account.
    2209             :   /// This access token can then be used to authorize other requests.
    2210             :   /// Required if the `inhibit_login` option is false.
    2211             :   String? accessToken;
    2212             : 
    2213             :   /// ID of the registered device. Will be the same as the
    2214             :   /// corresponding parameter in the request, if one was specified.
    2215             :   /// Required if the `inhibit_login` option is false.
    2216             :   String? deviceId;
    2217             : 
    2218             :   /// The lifetime of the access token, in milliseconds. Once
    2219             :   /// the access token has expired a new access token can be
    2220             :   /// obtained by using the provided refresh token. If no
    2221             :   /// refresh token is provided, the client will need to re-log in
    2222             :   /// to obtain a new access token. If not given, the client can
    2223             :   /// assume that the access token will not expire.
    2224             :   ///
    2225             :   /// Omitted if the `inhibit_login` option is true.
    2226             :   int? expiresInMs;
    2227             : 
    2228             :   /// The server_name of the homeserver on which the account has
    2229             :   /// been registered.
    2230             :   ///
    2231             :   /// **Deprecated**. Clients should extract the server_name from
    2232             :   /// `user_id` (by splitting at the first colon) if they require
    2233             :   /// it. Note also that `homeserver` is not spelt this way.
    2234             :   String? homeServer;
    2235             : 
    2236             :   /// A refresh token for the account. This token can be used to
    2237             :   /// obtain a new access token when it expires by calling the
    2238             :   /// `/refresh` endpoint.
    2239             :   ///
    2240             :   /// Omitted if the `inhibit_login` option is true.
    2241             :   String? refreshToken;
    2242             : 
    2243             :   /// The fully-qualified Matrix user ID (MXID) that has been registered.
    2244             :   ///
    2245             :   /// Any user ID returned by this API must conform to the grammar given in the
    2246             :   /// [Matrix specification](https://spec.matrix.org/unstable/appendices/#user-identifiers).
    2247             :   String userId;
    2248             : }
    2249             : 
    2250             : ///
    2251             : @_NameSource('spec')
    2252             : class RoomKeysUpdateResponse {
    2253           0 :   RoomKeysUpdateResponse({
    2254             :     required this.count,
    2255             :     required this.etag,
    2256             :   });
    2257             : 
    2258           4 :   RoomKeysUpdateResponse.fromJson(Map<String, Object?> json)
    2259           4 :       : count = json['count'] as int,
    2260           4 :         etag = json['etag'] as String;
    2261           0 :   Map<String, Object?> toJson() => {
    2262           0 :         'count': count,
    2263           0 :         'etag': etag,
    2264             :       };
    2265             : 
    2266             :   /// The number of keys stored in the backup
    2267             :   int count;
    2268             : 
    2269             :   /// The new etag value representing stored keys in the backup.
    2270             :   /// See `GET /room_keys/version/{version}` for more details.
    2271             :   String etag;
    2272             : }
    2273             : 
    2274             : /// The key data
    2275             : @_NameSource('spec')
    2276             : class KeyBackupData {
    2277           4 :   KeyBackupData({
    2278             :     required this.firstMessageIndex,
    2279             :     required this.forwardedCount,
    2280             :     required this.isVerified,
    2281             :     required this.sessionData,
    2282             :   });
    2283             : 
    2284           1 :   KeyBackupData.fromJson(Map<String, Object?> json)
    2285           1 :       : firstMessageIndex = json['first_message_index'] as int,
    2286           1 :         forwardedCount = json['forwarded_count'] as int,
    2287           1 :         isVerified = json['is_verified'] as bool,
    2288           1 :         sessionData = json['session_data'] as Map<String, Object?>;
    2289           8 :   Map<String, Object?> toJson() => {
    2290           4 :         'first_message_index': firstMessageIndex,
    2291           4 :         'forwarded_count': forwardedCount,
    2292           4 :         'is_verified': isVerified,
    2293           4 :         'session_data': sessionData,
    2294             :       };
    2295             : 
    2296             :   /// The index of the first message in the session that the key can decrypt.
    2297             :   int firstMessageIndex;
    2298             : 
    2299             :   /// The number of times this key has been forwarded via key-sharing between devices.
    2300             :   int forwardedCount;
    2301             : 
    2302             :   /// Whether the device backing up the key verified the device that the key
    2303             :   /// is from.
    2304             :   bool isVerified;
    2305             : 
    2306             :   /// Algorithm-dependent data.  See the documentation for the backup
    2307             :   /// algorithms in [Server-side key backups](https://spec.matrix.org/unstable/client-server-api/#server-side-key-backups) for more information on the
    2308             :   /// expected format of the data.
    2309             :   Map<String, Object?> sessionData;
    2310             : }
    2311             : 
    2312             : /// The backed up keys for a room.
    2313             : @_NameSource('spec')
    2314             : class RoomKeyBackup {
    2315           4 :   RoomKeyBackup({
    2316             :     required this.sessions,
    2317             :   });
    2318             : 
    2319           1 :   RoomKeyBackup.fromJson(Map<String, Object?> json)
    2320           3 :       : sessions = (json['sessions'] as Map<String, Object?>).map((k, v) =>
    2321           2 :             MapEntry(k, KeyBackupData.fromJson(v as Map<String, Object?>)));
    2322           8 :   Map<String, Object?> toJson() => {
    2323          20 :         'sessions': sessions.map((k, v) => MapEntry(k, v.toJson())),
    2324             :       };
    2325             : 
    2326             :   /// A map of session IDs to key data.
    2327             :   Map<String, KeyBackupData> sessions;
    2328             : }
    2329             : 
    2330             : ///
    2331             : @_NameSource('rule override generated')
    2332             : class RoomKeys {
    2333           4 :   RoomKeys({
    2334             :     required this.rooms,
    2335             :   });
    2336             : 
    2337           1 :   RoomKeys.fromJson(Map<String, Object?> json)
    2338           3 :       : rooms = (json['rooms'] as Map<String, Object?>).map((k, v) =>
    2339           2 :             MapEntry(k, RoomKeyBackup.fromJson(v as Map<String, Object?>)));
    2340           8 :   Map<String, Object?> toJson() => {
    2341          20 :         'rooms': rooms.map((k, v) => MapEntry(k, v.toJson())),
    2342             :       };
    2343             : 
    2344             :   /// A map of room IDs to room key backup data.
    2345             :   Map<String, RoomKeyBackup> rooms;
    2346             : }
    2347             : 
    2348             : ///
    2349             : @_NameSource('rule override generated')
    2350             : @EnhancedEnum()
    2351             : enum BackupAlgorithm {
    2352             :   @EnhancedEnumValue(name: 'm.megolm_backup.v1.curve25519-aes-sha2')
    2353             :   mMegolmBackupV1Curve25519AesSha2
    2354             : }
    2355             : 
    2356             : ///
    2357             : @_NameSource('generated')
    2358             : class GetRoomKeysVersionCurrentResponse {
    2359           0 :   GetRoomKeysVersionCurrentResponse({
    2360             :     required this.algorithm,
    2361             :     required this.authData,
    2362             :     required this.count,
    2363             :     required this.etag,
    2364             :     required this.version,
    2365             :   });
    2366             : 
    2367           5 :   GetRoomKeysVersionCurrentResponse.fromJson(Map<String, Object?> json)
    2368             :       : algorithm =
    2369          10 :             BackupAlgorithm.values.fromString(json['algorithm'] as String)!,
    2370           5 :         authData = json['auth_data'] as Map<String, Object?>,
    2371           5 :         count = json['count'] as int,
    2372           5 :         etag = json['etag'] as String,
    2373           5 :         version = json['version'] as String;
    2374           0 :   Map<String, Object?> toJson() => {
    2375           0 :         'algorithm': algorithm.name,
    2376           0 :         'auth_data': authData,
    2377           0 :         'count': count,
    2378           0 :         'etag': etag,
    2379           0 :         'version': version,
    2380             :       };
    2381             : 
    2382             :   /// The algorithm used for storing backups.
    2383             :   BackupAlgorithm algorithm;
    2384             : 
    2385             :   /// Algorithm-dependent data. See the documentation for the backup
    2386             :   /// algorithms in [Server-side key backups](https://spec.matrix.org/unstable/client-server-api/#server-side-key-backups) for more information on the
    2387             :   /// expected format of the data.
    2388             :   Map<String, Object?> authData;
    2389             : 
    2390             :   /// The number of keys stored in the backup.
    2391             :   int count;
    2392             : 
    2393             :   /// An opaque string representing stored keys in the backup.
    2394             :   /// Clients can compare it with the `etag` value they received
    2395             :   /// in the request of their last key storage request.  If not
    2396             :   /// equal, another client has modified the backup.
    2397             :   String etag;
    2398             : 
    2399             :   /// The backup version.
    2400             :   String version;
    2401             : }
    2402             : 
    2403             : ///
    2404             : @_NameSource('generated')
    2405             : class GetRoomKeysVersionResponse {
    2406           0 :   GetRoomKeysVersionResponse({
    2407             :     required this.algorithm,
    2408             :     required this.authData,
    2409             :     required this.count,
    2410             :     required this.etag,
    2411             :     required this.version,
    2412             :   });
    2413             : 
    2414           0 :   GetRoomKeysVersionResponse.fromJson(Map<String, Object?> json)
    2415             :       : algorithm =
    2416           0 :             BackupAlgorithm.values.fromString(json['algorithm'] as String)!,
    2417           0 :         authData = json['auth_data'] as Map<String, Object?>,
    2418           0 :         count = json['count'] as int,
    2419           0 :         etag = json['etag'] as String,
    2420           0 :         version = json['version'] as String;
    2421           0 :   Map<String, Object?> toJson() => {
    2422           0 :         'algorithm': algorithm.name,
    2423           0 :         'auth_data': authData,
    2424           0 :         'count': count,
    2425           0 :         'etag': etag,
    2426           0 :         'version': version,
    2427             :       };
    2428             : 
    2429             :   /// The algorithm used for storing backups.
    2430             :   BackupAlgorithm algorithm;
    2431             : 
    2432             :   /// Algorithm-dependent data. See the documentation for the backup
    2433             :   /// algorithms in [Server-side key backups](https://spec.matrix.org/unstable/client-server-api/#server-side-key-backups) for more information on the
    2434             :   /// expected format of the data.
    2435             :   Map<String, Object?> authData;
    2436             : 
    2437             :   /// The number of keys stored in the backup.
    2438             :   int count;
    2439             : 
    2440             :   /// An opaque string representing stored keys in the backup.
    2441             :   /// Clients can compare it with the `etag` value they received
    2442             :   /// in the request of their last key storage request.  If not
    2443             :   /// equal, another client has modified the backup.
    2444             :   String etag;
    2445             : 
    2446             :   /// The backup version.
    2447             :   String version;
    2448             : }
    2449             : 
    2450             : /// The events and state surrounding the requested event.
    2451             : @_NameSource('rule override generated')
    2452             : class EventContext {
    2453           0 :   EventContext({
    2454             :     this.end,
    2455             :     this.event,
    2456             :     this.eventsAfter,
    2457             :     this.eventsBefore,
    2458             :     this.start,
    2459             :     this.state,
    2460             :   });
    2461             : 
    2462           0 :   EventContext.fromJson(Map<String, Object?> json)
    2463           0 :       : end = ((v) => v != null ? v as String : null)(json['end']),
    2464           0 :         event = ((v) => v != null
    2465           0 :             ? MatrixEvent.fromJson(v as Map<String, Object?>)
    2466           0 :             : null)(json['event']),
    2467           0 :         eventsAfter = ((v) => v != null
    2468             :             ? (v as List)
    2469           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    2470           0 :                 .toList()
    2471           0 :             : null)(json['events_after']),
    2472           0 :         eventsBefore = ((v) => v != null
    2473             :             ? (v as List)
    2474           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    2475           0 :                 .toList()
    2476           0 :             : null)(json['events_before']),
    2477           0 :         start = ((v) => v != null ? v as String : null)(json['start']),
    2478           0 :         state = ((v) => v != null
    2479             :             ? (v as List)
    2480           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    2481           0 :                 .toList()
    2482           0 :             : null)(json['state']);
    2483           0 :   Map<String, Object?> toJson() {
    2484           0 :     final end = this.end;
    2485           0 :     final event = this.event;
    2486           0 :     final eventsAfter = this.eventsAfter;
    2487           0 :     final eventsBefore = this.eventsBefore;
    2488           0 :     final start = this.start;
    2489           0 :     final state = this.state;
    2490           0 :     return {
    2491           0 :       if (end != null) 'end': end,
    2492           0 :       if (event != null) 'event': event.toJson(),
    2493             :       if (eventsAfter != null)
    2494           0 :         'events_after': eventsAfter.map((v) => v.toJson()).toList(),
    2495             :       if (eventsBefore != null)
    2496           0 :         'events_before': eventsBefore.map((v) => v.toJson()).toList(),
    2497           0 :       if (start != null) 'start': start,
    2498           0 :       if (state != null) 'state': state.map((v) => v.toJson()).toList(),
    2499             :     };
    2500             :   }
    2501             : 
    2502             :   /// A token that can be used to paginate forwards with.
    2503             :   String? end;
    2504             : 
    2505             :   /// Details of the requested event.
    2506             :   MatrixEvent? event;
    2507             : 
    2508             :   /// A list of room events that happened just after the
    2509             :   /// requested event, in chronological order.
    2510             :   List<MatrixEvent>? eventsAfter;
    2511             : 
    2512             :   /// A list of room events that happened just before the
    2513             :   /// requested event, in reverse-chronological order.
    2514             :   List<MatrixEvent>? eventsBefore;
    2515             : 
    2516             :   /// A token that can be used to paginate backwards with.
    2517             :   String? start;
    2518             : 
    2519             :   /// The state of the room at the last event returned.
    2520             :   List<MatrixEvent>? state;
    2521             : }
    2522             : 
    2523             : ///
    2524             : @_NameSource('spec')
    2525             : class RoomMember {
    2526           0 :   RoomMember({
    2527             :     this.avatarUrl,
    2528             :     this.displayName,
    2529             :   });
    2530             : 
    2531           0 :   RoomMember.fromJson(Map<String, Object?> json)
    2532           0 :       : avatarUrl = ((v) =>
    2533           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    2534             :         displayName =
    2535           0 :             ((v) => v != null ? v as String : null)(json['display_name']);
    2536           0 :   Map<String, Object?> toJson() {
    2537           0 :     final avatarUrl = this.avatarUrl;
    2538           0 :     final displayName = this.displayName;
    2539           0 :     return {
    2540           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    2541           0 :       if (displayName != null) 'display_name': displayName,
    2542             :     };
    2543             :   }
    2544             : 
    2545             :   /// The mxc avatar url of the user this object is representing.
    2546             :   Uri? avatarUrl;
    2547             : 
    2548             :   /// The display name of the user this object is representing.
    2549             :   String? displayName;
    2550             : }
    2551             : 
    2552             : ///
    2553             : @_NameSource('(generated, rule override generated)')
    2554             : @EnhancedEnum()
    2555             : enum Membership {
    2556             :   @EnhancedEnumValue(name: 'ban')
    2557             :   ban,
    2558             :   @EnhancedEnumValue(name: 'invite')
    2559             :   invite,
    2560             :   @EnhancedEnumValue(name: 'join')
    2561             :   join,
    2562             :   @EnhancedEnumValue(name: 'knock')
    2563             :   knock,
    2564             :   @EnhancedEnumValue(name: 'leave')
    2565             :   leave
    2566             : }
    2567             : 
    2568             : /// A list of messages with a new token to request more.
    2569             : @_NameSource('generated')
    2570             : class GetRoomEventsResponse {
    2571           0 :   GetRoomEventsResponse({
    2572             :     required this.chunk,
    2573             :     this.end,
    2574             :     required this.start,
    2575             :     this.state,
    2576             :   });
    2577             : 
    2578           4 :   GetRoomEventsResponse.fromJson(Map<String, Object?> json)
    2579           4 :       : chunk = (json['chunk'] as List)
    2580          12 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    2581           4 :             .toList(),
    2582          12 :         end = ((v) => v != null ? v as String : null)(json['end']),
    2583           4 :         start = json['start'] as String,
    2584           4 :         state = ((v) => v != null
    2585             :             ? (v as List)
    2586           4 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    2587           4 :                 .toList()
    2588           8 :             : null)(json['state']);
    2589           0 :   Map<String, Object?> toJson() {
    2590           0 :     final end = this.end;
    2591           0 :     final state = this.state;
    2592           0 :     return {
    2593           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
    2594           0 :       if (end != null) 'end': end,
    2595           0 :       'start': start,
    2596           0 :       if (state != null) 'state': state.map((v) => v.toJson()).toList(),
    2597             :     };
    2598             :   }
    2599             : 
    2600             :   /// A list of room events. The order depends on the `dir` parameter.
    2601             :   /// For `dir=b` events will be in reverse-chronological order,
    2602             :   /// for `dir=f` in chronological order. (The exact definition of `chronological`
    2603             :   /// is dependent on the server implementation.)
    2604             :   ///
    2605             :   /// Note that an empty `chunk` does not *necessarily* imply that no more events
    2606             :   /// are available. Clients should continue to paginate until no `end` property
    2607             :   /// is returned.
    2608             :   List<MatrixEvent> chunk;
    2609             : 
    2610             :   /// A token corresponding to the end of `chunk`. This token can be passed
    2611             :   /// back to this endpoint to request further events.
    2612             :   ///
    2613             :   /// If no further events are available (either because we have
    2614             :   /// reached the start of the timeline, or because the user does
    2615             :   /// not have permission to see any more events), this property
    2616             :   /// is omitted from the response.
    2617             :   String? end;
    2618             : 
    2619             :   /// A token corresponding to the start of `chunk`. This will be the same as
    2620             :   /// the value given in `from`.
    2621             :   String start;
    2622             : 
    2623             :   /// A list of state events relevant to showing the `chunk`. For example, if
    2624             :   /// `lazy_load_members` is enabled in the filter then this may contain
    2625             :   /// the membership events for the senders of events in the `chunk`.
    2626             :   ///
    2627             :   /// Unless `include_redundant_members` is `true`, the server
    2628             :   /// may remove membership events which would have already been
    2629             :   /// sent to the client in prior calls to this endpoint, assuming
    2630             :   /// the membership of those members has not changed.
    2631             :   List<MatrixEvent>? state;
    2632             : }
    2633             : 
    2634             : ///
    2635             : @_NameSource('generated')
    2636             : @EnhancedEnum()
    2637             : enum ReceiptType {
    2638             :   @EnhancedEnumValue(name: 'm.fully_read')
    2639             :   mFullyRead,
    2640             :   @EnhancedEnumValue(name: 'm.read')
    2641             :   mRead,
    2642             :   @EnhancedEnumValue(name: 'm.read.private')
    2643             :   mReadPrivate
    2644             : }
    2645             : 
    2646             : ///
    2647             : @_NameSource('spec')
    2648             : class IncludeEventContext {
    2649           0 :   IncludeEventContext({
    2650             :     this.afterLimit,
    2651             :     this.beforeLimit,
    2652             :     this.includeProfile,
    2653             :   });
    2654             : 
    2655           0 :   IncludeEventContext.fromJson(Map<String, Object?> json)
    2656           0 :       : afterLimit = ((v) => v != null ? v as int : null)(json['after_limit']),
    2657             :         beforeLimit =
    2658           0 :             ((v) => v != null ? v as int : null)(json['before_limit']),
    2659             :         includeProfile =
    2660           0 :             ((v) => v != null ? v as bool : null)(json['include_profile']);
    2661           0 :   Map<String, Object?> toJson() {
    2662           0 :     final afterLimit = this.afterLimit;
    2663           0 :     final beforeLimit = this.beforeLimit;
    2664           0 :     final includeProfile = this.includeProfile;
    2665           0 :     return {
    2666           0 :       if (afterLimit != null) 'after_limit': afterLimit,
    2667           0 :       if (beforeLimit != null) 'before_limit': beforeLimit,
    2668           0 :       if (includeProfile != null) 'include_profile': includeProfile,
    2669             :     };
    2670             :   }
    2671             : 
    2672             :   /// How many events after the result are
    2673             :   /// returned. By default, this is `5`.
    2674             :   int? afterLimit;
    2675             : 
    2676             :   /// How many events before the result are
    2677             :   /// returned. By default, this is `5`.
    2678             :   int? beforeLimit;
    2679             : 
    2680             :   /// Requests that the server returns the
    2681             :   /// historic profile information for the users
    2682             :   /// that sent the events that were returned.
    2683             :   /// By default, this is `false`.
    2684             :   bool? includeProfile;
    2685             : }
    2686             : 
    2687             : ///
    2688             : @_NameSource('spec')
    2689             : class EventFilter {
    2690           0 :   EventFilter({
    2691             :     this.limit,
    2692             :     this.notSenders,
    2693             :     this.notTypes,
    2694             :     this.senders,
    2695             :     this.types,
    2696             :   });
    2697             : 
    2698           0 :   EventFilter.fromJson(Map<String, Object?> json)
    2699           0 :       : limit = ((v) => v != null ? v as int : null)(json['limit']),
    2700           0 :         notSenders = ((v) => v != null
    2701           0 :             ? (v as List).map((v) => v as String).toList()
    2702           0 :             : null)(json['not_senders']),
    2703           0 :         notTypes = ((v) => v != null
    2704           0 :             ? (v as List).map((v) => v as String).toList()
    2705           0 :             : null)(json['not_types']),
    2706           0 :         senders = ((v) => v != null
    2707           0 :             ? (v as List).map((v) => v as String).toList()
    2708           0 :             : null)(json['senders']),
    2709           0 :         types = ((v) => v != null
    2710           0 :             ? (v as List).map((v) => v as String).toList()
    2711           0 :             : null)(json['types']);
    2712           0 :   Map<String, Object?> toJson() {
    2713           0 :     final limit = this.limit;
    2714           0 :     final notSenders = this.notSenders;
    2715           0 :     final notTypes = this.notTypes;
    2716           0 :     final senders = this.senders;
    2717           0 :     final types = this.types;
    2718           0 :     return {
    2719           0 :       if (limit != null) 'limit': limit,
    2720           0 :       if (notSenders != null) 'not_senders': notSenders.map((v) => v).toList(),
    2721           0 :       if (notTypes != null) 'not_types': notTypes.map((v) => v).toList(),
    2722           0 :       if (senders != null) 'senders': senders.map((v) => v).toList(),
    2723           0 :       if (types != null) 'types': types.map((v) => v).toList(),
    2724             :     };
    2725             :   }
    2726             : 
    2727             :   /// The maximum number of events to return.
    2728             :   int? limit;
    2729             : 
    2730             :   /// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
    2731             :   List<String>? notSenders;
    2732             : 
    2733             :   /// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
    2734             :   List<String>? notTypes;
    2735             : 
    2736             :   /// A list of senders IDs to include. If this list is absent then all senders are included.
    2737             :   List<String>? senders;
    2738             : 
    2739             :   /// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
    2740             :   List<String>? types;
    2741             : }
    2742             : 
    2743             : ///
    2744             : @_NameSource('spec')
    2745             : class RoomEventFilter {
    2746           0 :   RoomEventFilter({
    2747             :     this.containsUrl,
    2748             :     this.includeRedundantMembers,
    2749             :     this.lazyLoadMembers,
    2750             :     this.notRooms,
    2751             :     this.rooms,
    2752             :     this.unreadThreadNotifications,
    2753             :   });
    2754             : 
    2755           0 :   RoomEventFilter.fromJson(Map<String, Object?> json)
    2756             :       : containsUrl =
    2757           0 :             ((v) => v != null ? v as bool : null)(json['contains_url']),
    2758           0 :         includeRedundantMembers = ((v) =>
    2759           0 :             v != null ? v as bool : null)(json['include_redundant_members']),
    2760             :         lazyLoadMembers =
    2761           0 :             ((v) => v != null ? v as bool : null)(json['lazy_load_members']),
    2762           0 :         notRooms = ((v) => v != null
    2763           0 :             ? (v as List).map((v) => v as String).toList()
    2764           0 :             : null)(json['not_rooms']),
    2765           0 :         rooms = ((v) => v != null
    2766           0 :             ? (v as List).map((v) => v as String).toList()
    2767           0 :             : null)(json['rooms']),
    2768           0 :         unreadThreadNotifications = ((v) =>
    2769           0 :             v != null ? v as bool : null)(json['unread_thread_notifications']);
    2770           0 :   Map<String, Object?> toJson() {
    2771           0 :     final containsUrl = this.containsUrl;
    2772           0 :     final includeRedundantMembers = this.includeRedundantMembers;
    2773           0 :     final lazyLoadMembers = this.lazyLoadMembers;
    2774           0 :     final notRooms = this.notRooms;
    2775           0 :     final rooms = this.rooms;
    2776           0 :     final unreadThreadNotifications = this.unreadThreadNotifications;
    2777           0 :     return {
    2778           0 :       if (containsUrl != null) 'contains_url': containsUrl,
    2779             :       if (includeRedundantMembers != null)
    2780           0 :         'include_redundant_members': includeRedundantMembers,
    2781           0 :       if (lazyLoadMembers != null) 'lazy_load_members': lazyLoadMembers,
    2782           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    2783           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    2784             :       if (unreadThreadNotifications != null)
    2785           0 :         'unread_thread_notifications': unreadThreadNotifications,
    2786             :     };
    2787             :   }
    2788             : 
    2789             :   /// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
    2790             :   bool? containsUrl;
    2791             : 
    2792             :   /// If `true`, sends all membership events for all events, even if they have already
    2793             :   /// been sent to the client. Does not
    2794             :   /// apply unless `lazy_load_members` is `true`. See
    2795             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    2796             :   /// for more information. Defaults to `false`.
    2797             :   bool? includeRedundantMembers;
    2798             : 
    2799             :   /// If `true`, enables lazy-loading of membership events. See
    2800             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    2801             :   /// for more information. Defaults to `false`.
    2802             :   bool? lazyLoadMembers;
    2803             : 
    2804             :   /// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
    2805             :   List<String>? notRooms;
    2806             : 
    2807             :   /// A list of room IDs to include. If this list is absent then all rooms are included.
    2808             :   List<String>? rooms;
    2809             : 
    2810             :   /// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
    2811             :   /// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
    2812             :   bool? unreadThreadNotifications;
    2813             : }
    2814             : 
    2815             : ///
    2816             : @_NameSource('rule override generated')
    2817             : class SearchFilter implements EventFilter, RoomEventFilter {
    2818           0 :   SearchFilter({
    2819             :     this.limit,
    2820             :     this.notSenders,
    2821             :     this.notTypes,
    2822             :     this.senders,
    2823             :     this.types,
    2824             :     this.containsUrl,
    2825             :     this.includeRedundantMembers,
    2826             :     this.lazyLoadMembers,
    2827             :     this.notRooms,
    2828             :     this.rooms,
    2829             :     this.unreadThreadNotifications,
    2830             :   });
    2831             : 
    2832           0 :   SearchFilter.fromJson(Map<String, Object?> json)
    2833           0 :       : limit = ((v) => v != null ? v as int : null)(json['limit']),
    2834           0 :         notSenders = ((v) => v != null
    2835           0 :             ? (v as List).map((v) => v as String).toList()
    2836           0 :             : null)(json['not_senders']),
    2837           0 :         notTypes = ((v) => v != null
    2838           0 :             ? (v as List).map((v) => v as String).toList()
    2839           0 :             : null)(json['not_types']),
    2840           0 :         senders = ((v) => v != null
    2841           0 :             ? (v as List).map((v) => v as String).toList()
    2842           0 :             : null)(json['senders']),
    2843           0 :         types = ((v) => v != null
    2844           0 :             ? (v as List).map((v) => v as String).toList()
    2845           0 :             : null)(json['types']),
    2846             :         containsUrl =
    2847           0 :             ((v) => v != null ? v as bool : null)(json['contains_url']),
    2848           0 :         includeRedundantMembers = ((v) =>
    2849           0 :             v != null ? v as bool : null)(json['include_redundant_members']),
    2850             :         lazyLoadMembers =
    2851           0 :             ((v) => v != null ? v as bool : null)(json['lazy_load_members']),
    2852           0 :         notRooms = ((v) => v != null
    2853           0 :             ? (v as List).map((v) => v as String).toList()
    2854           0 :             : null)(json['not_rooms']),
    2855           0 :         rooms = ((v) => v != null
    2856           0 :             ? (v as List).map((v) => v as String).toList()
    2857           0 :             : null)(json['rooms']),
    2858           0 :         unreadThreadNotifications = ((v) =>
    2859           0 :             v != null ? v as bool : null)(json['unread_thread_notifications']);
    2860           0 :   @override
    2861             :   Map<String, Object?> toJson() {
    2862           0 :     final limit = this.limit;
    2863           0 :     final notSenders = this.notSenders;
    2864           0 :     final notTypes = this.notTypes;
    2865           0 :     final senders = this.senders;
    2866           0 :     final types = this.types;
    2867           0 :     final containsUrl = this.containsUrl;
    2868           0 :     final includeRedundantMembers = this.includeRedundantMembers;
    2869           0 :     final lazyLoadMembers = this.lazyLoadMembers;
    2870           0 :     final notRooms = this.notRooms;
    2871           0 :     final rooms = this.rooms;
    2872           0 :     final unreadThreadNotifications = this.unreadThreadNotifications;
    2873           0 :     return {
    2874           0 :       if (limit != null) 'limit': limit,
    2875           0 :       if (notSenders != null) 'not_senders': notSenders.map((v) => v).toList(),
    2876           0 :       if (notTypes != null) 'not_types': notTypes.map((v) => v).toList(),
    2877           0 :       if (senders != null) 'senders': senders.map((v) => v).toList(),
    2878           0 :       if (types != null) 'types': types.map((v) => v).toList(),
    2879           0 :       if (containsUrl != null) 'contains_url': containsUrl,
    2880             :       if (includeRedundantMembers != null)
    2881           0 :         'include_redundant_members': includeRedundantMembers,
    2882           0 :       if (lazyLoadMembers != null) 'lazy_load_members': lazyLoadMembers,
    2883           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    2884           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    2885             :       if (unreadThreadNotifications != null)
    2886           0 :         'unread_thread_notifications': unreadThreadNotifications,
    2887             :     };
    2888             :   }
    2889             : 
    2890             :   /// The maximum number of events to return.
    2891             :   @override
    2892             :   int? limit;
    2893             : 
    2894             :   /// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
    2895             :   @override
    2896             :   List<String>? notSenders;
    2897             : 
    2898             :   /// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
    2899             :   @override
    2900             :   List<String>? notTypes;
    2901             : 
    2902             :   /// A list of senders IDs to include. If this list is absent then all senders are included.
    2903             :   @override
    2904             :   List<String>? senders;
    2905             : 
    2906             :   /// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
    2907             :   @override
    2908             :   List<String>? types;
    2909             : 
    2910             :   /// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
    2911             :   @override
    2912             :   bool? containsUrl;
    2913             : 
    2914             :   /// If `true`, sends all membership events for all events, even if they have already
    2915             :   /// been sent to the client. Does not
    2916             :   /// apply unless `lazy_load_members` is `true`. See
    2917             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    2918             :   /// for more information. Defaults to `false`.
    2919             :   @override
    2920             :   bool? includeRedundantMembers;
    2921             : 
    2922             :   /// If `true`, enables lazy-loading of membership events. See
    2923             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    2924             :   /// for more information. Defaults to `false`.
    2925             :   @override
    2926             :   bool? lazyLoadMembers;
    2927             : 
    2928             :   /// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
    2929             :   @override
    2930             :   List<String>? notRooms;
    2931             : 
    2932             :   /// A list of room IDs to include. If this list is absent then all rooms are included.
    2933             :   @override
    2934             :   List<String>? rooms;
    2935             : 
    2936             :   /// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
    2937             :   /// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
    2938             :   @override
    2939             :   bool? unreadThreadNotifications;
    2940             : }
    2941             : 
    2942             : ///
    2943             : @_NameSource('rule override generated')
    2944             : @EnhancedEnum()
    2945             : enum GroupKey {
    2946             :   @EnhancedEnumValue(name: 'room_id')
    2947             :   roomId,
    2948             :   @EnhancedEnumValue(name: 'sender')
    2949             :   sender
    2950             : }
    2951             : 
    2952             : /// Configuration for group.
    2953             : @_NameSource('spec')
    2954             : class Group {
    2955           0 :   Group({
    2956             :     this.key,
    2957             :   });
    2958             : 
    2959           0 :   Group.fromJson(Map<String, Object?> json)
    2960           0 :       : key = ((v) => v != null
    2961           0 :             ? GroupKey.values.fromString(v as String)!
    2962           0 :             : null)(json['key']);
    2963           0 :   Map<String, Object?> toJson() {
    2964           0 :     final key = this.key;
    2965           0 :     return {
    2966           0 :       if (key != null) 'key': key.name,
    2967             :     };
    2968             :   }
    2969             : 
    2970             :   /// Key that defines the group.
    2971             :   GroupKey? key;
    2972             : }
    2973             : 
    2974             : ///
    2975             : @_NameSource('spec')
    2976             : class Groupings {
    2977           0 :   Groupings({
    2978             :     this.groupBy,
    2979             :   });
    2980             : 
    2981           0 :   Groupings.fromJson(Map<String, Object?> json)
    2982           0 :       : groupBy = ((v) => v != null
    2983             :             ? (v as List)
    2984           0 :                 .map((v) => Group.fromJson(v as Map<String, Object?>))
    2985           0 :                 .toList()
    2986           0 :             : null)(json['group_by']);
    2987           0 :   Map<String, Object?> toJson() {
    2988           0 :     final groupBy = this.groupBy;
    2989           0 :     return {
    2990           0 :       if (groupBy != null) 'group_by': groupBy.map((v) => v.toJson()).toList(),
    2991             :     };
    2992             :   }
    2993             : 
    2994             :   /// List of groups to request.
    2995             :   List<Group>? groupBy;
    2996             : }
    2997             : 
    2998             : ///
    2999             : @_NameSource('rule override generated')
    3000             : @EnhancedEnum()
    3001             : enum KeyKind {
    3002             :   @EnhancedEnumValue(name: 'content.body')
    3003             :   contentBody,
    3004             :   @EnhancedEnumValue(name: 'content.name')
    3005             :   contentName,
    3006             :   @EnhancedEnumValue(name: 'content.topic')
    3007             :   contentTopic
    3008             : }
    3009             : 
    3010             : ///
    3011             : @_NameSource('rule override generated')
    3012             : @EnhancedEnum()
    3013             : enum SearchOrder {
    3014             :   @EnhancedEnumValue(name: 'rank')
    3015             :   rank,
    3016             :   @EnhancedEnumValue(name: 'recent')
    3017             :   recent
    3018             : }
    3019             : 
    3020             : ///
    3021             : @_NameSource('spec')
    3022             : class RoomEventsCriteria {
    3023           0 :   RoomEventsCriteria({
    3024             :     this.eventContext,
    3025             :     this.filter,
    3026             :     this.groupings,
    3027             :     this.includeState,
    3028             :     this.keys,
    3029             :     this.orderBy,
    3030             :     required this.searchTerm,
    3031             :   });
    3032             : 
    3033           0 :   RoomEventsCriteria.fromJson(Map<String, Object?> json)
    3034           0 :       : eventContext = ((v) => v != null
    3035           0 :             ? IncludeEventContext.fromJson(v as Map<String, Object?>)
    3036           0 :             : null)(json['event_context']),
    3037           0 :         filter = ((v) => v != null
    3038           0 :             ? SearchFilter.fromJson(v as Map<String, Object?>)
    3039           0 :             : null)(json['filter']),
    3040           0 :         groupings = ((v) => v != null
    3041           0 :             ? Groupings.fromJson(v as Map<String, Object?>)
    3042           0 :             : null)(json['groupings']),
    3043             :         includeState =
    3044           0 :             ((v) => v != null ? v as bool : null)(json['include_state']),
    3045           0 :         keys = ((v) => v != null
    3046             :             ? (v as List)
    3047           0 :                 .map((v) => KeyKind.values.fromString(v as String)!)
    3048           0 :                 .toList()
    3049           0 :             : null)(json['keys']),
    3050           0 :         orderBy = ((v) => v != null
    3051           0 :             ? SearchOrder.values.fromString(v as String)!
    3052           0 :             : null)(json['order_by']),
    3053           0 :         searchTerm = json['search_term'] as String;
    3054           0 :   Map<String, Object?> toJson() {
    3055           0 :     final eventContext = this.eventContext;
    3056           0 :     final filter = this.filter;
    3057           0 :     final groupings = this.groupings;
    3058           0 :     final includeState = this.includeState;
    3059           0 :     final keys = this.keys;
    3060           0 :     final orderBy = this.orderBy;
    3061           0 :     return {
    3062           0 :       if (eventContext != null) 'event_context': eventContext.toJson(),
    3063           0 :       if (filter != null) 'filter': filter.toJson(),
    3064           0 :       if (groupings != null) 'groupings': groupings.toJson(),
    3065           0 :       if (includeState != null) 'include_state': includeState,
    3066           0 :       if (keys != null) 'keys': keys.map((v) => v.name).toList(),
    3067           0 :       if (orderBy != null) 'order_by': orderBy.name,
    3068           0 :       'search_term': searchTerm,
    3069             :     };
    3070             :   }
    3071             : 
    3072             :   /// Configures whether any context for the events
    3073             :   /// returned are included in the response.
    3074             :   IncludeEventContext? eventContext;
    3075             : 
    3076             :   /// This takes a [filter](https://spec.matrix.org/unstable/client-server-api/#filtering).
    3077             :   SearchFilter? filter;
    3078             : 
    3079             :   /// Requests that the server partitions the result set
    3080             :   /// based on the provided list of keys.
    3081             :   Groupings? groupings;
    3082             : 
    3083             :   /// Requests the server return the current state for
    3084             :   /// each room returned.
    3085             :   bool? includeState;
    3086             : 
    3087             :   /// The keys to search. Defaults to all.
    3088             :   List<KeyKind>? keys;
    3089             : 
    3090             :   /// The order in which to search for results.
    3091             :   /// By default, this is `"rank"`.
    3092             :   SearchOrder? orderBy;
    3093             : 
    3094             :   /// The string to search events for
    3095             :   String searchTerm;
    3096             : }
    3097             : 
    3098             : ///
    3099             : @_NameSource('spec')
    3100             : class Categories {
    3101           0 :   Categories({
    3102             :     this.roomEvents,
    3103             :   });
    3104             : 
    3105           0 :   Categories.fromJson(Map<String, Object?> json)
    3106           0 :       : roomEvents = ((v) => v != null
    3107           0 :             ? RoomEventsCriteria.fromJson(v as Map<String, Object?>)
    3108           0 :             : null)(json['room_events']);
    3109           0 :   Map<String, Object?> toJson() {
    3110           0 :     final roomEvents = this.roomEvents;
    3111           0 :     return {
    3112           0 :       if (roomEvents != null) 'room_events': roomEvents.toJson(),
    3113             :     };
    3114             :   }
    3115             : 
    3116             :   /// Mapping of category name to search criteria.
    3117             :   RoomEventsCriteria? roomEvents;
    3118             : }
    3119             : 
    3120             : /// The results for a particular group value.
    3121             : @_NameSource('spec')
    3122             : class GroupValue {
    3123           0 :   GroupValue({
    3124             :     this.nextBatch,
    3125             :     this.order,
    3126             :     this.results,
    3127             :   });
    3128             : 
    3129           0 :   GroupValue.fromJson(Map<String, Object?> json)
    3130           0 :       : nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    3131           0 :         order = ((v) => v != null ? v as int : null)(json['order']),
    3132           0 :         results = ((v) => v != null
    3133           0 :             ? (v as List).map((v) => v as String).toList()
    3134           0 :             : null)(json['results']);
    3135           0 :   Map<String, Object?> toJson() {
    3136           0 :     final nextBatch = this.nextBatch;
    3137           0 :     final order = this.order;
    3138           0 :     final results = this.results;
    3139           0 :     return {
    3140           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    3141           0 :       if (order != null) 'order': order,
    3142           0 :       if (results != null) 'results': results.map((v) => v).toList(),
    3143             :     };
    3144             :   }
    3145             : 
    3146             :   /// Token that can be used to get the next batch
    3147             :   /// of results in the group, by passing as the
    3148             :   /// `next_batch` parameter to the next call. If
    3149             :   /// this field is absent, there are no more
    3150             :   /// results in this group.
    3151             :   String? nextBatch;
    3152             : 
    3153             :   /// Key that can be used to order different
    3154             :   /// groups.
    3155             :   int? order;
    3156             : 
    3157             :   /// Which results are in this group.
    3158             :   List<String>? results;
    3159             : }
    3160             : 
    3161             : ///
    3162             : @_NameSource('spec')
    3163             : class UserProfile {
    3164           0 :   UserProfile({
    3165             :     this.avatarUrl,
    3166             :     this.displayname,
    3167             :   });
    3168             : 
    3169           0 :   UserProfile.fromJson(Map<String, Object?> json)
    3170           0 :       : avatarUrl = ((v) =>
    3171           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    3172             :         displayname =
    3173           0 :             ((v) => v != null ? v as String : null)(json['displayname']);
    3174           0 :   Map<String, Object?> toJson() {
    3175           0 :     final avatarUrl = this.avatarUrl;
    3176           0 :     final displayname = this.displayname;
    3177           0 :     return {
    3178           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    3179           0 :       if (displayname != null) 'displayname': displayname,
    3180             :     };
    3181             :   }
    3182             : 
    3183             :   ///
    3184             :   Uri? avatarUrl;
    3185             : 
    3186             :   ///
    3187             :   String? displayname;
    3188             : }
    3189             : 
    3190             : ///
    3191             : @_NameSource('rule override spec')
    3192             : class SearchResultsEventContext {
    3193           0 :   SearchResultsEventContext({
    3194             :     this.end,
    3195             :     this.eventsAfter,
    3196             :     this.eventsBefore,
    3197             :     this.profileInfo,
    3198             :     this.start,
    3199             :   });
    3200             : 
    3201           0 :   SearchResultsEventContext.fromJson(Map<String, Object?> json)
    3202           0 :       : end = ((v) => v != null ? v as String : null)(json['end']),
    3203           0 :         eventsAfter = ((v) => v != null
    3204             :             ? (v as List)
    3205           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3206           0 :                 .toList()
    3207           0 :             : null)(json['events_after']),
    3208           0 :         eventsBefore = ((v) => v != null
    3209             :             ? (v as List)
    3210           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3211           0 :                 .toList()
    3212           0 :             : null)(json['events_before']),
    3213           0 :         profileInfo = ((v) => v != null
    3214           0 :             ? (v as Map<String, Object?>).map((k, v) =>
    3215           0 :                 MapEntry(k, UserProfile.fromJson(v as Map<String, Object?>)))
    3216           0 :             : null)(json['profile_info']),
    3217           0 :         start = ((v) => v != null ? v as String : null)(json['start']);
    3218           0 :   Map<String, Object?> toJson() {
    3219           0 :     final end = this.end;
    3220           0 :     final eventsAfter = this.eventsAfter;
    3221           0 :     final eventsBefore = this.eventsBefore;
    3222           0 :     final profileInfo = this.profileInfo;
    3223           0 :     final start = this.start;
    3224           0 :     return {
    3225           0 :       if (end != null) 'end': end,
    3226             :       if (eventsAfter != null)
    3227           0 :         'events_after': eventsAfter.map((v) => v.toJson()).toList(),
    3228             :       if (eventsBefore != null)
    3229           0 :         'events_before': eventsBefore.map((v) => v.toJson()).toList(),
    3230             :       if (profileInfo != null)
    3231           0 :         'profile_info': profileInfo.map((k, v) => MapEntry(k, v.toJson())),
    3232           0 :       if (start != null) 'start': start,
    3233             :     };
    3234             :   }
    3235             : 
    3236             :   /// Pagination token for the end of the chunk
    3237             :   String? end;
    3238             : 
    3239             :   /// Events just after the result.
    3240             :   List<MatrixEvent>? eventsAfter;
    3241             : 
    3242             :   /// Events just before the result.
    3243             :   List<MatrixEvent>? eventsBefore;
    3244             : 
    3245             :   /// The historic profile information of the
    3246             :   /// users that sent the events returned.
    3247             :   ///
    3248             :   /// The `string` key is the user ID for which
    3249             :   /// the profile belongs to.
    3250             :   Map<String, UserProfile>? profileInfo;
    3251             : 
    3252             :   /// Pagination token for the start of the chunk
    3253             :   String? start;
    3254             : }
    3255             : 
    3256             : /// The result object.
    3257             : @_NameSource('spec')
    3258             : class Result {
    3259           0 :   Result({
    3260             :     this.context,
    3261             :     this.rank,
    3262             :     this.result,
    3263             :   });
    3264             : 
    3265           0 :   Result.fromJson(Map<String, Object?> json)
    3266           0 :       : context = ((v) => v != null
    3267           0 :             ? SearchResultsEventContext.fromJson(v as Map<String, Object?>)
    3268           0 :             : null)(json['context']),
    3269           0 :         rank = ((v) => v != null ? (v as num).toDouble() : null)(json['rank']),
    3270           0 :         result = ((v) => v != null
    3271           0 :             ? MatrixEvent.fromJson(v as Map<String, Object?>)
    3272           0 :             : null)(json['result']);
    3273           0 :   Map<String, Object?> toJson() {
    3274           0 :     final context = this.context;
    3275           0 :     final rank = this.rank;
    3276           0 :     final result = this.result;
    3277           0 :     return {
    3278           0 :       if (context != null) 'context': context.toJson(),
    3279           0 :       if (rank != null) 'rank': rank,
    3280           0 :       if (result != null) 'result': result.toJson(),
    3281             :     };
    3282             :   }
    3283             : 
    3284             :   /// Context for result, if requested.
    3285             :   SearchResultsEventContext? context;
    3286             : 
    3287             :   /// A number that describes how closely this result matches the search. Higher is closer.
    3288             :   double? rank;
    3289             : 
    3290             :   /// The event that matched.
    3291             :   MatrixEvent? result;
    3292             : }
    3293             : 
    3294             : ///
    3295             : @_NameSource('spec')
    3296             : class ResultRoomEvents {
    3297           0 :   ResultRoomEvents({
    3298             :     this.count,
    3299             :     this.groups,
    3300             :     this.highlights,
    3301             :     this.nextBatch,
    3302             :     this.results,
    3303             :     this.state,
    3304             :   });
    3305             : 
    3306           0 :   ResultRoomEvents.fromJson(Map<String, Object?> json)
    3307           0 :       : count = ((v) => v != null ? v as int : null)(json['count']),
    3308           0 :         groups = ((v) => v != null
    3309           0 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    3310             :                 k,
    3311           0 :                 (v as Map<String, Object?>).map((k, v) => MapEntry(
    3312           0 :                     k, GroupValue.fromJson(v as Map<String, Object?>)))))
    3313           0 :             : null)(json['groups']),
    3314           0 :         highlights = ((v) => v != null
    3315           0 :             ? (v as List).map((v) => v as String).toList()
    3316           0 :             : null)(json['highlights']),
    3317           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    3318           0 :         results = ((v) => v != null
    3319             :             ? (v as List)
    3320           0 :                 .map((v) => Result.fromJson(v as Map<String, Object?>))
    3321           0 :                 .toList()
    3322           0 :             : null)(json['results']),
    3323           0 :         state = ((v) => v != null
    3324           0 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    3325             :                 k,
    3326             :                 (v as List)
    3327           0 :                     .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3328           0 :                     .toList()))
    3329           0 :             : null)(json['state']);
    3330           0 :   Map<String, Object?> toJson() {
    3331           0 :     final count = this.count;
    3332           0 :     final groups = this.groups;
    3333           0 :     final highlights = this.highlights;
    3334           0 :     final nextBatch = this.nextBatch;
    3335           0 :     final results = this.results;
    3336           0 :     final state = this.state;
    3337           0 :     return {
    3338           0 :       if (count != null) 'count': count,
    3339             :       if (groups != null)
    3340           0 :         'groups': groups.map(
    3341           0 :             (k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v.toJson())))),
    3342           0 :       if (highlights != null) 'highlights': highlights.map((v) => v).toList(),
    3343           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    3344           0 :       if (results != null) 'results': results.map((v) => v.toJson()).toList(),
    3345             :       if (state != null)
    3346           0 :         'state':
    3347           0 :             state.map((k, v) => MapEntry(k, v.map((v) => v.toJson()).toList())),
    3348             :     };
    3349             :   }
    3350             : 
    3351             :   /// An approximate count of the total number of results found.
    3352             :   int? count;
    3353             : 
    3354             :   /// Any groups that were requested.
    3355             :   ///
    3356             :   /// The outer `string` key is the group key requested (eg: `room_id`
    3357             :   /// or `sender`). The inner `string` key is the grouped value (eg:
    3358             :   /// a room's ID or a user's ID).
    3359             :   Map<String, Map<String, GroupValue>>? groups;
    3360             : 
    3361             :   /// List of words which should be highlighted, useful for stemming which may change the query terms.
    3362             :   List<String>? highlights;
    3363             : 
    3364             :   /// Token that can be used to get the next batch of
    3365             :   /// results, by passing as the `next_batch` parameter to
    3366             :   /// the next call. If this field is absent, there are no
    3367             :   /// more results.
    3368             :   String? nextBatch;
    3369             : 
    3370             :   /// List of results in the requested order.
    3371             :   List<Result>? results;
    3372             : 
    3373             :   /// The current state for every room in the results.
    3374             :   /// This is included if the request had the
    3375             :   /// `include_state` key set with a value of `true`.
    3376             :   ///
    3377             :   /// The `string` key is the room ID for which the `State
    3378             :   /// Event` array belongs to.
    3379             :   Map<String, List<MatrixEvent>>? state;
    3380             : }
    3381             : 
    3382             : ///
    3383             : @_NameSource('spec')
    3384             : class ResultCategories {
    3385           0 :   ResultCategories({
    3386             :     this.roomEvents,
    3387             :   });
    3388             : 
    3389           0 :   ResultCategories.fromJson(Map<String, Object?> json)
    3390           0 :       : roomEvents = ((v) => v != null
    3391           0 :             ? ResultRoomEvents.fromJson(v as Map<String, Object?>)
    3392           0 :             : null)(json['room_events']);
    3393           0 :   Map<String, Object?> toJson() {
    3394           0 :     final roomEvents = this.roomEvents;
    3395           0 :     return {
    3396           0 :       if (roomEvents != null) 'room_events': roomEvents.toJson(),
    3397             :     };
    3398             :   }
    3399             : 
    3400             :   /// Mapping of category name to search criteria.
    3401             :   ResultRoomEvents? roomEvents;
    3402             : }
    3403             : 
    3404             : ///
    3405             : @_NameSource('rule override spec')
    3406             : class SearchResults {
    3407           0 :   SearchResults({
    3408             :     required this.searchCategories,
    3409             :   });
    3410             : 
    3411           0 :   SearchResults.fromJson(Map<String, Object?> json)
    3412           0 :       : searchCategories = ResultCategories.fromJson(
    3413           0 :             json['search_categories'] as Map<String, Object?>);
    3414           0 :   Map<String, Object?> toJson() => {
    3415           0 :         'search_categories': searchCategories.toJson(),
    3416             :       };
    3417             : 
    3418             :   /// Describes which categories to search in and their criteria.
    3419             :   ResultCategories searchCategories;
    3420             : }
    3421             : 
    3422             : ///
    3423             : @_NameSource('spec')
    3424             : class Location {
    3425           0 :   Location({
    3426             :     required this.alias,
    3427             :     required this.fields,
    3428             :     required this.protocol,
    3429             :   });
    3430             : 
    3431           0 :   Location.fromJson(Map<String, Object?> json)
    3432           0 :       : alias = json['alias'] as String,
    3433           0 :         fields = json['fields'] as Map<String, Object?>,
    3434           0 :         protocol = json['protocol'] as String;
    3435           0 :   Map<String, Object?> toJson() => {
    3436           0 :         'alias': alias,
    3437           0 :         'fields': fields,
    3438           0 :         'protocol': protocol,
    3439             :       };
    3440             : 
    3441             :   /// An alias for a matrix room.
    3442             :   String alias;
    3443             : 
    3444             :   /// Information used to identify this third party location.
    3445             :   Map<String, Object?> fields;
    3446             : 
    3447             :   /// The protocol ID that the third party location is a part of.
    3448             :   String protocol;
    3449             : }
    3450             : 
    3451             : /// Definition of valid values for a field.
    3452             : @_NameSource('spec')
    3453             : class FieldType {
    3454           0 :   FieldType({
    3455             :     required this.placeholder,
    3456             :     required this.regexp,
    3457             :   });
    3458             : 
    3459           0 :   FieldType.fromJson(Map<String, Object?> json)
    3460           0 :       : placeholder = json['placeholder'] as String,
    3461           0 :         regexp = json['regexp'] as String;
    3462           0 :   Map<String, Object?> toJson() => {
    3463           0 :         'placeholder': placeholder,
    3464           0 :         'regexp': regexp,
    3465             :       };
    3466             : 
    3467             :   /// An placeholder serving as a valid example of the field value.
    3468             :   String placeholder;
    3469             : 
    3470             :   /// A regular expression for validation of a field's value. This may be relatively
    3471             :   /// coarse to verify the value as the application service providing this protocol
    3472             :   /// may apply additional validation or filtering.
    3473             :   String regexp;
    3474             : }
    3475             : 
    3476             : ///
    3477             : @_NameSource('spec')
    3478             : class ProtocolInstance {
    3479           0 :   ProtocolInstance({
    3480             :     required this.desc,
    3481             :     required this.fields,
    3482             :     this.icon,
    3483             :     required this.networkId,
    3484             :   });
    3485             : 
    3486           0 :   ProtocolInstance.fromJson(Map<String, Object?> json)
    3487           0 :       : desc = json['desc'] as String,
    3488           0 :         fields = json['fields'] as Map<String, Object?>,
    3489           0 :         icon = ((v) => v != null ? v as String : null)(json['icon']),
    3490           0 :         networkId = json['network_id'] as String;
    3491           0 :   Map<String, Object?> toJson() {
    3492           0 :     final icon = this.icon;
    3493           0 :     return {
    3494           0 :       'desc': desc,
    3495           0 :       'fields': fields,
    3496           0 :       if (icon != null) 'icon': icon,
    3497           0 :       'network_id': networkId,
    3498             :     };
    3499             :   }
    3500             : 
    3501             :   /// A human-readable description for the protocol, such as the name.
    3502             :   String desc;
    3503             : 
    3504             :   /// Preset values for `fields` the client may use to search by.
    3505             :   Map<String, Object?> fields;
    3506             : 
    3507             :   /// An optional content URI representing the protocol. Overrides the one provided
    3508             :   /// at the higher level Protocol object.
    3509             :   String? icon;
    3510             : 
    3511             :   /// A unique identifier across all instances.
    3512             :   String networkId;
    3513             : }
    3514             : 
    3515             : ///
    3516             : @_NameSource('spec')
    3517             : class Protocol {
    3518           0 :   Protocol({
    3519             :     required this.fieldTypes,
    3520             :     required this.icon,
    3521             :     required this.instances,
    3522             :     required this.locationFields,
    3523             :     required this.userFields,
    3524             :   });
    3525             : 
    3526           0 :   Protocol.fromJson(Map<String, Object?> json)
    3527           0 :       : fieldTypes = (json['field_types'] as Map<String, Object?>).map((k, v) =>
    3528           0 :             MapEntry(k, FieldType.fromJson(v as Map<String, Object?>))),
    3529           0 :         icon = json['icon'] as String,
    3530           0 :         instances = (json['instances'] as List)
    3531           0 :             .map((v) => ProtocolInstance.fromJson(v as Map<String, Object?>))
    3532           0 :             .toList(),
    3533             :         locationFields =
    3534           0 :             (json['location_fields'] as List).map((v) => v as String).toList(),
    3535             :         userFields =
    3536           0 :             (json['user_fields'] as List).map((v) => v as String).toList();
    3537           0 :   Map<String, Object?> toJson() => {
    3538           0 :         'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())),
    3539           0 :         'icon': icon,
    3540           0 :         'instances': instances.map((v) => v.toJson()).toList(),
    3541           0 :         'location_fields': locationFields.map((v) => v).toList(),
    3542           0 :         'user_fields': userFields.map((v) => v).toList(),
    3543             :       };
    3544             : 
    3545             :   /// The type definitions for the fields defined in the `user_fields` and
    3546             :   /// `location_fields`. Each entry in those arrays MUST have an entry here. The
    3547             :   /// `string` key for this object is field name itself.
    3548             :   ///
    3549             :   /// May be an empty object if no fields are defined.
    3550             :   Map<String, FieldType> fieldTypes;
    3551             : 
    3552             :   /// A content URI representing an icon for the third party protocol.
    3553             :   String icon;
    3554             : 
    3555             :   /// A list of objects representing independent instances of configuration.
    3556             :   /// For example, multiple networks on IRC if multiple are provided by the
    3557             :   /// same application service.
    3558             :   List<ProtocolInstance> instances;
    3559             : 
    3560             :   /// Fields which may be used to identify a third party location. These should be
    3561             :   /// ordered to suggest the way that entities may be grouped, where higher
    3562             :   /// groupings are ordered first. For example, the name of a network should be
    3563             :   /// searched before the name of a channel.
    3564             :   List<String> locationFields;
    3565             : 
    3566             :   /// Fields which may be used to identify a third party user. These should be
    3567             :   /// ordered to suggest the way that entities may be grouped, where higher
    3568             :   /// groupings are ordered first. For example, the name of a network should be
    3569             :   /// searched before the nickname of a user.
    3570             :   List<String> userFields;
    3571             : }
    3572             : 
    3573             : ///
    3574             : @_NameSource('rule override spec')
    3575             : class ThirdPartyUser {
    3576           0 :   ThirdPartyUser({
    3577             :     required this.fields,
    3578             :     required this.protocol,
    3579             :     required this.userid,
    3580             :   });
    3581             : 
    3582           0 :   ThirdPartyUser.fromJson(Map<String, Object?> json)
    3583           0 :       : fields = json['fields'] as Map<String, Object?>,
    3584           0 :         protocol = json['protocol'] as String,
    3585           0 :         userid = json['userid'] as String;
    3586           0 :   Map<String, Object?> toJson() => {
    3587           0 :         'fields': fields,
    3588           0 :         'protocol': protocol,
    3589           0 :         'userid': userid,
    3590             :       };
    3591             : 
    3592             :   /// Information used to identify this third party location.
    3593             :   Map<String, Object?> fields;
    3594             : 
    3595             :   /// The protocol ID that the third party location is a part of.
    3596             :   String protocol;
    3597             : 
    3598             :   /// A Matrix User ID represting a third party user.
    3599             :   String userid;
    3600             : }
    3601             : 
    3602             : ///
    3603             : @_NameSource('generated')
    3604             : @EnhancedEnum()
    3605             : enum EventFormat {
    3606             :   @EnhancedEnumValue(name: 'client')
    3607             :   client,
    3608             :   @EnhancedEnumValue(name: 'federation')
    3609             :   federation
    3610             : }
    3611             : 
    3612             : ///
    3613             : @_NameSource('rule override generated')
    3614             : class StateFilter implements EventFilter, RoomEventFilter {
    3615          38 :   StateFilter({
    3616             :     this.limit,
    3617             :     this.notSenders,
    3618             :     this.notTypes,
    3619             :     this.senders,
    3620             :     this.types,
    3621             :     this.containsUrl,
    3622             :     this.includeRedundantMembers,
    3623             :     this.lazyLoadMembers,
    3624             :     this.notRooms,
    3625             :     this.rooms,
    3626             :     this.unreadThreadNotifications,
    3627             :   });
    3628             : 
    3629           0 :   StateFilter.fromJson(Map<String, Object?> json)
    3630           0 :       : limit = ((v) => v != null ? v as int : null)(json['limit']),
    3631           0 :         notSenders = ((v) => v != null
    3632           0 :             ? (v as List).map((v) => v as String).toList()
    3633           0 :             : null)(json['not_senders']),
    3634           0 :         notTypes = ((v) => v != null
    3635           0 :             ? (v as List).map((v) => v as String).toList()
    3636           0 :             : null)(json['not_types']),
    3637           0 :         senders = ((v) => v != null
    3638           0 :             ? (v as List).map((v) => v as String).toList()
    3639           0 :             : null)(json['senders']),
    3640           0 :         types = ((v) => v != null
    3641           0 :             ? (v as List).map((v) => v as String).toList()
    3642           0 :             : null)(json['types']),
    3643             :         containsUrl =
    3644           0 :             ((v) => v != null ? v as bool : null)(json['contains_url']),
    3645           0 :         includeRedundantMembers = ((v) =>
    3646           0 :             v != null ? v as bool : null)(json['include_redundant_members']),
    3647             :         lazyLoadMembers =
    3648           0 :             ((v) => v != null ? v as bool : null)(json['lazy_load_members']),
    3649           0 :         notRooms = ((v) => v != null
    3650           0 :             ? (v as List).map((v) => v as String).toList()
    3651           0 :             : null)(json['not_rooms']),
    3652           0 :         rooms = ((v) => v != null
    3653           0 :             ? (v as List).map((v) => v as String).toList()
    3654           0 :             : null)(json['rooms']),
    3655           0 :         unreadThreadNotifications = ((v) =>
    3656           0 :             v != null ? v as bool : null)(json['unread_thread_notifications']);
    3657          31 :   @override
    3658             :   Map<String, Object?> toJson() {
    3659          31 :     final limit = this.limit;
    3660          31 :     final notSenders = this.notSenders;
    3661          31 :     final notTypes = this.notTypes;
    3662          31 :     final senders = this.senders;
    3663          31 :     final types = this.types;
    3664          31 :     final containsUrl = this.containsUrl;
    3665          31 :     final includeRedundantMembers = this.includeRedundantMembers;
    3666          31 :     final lazyLoadMembers = this.lazyLoadMembers;
    3667          31 :     final notRooms = this.notRooms;
    3668          31 :     final rooms = this.rooms;
    3669          31 :     final unreadThreadNotifications = this.unreadThreadNotifications;
    3670          31 :     return {
    3671           0 :       if (limit != null) 'limit': limit,
    3672           0 :       if (notSenders != null) 'not_senders': notSenders.map((v) => v).toList(),
    3673           0 :       if (notTypes != null) 'not_types': notTypes.map((v) => v).toList(),
    3674           0 :       if (senders != null) 'senders': senders.map((v) => v).toList(),
    3675           0 :       if (types != null) 'types': types.map((v) => v).toList(),
    3676           0 :       if (containsUrl != null) 'contains_url': containsUrl,
    3677             :       if (includeRedundantMembers != null)
    3678           0 :         'include_redundant_members': includeRedundantMembers,
    3679          31 :       if (lazyLoadMembers != null) 'lazy_load_members': lazyLoadMembers,
    3680           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    3681           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    3682             :       if (unreadThreadNotifications != null)
    3683           0 :         'unread_thread_notifications': unreadThreadNotifications,
    3684             :     };
    3685             :   }
    3686             : 
    3687             :   /// The maximum number of events to return.
    3688             :   @override
    3689             :   int? limit;
    3690             : 
    3691             :   /// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
    3692             :   @override
    3693             :   List<String>? notSenders;
    3694             : 
    3695             :   /// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
    3696             :   @override
    3697             :   List<String>? notTypes;
    3698             : 
    3699             :   /// A list of senders IDs to include. If this list is absent then all senders are included.
    3700             :   @override
    3701             :   List<String>? senders;
    3702             : 
    3703             :   /// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
    3704             :   @override
    3705             :   List<String>? types;
    3706             : 
    3707             :   /// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
    3708             :   @override
    3709             :   bool? containsUrl;
    3710             : 
    3711             :   /// If `true`, sends all membership events for all events, even if they have already
    3712             :   /// been sent to the client. Does not
    3713             :   /// apply unless `lazy_load_members` is `true`. See
    3714             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    3715             :   /// for more information. Defaults to `false`.
    3716             :   @override
    3717             :   bool? includeRedundantMembers;
    3718             : 
    3719             :   /// If `true`, enables lazy-loading of membership events. See
    3720             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    3721             :   /// for more information. Defaults to `false`.
    3722             :   @override
    3723             :   bool? lazyLoadMembers;
    3724             : 
    3725             :   /// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
    3726             :   @override
    3727             :   List<String>? notRooms;
    3728             : 
    3729             :   /// A list of room IDs to include. If this list is absent then all rooms are included.
    3730             :   @override
    3731             :   List<String>? rooms;
    3732             : 
    3733             :   /// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
    3734             :   /// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
    3735             :   @override
    3736             :   bool? unreadThreadNotifications;
    3737             : }
    3738             : 
    3739             : ///
    3740             : @_NameSource('spec')
    3741             : class RoomFilter {
    3742          38 :   RoomFilter({
    3743             :     this.accountData,
    3744             :     this.ephemeral,
    3745             :     this.includeLeave,
    3746             :     this.notRooms,
    3747             :     this.rooms,
    3748             :     this.state,
    3749             :     this.timeline,
    3750             :   });
    3751             : 
    3752           0 :   RoomFilter.fromJson(Map<String, Object?> json)
    3753           0 :       : accountData = ((v) => v != null
    3754           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    3755           0 :             : null)(json['account_data']),
    3756           0 :         ephemeral = ((v) => v != null
    3757           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    3758           0 :             : null)(json['ephemeral']),
    3759             :         includeLeave =
    3760           0 :             ((v) => v != null ? v as bool : null)(json['include_leave']),
    3761           0 :         notRooms = ((v) => v != null
    3762           0 :             ? (v as List).map((v) => v as String).toList()
    3763           0 :             : null)(json['not_rooms']),
    3764           0 :         rooms = ((v) => v != null
    3765           0 :             ? (v as List).map((v) => v as String).toList()
    3766           0 :             : null)(json['rooms']),
    3767           0 :         state = ((v) => v != null
    3768           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    3769           0 :             : null)(json['state']),
    3770           0 :         timeline = ((v) => v != null
    3771           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    3772           0 :             : null)(json['timeline']);
    3773          31 :   Map<String, Object?> toJson() {
    3774          31 :     final accountData = this.accountData;
    3775          31 :     final ephemeral = this.ephemeral;
    3776          31 :     final includeLeave = this.includeLeave;
    3777          31 :     final notRooms = this.notRooms;
    3778          31 :     final rooms = this.rooms;
    3779          31 :     final state = this.state;
    3780          31 :     final timeline = this.timeline;
    3781          31 :     return {
    3782           0 :       if (accountData != null) 'account_data': accountData.toJson(),
    3783           0 :       if (ephemeral != null) 'ephemeral': ephemeral.toJson(),
    3784           0 :       if (includeLeave != null) 'include_leave': includeLeave,
    3785           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    3786           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    3787          62 :       if (state != null) 'state': state.toJson(),
    3788           0 :       if (timeline != null) 'timeline': timeline.toJson(),
    3789             :     };
    3790             :   }
    3791             : 
    3792             :   /// The per user account data to include for rooms.
    3793             :   StateFilter? accountData;
    3794             : 
    3795             :   /// The ephemeral events to include for rooms. These are the events that appear in the `ephemeral` property in the `/sync` response.
    3796             :   StateFilter? ephemeral;
    3797             : 
    3798             :   /// Include rooms that the user has left in the sync, default false
    3799             :   bool? includeLeave;
    3800             : 
    3801             :   /// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter. This filter is applied before the filters in `ephemeral`, `state`, `timeline` or `account_data`
    3802             :   List<String>? notRooms;
    3803             : 
    3804             :   /// A list of room IDs to include. If this list is absent then all rooms are included. This filter is applied before the filters in `ephemeral`, `state`, `timeline` or `account_data`
    3805             :   List<String>? rooms;
    3806             : 
    3807             :   /// The state events to include for rooms.
    3808             :   StateFilter? state;
    3809             : 
    3810             :   /// The message and state update events to include for rooms.
    3811             :   StateFilter? timeline;
    3812             : }
    3813             : 
    3814             : ///
    3815             : @_NameSource('spec')
    3816             : class Filter {
    3817          38 :   Filter({
    3818             :     this.accountData,
    3819             :     this.eventFields,
    3820             :     this.eventFormat,
    3821             :     this.presence,
    3822             :     this.room,
    3823             :   });
    3824             : 
    3825           0 :   Filter.fromJson(Map<String, Object?> json)
    3826           0 :       : accountData = ((v) => v != null
    3827           0 :             ? EventFilter.fromJson(v as Map<String, Object?>)
    3828           0 :             : null)(json['account_data']),
    3829           0 :         eventFields = ((v) => v != null
    3830           0 :             ? (v as List).map((v) => v as String).toList()
    3831           0 :             : null)(json['event_fields']),
    3832           0 :         eventFormat = ((v) => v != null
    3833           0 :             ? EventFormat.values.fromString(v as String)!
    3834           0 :             : null)(json['event_format']),
    3835           0 :         presence = ((v) => v != null
    3836           0 :             ? EventFilter.fromJson(v as Map<String, Object?>)
    3837           0 :             : null)(json['presence']),
    3838           0 :         room = ((v) => v != null
    3839           0 :             ? RoomFilter.fromJson(v as Map<String, Object?>)
    3840           0 :             : null)(json['room']);
    3841          31 :   Map<String, Object?> toJson() {
    3842          31 :     final accountData = this.accountData;
    3843          31 :     final eventFields = this.eventFields;
    3844          31 :     final eventFormat = this.eventFormat;
    3845          31 :     final presence = this.presence;
    3846          31 :     final room = this.room;
    3847          31 :     return {
    3848           0 :       if (accountData != null) 'account_data': accountData.toJson(),
    3849             :       if (eventFields != null)
    3850           0 :         'event_fields': eventFields.map((v) => v).toList(),
    3851           0 :       if (eventFormat != null) 'event_format': eventFormat.name,
    3852           0 :       if (presence != null) 'presence': presence.toJson(),
    3853          62 :       if (room != null) 'room': room.toJson(),
    3854             :     };
    3855             :   }
    3856             : 
    3857             :   /// The user account data that isn't associated with rooms to include.
    3858             :   EventFilter? accountData;
    3859             : 
    3860             :   /// List of event fields to include. If this list is absent then all fields are included. The entries may include '.' characters to indicate sub-fields. So ['content.body'] will include the 'body' field of the 'content' object. A literal '.' character in a field name may be escaped using a '\\'. A server may include more fields than were requested.
    3861             :   List<String>? eventFields;
    3862             : 
    3863             :   /// The format to use for events. 'client' will return the events in a format suitable for clients. 'federation' will return the raw event as received over federation. The default is 'client'.
    3864             :   EventFormat? eventFormat;
    3865             : 
    3866             :   /// The presence updates to include.
    3867             :   EventFilter? presence;
    3868             : 
    3869             :   /// Filters to be applied to room data.
    3870             :   RoomFilter? room;
    3871             : }
    3872             : 
    3873             : ///
    3874             : @_NameSource('spec')
    3875             : class OpenIdCredentials {
    3876           0 :   OpenIdCredentials({
    3877             :     required this.accessToken,
    3878             :     required this.expiresIn,
    3879             :     required this.matrixServerName,
    3880             :     required this.tokenType,
    3881             :   });
    3882             : 
    3883           0 :   OpenIdCredentials.fromJson(Map<String, Object?> json)
    3884           0 :       : accessToken = json['access_token'] as String,
    3885           0 :         expiresIn = json['expires_in'] as int,
    3886           0 :         matrixServerName = json['matrix_server_name'] as String,
    3887           0 :         tokenType = json['token_type'] as String;
    3888           0 :   Map<String, Object?> toJson() => {
    3889           0 :         'access_token': accessToken,
    3890           0 :         'expires_in': expiresIn,
    3891           0 :         'matrix_server_name': matrixServerName,
    3892           0 :         'token_type': tokenType,
    3893             :       };
    3894             : 
    3895             :   /// An access token the consumer may use to verify the identity of
    3896             :   /// the person who generated the token. This is given to the federation
    3897             :   /// API `GET /openid/userinfo` to verify the user's identity.
    3898             :   String accessToken;
    3899             : 
    3900             :   /// The number of seconds before this token expires and a new one must
    3901             :   /// be generated.
    3902             :   int expiresIn;
    3903             : 
    3904             :   /// The homeserver domain the consumer should use when attempting to
    3905             :   /// verify the user's identity.
    3906             :   String matrixServerName;
    3907             : 
    3908             :   /// The string `Bearer`.
    3909             :   String tokenType;
    3910             : }
    3911             : 
    3912             : ///
    3913             : @_NameSource('spec')
    3914             : class Tag {
    3915          31 :   Tag({
    3916             :     this.order,
    3917             :     this.additionalProperties = const {},
    3918             :   });
    3919             : 
    3920           0 :   Tag.fromJson(Map<String, Object?> json)
    3921             :       : order =
    3922           0 :             ((v) => v != null ? (v as num).toDouble() : null)(json['order']),
    3923           0 :         additionalProperties = Map.fromEntries(json.entries
    3924           0 :             .where((e) => !['order'].contains(e.key))
    3925           0 :             .map((e) => MapEntry(e.key, e.value)));
    3926           0 :   Map<String, Object?> toJson() {
    3927           0 :     final order = this.order;
    3928           0 :     return {
    3929           0 :       ...additionalProperties,
    3930           0 :       if (order != null) 'order': order,
    3931             :     };
    3932             :   }
    3933             : 
    3934             :   /// A number in a range `[0,1]` describing a relative
    3935             :   /// position of the room under the given tag.
    3936             :   double? order;
    3937             : 
    3938             :   Map<String, Object?> additionalProperties;
    3939             : }
    3940             : 
    3941             : ///
    3942             : @_NameSource('rule override spec')
    3943             : class Profile {
    3944           3 :   Profile({
    3945             :     this.avatarUrl,
    3946             :     this.displayName,
    3947             :     required this.userId,
    3948             :   });
    3949             : 
    3950           0 :   Profile.fromJson(Map<String, Object?> json)
    3951           0 :       : avatarUrl = ((v) =>
    3952           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    3953             :         displayName =
    3954           0 :             ((v) => v != null ? v as String : null)(json['display_name']),
    3955           0 :         userId = json['user_id'] as String;
    3956           0 :   Map<String, Object?> toJson() {
    3957           0 :     final avatarUrl = this.avatarUrl;
    3958           0 :     final displayName = this.displayName;
    3959           0 :     return {
    3960           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    3961           0 :       if (displayName != null) 'display_name': displayName,
    3962           0 :       'user_id': userId,
    3963             :     };
    3964             :   }
    3965             : 
    3966             :   /// The avatar url, as an MXC, if one exists.
    3967             :   Uri? avatarUrl;
    3968             : 
    3969             :   /// The display name of the user, if one exists.
    3970             :   String? displayName;
    3971             : 
    3972             :   /// The user's matrix user ID.
    3973             :   String userId;
    3974             : }
    3975             : 
    3976             : ///
    3977             : @_NameSource('generated')
    3978             : class SearchUserDirectoryResponse {
    3979           0 :   SearchUserDirectoryResponse({
    3980             :     required this.limited,
    3981             :     required this.results,
    3982             :   });
    3983             : 
    3984           0 :   SearchUserDirectoryResponse.fromJson(Map<String, Object?> json)
    3985           0 :       : limited = json['limited'] as bool,
    3986           0 :         results = (json['results'] as List)
    3987           0 :             .map((v) => Profile.fromJson(v as Map<String, Object?>))
    3988           0 :             .toList();
    3989           0 :   Map<String, Object?> toJson() => {
    3990           0 :         'limited': limited,
    3991           0 :         'results': results.map((v) => v.toJson()).toList(),
    3992             :       };
    3993             : 
    3994             :   /// Indicates if the result list has been truncated by the limit.
    3995             :   bool limited;
    3996             : 
    3997             :   /// Ordered by rank and then whether or not profile info is available.
    3998             :   List<Profile> results;
    3999             : }
    4000             : 
    4001             : ///
    4002             : @_NameSource('rule override generated')
    4003             : class TurnServerCredentials {
    4004           0 :   TurnServerCredentials({
    4005             :     required this.password,
    4006             :     required this.ttl,
    4007             :     required this.uris,
    4008             :     required this.username,
    4009             :   });
    4010             : 
    4011           2 :   TurnServerCredentials.fromJson(Map<String, Object?> json)
    4012           2 :       : password = json['password'] as String,
    4013           2 :         ttl = json['ttl'] as int,
    4014           8 :         uris = (json['uris'] as List).map((v) => v as String).toList(),
    4015           2 :         username = json['username'] as String;
    4016           0 :   Map<String, Object?> toJson() => {
    4017           0 :         'password': password,
    4018           0 :         'ttl': ttl,
    4019           0 :         'uris': uris.map((v) => v).toList(),
    4020           0 :         'username': username,
    4021             :       };
    4022             : 
    4023             :   /// The password to use.
    4024             :   String password;
    4025             : 
    4026             :   /// The time-to-live in seconds
    4027             :   int ttl;
    4028             : 
    4029             :   /// A list of TURN URIs
    4030             :   List<String> uris;
    4031             : 
    4032             :   /// The username to use.
    4033             :   String username;
    4034             : }
    4035             : 
    4036             : ///
    4037             : @_NameSource('generated')
    4038             : class GetVersionsResponse {
    4039           0 :   GetVersionsResponse({
    4040             :     this.unstableFeatures,
    4041             :     required this.versions,
    4042             :   });
    4043             : 
    4044          33 :   GetVersionsResponse.fromJson(Map<String, Object?> json)
    4045          33 :       : unstableFeatures = ((v) => v != null
    4046          99 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(k, v as bool))
    4047          66 :             : null)(json['unstable_features']),
    4048         132 :         versions = (json['versions'] as List).map((v) => v as String).toList();
    4049           0 :   Map<String, Object?> toJson() {
    4050           0 :     final unstableFeatures = this.unstableFeatures;
    4051           0 :     return {
    4052             :       if (unstableFeatures != null)
    4053           0 :         'unstable_features': unstableFeatures.map((k, v) => MapEntry(k, v)),
    4054           0 :       'versions': versions.map((v) => v).toList(),
    4055             :     };
    4056             :   }
    4057             : 
    4058             :   /// Experimental features the server supports. Features not listed here,
    4059             :   /// or the lack of this property all together, indicate that a feature is
    4060             :   /// not supported.
    4061             :   Map<String, bool>? unstableFeatures;
    4062             : 
    4063             :   /// The supported versions.
    4064             :   List<String> versions;
    4065             : }
    4066             : 
    4067             : ///
    4068             : @_NameSource('rule override generated')
    4069             : class ServerConfig {
    4070           0 :   ServerConfig({
    4071             :     this.mUploadSize,
    4072             :   });
    4073             : 
    4074           4 :   ServerConfig.fromJson(Map<String, Object?> json)
    4075             :       : mUploadSize =
    4076          12 :             ((v) => v != null ? v as int : null)(json['m.upload.size']);
    4077           0 :   Map<String, Object?> toJson() {
    4078           0 :     final mUploadSize = this.mUploadSize;
    4079           0 :     return {
    4080           0 :       if (mUploadSize != null) 'm.upload.size': mUploadSize,
    4081             :     };
    4082             :   }
    4083             : 
    4084             :   /// The maximum size an upload can be in bytes.
    4085             :   /// Clients SHOULD use this as a guide when uploading content.
    4086             :   /// If not listed or null, the size limit should be treated as unknown.
    4087             :   int? mUploadSize;
    4088             : }
    4089             : 
    4090             : ///
    4091             : @_NameSource('generated')
    4092             : class GetUrlPreviewResponse {
    4093           0 :   GetUrlPreviewResponse({
    4094             :     this.matrixImageSize,
    4095             :     this.ogImage,
    4096             :   });
    4097             : 
    4098           0 :   GetUrlPreviewResponse.fromJson(Map<String, Object?> json)
    4099             :       : matrixImageSize =
    4100           0 :             ((v) => v != null ? v as int : null)(json['matrix:image:size']),
    4101           0 :         ogImage = ((v) =>
    4102           0 :             v != null ? Uri.parse(v as String) : null)(json['og:image']);
    4103           0 :   Map<String, Object?> toJson() {
    4104           0 :     final matrixImageSize = this.matrixImageSize;
    4105           0 :     final ogImage = this.ogImage;
    4106           0 :     return {
    4107           0 :       if (matrixImageSize != null) 'matrix:image:size': matrixImageSize,
    4108           0 :       if (ogImage != null) 'og:image': ogImage.toString(),
    4109             :     };
    4110             :   }
    4111             : 
    4112             :   /// The byte-size of the image. Omitted if there is no image attached.
    4113             :   int? matrixImageSize;
    4114             : 
    4115             :   /// An [MXC URI](https://spec.matrix.org/unstable/client-server-api/#matrix-content-mxc-uris) to the image. Omitted if there is no image.
    4116             :   Uri? ogImage;
    4117             : }
    4118             : 
    4119             : ///
    4120             : @_NameSource('generated')
    4121             : @EnhancedEnum()
    4122             : enum Method {
    4123             :   @EnhancedEnumValue(name: 'crop')
    4124             :   crop,
    4125             :   @EnhancedEnumValue(name: 'scale')
    4126             :   scale
    4127             : }

Generated by: LCOV version 1.14