LCOV - code coverage report
Current view: top level - lib/matrix_api_lite/generated - model.dart (source / functions) Hit Total Coverage
Test: merged.info Lines: 246 2385 10.3 %
Date: 2024-09-30 15:57:20 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           2 :   Map<String, Object?> toJson() => {
      24           2 :         'base_url': baseUrl.toString(),
      25             :       };
      26             : 
      27             :   /// The base URL for the homeserver for client-server connections.
      28             :   Uri baseUrl;
      29             : 
      30           0 :   @override
      31             :   bool operator ==(Object other) =>
      32           0 :       other is HomeserverInformation && other.baseUrl == baseUrl;
      33             : 
      34           0 :   @override
      35           0 :   int get hashCode => baseUrl.hashCode;
      36             : 
      37           0 :   @override
      38             :   String toString() {
      39           0 :     return toJson().toString();
      40             :   }
      41             : }
      42             : 
      43             : ///
      44             : @_NameSource('spec')
      45             : class IdentityServerInformation {
      46           0 :   IdentityServerInformation({
      47             :     required this.baseUrl,
      48             :   });
      49             : 
      50           4 :   IdentityServerInformation.fromJson(Map<String, Object?> json)
      51           8 :       : baseUrl = Uri.parse(json['base_url'] as String);
      52           2 :   Map<String, Object?> toJson() => {
      53           2 :         'base_url': baseUrl.toString(),
      54             :       };
      55             : 
      56             :   /// The base URL for the identity server for client-server connections.
      57             :   Uri baseUrl;
      58             : 
      59           0 :   @override
      60             :   bool operator ==(Object other) =>
      61           0 :       other is IdentityServerInformation && other.baseUrl == baseUrl;
      62             : 
      63           0 :   @override
      64           0 :   int get hashCode => baseUrl.hashCode;
      65             : 
      66           0 :   @override
      67             :   String toString() {
      68           0 :     return toJson().toString();
      69             :   }
      70             : }
      71             : 
      72             : /// Used by clients to determine the homeserver, identity server, and other
      73             : /// optional components they should be interacting with.
      74             : @_NameSource('spec')
      75             : class DiscoveryInformation {
      76           0 :   DiscoveryInformation({
      77             :     required this.mHomeserver,
      78             :     this.mIdentityServer,
      79             :     this.additionalProperties = const {},
      80             :   });
      81             : 
      82           4 :   DiscoveryInformation.fromJson(Map<String, Object?> json)
      83           4 :       : mHomeserver = HomeserverInformation.fromJson(
      84           4 :             json['m.homeserver'] as Map<String, Object?>),
      85           4 :         mIdentityServer = ((v) => v != null
      86           4 :             ? IdentityServerInformation.fromJson(v as Map<String, Object?>)
      87           8 :             : null)(json['m.identity_server']),
      88           8 :         additionalProperties = Map.fromEntries(json.entries
      89           4 :             .where(
      90          16 :                 (e) => !['m.homeserver', 'm.identity_server'].contains(e.key))
      91           8 :             .map((e) => MapEntry(e.key, e.value as Map<String, Object?>)));
      92           1 :   Map<String, Object?> toJson() {
      93           1 :     final mIdentityServer = this.mIdentityServer;
      94           1 :     return {
      95           1 :       ...additionalProperties,
      96           3 :       'm.homeserver': mHomeserver.toJson(),
      97             :       if (mIdentityServer != null)
      98           2 :         'm.identity_server': mIdentityServer.toJson(),
      99             :     };
     100             :   }
     101             : 
     102             :   /// Used by clients to discover homeserver information.
     103             :   HomeserverInformation mHomeserver;
     104             : 
     105             :   /// Used by clients to discover identity server information.
     106             :   IdentityServerInformation? mIdentityServer;
     107             : 
     108             :   Map<String, Map<String, Object?>> additionalProperties;
     109             : 
     110           0 :   @override
     111             :   bool operator ==(Object other) =>
     112           0 :       other is DiscoveryInformation &&
     113           0 :       other.mHomeserver == mHomeserver &&
     114           0 :       other.mIdentityServer == mIdentityServer;
     115             : 
     116           0 :   @override
     117           0 :   int get hashCode => Object.hash(mHomeserver, mIdentityServer);
     118             : 
     119           0 :   @override
     120             :   String toString() {
     121           0 :     return toJson().toString();
     122             :   }
     123             : }
     124             : 
     125             : ///
     126             : @_NameSource('generated')
     127             : @EnhancedEnum()
     128             : enum Role {
     129             :   @EnhancedEnumValue(name: 'm.role.admin')
     130             :   mRoleAdmin,
     131             :   @EnhancedEnumValue(name: 'm.role.security')
     132             :   mRoleSecurity
     133             : }
     134             : 
     135             : /// A way to contact the server administrator.
     136             : @_NameSource('spec')
     137             : class Contact {
     138           0 :   Contact({
     139             :     this.emailAddress,
     140             :     this.matrixId,
     141             :     required this.role,
     142             :   });
     143             : 
     144           0 :   Contact.fromJson(Map<String, Object?> json)
     145             :       : emailAddress =
     146           0 :             ((v) => v != null ? v as String : null)(json['email_address']),
     147           0 :         matrixId = ((v) => v != null ? v as String : null)(json['matrix_id']),
     148           0 :         role = Role.values.fromString(json['role'] as String)!;
     149           0 :   Map<String, Object?> toJson() {
     150           0 :     final emailAddress = this.emailAddress;
     151           0 :     final matrixId = this.matrixId;
     152           0 :     return {
     153           0 :       if (emailAddress != null) 'email_address': emailAddress,
     154           0 :       if (matrixId != null) 'matrix_id': matrixId,
     155           0 :       'role': role.name,
     156             :     };
     157             :   }
     158             : 
     159             :   /// An email address to reach the administrator.
     160             :   ///
     161             :   /// At least one of `matrix_id` or `email_address` is
     162             :   /// required.
     163             :   String? emailAddress;
     164             : 
     165             :   /// A [Matrix User ID](https://spec.matrix.org/unstable/appendices/#user-identifiers)
     166             :   /// representing the administrator.
     167             :   ///
     168             :   /// It could be an account registered on a different
     169             :   /// homeserver so the administrator can be contacted
     170             :   /// when the homeserver is down.
     171             :   ///
     172             :   /// At least one of `matrix_id` or `email_address` is
     173             :   /// required.
     174             :   String? matrixId;
     175             : 
     176             :   /// An informal description of what the contact methods
     177             :   /// are used for.
     178             :   ///
     179             :   /// `m.role.admin` is a catch-all role for any queries
     180             :   /// and `m.role.security` is intended for sensitive
     181             :   /// requests.
     182             :   ///
     183             :   /// Unspecified roles are permitted through the use of
     184             :   /// [Namespaced Identifiers](https://spec.matrix.org/unstable/appendices/#common-namespaced-identifier-grammar).
     185             :   Role role;
     186             : 
     187           0 :   @override
     188             :   bool operator ==(Object other) =>
     189           0 :       other is Contact &&
     190           0 :       other.emailAddress == emailAddress &&
     191           0 :       other.matrixId == matrixId &&
     192           0 :       other.role == role;
     193             : 
     194           0 :   @override
     195           0 :   int get hashCode => Object.hash(emailAddress, matrixId, role);
     196             : 
     197           0 :   @override
     198             :   String toString() {
     199           0 :     return toJson().toString();
     200             :   }
     201             : }
     202             : 
     203             : ///
     204             : @_NameSource('generated')
     205             : class GetWellknownSupportResponse {
     206           0 :   GetWellknownSupportResponse({
     207             :     this.contacts,
     208             :     this.supportPage,
     209             :   });
     210             : 
     211           0 :   GetWellknownSupportResponse.fromJson(Map<String, Object?> json)
     212           0 :       : contacts = ((v) => v != null
     213             :             ? (v as List)
     214           0 :                 .map((v) => Contact.fromJson(v as Map<String, Object?>))
     215           0 :                 .toList()
     216           0 :             : null)(json['contacts']),
     217             :         supportPage =
     218           0 :             ((v) => v != null ? v as String : null)(json['support_page']);
     219           0 :   Map<String, Object?> toJson() {
     220           0 :     final contacts = this.contacts;
     221           0 :     final supportPage = this.supportPage;
     222           0 :     return {
     223             :       if (contacts != null)
     224           0 :         'contacts': contacts.map((v) => v.toJson()).toList(),
     225           0 :       if (supportPage != null) 'support_page': supportPage,
     226             :     };
     227             :   }
     228             : 
     229             :   /// Ways to contact the server administrator.
     230             :   ///
     231             :   /// At least one of `contacts` or `support_page` is required.
     232             :   /// If only `contacts` is set, it must contain at least one
     233             :   /// item.
     234             :   List<Contact>? contacts;
     235             : 
     236             :   /// The URL of a page to give users help specific to the
     237             :   /// homeserver, like extra login/registration steps.
     238             :   ///
     239             :   /// At least one of `contacts` or `support_page` is required.
     240             :   String? supportPage;
     241             : 
     242           0 :   @override
     243             :   bool operator ==(Object other) =>
     244           0 :       other is GetWellknownSupportResponse &&
     245           0 :       other.contacts == contacts &&
     246           0 :       other.supportPage == supportPage;
     247             : 
     248           0 :   @override
     249           0 :   int get hashCode => Object.hash(contacts, supportPage);
     250             : 
     251           0 :   @override
     252             :   String toString() {
     253           0 :     return toJson().toString();
     254             :   }
     255             : }
     256             : 
     257             : ///
     258             : @_NameSource('generated')
     259             : class GenerateLoginTokenResponse {
     260           0 :   GenerateLoginTokenResponse({
     261             :     required this.expiresInMs,
     262             :     required this.loginToken,
     263             :   });
     264             : 
     265           0 :   GenerateLoginTokenResponse.fromJson(Map<String, Object?> json)
     266           0 :       : expiresInMs = json['expires_in_ms'] as int,
     267           0 :         loginToken = json['login_token'] as String;
     268           0 :   Map<String, Object?> toJson() => {
     269           0 :         'expires_in_ms': expiresInMs,
     270           0 :         'login_token': loginToken,
     271             :       };
     272             : 
     273             :   /// The time remaining in milliseconds until the homeserver will no longer accept the token. `120000`
     274             :   /// (2 minutes) is recommended as a default.
     275             :   int expiresInMs;
     276             : 
     277             :   /// The login token for the `m.login.token` login flow.
     278             :   String loginToken;
     279             : 
     280           0 :   @override
     281             :   bool operator ==(Object other) =>
     282           0 :       other is GenerateLoginTokenResponse &&
     283           0 :       other.expiresInMs == expiresInMs &&
     284           0 :       other.loginToken == loginToken;
     285             : 
     286           0 :   @override
     287           0 :   int get hashCode => Object.hash(expiresInMs, loginToken);
     288             : 
     289           0 :   @override
     290             :   String toString() {
     291           0 :     return toJson().toString();
     292             :   }
     293             : }
     294             : 
     295             : ///
     296             : @_NameSource('rule override generated')
     297             : class MediaConfig {
     298           0 :   MediaConfig({
     299             :     this.mUploadSize,
     300             :   });
     301             : 
     302           4 :   MediaConfig.fromJson(Map<String, Object?> json)
     303             :       : mUploadSize =
     304          12 :             ((v) => v != null ? v as int : null)(json['m.upload.size']);
     305           0 :   Map<String, Object?> toJson() {
     306           0 :     final mUploadSize = this.mUploadSize;
     307           0 :     return {
     308           0 :       if (mUploadSize != null) 'm.upload.size': mUploadSize,
     309             :     };
     310             :   }
     311             : 
     312             :   /// The maximum size an upload can be in bytes.
     313             :   /// Clients SHOULD use this as a guide when uploading content.
     314             :   /// If not listed or null, the size limit should be treated as unknown.
     315             :   int? mUploadSize;
     316             : 
     317           0 :   @override
     318             :   bool operator ==(Object other) =>
     319           0 :       other is MediaConfig && other.mUploadSize == mUploadSize;
     320             : 
     321           0 :   @override
     322           0 :   int get hashCode => mUploadSize.hashCode;
     323             : 
     324           0 :   @override
     325             :   String toString() {
     326           0 :     return toJson().toString();
     327             :   }
     328             : }
     329             : 
     330             : ///
     331             : @_NameSource('rule override generated')
     332             : class PreviewForUrl {
     333           0 :   PreviewForUrl({
     334             :     this.matrixImageSize,
     335             :     this.ogImage,
     336             :   });
     337             : 
     338           0 :   PreviewForUrl.fromJson(Map<String, Object?> json)
     339             :       : matrixImageSize =
     340           0 :             ((v) => v != null ? v as int : null)(json['matrix:image:size']),
     341           0 :         ogImage = ((v) =>
     342           0 :             v != null ? Uri.parse(v as String) : null)(json['og:image']);
     343           0 :   Map<String, Object?> toJson() {
     344           0 :     final matrixImageSize = this.matrixImageSize;
     345           0 :     final ogImage = this.ogImage;
     346           0 :     return {
     347           0 :       if (matrixImageSize != null) 'matrix:image:size': matrixImageSize,
     348           0 :       if (ogImage != null) 'og:image': ogImage.toString(),
     349             :     };
     350             :   }
     351             : 
     352             :   /// The byte-size of the image. Omitted if there is no image attached.
     353             :   int? matrixImageSize;
     354             : 
     355             :   /// An [`mxc://` URI](https://spec.matrix.org/unstable/client-server-api/#matrix-content-mxc-uris) to the image. Omitted if there is no image.
     356             :   Uri? ogImage;
     357             : 
     358           0 :   @override
     359             :   bool operator ==(Object other) =>
     360           0 :       other is PreviewForUrl &&
     361           0 :       other.matrixImageSize == matrixImageSize &&
     362           0 :       other.ogImage == ogImage;
     363             : 
     364           0 :   @override
     365           0 :   int get hashCode => Object.hash(matrixImageSize, ogImage);
     366             : 
     367           0 :   @override
     368             :   String toString() {
     369           0 :     return toJson().toString();
     370             :   }
     371             : }
     372             : 
     373             : ///
     374             : @_NameSource('generated')
     375             : @EnhancedEnum()
     376             : enum Method {
     377             :   @EnhancedEnumValue(name: 'crop')
     378             :   crop,
     379             :   @EnhancedEnumValue(name: 'scale')
     380             :   scale
     381             : }
     382             : 
     383             : ///
     384             : @_NameSource('spec')
     385             : class PublicRoomsChunk {
     386           0 :   PublicRoomsChunk({
     387             :     this.avatarUrl,
     388             :     this.canonicalAlias,
     389             :     required this.guestCanJoin,
     390             :     this.joinRule,
     391             :     this.name,
     392             :     required this.numJoinedMembers,
     393             :     required this.roomId,
     394             :     this.roomType,
     395             :     this.topic,
     396             :     required this.worldReadable,
     397             :   });
     398             : 
     399           0 :   PublicRoomsChunk.fromJson(Map<String, Object?> json)
     400           0 :       : avatarUrl = ((v) =>
     401           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
     402             :         canonicalAlias =
     403           0 :             ((v) => v != null ? v as String : null)(json['canonical_alias']),
     404           0 :         guestCanJoin = json['guest_can_join'] as bool,
     405           0 :         joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
     406           0 :         name = ((v) => v != null ? v as String : null)(json['name']),
     407           0 :         numJoinedMembers = json['num_joined_members'] as int,
     408           0 :         roomId = json['room_id'] as String,
     409           0 :         roomType = ((v) => v != null ? v as String : null)(json['room_type']),
     410           0 :         topic = ((v) => v != null ? v as String : null)(json['topic']),
     411           0 :         worldReadable = json['world_readable'] as bool;
     412           0 :   Map<String, Object?> toJson() {
     413           0 :     final avatarUrl = this.avatarUrl;
     414           0 :     final canonicalAlias = this.canonicalAlias;
     415           0 :     final joinRule = this.joinRule;
     416           0 :     final name = this.name;
     417           0 :     final roomType = this.roomType;
     418           0 :     final topic = this.topic;
     419           0 :     return {
     420           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
     421           0 :       if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
     422           0 :       'guest_can_join': guestCanJoin,
     423           0 :       if (joinRule != null) 'join_rule': joinRule,
     424           0 :       if (name != null) 'name': name,
     425           0 :       'num_joined_members': numJoinedMembers,
     426           0 :       'room_id': roomId,
     427           0 :       if (roomType != null) 'room_type': roomType,
     428           0 :       if (topic != null) 'topic': topic,
     429           0 :       'world_readable': worldReadable,
     430             :     };
     431             :   }
     432             : 
     433             :   /// The URL for the room's avatar, if one is set.
     434             :   Uri? avatarUrl;
     435             : 
     436             :   /// The canonical alias of the room, if any.
     437             :   String? canonicalAlias;
     438             : 
     439             :   /// Whether guest users may join the room and participate in it.
     440             :   /// If they can, they will be subject to ordinary power level
     441             :   /// rules like any other user.
     442             :   bool guestCanJoin;
     443             : 
     444             :   /// The room's join rule. When not present, the room is assumed to
     445             :   /// be `public`.
     446             :   String? joinRule;
     447             : 
     448             :   /// The name of the room, if any.
     449             :   String? name;
     450             : 
     451             :   /// The number of members joined to the room.
     452             :   int numJoinedMembers;
     453             : 
     454             :   /// The ID of the room.
     455             :   String roomId;
     456             : 
     457             :   /// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
     458             :   String? roomType;
     459             : 
     460             :   /// The topic of the room, if any.
     461             :   String? topic;
     462             : 
     463             :   /// Whether the room may be viewed by guest users without joining.
     464             :   bool worldReadable;
     465             : 
     466           0 :   @override
     467             :   bool operator ==(Object other) =>
     468           0 :       other is PublicRoomsChunk &&
     469           0 :       other.avatarUrl == avatarUrl &&
     470           0 :       other.canonicalAlias == canonicalAlias &&
     471           0 :       other.guestCanJoin == guestCanJoin &&
     472           0 :       other.joinRule == joinRule &&
     473           0 :       other.name == name &&
     474           0 :       other.numJoinedMembers == numJoinedMembers &&
     475           0 :       other.roomId == roomId &&
     476           0 :       other.roomType == roomType &&
     477           0 :       other.topic == topic &&
     478           0 :       other.worldReadable == worldReadable;
     479             : 
     480           0 :   @override
     481           0 :   int get hashCode => Object.hash(avatarUrl, canonicalAlias, guestCanJoin,
     482           0 :       joinRule, name, numJoinedMembers, roomId, roomType, topic, worldReadable);
     483             : 
     484           0 :   @override
     485             :   String toString() {
     486           0 :     return toJson().toString();
     487             :   }
     488             : }
     489             : 
     490             : ///
     491             : @_NameSource('spec')
     492             : class SpaceHierarchyRoomsChunk {
     493           0 :   SpaceHierarchyRoomsChunk({
     494             :     required this.childrenState,
     495             :     this.roomType,
     496             :   });
     497             : 
     498           0 :   SpaceHierarchyRoomsChunk.fromJson(Map<String, Object?> json)
     499           0 :       : childrenState = (json['children_state'] as List)
     500           0 :             .map((v) => ChildrenState.fromJson(v as Map<String, Object?>))
     501           0 :             .toList(),
     502           0 :         roomType = ((v) => v != null ? v as String : null)(json['room_type']);
     503           0 :   Map<String, Object?> toJson() {
     504           0 :     final roomType = this.roomType;
     505           0 :     return {
     506           0 :       'children_state': childrenState.map((v) => v.toJson()).toList(),
     507           0 :       if (roomType != null) 'room_type': roomType,
     508             :     };
     509             :   }
     510             : 
     511             :   /// The [`m.space.child`](#mspacechild) events of the space-room, represented
     512             :   /// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
     513             :   ///
     514             :   /// If the room is not a space-room, this should be empty.
     515             :   List<ChildrenState> childrenState;
     516             : 
     517             :   /// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
     518             :   String? roomType;
     519             : 
     520           0 :   @override
     521             :   bool operator ==(Object other) =>
     522           0 :       other is SpaceHierarchyRoomsChunk &&
     523           0 :       other.childrenState == childrenState &&
     524           0 :       other.roomType == roomType;
     525             : 
     526           0 :   @override
     527           0 :   int get hashCode => Object.hash(childrenState, roomType);
     528             : 
     529           0 :   @override
     530             :   String toString() {
     531           0 :     return toJson().toString();
     532             :   }
     533             : }
     534             : 
     535             : ///
     536             : @_NameSource('rule override generated')
     537             : class SpaceRoomsChunk implements PublicRoomsChunk, SpaceHierarchyRoomsChunk {
     538           0 :   SpaceRoomsChunk({
     539             :     this.avatarUrl,
     540             :     this.canonicalAlias,
     541             :     required this.guestCanJoin,
     542             :     this.joinRule,
     543             :     this.name,
     544             :     required this.numJoinedMembers,
     545             :     required this.roomId,
     546             :     this.roomType,
     547             :     this.topic,
     548             :     required this.worldReadable,
     549             :     required this.childrenState,
     550             :   });
     551             : 
     552           0 :   SpaceRoomsChunk.fromJson(Map<String, Object?> json)
     553           0 :       : avatarUrl = ((v) =>
     554           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
     555             :         canonicalAlias =
     556           0 :             ((v) => v != null ? v as String : null)(json['canonical_alias']),
     557           0 :         guestCanJoin = json['guest_can_join'] as bool,
     558           0 :         joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
     559           0 :         name = ((v) => v != null ? v as String : null)(json['name']),
     560           0 :         numJoinedMembers = json['num_joined_members'] as int,
     561           0 :         roomId = json['room_id'] as String,
     562           0 :         roomType = ((v) => v != null ? v as String : null)(json['room_type']),
     563           0 :         topic = ((v) => v != null ? v as String : null)(json['topic']),
     564           0 :         worldReadable = json['world_readable'] as bool,
     565           0 :         childrenState = (json['children_state'] as List)
     566           0 :             .map((v) => ChildrenState.fromJson(v as Map<String, Object?>))
     567           0 :             .toList();
     568           0 :   @override
     569             :   Map<String, Object?> toJson() {
     570           0 :     final avatarUrl = this.avatarUrl;
     571           0 :     final canonicalAlias = this.canonicalAlias;
     572           0 :     final joinRule = this.joinRule;
     573           0 :     final name = this.name;
     574           0 :     final roomType = this.roomType;
     575           0 :     final topic = this.topic;
     576           0 :     return {
     577           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
     578           0 :       if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
     579           0 :       'guest_can_join': guestCanJoin,
     580           0 :       if (joinRule != null) 'join_rule': joinRule,
     581           0 :       if (name != null) 'name': name,
     582           0 :       'num_joined_members': numJoinedMembers,
     583           0 :       'room_id': roomId,
     584           0 :       if (roomType != null) 'room_type': roomType,
     585           0 :       if (topic != null) 'topic': topic,
     586           0 :       'world_readable': worldReadable,
     587           0 :       'children_state': childrenState.map((v) => v.toJson()).toList(),
     588             :     };
     589             :   }
     590             : 
     591             :   /// The URL for the room's avatar, if one is set.
     592             :   @override
     593             :   Uri? avatarUrl;
     594             : 
     595             :   /// The canonical alias of the room, if any.
     596             :   @override
     597             :   String? canonicalAlias;
     598             : 
     599             :   /// Whether guest users may join the room and participate in it.
     600             :   /// If they can, they will be subject to ordinary power level
     601             :   /// rules like any other user.
     602             :   @override
     603             :   bool guestCanJoin;
     604             : 
     605             :   /// The room's join rule. When not present, the room is assumed to
     606             :   /// be `public`.
     607             :   @override
     608             :   String? joinRule;
     609             : 
     610             :   /// The name of the room, if any.
     611             :   @override
     612             :   String? name;
     613             : 
     614             :   /// The number of members joined to the room.
     615             :   @override
     616             :   int numJoinedMembers;
     617             : 
     618             :   /// The ID of the room.
     619             :   @override
     620             :   String roomId;
     621             : 
     622             :   /// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
     623             :   @override
     624             :   String? roomType;
     625             : 
     626             :   /// The topic of the room, if any.
     627             :   @override
     628             :   String? topic;
     629             : 
     630             :   /// Whether the room may be viewed by guest users without joining.
     631             :   @override
     632             :   bool worldReadable;
     633             : 
     634             :   /// The [`m.space.child`](#mspacechild) events of the space-room, represented
     635             :   /// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
     636             :   ///
     637             :   /// If the room is not a space-room, this should be empty.
     638             :   @override
     639             :   List<ChildrenState> childrenState;
     640             : 
     641           0 :   @override
     642             :   bool operator ==(Object other) =>
     643           0 :       other is SpaceRoomsChunk &&
     644           0 :       other.avatarUrl == avatarUrl &&
     645           0 :       other.canonicalAlias == canonicalAlias &&
     646           0 :       other.guestCanJoin == guestCanJoin &&
     647           0 :       other.joinRule == joinRule &&
     648           0 :       other.name == name &&
     649           0 :       other.numJoinedMembers == numJoinedMembers &&
     650           0 :       other.roomId == roomId &&
     651           0 :       other.roomType == roomType &&
     652           0 :       other.topic == topic &&
     653           0 :       other.worldReadable == worldReadable &&
     654           0 :       other.childrenState == childrenState;
     655             : 
     656           0 :   @override
     657           0 :   int get hashCode => Object.hash(
     658           0 :       avatarUrl,
     659           0 :       canonicalAlias,
     660           0 :       guestCanJoin,
     661           0 :       joinRule,
     662           0 :       name,
     663           0 :       numJoinedMembers,
     664           0 :       roomId,
     665           0 :       roomType,
     666           0 :       topic,
     667           0 :       worldReadable,
     668           0 :       childrenState);
     669             : 
     670           0 :   @override
     671             :   String toString() {
     672           0 :     return toJson().toString();
     673             :   }
     674             : }
     675             : 
     676             : ///
     677             : @_NameSource('generated')
     678             : class GetSpaceHierarchyResponse {
     679           0 :   GetSpaceHierarchyResponse({
     680             :     this.nextBatch,
     681             :     required this.rooms,
     682             :   });
     683             : 
     684           0 :   GetSpaceHierarchyResponse.fromJson(Map<String, Object?> json)
     685           0 :       : nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     686           0 :         rooms = (json['rooms'] as List)
     687           0 :             .map((v) => SpaceRoomsChunk.fromJson(v as Map<String, Object?>))
     688           0 :             .toList();
     689           0 :   Map<String, Object?> toJson() {
     690           0 :     final nextBatch = this.nextBatch;
     691           0 :     return {
     692           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     693           0 :       'rooms': rooms.map((v) => v.toJson()).toList(),
     694             :     };
     695             :   }
     696             : 
     697             :   /// A token to supply to `from` to keep paginating the responses. Not present when there are
     698             :   /// no further results.
     699             :   String? nextBatch;
     700             : 
     701             :   /// The rooms for the current page, with the current filters.
     702             :   List<SpaceRoomsChunk> rooms;
     703             : 
     704           0 :   @override
     705             :   bool operator ==(Object other) =>
     706           0 :       other is GetSpaceHierarchyResponse &&
     707           0 :       other.nextBatch == nextBatch &&
     708           0 :       other.rooms == rooms;
     709             : 
     710           0 :   @override
     711           0 :   int get hashCode => Object.hash(nextBatch, rooms);
     712             : 
     713           0 :   @override
     714             :   String toString() {
     715           0 :     return toJson().toString();
     716             :   }
     717             : }
     718             : 
     719             : ///
     720             : @_NameSource('rule override generated')
     721             : @EnhancedEnum()
     722             : enum Direction {
     723             :   @EnhancedEnumValue(name: 'b')
     724             :   b,
     725             :   @EnhancedEnumValue(name: 'f')
     726             :   f
     727             : }
     728             : 
     729             : ///
     730             : @_NameSource('generated')
     731             : class GetRelatingEventsResponse {
     732           0 :   GetRelatingEventsResponse({
     733             :     required this.chunk,
     734             :     this.nextBatch,
     735             :     this.prevBatch,
     736             :     this.recursionDepth,
     737             :   });
     738             : 
     739           0 :   GetRelatingEventsResponse.fromJson(Map<String, Object?> json)
     740           0 :       : chunk = (json['chunk'] as List)
     741           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     742           0 :             .toList(),
     743           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     744           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
     745             :         recursionDepth =
     746           0 :             ((v) => v != null ? v as int : null)(json['recursion_depth']);
     747           0 :   Map<String, Object?> toJson() {
     748           0 :     final nextBatch = this.nextBatch;
     749           0 :     final prevBatch = this.prevBatch;
     750           0 :     final recursionDepth = this.recursionDepth;
     751           0 :     return {
     752           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     753           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     754           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
     755           0 :       if (recursionDepth != null) 'recursion_depth': recursionDepth,
     756             :     };
     757             :   }
     758             : 
     759             :   /// The child events of the requested event, ordered topologically most-recent
     760             :   /// first. The events returned will match the `relType` and `eventType` supplied
     761             :   /// in the URL.
     762             :   List<MatrixEvent> chunk;
     763             : 
     764             :   /// An opaque string representing a pagination token. The absence of this token
     765             :   /// means there are no more results to fetch and the client should stop paginating.
     766             :   String? nextBatch;
     767             : 
     768             :   /// An opaque string representing a pagination token. The absence of this token
     769             :   /// means this is the start of the result set, i.e. this is the first batch/page.
     770             :   String? prevBatch;
     771             : 
     772             :   /// If the `recurse` parameter was supplied by the client, this response field is
     773             :   /// mandatory and gives the actual depth to which the server recursed. If the client
     774             :   /// did not specify the `recurse` parameter, this field must be absent.
     775             :   int? recursionDepth;
     776             : 
     777           0 :   @override
     778             :   bool operator ==(Object other) =>
     779           0 :       other is GetRelatingEventsResponse &&
     780           0 :       other.chunk == chunk &&
     781           0 :       other.nextBatch == nextBatch &&
     782           0 :       other.prevBatch == prevBatch &&
     783           0 :       other.recursionDepth == recursionDepth;
     784             : 
     785           0 :   @override
     786           0 :   int get hashCode => Object.hash(chunk, nextBatch, prevBatch, recursionDepth);
     787             : 
     788           0 :   @override
     789             :   String toString() {
     790           0 :     return toJson().toString();
     791             :   }
     792             : }
     793             : 
     794             : ///
     795             : @_NameSource('generated')
     796             : class GetRelatingEventsWithRelTypeResponse {
     797           0 :   GetRelatingEventsWithRelTypeResponse({
     798             :     required this.chunk,
     799             :     this.nextBatch,
     800             :     this.prevBatch,
     801             :     this.recursionDepth,
     802             :   });
     803             : 
     804           0 :   GetRelatingEventsWithRelTypeResponse.fromJson(Map<String, Object?> json)
     805           0 :       : chunk = (json['chunk'] as List)
     806           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     807           0 :             .toList(),
     808           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     809           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
     810             :         recursionDepth =
     811           0 :             ((v) => v != null ? v as int : null)(json['recursion_depth']);
     812           0 :   Map<String, Object?> toJson() {
     813           0 :     final nextBatch = this.nextBatch;
     814           0 :     final prevBatch = this.prevBatch;
     815           0 :     final recursionDepth = this.recursionDepth;
     816           0 :     return {
     817           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     818           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     819           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
     820           0 :       if (recursionDepth != null) 'recursion_depth': recursionDepth,
     821             :     };
     822             :   }
     823             : 
     824             :   /// The child events of the requested event, ordered topologically most-recent
     825             :   /// first. The events returned will match the `relType` and `eventType` supplied
     826             :   /// in the URL.
     827             :   List<MatrixEvent> chunk;
     828             : 
     829             :   /// An opaque string representing a pagination token. The absence of this token
     830             :   /// means there are no more results to fetch and the client should stop paginating.
     831             :   String? nextBatch;
     832             : 
     833             :   /// An opaque string representing a pagination token. The absence of this token
     834             :   /// means this is the start of the result set, i.e. this is the first batch/page.
     835             :   String? prevBatch;
     836             : 
     837             :   /// If the `recurse` parameter was supplied by the client, this response field is
     838             :   /// mandatory and gives the actual depth to which the server recursed. If the client
     839             :   /// did not specify the `recurse` parameter, this field must be absent.
     840             :   int? recursionDepth;
     841             : 
     842           0 :   @override
     843             :   bool operator ==(Object other) =>
     844           0 :       other is GetRelatingEventsWithRelTypeResponse &&
     845           0 :       other.chunk == chunk &&
     846           0 :       other.nextBatch == nextBatch &&
     847           0 :       other.prevBatch == prevBatch &&
     848           0 :       other.recursionDepth == recursionDepth;
     849             : 
     850           0 :   @override
     851           0 :   int get hashCode => Object.hash(chunk, nextBatch, prevBatch, recursionDepth);
     852             : 
     853           0 :   @override
     854             :   String toString() {
     855           0 :     return toJson().toString();
     856             :   }
     857             : }
     858             : 
     859             : ///
     860             : @_NameSource('generated')
     861             : class GetRelatingEventsWithRelTypeAndEventTypeResponse {
     862           0 :   GetRelatingEventsWithRelTypeAndEventTypeResponse({
     863             :     required this.chunk,
     864             :     this.nextBatch,
     865             :     this.prevBatch,
     866             :     this.recursionDepth,
     867             :   });
     868             : 
     869           0 :   GetRelatingEventsWithRelTypeAndEventTypeResponse.fromJson(
     870             :       Map<String, Object?> json)
     871           0 :       : chunk = (json['chunk'] as List)
     872           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     873           0 :             .toList(),
     874           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
     875           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
     876             :         recursionDepth =
     877           0 :             ((v) => v != null ? v as int : null)(json['recursion_depth']);
     878           0 :   Map<String, Object?> toJson() {
     879           0 :     final nextBatch = this.nextBatch;
     880           0 :     final prevBatch = this.prevBatch;
     881           0 :     final recursionDepth = this.recursionDepth;
     882           0 :     return {
     883           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     884           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     885           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
     886           0 :       if (recursionDepth != null) 'recursion_depth': recursionDepth,
     887             :     };
     888             :   }
     889             : 
     890             :   /// The child events of the requested event, ordered topologically most-recent
     891             :   /// first. The events returned will match the `relType` and `eventType` supplied
     892             :   /// in the URL.
     893             :   List<MatrixEvent> chunk;
     894             : 
     895             :   /// An opaque string representing a pagination token. The absence of this token
     896             :   /// means there are no more results to fetch and the client should stop paginating.
     897             :   String? nextBatch;
     898             : 
     899             :   /// An opaque string representing a pagination token. The absence of this token
     900             :   /// means this is the start of the result set, i.e. this is the first batch/page.
     901             :   String? prevBatch;
     902             : 
     903             :   /// If the `recurse` parameter was supplied by the client, this response field is
     904             :   /// mandatory and gives the actual depth to which the server recursed. If the client
     905             :   /// did not specify the `recurse` parameter, this field must be absent.
     906             :   int? recursionDepth;
     907             : 
     908           0 :   @override
     909             :   bool operator ==(Object other) =>
     910           0 :       other is GetRelatingEventsWithRelTypeAndEventTypeResponse &&
     911           0 :       other.chunk == chunk &&
     912           0 :       other.nextBatch == nextBatch &&
     913           0 :       other.prevBatch == prevBatch &&
     914           0 :       other.recursionDepth == recursionDepth;
     915             : 
     916           0 :   @override
     917           0 :   int get hashCode => Object.hash(chunk, nextBatch, prevBatch, recursionDepth);
     918             : 
     919           0 :   @override
     920             :   String toString() {
     921           0 :     return toJson().toString();
     922             :   }
     923             : }
     924             : 
     925             : ///
     926             : @_NameSource('generated')
     927             : @EnhancedEnum()
     928             : enum Include {
     929             :   @EnhancedEnumValue(name: 'all')
     930             :   all,
     931             :   @EnhancedEnumValue(name: 'participated')
     932             :   participated
     933             : }
     934             : 
     935             : ///
     936             : @_NameSource('generated')
     937             : class GetThreadRootsResponse {
     938           0 :   GetThreadRootsResponse({
     939             :     required this.chunk,
     940             :     this.nextBatch,
     941             :   });
     942             : 
     943           0 :   GetThreadRootsResponse.fromJson(Map<String, Object?> json)
     944           0 :       : chunk = (json['chunk'] as List)
     945           0 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
     946           0 :             .toList(),
     947           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']);
     948           0 :   Map<String, Object?> toJson() {
     949           0 :     final nextBatch = this.nextBatch;
     950           0 :     return {
     951           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
     952           0 :       if (nextBatch != null) 'next_batch': nextBatch,
     953             :     };
     954             :   }
     955             : 
     956             :   /// The thread roots, ordered by the `latest_event` in each event's aggregated children. All events
     957             :   /// returned include bundled [aggregations](https://spec.matrix.org/unstable/client-server-api/#aggregations-of-child-events).
     958             :   ///
     959             :   /// If the thread root event was sent by an [ignored user](https://spec.matrix.org/unstable/client-server-api/#ignoring-users), the
     960             :   /// event is returned redacted to the caller. This is to simulate the same behaviour of a client doing
     961             :   /// aggregation locally on the thread.
     962             :   List<MatrixEvent> chunk;
     963             : 
     964             :   /// A token to supply to `from` to keep paginating the responses. Not present when there are
     965             :   /// no further results.
     966             :   String? nextBatch;
     967             : 
     968           0 :   @override
     969             :   bool operator ==(Object other) =>
     970           0 :       other is GetThreadRootsResponse &&
     971           0 :       other.chunk == chunk &&
     972           0 :       other.nextBatch == nextBatch;
     973             : 
     974           0 :   @override
     975           0 :   int get hashCode => Object.hash(chunk, nextBatch);
     976             : 
     977           0 :   @override
     978             :   String toString() {
     979           0 :     return toJson().toString();
     980             :   }
     981             : }
     982             : 
     983             : ///
     984             : @_NameSource('generated')
     985             : class GetEventByTimestampResponse {
     986           0 :   GetEventByTimestampResponse({
     987             :     required this.eventId,
     988             :     required this.originServerTs,
     989             :   });
     990             : 
     991           0 :   GetEventByTimestampResponse.fromJson(Map<String, Object?> json)
     992           0 :       : eventId = json['event_id'] as String,
     993           0 :         originServerTs = json['origin_server_ts'] as int;
     994           0 :   Map<String, Object?> toJson() => {
     995           0 :         'event_id': eventId,
     996           0 :         'origin_server_ts': originServerTs,
     997             :       };
     998             : 
     999             :   /// The ID of the event found
    1000             :   String eventId;
    1001             : 
    1002             :   /// The event's timestamp, in milliseconds since the Unix epoch.
    1003             :   /// This makes it easy to do a quick comparison to see if the
    1004             :   /// `event_id` fetched is too far out of range to be useful for your
    1005             :   /// use case.
    1006             :   int originServerTs;
    1007             : 
    1008           0 :   @override
    1009             :   bool operator ==(Object other) =>
    1010           0 :       other is GetEventByTimestampResponse &&
    1011           0 :       other.eventId == eventId &&
    1012           0 :       other.originServerTs == originServerTs;
    1013             : 
    1014           0 :   @override
    1015           0 :   int get hashCode => Object.hash(eventId, originServerTs);
    1016             : 
    1017           0 :   @override
    1018             :   String toString() {
    1019           0 :     return toJson().toString();
    1020             :   }
    1021             : }
    1022             : 
    1023             : ///
    1024             : @_NameSource('rule override generated')
    1025             : @EnhancedEnum()
    1026             : enum ThirdPartyIdentifierMedium {
    1027             :   @EnhancedEnumValue(name: 'email')
    1028             :   email,
    1029             :   @EnhancedEnumValue(name: 'msisdn')
    1030             :   msisdn
    1031             : }
    1032             : 
    1033             : ///
    1034             : @_NameSource('spec')
    1035             : class ThirdPartyIdentifier {
    1036           0 :   ThirdPartyIdentifier({
    1037             :     required this.addedAt,
    1038             :     required this.address,
    1039             :     required this.medium,
    1040             :     required this.validatedAt,
    1041             :   });
    1042             : 
    1043           0 :   ThirdPartyIdentifier.fromJson(Map<String, Object?> json)
    1044           0 :       : addedAt = json['added_at'] as int,
    1045           0 :         address = json['address'] as String,
    1046             :         medium = ThirdPartyIdentifierMedium.values
    1047           0 :             .fromString(json['medium'] as String)!,
    1048           0 :         validatedAt = json['validated_at'] as int;
    1049           0 :   Map<String, Object?> toJson() => {
    1050           0 :         'added_at': addedAt,
    1051           0 :         'address': address,
    1052           0 :         'medium': medium.name,
    1053           0 :         'validated_at': validatedAt,
    1054             :       };
    1055             : 
    1056             :   /// The timestamp, in milliseconds, when the homeserver associated the third-party identifier with the user.
    1057             :   int addedAt;
    1058             : 
    1059             :   /// The third-party identifier address.
    1060             :   String address;
    1061             : 
    1062             :   /// The medium of the third-party identifier.
    1063             :   ThirdPartyIdentifierMedium medium;
    1064             : 
    1065             :   /// The timestamp, in milliseconds, when the identifier was
    1066             :   /// validated by the identity server.
    1067             :   int validatedAt;
    1068             : 
    1069           0 :   @override
    1070             :   bool operator ==(Object other) =>
    1071           0 :       other is ThirdPartyIdentifier &&
    1072           0 :       other.addedAt == addedAt &&
    1073           0 :       other.address == address &&
    1074           0 :       other.medium == medium &&
    1075           0 :       other.validatedAt == validatedAt;
    1076             : 
    1077           0 :   @override
    1078           0 :   int get hashCode => Object.hash(addedAt, address, medium, validatedAt);
    1079             : 
    1080           0 :   @override
    1081             :   String toString() {
    1082           0 :     return toJson().toString();
    1083             :   }
    1084             : }
    1085             : 
    1086             : ///
    1087             : @_NameSource('spec')
    1088             : class ThreePidCredentials {
    1089           0 :   ThreePidCredentials({
    1090             :     required this.clientSecret,
    1091             :     required this.idAccessToken,
    1092             :     required this.idServer,
    1093             :     required this.sid,
    1094             :   });
    1095             : 
    1096           0 :   ThreePidCredentials.fromJson(Map<String, Object?> json)
    1097           0 :       : clientSecret = json['client_secret'] as String,
    1098           0 :         idAccessToken = json['id_access_token'] as String,
    1099           0 :         idServer = json['id_server'] as String,
    1100           0 :         sid = json['sid'] as String;
    1101           0 :   Map<String, Object?> toJson() => {
    1102           0 :         'client_secret': clientSecret,
    1103           0 :         'id_access_token': idAccessToken,
    1104           0 :         'id_server': idServer,
    1105           0 :         'sid': sid,
    1106             :       };
    1107             : 
    1108             :   /// The client secret used in the session with the identity server.
    1109             :   String clientSecret;
    1110             : 
    1111             :   /// An access token previously registered with the identity server. Servers
    1112             :   /// can treat this as optional to distinguish between r0.5-compatible clients
    1113             :   /// and this specification version.
    1114             :   String idAccessToken;
    1115             : 
    1116             :   /// The identity server to use.
    1117             :   String idServer;
    1118             : 
    1119             :   /// The session identifier given by the identity server.
    1120             :   String sid;
    1121             : 
    1122           0 :   @override
    1123             :   bool operator ==(Object other) =>
    1124           0 :       other is ThreePidCredentials &&
    1125           0 :       other.clientSecret == clientSecret &&
    1126           0 :       other.idAccessToken == idAccessToken &&
    1127           0 :       other.idServer == idServer &&
    1128           0 :       other.sid == sid;
    1129             : 
    1130           0 :   @override
    1131           0 :   int get hashCode => Object.hash(clientSecret, idAccessToken, idServer, sid);
    1132             : 
    1133           0 :   @override
    1134             :   String toString() {
    1135           0 :     return toJson().toString();
    1136             :   }
    1137             : }
    1138             : 
    1139             : ///
    1140             : @_NameSource('generated')
    1141             : @EnhancedEnum()
    1142             : enum IdServerUnbindResult {
    1143             :   @EnhancedEnumValue(name: 'no-support')
    1144             :   noSupport,
    1145             :   @EnhancedEnumValue(name: 'success')
    1146             :   success
    1147             : }
    1148             : 
    1149             : ///
    1150             : @_NameSource('spec')
    1151             : class RequestTokenResponse {
    1152           0 :   RequestTokenResponse({
    1153             :     required this.sid,
    1154             :     this.submitUrl,
    1155             :   });
    1156             : 
    1157           0 :   RequestTokenResponse.fromJson(Map<String, Object?> json)
    1158           0 :       : sid = json['sid'] as String,
    1159           0 :         submitUrl = ((v) =>
    1160           0 :             v != null ? Uri.parse(v as String) : null)(json['submit_url']);
    1161           0 :   Map<String, Object?> toJson() {
    1162           0 :     final submitUrl = this.submitUrl;
    1163           0 :     return {
    1164           0 :       'sid': sid,
    1165           0 :       if (submitUrl != null) 'submit_url': submitUrl.toString(),
    1166             :     };
    1167             :   }
    1168             : 
    1169             :   /// The session ID. Session IDs are opaque strings that must consist entirely
    1170             :   /// of the characters `[0-9a-zA-Z.=_-]`. Their length must not exceed 255
    1171             :   /// characters and they must not be empty.
    1172             :   String sid;
    1173             : 
    1174             :   /// An optional field containing a URL where the client must submit the
    1175             :   /// validation token to, with identical parameters to the Identity Service
    1176             :   /// API's `POST /validate/email/submitToken` endpoint (without the requirement
    1177             :   /// for an access token). The homeserver must send this token to the user (if
    1178             :   /// applicable), who should then be prompted to provide it to the client.
    1179             :   ///
    1180             :   /// If this field is not present, the client can assume that verification
    1181             :   /// will happen without the client's involvement provided the homeserver
    1182             :   /// advertises this specification version in the `/versions` response
    1183             :   /// (ie: r0.5.0).
    1184             :   Uri? submitUrl;
    1185             : 
    1186           0 :   @override
    1187             :   bool operator ==(Object other) =>
    1188           0 :       other is RequestTokenResponse &&
    1189           0 :       other.sid == sid &&
    1190           0 :       other.submitUrl == submitUrl;
    1191             : 
    1192           0 :   @override
    1193           0 :   int get hashCode => Object.hash(sid, submitUrl);
    1194             : 
    1195           0 :   @override
    1196             :   String toString() {
    1197           0 :     return toJson().toString();
    1198             :   }
    1199             : }
    1200             : 
    1201             : ///
    1202             : @_NameSource('rule override generated')
    1203             : class TokenOwnerInfo {
    1204           0 :   TokenOwnerInfo({
    1205             :     this.deviceId,
    1206             :     this.isGuest,
    1207             :     required this.userId,
    1208             :   });
    1209             : 
    1210           0 :   TokenOwnerInfo.fromJson(Map<String, Object?> json)
    1211           0 :       : deviceId = ((v) => v != null ? v as String : null)(json['device_id']),
    1212           0 :         isGuest = ((v) => v != null ? v as bool : null)(json['is_guest']),
    1213           0 :         userId = json['user_id'] as String;
    1214           0 :   Map<String, Object?> toJson() {
    1215           0 :     final deviceId = this.deviceId;
    1216           0 :     final isGuest = this.isGuest;
    1217           0 :     return {
    1218           0 :       if (deviceId != null) 'device_id': deviceId,
    1219           0 :       if (isGuest != null) 'is_guest': isGuest,
    1220           0 :       'user_id': userId,
    1221             :     };
    1222             :   }
    1223             : 
    1224             :   /// Device ID associated with the access token. If no device
    1225             :   /// is associated with the access token (such as in the case
    1226             :   /// of application services) then this field can be omitted.
    1227             :   /// Otherwise this is required.
    1228             :   String? deviceId;
    1229             : 
    1230             :   /// When `true`, the user is a [Guest User](#guest-access). When
    1231             :   /// not present or `false`, the user is presumed to be a non-guest
    1232             :   /// user.
    1233             :   bool? isGuest;
    1234             : 
    1235             :   /// The user ID that owns the access token.
    1236             :   String userId;
    1237             : 
    1238           0 :   @override
    1239             :   bool operator ==(Object other) =>
    1240           0 :       other is TokenOwnerInfo &&
    1241           0 :       other.deviceId == deviceId &&
    1242           0 :       other.isGuest == isGuest &&
    1243           0 :       other.userId == userId;
    1244             : 
    1245           0 :   @override
    1246           0 :   int get hashCode => Object.hash(deviceId, isGuest, userId);
    1247             : 
    1248           0 :   @override
    1249             :   String toString() {
    1250           0 :     return toJson().toString();
    1251             :   }
    1252             : }
    1253             : 
    1254             : ///
    1255             : @_NameSource('spec')
    1256             : class ConnectionInfo {
    1257           0 :   ConnectionInfo({
    1258             :     this.ip,
    1259             :     this.lastSeen,
    1260             :     this.userAgent,
    1261             :   });
    1262             : 
    1263           0 :   ConnectionInfo.fromJson(Map<String, Object?> json)
    1264           0 :       : ip = ((v) => v != null ? v as String : null)(json['ip']),
    1265           0 :         lastSeen = ((v) => v != null ? v as int : null)(json['last_seen']),
    1266           0 :         userAgent = ((v) => v != null ? v as String : null)(json['user_agent']);
    1267           0 :   Map<String, Object?> toJson() {
    1268           0 :     final ip = this.ip;
    1269           0 :     final lastSeen = this.lastSeen;
    1270           0 :     final userAgent = this.userAgent;
    1271           0 :     return {
    1272           0 :       if (ip != null) 'ip': ip,
    1273           0 :       if (lastSeen != null) 'last_seen': lastSeen,
    1274           0 :       if (userAgent != null) 'user_agent': userAgent,
    1275             :     };
    1276             :   }
    1277             : 
    1278             :   /// Most recently seen IP address of the session.
    1279             :   String? ip;
    1280             : 
    1281             :   /// Unix timestamp that the session was last active.
    1282             :   int? lastSeen;
    1283             : 
    1284             :   /// User agent string last seen in the session.
    1285             :   String? userAgent;
    1286             : 
    1287           0 :   @override
    1288             :   bool operator ==(Object other) =>
    1289           0 :       other is ConnectionInfo &&
    1290           0 :       other.ip == ip &&
    1291           0 :       other.lastSeen == lastSeen &&
    1292           0 :       other.userAgent == userAgent;
    1293             : 
    1294           0 :   @override
    1295           0 :   int get hashCode => Object.hash(ip, lastSeen, userAgent);
    1296             : 
    1297           0 :   @override
    1298             :   String toString() {
    1299           0 :     return toJson().toString();
    1300             :   }
    1301             : }
    1302             : 
    1303             : ///
    1304             : @_NameSource('spec')
    1305             : class SessionInfo {
    1306           0 :   SessionInfo({
    1307             :     this.connections,
    1308             :   });
    1309             : 
    1310           0 :   SessionInfo.fromJson(Map<String, Object?> json)
    1311           0 :       : connections = ((v) => v != null
    1312             :             ? (v as List)
    1313           0 :                 .map((v) => ConnectionInfo.fromJson(v as Map<String, Object?>))
    1314           0 :                 .toList()
    1315           0 :             : null)(json['connections']);
    1316           0 :   Map<String, Object?> toJson() {
    1317           0 :     final connections = this.connections;
    1318           0 :     return {
    1319             :       if (connections != null)
    1320           0 :         'connections': connections.map((v) => v.toJson()).toList(),
    1321             :     };
    1322             :   }
    1323             : 
    1324             :   /// Information particular connections in the session.
    1325             :   List<ConnectionInfo>? connections;
    1326             : 
    1327           0 :   @override
    1328             :   bool operator ==(Object other) =>
    1329           0 :       other is SessionInfo && other.connections == connections;
    1330             : 
    1331           0 :   @override
    1332           0 :   int get hashCode => connections.hashCode;
    1333             : 
    1334           0 :   @override
    1335             :   String toString() {
    1336           0 :     return toJson().toString();
    1337             :   }
    1338             : }
    1339             : 
    1340             : ///
    1341             : @_NameSource('spec')
    1342             : class DeviceInfo {
    1343           0 :   DeviceInfo({
    1344             :     this.sessions,
    1345             :   });
    1346             : 
    1347           0 :   DeviceInfo.fromJson(Map<String, Object?> json)
    1348           0 :       : sessions = ((v) => v != null
    1349             :             ? (v as List)
    1350           0 :                 .map((v) => SessionInfo.fromJson(v as Map<String, Object?>))
    1351           0 :                 .toList()
    1352           0 :             : null)(json['sessions']);
    1353           0 :   Map<String, Object?> toJson() {
    1354           0 :     final sessions = this.sessions;
    1355           0 :     return {
    1356             :       if (sessions != null)
    1357           0 :         'sessions': sessions.map((v) => v.toJson()).toList(),
    1358             :     };
    1359             :   }
    1360             : 
    1361             :   /// A user's sessions (i.e. what they did with an access token from one login).
    1362             :   List<SessionInfo>? sessions;
    1363             : 
    1364           0 :   @override
    1365             :   bool operator ==(Object other) =>
    1366           0 :       other is DeviceInfo && other.sessions == sessions;
    1367             : 
    1368           0 :   @override
    1369           0 :   int get hashCode => sessions.hashCode;
    1370             : 
    1371           0 :   @override
    1372             :   String toString() {
    1373           0 :     return toJson().toString();
    1374             :   }
    1375             : }
    1376             : 
    1377             : ///
    1378             : @_NameSource('rule override generated')
    1379             : class WhoIsInfo {
    1380           0 :   WhoIsInfo({
    1381             :     this.devices,
    1382             :     this.userId,
    1383             :   });
    1384             : 
    1385           0 :   WhoIsInfo.fromJson(Map<String, Object?> json)
    1386           0 :       : devices = ((v) => v != null
    1387           0 :             ? (v as Map<String, Object?>).map((k, v) =>
    1388           0 :                 MapEntry(k, DeviceInfo.fromJson(v as Map<String, Object?>)))
    1389           0 :             : null)(json['devices']),
    1390           0 :         userId = ((v) => v != null ? v as String : null)(json['user_id']);
    1391           0 :   Map<String, Object?> toJson() {
    1392           0 :     final devices = this.devices;
    1393           0 :     final userId = this.userId;
    1394           0 :     return {
    1395             :       if (devices != null)
    1396           0 :         'devices': devices.map((k, v) => MapEntry(k, v.toJson())),
    1397           0 :       if (userId != null) 'user_id': userId,
    1398             :     };
    1399             :   }
    1400             : 
    1401             :   /// Each key is an identifier for one of the user's devices.
    1402             :   Map<String, DeviceInfo>? devices;
    1403             : 
    1404             :   /// The Matrix user ID of the user.
    1405             :   String? userId;
    1406             : 
    1407           0 :   @override
    1408             :   bool operator ==(Object other) =>
    1409           0 :       other is WhoIsInfo && other.devices == devices && other.userId == userId;
    1410             : 
    1411           0 :   @override
    1412           0 :   int get hashCode => Object.hash(devices, userId);
    1413             : 
    1414           0 :   @override
    1415             :   String toString() {
    1416           0 :     return toJson().toString();
    1417             :   }
    1418             : }
    1419             : 
    1420             : ///
    1421             : @_NameSource('spec')
    1422             : class ChangePasswordCapability {
    1423           0 :   ChangePasswordCapability({
    1424             :     required this.enabled,
    1425             :   });
    1426             : 
    1427           0 :   ChangePasswordCapability.fromJson(Map<String, Object?> json)
    1428           0 :       : enabled = json['enabled'] as bool;
    1429           0 :   Map<String, Object?> toJson() => {
    1430           0 :         'enabled': enabled,
    1431             :       };
    1432             : 
    1433             :   /// True if the user can change their password, false otherwise.
    1434             :   bool enabled;
    1435             : 
    1436           0 :   @override
    1437             :   bool operator ==(Object other) =>
    1438           0 :       other is ChangePasswordCapability && other.enabled == enabled;
    1439             : 
    1440           0 :   @override
    1441           0 :   int get hashCode => enabled.hashCode;
    1442             : 
    1443           0 :   @override
    1444             :   String toString() {
    1445           0 :     return toJson().toString();
    1446             :   }
    1447             : }
    1448             : 
    1449             : /// The stability of the room version.
    1450             : @_NameSource('rule override generated')
    1451             : @EnhancedEnum()
    1452             : enum RoomVersionAvailable {
    1453             :   @EnhancedEnumValue(name: 'stable')
    1454             :   stable,
    1455             :   @EnhancedEnumValue(name: 'unstable')
    1456             :   unstable
    1457             : }
    1458             : 
    1459             : ///
    1460             : @_NameSource('spec')
    1461             : class RoomVersionsCapability {
    1462           0 :   RoomVersionsCapability({
    1463             :     required this.available,
    1464             :     required this.default$,
    1465             :   });
    1466             : 
    1467           0 :   RoomVersionsCapability.fromJson(Map<String, Object?> json)
    1468           0 :       : available = (json['available'] as Map<String, Object?>).map((k, v) =>
    1469           0 :             MapEntry(k, RoomVersionAvailable.values.fromString(v as String)!)),
    1470           0 :         default$ = json['default'] as String;
    1471           0 :   Map<String, Object?> toJson() => {
    1472           0 :         'available': available.map((k, v) => MapEntry(k, v.name)),
    1473           0 :         'default': default$,
    1474             :       };
    1475             : 
    1476             :   /// A detailed description of the room versions the server supports.
    1477             :   Map<String, RoomVersionAvailable> available;
    1478             : 
    1479             :   /// The default room version the server is using for new rooms.
    1480             :   String default$;
    1481             : 
    1482           0 :   @override
    1483             :   bool operator ==(Object other) =>
    1484           0 :       other is RoomVersionsCapability &&
    1485           0 :       other.available == available &&
    1486           0 :       other.default$ == default$;
    1487             : 
    1488           0 :   @override
    1489           0 :   int get hashCode => Object.hash(available, default$);
    1490             : 
    1491           0 :   @override
    1492             :   String toString() {
    1493           0 :     return toJson().toString();
    1494             :   }
    1495             : }
    1496             : 
    1497             : ///
    1498             : @_NameSource('spec')
    1499             : class Capabilities {
    1500           0 :   Capabilities({
    1501             :     this.mChangePassword,
    1502             :     this.mRoomVersions,
    1503             :     this.additionalProperties = const {},
    1504             :   });
    1505             : 
    1506           0 :   Capabilities.fromJson(Map<String, Object?> json)
    1507           0 :       : mChangePassword = ((v) => v != null
    1508           0 :             ? ChangePasswordCapability.fromJson(v as Map<String, Object?>)
    1509           0 :             : null)(json['m.change_password']),
    1510           0 :         mRoomVersions = ((v) => v != null
    1511           0 :             ? RoomVersionsCapability.fromJson(v as Map<String, Object?>)
    1512           0 :             : null)(json['m.room_versions']),
    1513           0 :         additionalProperties = Map.fromEntries(json.entries
    1514           0 :             .where((e) =>
    1515           0 :                 !['m.change_password', 'm.room_versions'].contains(e.key))
    1516           0 :             .map((e) => MapEntry(e.key, e.value as Map<String, Object?>)));
    1517           0 :   Map<String, Object?> toJson() {
    1518           0 :     final mChangePassword = this.mChangePassword;
    1519           0 :     final mRoomVersions = this.mRoomVersions;
    1520           0 :     return {
    1521           0 :       ...additionalProperties,
    1522             :       if (mChangePassword != null)
    1523           0 :         'm.change_password': mChangePassword.toJson(),
    1524           0 :       if (mRoomVersions != null) 'm.room_versions': mRoomVersions.toJson(),
    1525             :     };
    1526             :   }
    1527             : 
    1528             :   /// Capability to indicate if the user can change their password.
    1529             :   ChangePasswordCapability? mChangePassword;
    1530             : 
    1531             :   /// The room versions the server supports.
    1532             :   RoomVersionsCapability? mRoomVersions;
    1533             : 
    1534             :   Map<String, Map<String, Object?>> additionalProperties;
    1535             : 
    1536           0 :   @override
    1537             :   bool operator ==(Object other) =>
    1538           0 :       other is Capabilities &&
    1539           0 :       other.mChangePassword == mChangePassword &&
    1540           0 :       other.mRoomVersions == mRoomVersions;
    1541             : 
    1542           0 :   @override
    1543           0 :   int get hashCode => Object.hash(mChangePassword, mRoomVersions);
    1544             : 
    1545           0 :   @override
    1546             :   String toString() {
    1547           0 :     return toJson().toString();
    1548             :   }
    1549             : }
    1550             : 
    1551             : ///
    1552             : @_NameSource('spec')
    1553             : class StateEvent {
    1554           2 :   StateEvent({
    1555             :     required this.content,
    1556             :     this.stateKey,
    1557             :     required this.type,
    1558             :   });
    1559             : 
    1560           0 :   StateEvent.fromJson(Map<String, Object?> json)
    1561           0 :       : content = json['content'] as Map<String, Object?>,
    1562           0 :         stateKey = ((v) => v != null ? v as String : null)(json['state_key']),
    1563           0 :         type = json['type'] as String;
    1564           2 :   Map<String, Object?> toJson() {
    1565           2 :     final stateKey = this.stateKey;
    1566           2 :     return {
    1567           4 :       'content': content,
    1568           0 :       if (stateKey != null) 'state_key': stateKey,
    1569           4 :       'type': type,
    1570             :     };
    1571             :   }
    1572             : 
    1573             :   /// The content of the event.
    1574             :   Map<String, Object?> content;
    1575             : 
    1576             :   /// The state_key of the state event. Defaults to an empty string.
    1577             :   String? stateKey;
    1578             : 
    1579             :   /// The type of event to send.
    1580             :   String type;
    1581             : 
    1582           0 :   @override
    1583             :   bool operator ==(Object other) =>
    1584           0 :       other is StateEvent &&
    1585           0 :       other.content == content &&
    1586           0 :       other.stateKey == stateKey &&
    1587           0 :       other.type == type;
    1588             : 
    1589           0 :   @override
    1590           0 :   int get hashCode => Object.hash(content, stateKey, type);
    1591             : 
    1592           0 :   @override
    1593             :   String toString() {
    1594           0 :     return toJson().toString();
    1595             :   }
    1596             : }
    1597             : 
    1598             : ///
    1599             : @_NameSource('spec')
    1600             : class Invite3pid {
    1601           0 :   Invite3pid({
    1602             :     required this.address,
    1603             :     required this.idAccessToken,
    1604             :     required this.idServer,
    1605             :     required this.medium,
    1606             :   });
    1607             : 
    1608           0 :   Invite3pid.fromJson(Map<String, Object?> json)
    1609           0 :       : address = json['address'] as String,
    1610           0 :         idAccessToken = json['id_access_token'] as String,
    1611           0 :         idServer = json['id_server'] as String,
    1612           0 :         medium = json['medium'] as String;
    1613           0 :   Map<String, Object?> toJson() => {
    1614           0 :         'address': address,
    1615           0 :         'id_access_token': idAccessToken,
    1616           0 :         'id_server': idServer,
    1617           0 :         'medium': medium,
    1618             :       };
    1619             : 
    1620             :   /// The invitee's third-party identifier.
    1621             :   String address;
    1622             : 
    1623             :   /// An access token previously registered with the identity server. Servers
    1624             :   /// can treat this as optional to distinguish between r0.5-compatible clients
    1625             :   /// and this specification version.
    1626             :   String idAccessToken;
    1627             : 
    1628             :   /// The hostname+port of the identity server which should be used for third-party identifier lookups.
    1629             :   String idServer;
    1630             : 
    1631             :   /// The kind of address being passed in the address field, for example `email`
    1632             :   /// (see [the list of recognised values](https://spec.matrix.org/unstable/appendices/#3pid-types)).
    1633             :   String medium;
    1634             : 
    1635           0 :   @override
    1636             :   bool operator ==(Object other) =>
    1637           0 :       other is Invite3pid &&
    1638           0 :       other.address == address &&
    1639           0 :       other.idAccessToken == idAccessToken &&
    1640           0 :       other.idServer == idServer &&
    1641           0 :       other.medium == medium;
    1642             : 
    1643           0 :   @override
    1644           0 :   int get hashCode => Object.hash(address, idAccessToken, idServer, medium);
    1645             : 
    1646           0 :   @override
    1647             :   String toString() {
    1648           0 :     return toJson().toString();
    1649             :   }
    1650             : }
    1651             : 
    1652             : ///
    1653             : @_NameSource('rule override generated')
    1654             : @EnhancedEnum()
    1655             : enum CreateRoomPreset {
    1656             :   @EnhancedEnumValue(name: 'private_chat')
    1657             :   privateChat,
    1658             :   @EnhancedEnumValue(name: 'public_chat')
    1659             :   publicChat,
    1660             :   @EnhancedEnumValue(name: 'trusted_private_chat')
    1661             :   trustedPrivateChat
    1662             : }
    1663             : 
    1664             : ///
    1665             : @_NameSource('generated')
    1666             : @EnhancedEnum()
    1667             : enum Visibility {
    1668             :   @EnhancedEnumValue(name: 'private')
    1669             :   private,
    1670             :   @EnhancedEnumValue(name: 'public')
    1671             :   public
    1672             : }
    1673             : 
    1674             : /// A client device
    1675             : @_NameSource('spec')
    1676             : class Device {
    1677           0 :   Device({
    1678             :     required this.deviceId,
    1679             :     this.displayName,
    1680             :     this.lastSeenIp,
    1681             :     this.lastSeenTs,
    1682             :   });
    1683             : 
    1684           0 :   Device.fromJson(Map<String, Object?> json)
    1685           0 :       : deviceId = json['device_id'] as String,
    1686             :         displayName =
    1687           0 :             ((v) => v != null ? v as String : null)(json['display_name']),
    1688             :         lastSeenIp =
    1689           0 :             ((v) => v != null ? v as String : null)(json['last_seen_ip']),
    1690           0 :         lastSeenTs = ((v) => v != null ? v as int : null)(json['last_seen_ts']);
    1691           0 :   Map<String, Object?> toJson() {
    1692           0 :     final displayName = this.displayName;
    1693           0 :     final lastSeenIp = this.lastSeenIp;
    1694           0 :     final lastSeenTs = this.lastSeenTs;
    1695           0 :     return {
    1696           0 :       'device_id': deviceId,
    1697           0 :       if (displayName != null) 'display_name': displayName,
    1698           0 :       if (lastSeenIp != null) 'last_seen_ip': lastSeenIp,
    1699           0 :       if (lastSeenTs != null) 'last_seen_ts': lastSeenTs,
    1700             :     };
    1701             :   }
    1702             : 
    1703             :   /// Identifier of this device.
    1704             :   String deviceId;
    1705             : 
    1706             :   /// Display name set by the user for this device. Absent if no name has been
    1707             :   /// set.
    1708             :   String? displayName;
    1709             : 
    1710             :   /// The IP address where this device was last seen. (May be a few minutes out
    1711             :   /// of date, for efficiency reasons).
    1712             :   String? lastSeenIp;
    1713             : 
    1714             :   /// The timestamp (in milliseconds since the unix epoch) when this devices
    1715             :   /// was last seen. (May be a few minutes out of date, for efficiency
    1716             :   /// reasons).
    1717             :   int? lastSeenTs;
    1718             : 
    1719           0 :   @override
    1720             :   bool operator ==(Object other) =>
    1721           0 :       other is Device &&
    1722           0 :       other.deviceId == deviceId &&
    1723           0 :       other.displayName == displayName &&
    1724           0 :       other.lastSeenIp == lastSeenIp &&
    1725           0 :       other.lastSeenTs == lastSeenTs;
    1726             : 
    1727           0 :   @override
    1728             :   int get hashCode =>
    1729           0 :       Object.hash(deviceId, displayName, lastSeenIp, lastSeenTs);
    1730             : 
    1731           0 :   @override
    1732             :   String toString() {
    1733           0 :     return toJson().toString();
    1734             :   }
    1735             : }
    1736             : 
    1737             : ///
    1738             : @_NameSource('generated')
    1739             : class GetRoomIdByAliasResponse {
    1740           0 :   GetRoomIdByAliasResponse({
    1741             :     this.roomId,
    1742             :     this.servers,
    1743             :   });
    1744             : 
    1745           0 :   GetRoomIdByAliasResponse.fromJson(Map<String, Object?> json)
    1746           0 :       : roomId = ((v) => v != null ? v as String : null)(json['room_id']),
    1747           0 :         servers = ((v) => v != null
    1748           0 :             ? (v as List).map((v) => v as String).toList()
    1749           0 :             : null)(json['servers']);
    1750           0 :   Map<String, Object?> toJson() {
    1751           0 :     final roomId = this.roomId;
    1752           0 :     final servers = this.servers;
    1753           0 :     return {
    1754           0 :       if (roomId != null) 'room_id': roomId,
    1755           0 :       if (servers != null) 'servers': servers.map((v) => v).toList(),
    1756             :     };
    1757             :   }
    1758             : 
    1759             :   /// The room ID for this room alias.
    1760             :   String? roomId;
    1761             : 
    1762             :   /// A list of servers that are aware of this room alias.
    1763             :   List<String>? servers;
    1764             : 
    1765           0 :   @override
    1766             :   bool operator ==(Object other) =>
    1767           0 :       other is GetRoomIdByAliasResponse &&
    1768           0 :       other.roomId == roomId &&
    1769           0 :       other.servers == servers;
    1770             : 
    1771           0 :   @override
    1772           0 :   int get hashCode => Object.hash(roomId, servers);
    1773             : 
    1774           0 :   @override
    1775             :   String toString() {
    1776           0 :     return toJson().toString();
    1777             :   }
    1778             : }
    1779             : 
    1780             : ///
    1781             : @_NameSource('generated')
    1782             : class GetEventsResponse {
    1783           0 :   GetEventsResponse({
    1784             :     this.chunk,
    1785             :     this.end,
    1786             :     this.start,
    1787             :   });
    1788             : 
    1789           0 :   GetEventsResponse.fromJson(Map<String, Object?> json)
    1790           0 :       : chunk = ((v) => v != null
    1791             :             ? (v as List)
    1792           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    1793           0 :                 .toList()
    1794           0 :             : null)(json['chunk']),
    1795           0 :         end = ((v) => v != null ? v as String : null)(json['end']),
    1796           0 :         start = ((v) => v != null ? v as String : null)(json['start']);
    1797           0 :   Map<String, Object?> toJson() {
    1798           0 :     final chunk = this.chunk;
    1799           0 :     final end = this.end;
    1800           0 :     final start = this.start;
    1801           0 :     return {
    1802           0 :       if (chunk != null) 'chunk': chunk.map((v) => v.toJson()).toList(),
    1803           0 :       if (end != null) 'end': end,
    1804           0 :       if (start != null) 'start': start,
    1805             :     };
    1806             :   }
    1807             : 
    1808             :   /// An array of events.
    1809             :   List<MatrixEvent>? chunk;
    1810             : 
    1811             :   /// A token which correlates to the end of `chunk`. This
    1812             :   /// token should be used in the next request to `/events`.
    1813             :   String? end;
    1814             : 
    1815             :   /// A token which correlates to the start of `chunk`. This
    1816             :   /// is usually the same token supplied to `from=`.
    1817             :   String? start;
    1818             : 
    1819           0 :   @override
    1820             :   bool operator ==(Object other) =>
    1821           0 :       other is GetEventsResponse &&
    1822           0 :       other.chunk == chunk &&
    1823           0 :       other.end == end &&
    1824           0 :       other.start == start;
    1825             : 
    1826           0 :   @override
    1827           0 :   int get hashCode => Object.hash(chunk, end, start);
    1828             : 
    1829           0 :   @override
    1830             :   String toString() {
    1831           0 :     return toJson().toString();
    1832             :   }
    1833             : }
    1834             : 
    1835             : ///
    1836             : @_NameSource('generated')
    1837             : class PeekEventsResponse {
    1838           0 :   PeekEventsResponse({
    1839             :     this.chunk,
    1840             :     this.end,
    1841             :     this.start,
    1842             :   });
    1843             : 
    1844           0 :   PeekEventsResponse.fromJson(Map<String, Object?> json)
    1845           0 :       : chunk = ((v) => v != null
    1846             :             ? (v as List)
    1847           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    1848           0 :                 .toList()
    1849           0 :             : null)(json['chunk']),
    1850           0 :         end = ((v) => v != null ? v as String : null)(json['end']),
    1851           0 :         start = ((v) => v != null ? v as String : null)(json['start']);
    1852           0 :   Map<String, Object?> toJson() {
    1853           0 :     final chunk = this.chunk;
    1854           0 :     final end = this.end;
    1855           0 :     final start = this.start;
    1856           0 :     return {
    1857           0 :       if (chunk != null) 'chunk': chunk.map((v) => v.toJson()).toList(),
    1858           0 :       if (end != null) 'end': end,
    1859           0 :       if (start != null) 'start': start,
    1860             :     };
    1861             :   }
    1862             : 
    1863             :   /// An array of events.
    1864             :   List<MatrixEvent>? chunk;
    1865             : 
    1866             :   /// A token which correlates to the last value in `chunk`. This
    1867             :   /// token should be used in the next request to `/events`.
    1868             :   String? end;
    1869             : 
    1870             :   /// A token which correlates to the first value in `chunk`. This
    1871             :   /// is usually the same token supplied to `from=`.
    1872             :   String? start;
    1873             : 
    1874           0 :   @override
    1875             :   bool operator ==(Object other) =>
    1876           0 :       other is PeekEventsResponse &&
    1877           0 :       other.chunk == chunk &&
    1878           0 :       other.end == end &&
    1879           0 :       other.start == start;
    1880             : 
    1881           0 :   @override
    1882           0 :   int get hashCode => Object.hash(chunk, end, start);
    1883             : 
    1884           0 :   @override
    1885             :   String toString() {
    1886           0 :     return toJson().toString();
    1887             :   }
    1888             : }
    1889             : 
    1890             : /// A signature of an `m.third_party_invite` token to prove that this user
    1891             : /// owns a third-party identity which has been invited to the room.
    1892             : @_NameSource('spec')
    1893             : class ThirdPartySigned {
    1894           0 :   ThirdPartySigned({
    1895             :     required this.mxid,
    1896             :     required this.sender,
    1897             :     required this.signatures,
    1898             :     required this.token,
    1899             :   });
    1900             : 
    1901           0 :   ThirdPartySigned.fromJson(Map<String, Object?> json)
    1902           0 :       : mxid = json['mxid'] as String,
    1903           0 :         sender = json['sender'] as String,
    1904           0 :         signatures = (json['signatures'] as Map<String, Object?>).map((k, v) =>
    1905           0 :             MapEntry(
    1906             :                 k,
    1907             :                 (v as Map<String, Object?>)
    1908           0 :                     .map((k, v) => MapEntry(k, v as String)))),
    1909           0 :         token = json['token'] as String;
    1910           0 :   Map<String, Object?> toJson() => {
    1911           0 :         'mxid': mxid,
    1912           0 :         'sender': sender,
    1913           0 :         'signatures': signatures
    1914           0 :             .map((k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v)))),
    1915           0 :         'token': token,
    1916             :       };
    1917             : 
    1918             :   /// The Matrix ID of the invitee.
    1919             :   String mxid;
    1920             : 
    1921             :   /// The Matrix ID of the user who issued the invite.
    1922             :   String sender;
    1923             : 
    1924             :   /// A signatures object containing a signature of the entire signed object.
    1925             :   Map<String, Map<String, String>> signatures;
    1926             : 
    1927             :   /// The state key of the m.third_party_invite event.
    1928             :   String token;
    1929             : 
    1930           0 :   @override
    1931             :   bool operator ==(Object other) =>
    1932           0 :       other is ThirdPartySigned &&
    1933           0 :       other.mxid == mxid &&
    1934           0 :       other.sender == sender &&
    1935           0 :       other.signatures == signatures &&
    1936           0 :       other.token == token;
    1937             : 
    1938           0 :   @override
    1939           0 :   int get hashCode => Object.hash(mxid, sender, signatures, token);
    1940             : 
    1941           0 :   @override
    1942             :   String toString() {
    1943           0 :     return toJson().toString();
    1944             :   }
    1945             : }
    1946             : 
    1947             : ///
    1948             : @_NameSource('generated')
    1949             : class GetKeysChangesResponse {
    1950           0 :   GetKeysChangesResponse({
    1951             :     this.changed,
    1952             :     this.left,
    1953             :   });
    1954             : 
    1955           0 :   GetKeysChangesResponse.fromJson(Map<String, Object?> json)
    1956           0 :       : changed = ((v) => v != null
    1957           0 :             ? (v as List).map((v) => v as String).toList()
    1958           0 :             : null)(json['changed']),
    1959           0 :         left = ((v) => v != null
    1960           0 :             ? (v as List).map((v) => v as String).toList()
    1961           0 :             : null)(json['left']);
    1962           0 :   Map<String, Object?> toJson() {
    1963           0 :     final changed = this.changed;
    1964           0 :     final left = this.left;
    1965           0 :     return {
    1966           0 :       if (changed != null) 'changed': changed.map((v) => v).toList(),
    1967           0 :       if (left != null) 'left': left.map((v) => v).toList(),
    1968             :     };
    1969             :   }
    1970             : 
    1971             :   /// The Matrix User IDs of all users who updated their device
    1972             :   /// identity keys.
    1973             :   List<String>? changed;
    1974             : 
    1975             :   /// The Matrix User IDs of all users who may have left all
    1976             :   /// the end-to-end encrypted rooms they previously shared
    1977             :   /// with the user.
    1978             :   List<String>? left;
    1979             : 
    1980           0 :   @override
    1981             :   bool operator ==(Object other) =>
    1982           0 :       other is GetKeysChangesResponse &&
    1983           0 :       other.changed == changed &&
    1984           0 :       other.left == left;
    1985             : 
    1986           0 :   @override
    1987           0 :   int get hashCode => Object.hash(changed, left);
    1988             : 
    1989           0 :   @override
    1990             :   String toString() {
    1991           0 :     return toJson().toString();
    1992             :   }
    1993             : }
    1994             : 
    1995             : ///
    1996             : @_NameSource('generated')
    1997             : class ClaimKeysResponse {
    1998           0 :   ClaimKeysResponse({
    1999             :     this.failures,
    2000             :     required this.oneTimeKeys,
    2001             :   });
    2002             : 
    2003          10 :   ClaimKeysResponse.fromJson(Map<String, Object?> json)
    2004          10 :       : failures = ((v) => v != null
    2005             :             ? (v as Map<String, Object?>)
    2006          10 :                 .map((k, v) => MapEntry(k, v as Map<String, Object?>))
    2007          20 :             : null)(json['failures']),
    2008          20 :         oneTimeKeys = (json['one_time_keys'] as Map<String, Object?>).map(
    2009          20 :             (k, v) => MapEntry(
    2010             :                 k,
    2011             :                 (v as Map<String, Object?>)
    2012          30 :                     .map((k, v) => MapEntry(k, v as Map<String, Object?>))));
    2013           0 :   Map<String, Object?> toJson() {
    2014           0 :     final failures = this.failures;
    2015           0 :     return {
    2016           0 :       if (failures != null) 'failures': failures.map((k, v) => MapEntry(k, v)),
    2017           0 :       'one_time_keys': oneTimeKeys
    2018           0 :           .map((k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v)))),
    2019             :     };
    2020             :   }
    2021             : 
    2022             :   /// If any remote homeservers could not be reached, they are
    2023             :   /// recorded here. The names of the properties are the names of
    2024             :   /// the unreachable servers.
    2025             :   ///
    2026             :   /// If the homeserver could be reached, but the user or device
    2027             :   /// was unknown, no failure is recorded. Instead, the corresponding
    2028             :   /// user or device is missing from the `one_time_keys` result.
    2029             :   Map<String, Map<String, Object?>>? failures;
    2030             : 
    2031             :   /// One-time keys for the queried devices. A map from user ID, to a
    2032             :   /// map from devices to a map from `<algorithm>:<key_id>` to the key object.
    2033             :   ///
    2034             :   /// See the [key algorithms](https://spec.matrix.org/unstable/client-server-api/#key-algorithms) section for information
    2035             :   /// on the Key Object format.
    2036             :   ///
    2037             :   /// If necessary, the claimed key might be a fallback key. Fallback
    2038             :   /// keys are re-used by the server until replaced by the device.
    2039             :   Map<String, Map<String, Map<String, Object?>>> oneTimeKeys;
    2040             : 
    2041           0 :   @override
    2042             :   bool operator ==(Object other) =>
    2043           0 :       other is ClaimKeysResponse &&
    2044           0 :       other.failures == failures &&
    2045           0 :       other.oneTimeKeys == oneTimeKeys;
    2046             : 
    2047           0 :   @override
    2048           0 :   int get hashCode => Object.hash(failures, oneTimeKeys);
    2049             : 
    2050           0 :   @override
    2051             :   String toString() {
    2052           0 :     return toJson().toString();
    2053             :   }
    2054             : }
    2055             : 
    2056             : ///
    2057             : @_NameSource('generated')
    2058             : class QueryKeysResponse {
    2059           0 :   QueryKeysResponse({
    2060             :     this.deviceKeys,
    2061             :     this.failures,
    2062             :     this.masterKeys,
    2063             :     this.selfSigningKeys,
    2064             :     this.userSigningKeys,
    2065             :   });
    2066             : 
    2067          31 :   QueryKeysResponse.fromJson(Map<String, Object?> json)
    2068          31 :       : deviceKeys = ((v) => v != null
    2069          93 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    2070             :                 k,
    2071          93 :                 (v as Map<String, Object?>).map((k, v) => MapEntry(
    2072          31 :                     k, MatrixDeviceKeys.fromJson(v as Map<String, Object?>)))))
    2073          62 :             : null)(json['device_keys']),
    2074          31 :         failures = ((v) => v != null
    2075             :             ? (v as Map<String, Object?>)
    2076          31 :                 .map((k, v) => MapEntry(k, v as Map<String, Object?>))
    2077          62 :             : null)(json['failures']),
    2078          31 :         masterKeys = ((v) => v != null
    2079          93 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    2080          31 :                 k, MatrixCrossSigningKey.fromJson(v as Map<String, Object?>)))
    2081          62 :             : null)(json['master_keys']),
    2082          31 :         selfSigningKeys = ((v) => v != null
    2083          93 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    2084          31 :                 k, MatrixCrossSigningKey.fromJson(v as Map<String, Object?>)))
    2085          62 :             : null)(json['self_signing_keys']),
    2086          31 :         userSigningKeys = ((v) => v != null
    2087          93 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    2088          31 :                 k, MatrixCrossSigningKey.fromJson(v as Map<String, Object?>)))
    2089          62 :             : null)(json['user_signing_keys']);
    2090           0 :   Map<String, Object?> toJson() {
    2091           0 :     final deviceKeys = this.deviceKeys;
    2092           0 :     final failures = this.failures;
    2093           0 :     final masterKeys = this.masterKeys;
    2094           0 :     final selfSigningKeys = this.selfSigningKeys;
    2095           0 :     final userSigningKeys = this.userSigningKeys;
    2096           0 :     return {
    2097             :       if (deviceKeys != null)
    2098           0 :         'device_keys': deviceKeys.map(
    2099           0 :             (k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v.toJson())))),
    2100           0 :       if (failures != null) 'failures': failures.map((k, v) => MapEntry(k, v)),
    2101             :       if (masterKeys != null)
    2102           0 :         'master_keys': masterKeys.map((k, v) => MapEntry(k, v.toJson())),
    2103             :       if (selfSigningKeys != null)
    2104           0 :         'self_signing_keys':
    2105           0 :             selfSigningKeys.map((k, v) => MapEntry(k, v.toJson())),
    2106             :       if (userSigningKeys != null)
    2107           0 :         'user_signing_keys':
    2108           0 :             userSigningKeys.map((k, v) => MapEntry(k, v.toJson())),
    2109             :     };
    2110             :   }
    2111             : 
    2112             :   /// Information on the queried devices. A map from user ID, to a
    2113             :   /// map from device ID to device information.  For each device,
    2114             :   /// the information returned will be the same as uploaded via
    2115             :   /// `/keys/upload`, with the addition of an `unsigned`
    2116             :   /// property.
    2117             :   Map<String, Map<String, MatrixDeviceKeys>>? deviceKeys;
    2118             : 
    2119             :   /// If any remote homeservers could not be reached, they are
    2120             :   /// recorded here. The names of the properties are the names of
    2121             :   /// the unreachable servers.
    2122             :   ///
    2123             :   /// If the homeserver could be reached, but the user or device
    2124             :   /// was unknown, no failure is recorded. Instead, the corresponding
    2125             :   /// user or device is missing from the `device_keys` result.
    2126             :   Map<String, Map<String, Object?>>? failures;
    2127             : 
    2128             :   /// Information on the master cross-signing keys of the queried users.
    2129             :   /// A map from user ID, to master key information.  For each key, the
    2130             :   /// information returned will be the same as uploaded via
    2131             :   /// `/keys/device_signing/upload`, along with the signatures
    2132             :   /// uploaded via `/keys/signatures/upload` that the requesting user
    2133             :   /// is allowed to see.
    2134             :   Map<String, MatrixCrossSigningKey>? masterKeys;
    2135             : 
    2136             :   /// Information on the self-signing keys of the queried users. A map
    2137             :   /// from user ID, to self-signing key information.  For each key, the
    2138             :   /// information returned will be the same as uploaded via
    2139             :   /// `/keys/device_signing/upload`.
    2140             :   Map<String, MatrixCrossSigningKey>? selfSigningKeys;
    2141             : 
    2142             :   /// Information on the user-signing key of the user making the
    2143             :   /// request, if they queried their own device information. A map
    2144             :   /// from user ID, to user-signing key information.  The
    2145             :   /// information returned will be the same as uploaded via
    2146             :   /// `/keys/device_signing/upload`.
    2147             :   Map<String, MatrixCrossSigningKey>? userSigningKeys;
    2148             : 
    2149           0 :   @override
    2150             :   bool operator ==(Object other) =>
    2151           0 :       other is QueryKeysResponse &&
    2152           0 :       other.deviceKeys == deviceKeys &&
    2153           0 :       other.failures == failures &&
    2154           0 :       other.masterKeys == masterKeys &&
    2155           0 :       other.selfSigningKeys == selfSigningKeys &&
    2156           0 :       other.userSigningKeys == userSigningKeys;
    2157             : 
    2158           0 :   @override
    2159           0 :   int get hashCode => Object.hash(
    2160           0 :       deviceKeys, failures, masterKeys, selfSigningKeys, userSigningKeys);
    2161             : 
    2162           0 :   @override
    2163             :   String toString() {
    2164           0 :     return toJson().toString();
    2165             :   }
    2166             : }
    2167             : 
    2168             : ///
    2169             : @_NameSource('spec')
    2170             : class LoginFlow {
    2171           0 :   LoginFlow({
    2172             :     this.getLoginToken,
    2173             :     required this.type,
    2174             :   });
    2175             : 
    2176          34 :   LoginFlow.fromJson(Map<String, Object?> json)
    2177             :       : getLoginToken =
    2178         102 :             ((v) => v != null ? v as bool : null)(json['get_login_token']),
    2179          34 :         type = json['type'] as String;
    2180           0 :   Map<String, Object?> toJson() {
    2181           0 :     final getLoginToken = this.getLoginToken;
    2182           0 :     return {
    2183           0 :       if (getLoginToken != null) 'get_login_token': getLoginToken,
    2184           0 :       'type': type,
    2185             :     };
    2186             :   }
    2187             : 
    2188             :   /// If `type` is `m.login.token`, an optional field to indicate
    2189             :   /// to the unauthenticated client that the homeserver supports
    2190             :   /// the [`POST /login/get_token`](https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv1loginget_token)
    2191             :   /// endpoint. Note that supporting the endpoint does not
    2192             :   /// necessarily indicate that the user attempting to log in will
    2193             :   /// be able to generate such a token.
    2194             :   bool? getLoginToken;
    2195             : 
    2196             :   /// The login type. This is supplied as the `type` when
    2197             :   /// logging in.
    2198             :   String type;
    2199             : 
    2200           0 :   @override
    2201             :   bool operator ==(Object other) =>
    2202           0 :       other is LoginFlow &&
    2203           0 :       other.getLoginToken == getLoginToken &&
    2204           0 :       other.type == type;
    2205             : 
    2206           0 :   @override
    2207           0 :   int get hashCode => Object.hash(getLoginToken, type);
    2208             : 
    2209           0 :   @override
    2210             :   String toString() {
    2211           0 :     return toJson().toString();
    2212             :   }
    2213             : }
    2214             : 
    2215             : ///
    2216             : @_NameSource('generated')
    2217             : class LoginResponse {
    2218           0 :   LoginResponse({
    2219             :     required this.accessToken,
    2220             :     required this.deviceId,
    2221             :     this.expiresInMs,
    2222             :     this.homeServer,
    2223             :     this.refreshToken,
    2224             :     required this.userId,
    2225             :     this.wellKnown,
    2226             :   });
    2227             : 
    2228           4 :   LoginResponse.fromJson(Map<String, Object?> json)
    2229           4 :       : accessToken = json['access_token'] as String,
    2230           4 :         deviceId = json['device_id'] as String,
    2231             :         expiresInMs =
    2232          12 :             ((v) => v != null ? v as int : null)(json['expires_in_ms']),
    2233             :         homeServer =
    2234          12 :             ((v) => v != null ? v as String : null)(json['home_server']),
    2235             :         refreshToken =
    2236          12 :             ((v) => v != null ? v as String : null)(json['refresh_token']),
    2237           4 :         userId = json['user_id'] as String,
    2238           4 :         wellKnown = ((v) => v != null
    2239           4 :             ? DiscoveryInformation.fromJson(v as Map<String, Object?>)
    2240           8 :             : null)(json['well_known']);
    2241           0 :   Map<String, Object?> toJson() {
    2242           0 :     final expiresInMs = this.expiresInMs;
    2243           0 :     final homeServer = this.homeServer;
    2244           0 :     final refreshToken = this.refreshToken;
    2245           0 :     final wellKnown = this.wellKnown;
    2246           0 :     return {
    2247           0 :       'access_token': accessToken,
    2248           0 :       'device_id': deviceId,
    2249           0 :       if (expiresInMs != null) 'expires_in_ms': expiresInMs,
    2250           0 :       if (homeServer != null) 'home_server': homeServer,
    2251           0 :       if (refreshToken != null) 'refresh_token': refreshToken,
    2252           0 :       'user_id': userId,
    2253           0 :       if (wellKnown != null) 'well_known': wellKnown.toJson(),
    2254             :     };
    2255             :   }
    2256             : 
    2257             :   /// An access token for the account.
    2258             :   /// This access token can then be used to authorize other requests.
    2259             :   String accessToken;
    2260             : 
    2261             :   /// ID of the logged-in device. Will be the same as the
    2262             :   /// corresponding parameter in the request, if one was specified.
    2263             :   String deviceId;
    2264             : 
    2265             :   /// The lifetime of the access token, in milliseconds. Once
    2266             :   /// the access token has expired a new access token can be
    2267             :   /// obtained by using the provided refresh token. If no
    2268             :   /// refresh token is provided, the client will need to re-log in
    2269             :   /// to obtain a new access token. If not given, the client can
    2270             :   /// assume that the access token will not expire.
    2271             :   int? expiresInMs;
    2272             : 
    2273             :   /// The server_name of the homeserver on which the account has
    2274             :   /// been registered.
    2275             :   ///
    2276             :   /// **Deprecated**. Clients should extract the server_name from
    2277             :   /// `user_id` (by splitting at the first colon) if they require
    2278             :   /// it. Note also that `homeserver` is not spelt this way.
    2279             :   String? homeServer;
    2280             : 
    2281             :   /// A refresh token for the account. This token can be used to
    2282             :   /// obtain a new access token when it expires by calling the
    2283             :   /// `/refresh` endpoint.
    2284             :   String? refreshToken;
    2285             : 
    2286             :   /// The fully-qualified Matrix ID for the account.
    2287             :   String userId;
    2288             : 
    2289             :   /// Optional client configuration provided by the server. If present,
    2290             :   /// clients SHOULD use the provided object to reconfigure themselves,
    2291             :   /// optionally validating the URLs within. This object takes the same
    2292             :   /// form as the one returned from .well-known autodiscovery.
    2293             :   DiscoveryInformation? wellKnown;
    2294             : 
    2295           0 :   @override
    2296             :   bool operator ==(Object other) =>
    2297           0 :       other is LoginResponse &&
    2298           0 :       other.accessToken == accessToken &&
    2299           0 :       other.deviceId == deviceId &&
    2300           0 :       other.expiresInMs == expiresInMs &&
    2301           0 :       other.homeServer == homeServer &&
    2302           0 :       other.refreshToken == refreshToken &&
    2303           0 :       other.userId == userId &&
    2304           0 :       other.wellKnown == wellKnown;
    2305             : 
    2306           0 :   @override
    2307           0 :   int get hashCode => Object.hash(accessToken, deviceId, expiresInMs,
    2308           0 :       homeServer, refreshToken, userId, wellKnown);
    2309             : 
    2310           0 :   @override
    2311             :   String toString() {
    2312           0 :     return toJson().toString();
    2313             :   }
    2314             : }
    2315             : 
    2316             : ///
    2317             : @_NameSource('spec')
    2318             : class Notification {
    2319           0 :   Notification({
    2320             :     required this.actions,
    2321             :     required this.event,
    2322             :     this.profileTag,
    2323             :     required this.read,
    2324             :     required this.roomId,
    2325             :     required this.ts,
    2326             :   });
    2327             : 
    2328           0 :   Notification.fromJson(Map<String, Object?> json)
    2329           0 :       : actions = (json['actions'] as List).map((v) => v as Object?).toList(),
    2330           0 :         event = MatrixEvent.fromJson(json['event'] as Map<String, Object?>),
    2331             :         profileTag =
    2332           0 :             ((v) => v != null ? v as String : null)(json['profile_tag']),
    2333           0 :         read = json['read'] as bool,
    2334           0 :         roomId = json['room_id'] as String,
    2335           0 :         ts = json['ts'] as int;
    2336           0 :   Map<String, Object?> toJson() {
    2337           0 :     final profileTag = this.profileTag;
    2338           0 :     return {
    2339           0 :       'actions': actions.map((v) => v).toList(),
    2340           0 :       'event': event.toJson(),
    2341           0 :       if (profileTag != null) 'profile_tag': profileTag,
    2342           0 :       'read': read,
    2343           0 :       'room_id': roomId,
    2344           0 :       'ts': ts,
    2345             :     };
    2346             :   }
    2347             : 
    2348             :   /// The action(s) to perform when the conditions for this rule are met.
    2349             :   /// See [Push Rules: API](https://spec.matrix.org/unstable/client-server-api/#push-rules-api).
    2350             :   List<Object?> actions;
    2351             : 
    2352             :   /// The Event object for the event that triggered the notification.
    2353             :   MatrixEvent event;
    2354             : 
    2355             :   /// The profile tag of the rule that matched this event.
    2356             :   String? profileTag;
    2357             : 
    2358             :   /// Indicates whether the user has sent a read receipt indicating
    2359             :   /// that they have read this message.
    2360             :   bool read;
    2361             : 
    2362             :   /// The ID of the room in which the event was posted.
    2363             :   String roomId;
    2364             : 
    2365             :   /// The unix timestamp at which the event notification was sent,
    2366             :   /// in milliseconds.
    2367             :   int ts;
    2368             : 
    2369           0 :   @override
    2370             :   bool operator ==(Object other) =>
    2371           0 :       other is Notification &&
    2372           0 :       other.actions == actions &&
    2373           0 :       other.event == event &&
    2374           0 :       other.profileTag == profileTag &&
    2375           0 :       other.read == read &&
    2376           0 :       other.roomId == roomId &&
    2377           0 :       other.ts == ts;
    2378             : 
    2379           0 :   @override
    2380           0 :   int get hashCode => Object.hash(actions, event, profileTag, read, roomId, ts);
    2381             : 
    2382           0 :   @override
    2383             :   String toString() {
    2384           0 :     return toJson().toString();
    2385             :   }
    2386             : }
    2387             : 
    2388             : ///
    2389             : @_NameSource('generated')
    2390             : class GetNotificationsResponse {
    2391           0 :   GetNotificationsResponse({
    2392             :     this.nextToken,
    2393             :     required this.notifications,
    2394             :   });
    2395             : 
    2396           0 :   GetNotificationsResponse.fromJson(Map<String, Object?> json)
    2397           0 :       : nextToken = ((v) => v != null ? v as String : null)(json['next_token']),
    2398           0 :         notifications = (json['notifications'] as List)
    2399           0 :             .map((v) => Notification.fromJson(v as Map<String, Object?>))
    2400           0 :             .toList();
    2401           0 :   Map<String, Object?> toJson() {
    2402           0 :     final nextToken = this.nextToken;
    2403           0 :     return {
    2404           0 :       if (nextToken != null) 'next_token': nextToken,
    2405           0 :       'notifications': notifications.map((v) => v.toJson()).toList(),
    2406             :     };
    2407             :   }
    2408             : 
    2409             :   /// The token to supply in the `from` param of the next
    2410             :   /// `/notifications` request in order to request more
    2411             :   /// events. If this is absent, there are no more results.
    2412             :   String? nextToken;
    2413             : 
    2414             :   /// The list of events that triggered notifications.
    2415             :   List<Notification> notifications;
    2416             : 
    2417           0 :   @override
    2418             :   bool operator ==(Object other) =>
    2419           0 :       other is GetNotificationsResponse &&
    2420           0 :       other.nextToken == nextToken &&
    2421           0 :       other.notifications == notifications;
    2422             : 
    2423           0 :   @override
    2424           0 :   int get hashCode => Object.hash(nextToken, notifications);
    2425             : 
    2426           0 :   @override
    2427             :   String toString() {
    2428           0 :     return toJson().toString();
    2429             :   }
    2430             : }
    2431             : 
    2432             : ///
    2433             : @_NameSource('rule override generated')
    2434             : @EnhancedEnum()
    2435             : enum PresenceType {
    2436             :   @EnhancedEnumValue(name: 'offline')
    2437             :   offline,
    2438             :   @EnhancedEnumValue(name: 'online')
    2439             :   online,
    2440             :   @EnhancedEnumValue(name: 'unavailable')
    2441             :   unavailable
    2442             : }
    2443             : 
    2444             : ///
    2445             : @_NameSource('generated')
    2446             : class GetPresenceResponse {
    2447           0 :   GetPresenceResponse({
    2448             :     this.currentlyActive,
    2449             :     this.lastActiveAgo,
    2450             :     required this.presence,
    2451             :     this.statusMsg,
    2452             :   });
    2453             : 
    2454           0 :   GetPresenceResponse.fromJson(Map<String, Object?> json)
    2455             :       : currentlyActive =
    2456           0 :             ((v) => v != null ? v as bool : null)(json['currently_active']),
    2457             :         lastActiveAgo =
    2458           0 :             ((v) => v != null ? v as int : null)(json['last_active_ago']),
    2459           0 :         presence = PresenceType.values.fromString(json['presence'] as String)!,
    2460           0 :         statusMsg = ((v) => v != null ? v as String : null)(json['status_msg']);
    2461           0 :   Map<String, Object?> toJson() {
    2462           0 :     final currentlyActive = this.currentlyActive;
    2463           0 :     final lastActiveAgo = this.lastActiveAgo;
    2464           0 :     final statusMsg = this.statusMsg;
    2465           0 :     return {
    2466           0 :       if (currentlyActive != null) 'currently_active': currentlyActive,
    2467           0 :       if (lastActiveAgo != null) 'last_active_ago': lastActiveAgo,
    2468           0 :       'presence': presence.name,
    2469           0 :       if (statusMsg != null) 'status_msg': statusMsg,
    2470             :     };
    2471             :   }
    2472             : 
    2473             :   /// Whether the user is currently active
    2474             :   bool? currentlyActive;
    2475             : 
    2476             :   /// The length of time in milliseconds since an action was performed
    2477             :   /// by this user.
    2478             :   int? lastActiveAgo;
    2479             : 
    2480             :   /// This user's presence.
    2481             :   PresenceType presence;
    2482             : 
    2483             :   /// The state message for this user if one was set.
    2484             :   String? statusMsg;
    2485             : 
    2486           0 :   @override
    2487             :   bool operator ==(Object other) =>
    2488           0 :       other is GetPresenceResponse &&
    2489           0 :       other.currentlyActive == currentlyActive &&
    2490           0 :       other.lastActiveAgo == lastActiveAgo &&
    2491           0 :       other.presence == presence &&
    2492           0 :       other.statusMsg == statusMsg;
    2493             : 
    2494           0 :   @override
    2495             :   int get hashCode =>
    2496           0 :       Object.hash(currentlyActive, lastActiveAgo, presence, statusMsg);
    2497             : 
    2498           0 :   @override
    2499             :   String toString() {
    2500           0 :     return toJson().toString();
    2501             :   }
    2502             : }
    2503             : 
    2504             : ///
    2505             : @_NameSource('rule override generated')
    2506             : class ProfileInformation {
    2507           4 :   ProfileInformation({
    2508             :     this.avatarUrl,
    2509             :     this.displayname,
    2510             :   });
    2511             : 
    2512           4 :   ProfileInformation.fromJson(Map<String, Object?> json)
    2513           4 :       : avatarUrl = ((v) =>
    2514          12 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    2515             :         displayname =
    2516          12 :             ((v) => v != null ? v as String : null)(json['displayname']);
    2517           4 :   Map<String, Object?> toJson() {
    2518           4 :     final avatarUrl = this.avatarUrl;
    2519           4 :     final displayname = this.displayname;
    2520           4 :     return {
    2521           8 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    2522           4 :       if (displayname != null) 'displayname': displayname,
    2523             :     };
    2524             :   }
    2525             : 
    2526             :   /// The user's avatar URL if they have set one, otherwise not present.
    2527             :   Uri? avatarUrl;
    2528             : 
    2529             :   /// The user's display name if they have set one, otherwise not present.
    2530             :   String? displayname;
    2531             : 
    2532           0 :   @override
    2533             :   bool operator ==(Object other) =>
    2534           0 :       other is ProfileInformation &&
    2535           0 :       other.avatarUrl == avatarUrl &&
    2536           0 :       other.displayname == displayname;
    2537             : 
    2538           0 :   @override
    2539           0 :   int get hashCode => Object.hash(avatarUrl, displayname);
    2540             : 
    2541           0 :   @override
    2542             :   String toString() {
    2543           0 :     return toJson().toString();
    2544             :   }
    2545             : }
    2546             : 
    2547             : /// A list of the rooms on the server.
    2548             : @_NameSource('generated')
    2549             : class GetPublicRoomsResponse {
    2550           0 :   GetPublicRoomsResponse({
    2551             :     required this.chunk,
    2552             :     this.nextBatch,
    2553             :     this.prevBatch,
    2554             :     this.totalRoomCountEstimate,
    2555             :   });
    2556             : 
    2557           0 :   GetPublicRoomsResponse.fromJson(Map<String, Object?> json)
    2558           0 :       : chunk = (json['chunk'] as List)
    2559           0 :             .map((v) => PublicRoomsChunk.fromJson(v as Map<String, Object?>))
    2560           0 :             .toList(),
    2561           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    2562           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
    2563           0 :         totalRoomCountEstimate = ((v) =>
    2564           0 :             v != null ? v as int : null)(json['total_room_count_estimate']);
    2565           0 :   Map<String, Object?> toJson() {
    2566           0 :     final nextBatch = this.nextBatch;
    2567           0 :     final prevBatch = this.prevBatch;
    2568           0 :     final totalRoomCountEstimate = this.totalRoomCountEstimate;
    2569           0 :     return {
    2570           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
    2571           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    2572           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
    2573             :       if (totalRoomCountEstimate != null)
    2574           0 :         'total_room_count_estimate': totalRoomCountEstimate,
    2575             :     };
    2576             :   }
    2577             : 
    2578             :   /// A paginated chunk of public rooms.
    2579             :   List<PublicRoomsChunk> chunk;
    2580             : 
    2581             :   /// A pagination token for the response. The absence of this token
    2582             :   /// means there are no more results to fetch and the client should
    2583             :   /// stop paginating.
    2584             :   String? nextBatch;
    2585             : 
    2586             :   /// A pagination token that allows fetching previous results. The
    2587             :   /// absence of this token means there are no results before this
    2588             :   /// batch, i.e. this is the first batch.
    2589             :   String? prevBatch;
    2590             : 
    2591             :   /// An estimate on the total number of public rooms, if the
    2592             :   /// server has an estimate.
    2593             :   int? totalRoomCountEstimate;
    2594             : 
    2595           0 :   @override
    2596             :   bool operator ==(Object other) =>
    2597           0 :       other is GetPublicRoomsResponse &&
    2598           0 :       other.chunk == chunk &&
    2599           0 :       other.nextBatch == nextBatch &&
    2600           0 :       other.prevBatch == prevBatch &&
    2601           0 :       other.totalRoomCountEstimate == totalRoomCountEstimate;
    2602             : 
    2603           0 :   @override
    2604             :   int get hashCode =>
    2605           0 :       Object.hash(chunk, nextBatch, prevBatch, totalRoomCountEstimate);
    2606             : 
    2607           0 :   @override
    2608             :   String toString() {
    2609           0 :     return toJson().toString();
    2610             :   }
    2611             : }
    2612             : 
    2613             : ///
    2614             : @_NameSource('rule override spec')
    2615             : class PublicRoomQueryFilter {
    2616           0 :   PublicRoomQueryFilter({
    2617             :     this.genericSearchTerm,
    2618             :     this.roomTypes,
    2619             :   });
    2620             : 
    2621           0 :   PublicRoomQueryFilter.fromJson(Map<String, Object?> json)
    2622           0 :       : genericSearchTerm = ((v) =>
    2623           0 :             v != null ? v as String : null)(json['generic_search_term']),
    2624           0 :         roomTypes = ((v) => v != null
    2625             :             ? (v as List)
    2626           0 :                 .map((v) => ((v) => v != null ? v as String : null)(v))
    2627           0 :                 .toList()
    2628           0 :             : null)(json['room_types']);
    2629           0 :   Map<String, Object?> toJson() {
    2630           0 :     final genericSearchTerm = this.genericSearchTerm;
    2631           0 :     final roomTypes = this.roomTypes;
    2632           0 :     return {
    2633           0 :       if (genericSearchTerm != null) 'generic_search_term': genericSearchTerm,
    2634           0 :       if (roomTypes != null) 'room_types': roomTypes.map((v) => v).toList(),
    2635             :     };
    2636             :   }
    2637             : 
    2638             :   /// An optional string to search for in the room metadata, e.g. name,
    2639             :   /// topic, canonical alias, etc.
    2640             :   String? genericSearchTerm;
    2641             : 
    2642             :   /// An optional list of [room types](https://spec.matrix.org/unstable/client-server-api/#types) to search
    2643             :   /// for. To include rooms without a room type, specify `null` within this
    2644             :   /// list. When not specified, all applicable rooms (regardless of type)
    2645             :   /// are returned.
    2646             :   List<String?>? roomTypes;
    2647             : 
    2648           0 :   @override
    2649             :   bool operator ==(Object other) =>
    2650           0 :       other is PublicRoomQueryFilter &&
    2651           0 :       other.genericSearchTerm == genericSearchTerm &&
    2652           0 :       other.roomTypes == roomTypes;
    2653             : 
    2654           0 :   @override
    2655           0 :   int get hashCode => Object.hash(genericSearchTerm, roomTypes);
    2656             : 
    2657           0 :   @override
    2658             :   String toString() {
    2659           0 :     return toJson().toString();
    2660             :   }
    2661             : }
    2662             : 
    2663             : /// A list of the rooms on the server.
    2664             : @_NameSource('generated')
    2665             : class QueryPublicRoomsResponse {
    2666           0 :   QueryPublicRoomsResponse({
    2667             :     required this.chunk,
    2668             :     this.nextBatch,
    2669             :     this.prevBatch,
    2670             :     this.totalRoomCountEstimate,
    2671             :   });
    2672             : 
    2673           0 :   QueryPublicRoomsResponse.fromJson(Map<String, Object?> json)
    2674           0 :       : chunk = (json['chunk'] as List)
    2675           0 :             .map((v) => PublicRoomsChunk.fromJson(v as Map<String, Object?>))
    2676           0 :             .toList(),
    2677           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    2678           0 :         prevBatch = ((v) => v != null ? v as String : null)(json['prev_batch']),
    2679           0 :         totalRoomCountEstimate = ((v) =>
    2680           0 :             v != null ? v as int : null)(json['total_room_count_estimate']);
    2681           0 :   Map<String, Object?> toJson() {
    2682           0 :     final nextBatch = this.nextBatch;
    2683           0 :     final prevBatch = this.prevBatch;
    2684           0 :     final totalRoomCountEstimate = this.totalRoomCountEstimate;
    2685           0 :     return {
    2686           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
    2687           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    2688           0 :       if (prevBatch != null) 'prev_batch': prevBatch,
    2689             :       if (totalRoomCountEstimate != null)
    2690           0 :         'total_room_count_estimate': totalRoomCountEstimate,
    2691             :     };
    2692             :   }
    2693             : 
    2694             :   /// A paginated chunk of public rooms.
    2695             :   List<PublicRoomsChunk> chunk;
    2696             : 
    2697             :   /// A pagination token for the response. The absence of this token
    2698             :   /// means there are no more results to fetch and the client should
    2699             :   /// stop paginating.
    2700             :   String? nextBatch;
    2701             : 
    2702             :   /// A pagination token that allows fetching previous results. The
    2703             :   /// absence of this token means there are no results before this
    2704             :   /// batch, i.e. this is the first batch.
    2705             :   String? prevBatch;
    2706             : 
    2707             :   /// An estimate on the total number of public rooms, if the
    2708             :   /// server has an estimate.
    2709             :   int? totalRoomCountEstimate;
    2710             : 
    2711           0 :   @override
    2712             :   bool operator ==(Object other) =>
    2713           0 :       other is QueryPublicRoomsResponse &&
    2714           0 :       other.chunk == chunk &&
    2715           0 :       other.nextBatch == nextBatch &&
    2716           0 :       other.prevBatch == prevBatch &&
    2717           0 :       other.totalRoomCountEstimate == totalRoomCountEstimate;
    2718             : 
    2719           0 :   @override
    2720             :   int get hashCode =>
    2721           0 :       Object.hash(chunk, nextBatch, prevBatch, totalRoomCountEstimate);
    2722             : 
    2723           0 :   @override
    2724             :   String toString() {
    2725           0 :     return toJson().toString();
    2726             :   }
    2727             : }
    2728             : 
    2729             : ///
    2730             : @_NameSource('spec')
    2731             : class PusherData {
    2732           0 :   PusherData({
    2733             :     this.format,
    2734             :     this.url,
    2735             :     this.additionalProperties = const {},
    2736             :   });
    2737             : 
    2738           0 :   PusherData.fromJson(Map<String, Object?> json)
    2739           0 :       : format = ((v) => v != null ? v as String : null)(json['format']),
    2740           0 :         url = ((v) => v != null ? Uri.parse(v as String) : null)(json['url']),
    2741           0 :         additionalProperties = Map.fromEntries(json.entries
    2742           0 :             .where((e) => !['format', 'url'].contains(e.key))
    2743           0 :             .map((e) => MapEntry(e.key, e.value)));
    2744           0 :   Map<String, Object?> toJson() {
    2745           0 :     final format = this.format;
    2746           0 :     final url = this.url;
    2747           0 :     return {
    2748           0 :       ...additionalProperties,
    2749           0 :       if (format != null) 'format': format,
    2750           0 :       if (url != null) 'url': url.toString(),
    2751             :     };
    2752             :   }
    2753             : 
    2754             :   /// The format to use when sending notifications to the Push
    2755             :   /// Gateway.
    2756             :   String? format;
    2757             : 
    2758             :   /// Required if `kind` is `http`. The URL to use to send
    2759             :   /// notifications to.
    2760             :   Uri? url;
    2761             : 
    2762             :   Map<String, Object?> additionalProperties;
    2763             : 
    2764           0 :   @override
    2765             :   bool operator ==(Object other) =>
    2766           0 :       other is PusherData && other.format == format && other.url == url;
    2767             : 
    2768           0 :   @override
    2769           0 :   int get hashCode => Object.hash(format, url);
    2770             : 
    2771           0 :   @override
    2772             :   String toString() {
    2773           0 :     return toJson().toString();
    2774             :   }
    2775             : }
    2776             : 
    2777             : ///
    2778             : @_NameSource('spec')
    2779             : class PusherId {
    2780           0 :   PusherId({
    2781             :     required this.appId,
    2782             :     required this.pushkey,
    2783             :   });
    2784             : 
    2785           0 :   PusherId.fromJson(Map<String, Object?> json)
    2786           0 :       : appId = json['app_id'] as String,
    2787           0 :         pushkey = json['pushkey'] as String;
    2788           0 :   Map<String, Object?> toJson() => {
    2789           0 :         'app_id': appId,
    2790           0 :         'pushkey': pushkey,
    2791             :       };
    2792             : 
    2793             :   /// This is a reverse-DNS style identifier for the application.
    2794             :   /// Max length, 64 chars.
    2795             :   String appId;
    2796             : 
    2797             :   /// This is a unique identifier for this pusher. See `/set` for
    2798             :   /// more detail.
    2799             :   /// Max length, 512 bytes.
    2800             :   String pushkey;
    2801             : 
    2802           0 :   @override
    2803             :   bool operator ==(Object other) =>
    2804           0 :       other is PusherId && other.appId == appId && other.pushkey == pushkey;
    2805             : 
    2806           0 :   @override
    2807           0 :   int get hashCode => Object.hash(appId, pushkey);
    2808             : 
    2809           0 :   @override
    2810             :   String toString() {
    2811           0 :     return toJson().toString();
    2812             :   }
    2813             : }
    2814             : 
    2815             : ///
    2816             : @_NameSource('spec')
    2817             : class Pusher implements PusherId {
    2818           0 :   Pusher({
    2819             :     required this.appId,
    2820             :     required this.pushkey,
    2821             :     required this.appDisplayName,
    2822             :     required this.data,
    2823             :     required this.deviceDisplayName,
    2824             :     required this.kind,
    2825             :     required this.lang,
    2826             :     this.profileTag,
    2827             :   });
    2828             : 
    2829           0 :   Pusher.fromJson(Map<String, Object?> json)
    2830           0 :       : appId = json['app_id'] as String,
    2831           0 :         pushkey = json['pushkey'] as String,
    2832           0 :         appDisplayName = json['app_display_name'] as String,
    2833           0 :         data = PusherData.fromJson(json['data'] as Map<String, Object?>),
    2834           0 :         deviceDisplayName = json['device_display_name'] as String,
    2835           0 :         kind = json['kind'] as String,
    2836           0 :         lang = json['lang'] as String,
    2837             :         profileTag =
    2838           0 :             ((v) => v != null ? v as String : null)(json['profile_tag']);
    2839           0 :   @override
    2840             :   Map<String, Object?> toJson() {
    2841           0 :     final profileTag = this.profileTag;
    2842           0 :     return {
    2843           0 :       'app_id': appId,
    2844           0 :       'pushkey': pushkey,
    2845           0 :       'app_display_name': appDisplayName,
    2846           0 :       'data': data.toJson(),
    2847           0 :       'device_display_name': deviceDisplayName,
    2848           0 :       'kind': kind,
    2849           0 :       'lang': lang,
    2850           0 :       if (profileTag != null) 'profile_tag': profileTag,
    2851             :     };
    2852             :   }
    2853             : 
    2854             :   /// This is a reverse-DNS style identifier for the application.
    2855             :   /// Max length, 64 chars.
    2856             :   @override
    2857             :   String appId;
    2858             : 
    2859             :   /// This is a unique identifier for this pusher. See `/set` for
    2860             :   /// more detail.
    2861             :   /// Max length, 512 bytes.
    2862             :   @override
    2863             :   String pushkey;
    2864             : 
    2865             :   /// A string that will allow the user to identify what application
    2866             :   /// owns this pusher.
    2867             :   String appDisplayName;
    2868             : 
    2869             :   /// A dictionary of information for the pusher implementation
    2870             :   /// itself.
    2871             :   PusherData data;
    2872             : 
    2873             :   /// A string that will allow the user to identify what device owns
    2874             :   /// this pusher.
    2875             :   String deviceDisplayName;
    2876             : 
    2877             :   /// The kind of pusher. `"http"` is a pusher that
    2878             :   /// sends HTTP pokes.
    2879             :   String kind;
    2880             : 
    2881             :   /// The preferred language for receiving notifications (e.g. 'en'
    2882             :   /// or 'en-US')
    2883             :   String lang;
    2884             : 
    2885             :   /// This string determines which set of device specific rules this
    2886             :   /// pusher executes.
    2887             :   String? profileTag;
    2888             : 
    2889           0 :   @override
    2890             :   bool operator ==(Object other) =>
    2891           0 :       other is Pusher &&
    2892           0 :       other.appId == appId &&
    2893           0 :       other.pushkey == pushkey &&
    2894           0 :       other.appDisplayName == appDisplayName &&
    2895           0 :       other.data == data &&
    2896           0 :       other.deviceDisplayName == deviceDisplayName &&
    2897           0 :       other.kind == kind &&
    2898           0 :       other.lang == lang &&
    2899           0 :       other.profileTag == profileTag;
    2900             : 
    2901           0 :   @override
    2902           0 :   int get hashCode => Object.hash(appId, pushkey, appDisplayName, data,
    2903           0 :       deviceDisplayName, kind, lang, profileTag);
    2904             : 
    2905           0 :   @override
    2906             :   String toString() {
    2907           0 :     return toJson().toString();
    2908             :   }
    2909             : }
    2910             : 
    2911             : ///
    2912             : @_NameSource('spec')
    2913             : class PushCondition {
    2914          32 :   PushCondition({
    2915             :     this.is$,
    2916             :     this.key,
    2917             :     required this.kind,
    2918             :     this.pattern,
    2919             :     this.value,
    2920             :   });
    2921             : 
    2922          32 :   PushCondition.fromJson(Map<String, Object?> json)
    2923          96 :       : is$ = ((v) => v != null ? v as String : null)(json['is']),
    2924          96 :         key = ((v) => v != null ? v as String : null)(json['key']),
    2925          32 :         kind = json['kind'] as String,
    2926          96 :         pattern = ((v) => v != null ? v as String : null)(json['pattern']),
    2927          96 :         value = ((v) => v != null ? v as Object? : null)(json['value']);
    2928           2 :   Map<String, Object?> toJson() {
    2929           2 :     final is$ = this.is$;
    2930           2 :     final key = this.key;
    2931           2 :     final pattern = this.pattern;
    2932           2 :     final value = this.value;
    2933           2 :     return {
    2934           0 :       if (is$ != null) 'is': is$,
    2935           2 :       if (key != null) 'key': key,
    2936           4 :       'kind': kind,
    2937           2 :       if (pattern != null) 'pattern': pattern,
    2938           0 :       if (value != null) 'value': value,
    2939             :     };
    2940             :   }
    2941             : 
    2942             :   /// Required for `room_member_count` conditions. A decimal integer
    2943             :   /// optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches
    2944             :   /// rooms where the member count is strictly less than the given number and
    2945             :   /// so forth. If no prefix is present, this parameter defaults to ==.
    2946             :   String? is$;
    2947             : 
    2948             :   /// Required for `event_match`, `event_property_is` and `event_property_contains`
    2949             :   /// conditions. The dot-separated field of the event to match.
    2950             :   ///
    2951             :   /// Required for `sender_notification_permission` conditions. The field in
    2952             :   /// the power level event the user needs a minimum power level for. Fields
    2953             :   /// must be specified under the `notifications` property in the power level
    2954             :   /// event's `content`.
    2955             :   String? key;
    2956             : 
    2957             :   /// The kind of condition to apply. See [conditions](https://spec.matrix.org/unstable/client-server-api/#conditions-1) for
    2958             :   /// more information on the allowed kinds and how they work.
    2959             :   String kind;
    2960             : 
    2961             :   /// Required for `event_match` conditions. The [glob-style pattern](https://spec.matrix.org/unstable/appendices#glob-style-matching)
    2962             :   /// to match against.
    2963             :   String? pattern;
    2964             : 
    2965             :   /// Required for `event_property_is` and `event_property_contains` conditions.
    2966             :   /// A non-compound [canonical JSON](https://spec.matrix.org/unstable/appendices#canonical-json) value to match
    2967             :   /// against.
    2968             :   Object? value;
    2969             : 
    2970           0 :   @override
    2971             :   bool operator ==(Object other) =>
    2972           0 :       other is PushCondition &&
    2973           0 :       other.is$ == is$ &&
    2974           0 :       other.key == key &&
    2975           0 :       other.kind == kind &&
    2976           0 :       other.pattern == pattern &&
    2977           0 :       other.value == value;
    2978             : 
    2979           0 :   @override
    2980           0 :   int get hashCode => Object.hash(is$, key, kind, pattern, value);
    2981             : 
    2982           0 :   @override
    2983             :   String toString() {
    2984           0 :     return toJson().toString();
    2985             :   }
    2986             : }
    2987             : 
    2988             : ///
    2989             : @_NameSource('spec')
    2990             : class PushRule {
    2991          32 :   PushRule({
    2992             :     required this.actions,
    2993             :     this.conditions,
    2994             :     required this.default$,
    2995             :     required this.enabled,
    2996             :     this.pattern,
    2997             :     required this.ruleId,
    2998             :   });
    2999             : 
    3000          32 :   PushRule.fromJson(Map<String, Object?> json)
    3001         128 :       : actions = (json['actions'] as List).map((v) => v as Object?).toList(),
    3002          32 :         conditions = ((v) => v != null
    3003             :             ? (v as List)
    3004          96 :                 .map((v) => PushCondition.fromJson(v as Map<String, Object?>))
    3005          32 :                 .toList()
    3006          64 :             : null)(json['conditions']),
    3007          32 :         default$ = json['default'] as bool,
    3008          32 :         enabled = json['enabled'] as bool,
    3009          96 :         pattern = ((v) => v != null ? v as String : null)(json['pattern']),
    3010          32 :         ruleId = json['rule_id'] as String;
    3011           2 :   Map<String, Object?> toJson() {
    3012           2 :     final conditions = this.conditions;
    3013           2 :     final pattern = this.pattern;
    3014           2 :     return {
    3015          10 :       'actions': actions.map((v) => v).toList(),
    3016             :       if (conditions != null)
    3017          10 :         'conditions': conditions.map((v) => v.toJson()).toList(),
    3018           4 :       'default': default$,
    3019           4 :       'enabled': enabled,
    3020           0 :       if (pattern != null) 'pattern': pattern,
    3021           4 :       'rule_id': ruleId,
    3022             :     };
    3023             :   }
    3024             : 
    3025             :   /// The actions to perform when this rule is matched.
    3026             :   List<Object?> actions;
    3027             : 
    3028             :   /// The conditions that must hold true for an event in order for a rule to be
    3029             :   /// applied to an event. A rule with no conditions always matches. Only
    3030             :   /// applicable to `underride` and `override` rules.
    3031             :   List<PushCondition>? conditions;
    3032             : 
    3033             :   /// Whether this is a default rule, or has been set explicitly.
    3034             :   bool default$;
    3035             : 
    3036             :   /// Whether the push rule is enabled or not.
    3037             :   bool enabled;
    3038             : 
    3039             :   /// The [glob-style pattern](https://spec.matrix.org/unstable/appendices#glob-style-matching) to match against.
    3040             :   /// Only applicable to `content` rules.
    3041             :   String? pattern;
    3042             : 
    3043             :   /// The ID of this rule.
    3044             :   String ruleId;
    3045             : 
    3046           0 :   @override
    3047             :   bool operator ==(Object other) =>
    3048           0 :       other is PushRule &&
    3049           0 :       other.actions == actions &&
    3050           0 :       other.conditions == conditions &&
    3051           0 :       other.default$ == default$ &&
    3052           0 :       other.enabled == enabled &&
    3053           0 :       other.pattern == pattern &&
    3054           0 :       other.ruleId == ruleId;
    3055             : 
    3056           0 :   @override
    3057             :   int get hashCode =>
    3058           0 :       Object.hash(actions, conditions, default$, enabled, pattern, ruleId);
    3059             : 
    3060           2 :   @override
    3061             :   String toString() {
    3062           4 :     return toJson().toString();
    3063             :   }
    3064             : }
    3065             : 
    3066             : ///
    3067             : @_NameSource('rule override generated')
    3068             : class PushRuleSet {
    3069           2 :   PushRuleSet({
    3070             :     this.content,
    3071             :     this.overrideField,
    3072             :     this.room,
    3073             :     this.sender,
    3074             :     this.underride,
    3075             :   });
    3076             : 
    3077          32 :   PushRuleSet.fromJson(Map<String, Object?> json)
    3078          32 :       : content = ((v) => v != null
    3079             :             ? (v as List)
    3080          96 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    3081          32 :                 .toList()
    3082          64 :             : null)(json['content']),
    3083          32 :         overrideField = ((v) => v != null
    3084             :             ? (v as List)
    3085          96 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    3086          32 :                 .toList()
    3087          64 :             : null)(json['override']),
    3088          32 :         room = ((v) => v != null
    3089             :             ? (v as List)
    3090          96 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    3091          32 :                 .toList()
    3092          64 :             : null)(json['room']),
    3093          32 :         sender = ((v) => v != null
    3094             :             ? (v as List)
    3095          32 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    3096          32 :                 .toList()
    3097          64 :             : null)(json['sender']),
    3098          32 :         underride = ((v) => v != null
    3099             :             ? (v as List)
    3100          96 :                 .map((v) => PushRule.fromJson(v as Map<String, Object?>))
    3101          32 :                 .toList()
    3102          64 :             : null)(json['underride']);
    3103           0 :   Map<String, Object?> toJson() {
    3104           0 :     final content = this.content;
    3105           0 :     final overrideField = this.overrideField;
    3106           0 :     final room = this.room;
    3107           0 :     final sender = this.sender;
    3108           0 :     final underride = this.underride;
    3109           0 :     return {
    3110           0 :       if (content != null) 'content': content.map((v) => v.toJson()).toList(),
    3111             :       if (overrideField != null)
    3112           0 :         'override': overrideField.map((v) => v.toJson()).toList(),
    3113           0 :       if (room != null) 'room': room.map((v) => v.toJson()).toList(),
    3114           0 :       if (sender != null) 'sender': sender.map((v) => v.toJson()).toList(),
    3115             :       if (underride != null)
    3116           0 :         'underride': underride.map((v) => v.toJson()).toList(),
    3117             :     };
    3118             :   }
    3119             : 
    3120             :   ///
    3121             :   List<PushRule>? content;
    3122             : 
    3123             :   ///
    3124             :   List<PushRule>? overrideField;
    3125             : 
    3126             :   ///
    3127             :   List<PushRule>? room;
    3128             : 
    3129             :   ///
    3130             :   List<PushRule>? sender;
    3131             : 
    3132             :   ///
    3133             :   List<PushRule>? underride;
    3134             : 
    3135           0 :   @override
    3136             :   bool operator ==(Object other) =>
    3137           0 :       other is PushRuleSet &&
    3138           0 :       other.content == content &&
    3139           0 :       other.overrideField == overrideField &&
    3140           0 :       other.room == room &&
    3141           0 :       other.sender == sender &&
    3142           0 :       other.underride == underride;
    3143             : 
    3144           0 :   @override
    3145             :   int get hashCode =>
    3146           0 :       Object.hash(content, overrideField, room, sender, underride);
    3147             : 
    3148           0 :   @override
    3149             :   String toString() {
    3150           0 :     return toJson().toString();
    3151             :   }
    3152             : }
    3153             : 
    3154             : ///
    3155             : @_NameSource('rule override generated')
    3156             : @EnhancedEnum()
    3157             : enum PushRuleKind {
    3158             :   @EnhancedEnumValue(name: 'content')
    3159             :   content,
    3160             :   @EnhancedEnumValue(name: 'override')
    3161             :   overrideField,
    3162             :   @EnhancedEnumValue(name: 'room')
    3163             :   room,
    3164             :   @EnhancedEnumValue(name: 'sender')
    3165             :   sender,
    3166             :   @EnhancedEnumValue(name: 'underride')
    3167             :   underride
    3168             : }
    3169             : 
    3170             : ///
    3171             : @_NameSource('generated')
    3172             : class RefreshResponse {
    3173           0 :   RefreshResponse({
    3174             :     required this.accessToken,
    3175             :     this.expiresInMs,
    3176             :     this.refreshToken,
    3177             :   });
    3178             : 
    3179           1 :   RefreshResponse.fromJson(Map<String, Object?> json)
    3180           1 :       : accessToken = json['access_token'] as String,
    3181             :         expiresInMs =
    3182           3 :             ((v) => v != null ? v as int : null)(json['expires_in_ms']),
    3183             :         refreshToken =
    3184           3 :             ((v) => v != null ? v as String : null)(json['refresh_token']);
    3185           0 :   Map<String, Object?> toJson() {
    3186           0 :     final expiresInMs = this.expiresInMs;
    3187           0 :     final refreshToken = this.refreshToken;
    3188           0 :     return {
    3189           0 :       'access_token': accessToken,
    3190           0 :       if (expiresInMs != null) 'expires_in_ms': expiresInMs,
    3191           0 :       if (refreshToken != null) 'refresh_token': refreshToken,
    3192             :     };
    3193             :   }
    3194             : 
    3195             :   /// The new access token to use.
    3196             :   String accessToken;
    3197             : 
    3198             :   /// The lifetime of the access token, in milliseconds. If not
    3199             :   /// given, the client can assume that the access token will not
    3200             :   /// expire.
    3201             :   int? expiresInMs;
    3202             : 
    3203             :   /// The new refresh token to use when the access token needs to
    3204             :   /// be refreshed again. If not given, the old refresh token can
    3205             :   /// be re-used.
    3206             :   String? refreshToken;
    3207             : 
    3208           0 :   @override
    3209             :   bool operator ==(Object other) =>
    3210           0 :       other is RefreshResponse &&
    3211           0 :       other.accessToken == accessToken &&
    3212           0 :       other.expiresInMs == expiresInMs &&
    3213           0 :       other.refreshToken == refreshToken;
    3214             : 
    3215           0 :   @override
    3216           0 :   int get hashCode => Object.hash(accessToken, expiresInMs, refreshToken);
    3217             : 
    3218           0 :   @override
    3219             :   String toString() {
    3220           0 :     return toJson().toString();
    3221             :   }
    3222             : }
    3223             : 
    3224             : ///
    3225             : @_NameSource('rule override generated')
    3226             : @EnhancedEnum()
    3227             : enum AccountKind {
    3228             :   @EnhancedEnumValue(name: 'guest')
    3229             :   guest,
    3230             :   @EnhancedEnumValue(name: 'user')
    3231             :   user
    3232             : }
    3233             : 
    3234             : ///
    3235             : @_NameSource('generated')
    3236             : class RegisterResponse {
    3237           0 :   RegisterResponse({
    3238             :     this.accessToken,
    3239             :     this.deviceId,
    3240             :     this.expiresInMs,
    3241             :     this.homeServer,
    3242             :     this.refreshToken,
    3243             :     required this.userId,
    3244             :   });
    3245             : 
    3246           0 :   RegisterResponse.fromJson(Map<String, Object?> json)
    3247             :       : accessToken =
    3248           0 :             ((v) => v != null ? v as String : null)(json['access_token']),
    3249           0 :         deviceId = ((v) => v != null ? v as String : null)(json['device_id']),
    3250             :         expiresInMs =
    3251           0 :             ((v) => v != null ? v as int : null)(json['expires_in_ms']),
    3252             :         homeServer =
    3253           0 :             ((v) => v != null ? v as String : null)(json['home_server']),
    3254             :         refreshToken =
    3255           0 :             ((v) => v != null ? v as String : null)(json['refresh_token']),
    3256           0 :         userId = json['user_id'] as String;
    3257           0 :   Map<String, Object?> toJson() {
    3258           0 :     final accessToken = this.accessToken;
    3259           0 :     final deviceId = this.deviceId;
    3260           0 :     final expiresInMs = this.expiresInMs;
    3261           0 :     final homeServer = this.homeServer;
    3262           0 :     final refreshToken = this.refreshToken;
    3263           0 :     return {
    3264           0 :       if (accessToken != null) 'access_token': accessToken,
    3265           0 :       if (deviceId != null) 'device_id': deviceId,
    3266           0 :       if (expiresInMs != null) 'expires_in_ms': expiresInMs,
    3267           0 :       if (homeServer != null) 'home_server': homeServer,
    3268           0 :       if (refreshToken != null) 'refresh_token': refreshToken,
    3269           0 :       'user_id': userId,
    3270             :     };
    3271             :   }
    3272             : 
    3273             :   /// An access token for the account.
    3274             :   /// This access token can then be used to authorize other requests.
    3275             :   /// Required if the `inhibit_login` option is false.
    3276             :   String? accessToken;
    3277             : 
    3278             :   /// ID of the registered device. Will be the same as the
    3279             :   /// corresponding parameter in the request, if one was specified.
    3280             :   /// Required if the `inhibit_login` option is false.
    3281             :   String? deviceId;
    3282             : 
    3283             :   /// The lifetime of the access token, in milliseconds. Once
    3284             :   /// the access token has expired a new access token can be
    3285             :   /// obtained by using the provided refresh token. If no
    3286             :   /// refresh token is provided, the client will need to re-log in
    3287             :   /// to obtain a new access token. If not given, the client can
    3288             :   /// assume that the access token will not expire.
    3289             :   ///
    3290             :   /// Omitted if the `inhibit_login` option is true.
    3291             :   int? expiresInMs;
    3292             : 
    3293             :   /// The server_name of the homeserver on which the account has
    3294             :   /// been registered.
    3295             :   ///
    3296             :   /// **Deprecated**. Clients should extract the server_name from
    3297             :   /// `user_id` (by splitting at the first colon) if they require
    3298             :   /// it. Note also that `homeserver` is not spelt this way.
    3299             :   String? homeServer;
    3300             : 
    3301             :   /// A refresh token for the account. This token can be used to
    3302             :   /// obtain a new access token when it expires by calling the
    3303             :   /// `/refresh` endpoint.
    3304             :   ///
    3305             :   /// Omitted if the `inhibit_login` option is true.
    3306             :   String? refreshToken;
    3307             : 
    3308             :   /// The fully-qualified Matrix user ID (MXID) that has been registered.
    3309             :   ///
    3310             :   /// Any user ID returned by this API must conform to the grammar given in the
    3311             :   /// [Matrix specification](https://spec.matrix.org/unstable/appendices/#user-identifiers).
    3312             :   String userId;
    3313             : 
    3314           0 :   @override
    3315             :   bool operator ==(Object other) =>
    3316           0 :       other is RegisterResponse &&
    3317           0 :       other.accessToken == accessToken &&
    3318           0 :       other.deviceId == deviceId &&
    3319           0 :       other.expiresInMs == expiresInMs &&
    3320           0 :       other.homeServer == homeServer &&
    3321           0 :       other.refreshToken == refreshToken &&
    3322           0 :       other.userId == userId;
    3323             : 
    3324           0 :   @override
    3325           0 :   int get hashCode => Object.hash(
    3326           0 :       accessToken, deviceId, expiresInMs, homeServer, refreshToken, userId);
    3327             : 
    3328           0 :   @override
    3329             :   String toString() {
    3330           0 :     return toJson().toString();
    3331             :   }
    3332             : }
    3333             : 
    3334             : ///
    3335             : @_NameSource('spec')
    3336             : class RoomKeysUpdateResponse {
    3337           0 :   RoomKeysUpdateResponse({
    3338             :     required this.count,
    3339             :     required this.etag,
    3340             :   });
    3341             : 
    3342           4 :   RoomKeysUpdateResponse.fromJson(Map<String, Object?> json)
    3343           4 :       : count = json['count'] as int,
    3344           4 :         etag = json['etag'] as String;
    3345           0 :   Map<String, Object?> toJson() => {
    3346           0 :         'count': count,
    3347           0 :         'etag': etag,
    3348             :       };
    3349             : 
    3350             :   /// The number of keys stored in the backup
    3351             :   int count;
    3352             : 
    3353             :   /// The new etag value representing stored keys in the backup.
    3354             :   /// See `GET /room_keys/version/{version}` for more details.
    3355             :   String etag;
    3356             : 
    3357           0 :   @override
    3358             :   bool operator ==(Object other) =>
    3359           0 :       other is RoomKeysUpdateResponse &&
    3360           0 :       other.count == count &&
    3361           0 :       other.etag == etag;
    3362             : 
    3363           0 :   @override
    3364           0 :   int get hashCode => Object.hash(count, etag);
    3365             : 
    3366           0 :   @override
    3367             :   String toString() {
    3368           0 :     return toJson().toString();
    3369             :   }
    3370             : }
    3371             : 
    3372             : /// The key data
    3373             : @_NameSource('spec')
    3374             : class KeyBackupData {
    3375           4 :   KeyBackupData({
    3376             :     required this.firstMessageIndex,
    3377             :     required this.forwardedCount,
    3378             :     required this.isVerified,
    3379             :     required this.sessionData,
    3380             :   });
    3381             : 
    3382           1 :   KeyBackupData.fromJson(Map<String, Object?> json)
    3383           1 :       : firstMessageIndex = json['first_message_index'] as int,
    3384           1 :         forwardedCount = json['forwarded_count'] as int,
    3385           1 :         isVerified = json['is_verified'] as bool,
    3386           1 :         sessionData = json['session_data'] as Map<String, Object?>;
    3387           8 :   Map<String, Object?> toJson() => {
    3388           4 :         'first_message_index': firstMessageIndex,
    3389           4 :         'forwarded_count': forwardedCount,
    3390           4 :         'is_verified': isVerified,
    3391           4 :         'session_data': sessionData,
    3392             :       };
    3393             : 
    3394             :   /// The index of the first message in the session that the key can decrypt.
    3395             :   int firstMessageIndex;
    3396             : 
    3397             :   /// The number of times this key has been forwarded via key-sharing between devices.
    3398             :   int forwardedCount;
    3399             : 
    3400             :   /// Whether the device backing up the key verified the device that the key
    3401             :   /// is from.
    3402             :   bool isVerified;
    3403             : 
    3404             :   /// Algorithm-dependent data.  See the documentation for the backup
    3405             :   /// algorithms in [Server-side key backups](https://spec.matrix.org/unstable/client-server-api/#server-side-key-backups) for more information on the
    3406             :   /// expected format of the data.
    3407             :   Map<String, Object?> sessionData;
    3408             : 
    3409           0 :   @override
    3410             :   bool operator ==(Object other) =>
    3411           0 :       other is KeyBackupData &&
    3412           0 :       other.firstMessageIndex == firstMessageIndex &&
    3413           0 :       other.forwardedCount == forwardedCount &&
    3414           0 :       other.isVerified == isVerified &&
    3415           0 :       other.sessionData == sessionData;
    3416             : 
    3417           0 :   @override
    3418             :   int get hashCode =>
    3419           0 :       Object.hash(firstMessageIndex, forwardedCount, isVerified, sessionData);
    3420             : 
    3421           0 :   @override
    3422             :   String toString() {
    3423           0 :     return toJson().toString();
    3424             :   }
    3425             : }
    3426             : 
    3427             : /// The backed up keys for a room.
    3428             : @_NameSource('spec')
    3429             : class RoomKeyBackup {
    3430           4 :   RoomKeyBackup({
    3431             :     required this.sessions,
    3432             :   });
    3433             : 
    3434           1 :   RoomKeyBackup.fromJson(Map<String, Object?> json)
    3435           3 :       : sessions = (json['sessions'] as Map<String, Object?>).map((k, v) =>
    3436           2 :             MapEntry(k, KeyBackupData.fromJson(v as Map<String, Object?>)));
    3437           8 :   Map<String, Object?> toJson() => {
    3438          20 :         'sessions': sessions.map((k, v) => MapEntry(k, v.toJson())),
    3439             :       };
    3440             : 
    3441             :   /// A map of session IDs to key data.
    3442             :   Map<String, KeyBackupData> sessions;
    3443             : 
    3444           0 :   @override
    3445             :   bool operator ==(Object other) =>
    3446           0 :       other is RoomKeyBackup && other.sessions == sessions;
    3447             : 
    3448           0 :   @override
    3449           0 :   int get hashCode => sessions.hashCode;
    3450             : 
    3451           0 :   @override
    3452             :   String toString() {
    3453           0 :     return toJson().toString();
    3454             :   }
    3455             : }
    3456             : 
    3457             : ///
    3458             : @_NameSource('rule override generated')
    3459             : class RoomKeys {
    3460           4 :   RoomKeys({
    3461             :     required this.rooms,
    3462             :   });
    3463             : 
    3464           1 :   RoomKeys.fromJson(Map<String, Object?> json)
    3465           3 :       : rooms = (json['rooms'] as Map<String, Object?>).map((k, v) =>
    3466           2 :             MapEntry(k, RoomKeyBackup.fromJson(v as Map<String, Object?>)));
    3467           8 :   Map<String, Object?> toJson() => {
    3468          20 :         'rooms': rooms.map((k, v) => MapEntry(k, v.toJson())),
    3469             :       };
    3470             : 
    3471             :   /// A map of room IDs to room key backup data.
    3472             :   Map<String, RoomKeyBackup> rooms;
    3473             : 
    3474           0 :   @override
    3475           0 :   bool operator ==(Object other) => other is RoomKeys && other.rooms == rooms;
    3476             : 
    3477           0 :   @override
    3478           0 :   int get hashCode => rooms.hashCode;
    3479             : 
    3480           0 :   @override
    3481             :   String toString() {
    3482           0 :     return toJson().toString();
    3483             :   }
    3484             : }
    3485             : 
    3486             : ///
    3487             : @_NameSource('rule override generated')
    3488             : @EnhancedEnum()
    3489             : enum BackupAlgorithm {
    3490             :   @EnhancedEnumValue(name: 'm.megolm_backup.v1.curve25519-aes-sha2')
    3491             :   mMegolmBackupV1Curve25519AesSha2
    3492             : }
    3493             : 
    3494             : ///
    3495             : @_NameSource('generated')
    3496             : class GetRoomKeysVersionCurrentResponse {
    3497           0 :   GetRoomKeysVersionCurrentResponse({
    3498             :     required this.algorithm,
    3499             :     required this.authData,
    3500             :     required this.count,
    3501             :     required this.etag,
    3502             :     required this.version,
    3503             :   });
    3504             : 
    3505           5 :   GetRoomKeysVersionCurrentResponse.fromJson(Map<String, Object?> json)
    3506             :       : algorithm =
    3507          10 :             BackupAlgorithm.values.fromString(json['algorithm'] as String)!,
    3508           5 :         authData = json['auth_data'] as Map<String, Object?>,
    3509           5 :         count = json['count'] as int,
    3510           5 :         etag = json['etag'] as String,
    3511           5 :         version = json['version'] as String;
    3512           0 :   Map<String, Object?> toJson() => {
    3513           0 :         'algorithm': algorithm.name,
    3514           0 :         'auth_data': authData,
    3515           0 :         'count': count,
    3516           0 :         'etag': etag,
    3517           0 :         'version': version,
    3518             :       };
    3519             : 
    3520             :   /// The algorithm used for storing backups.
    3521             :   BackupAlgorithm algorithm;
    3522             : 
    3523             :   /// Algorithm-dependent data. See the documentation for the backup
    3524             :   /// algorithms in [Server-side key backups](https://spec.matrix.org/unstable/client-server-api/#server-side-key-backups) for more information on the
    3525             :   /// expected format of the data.
    3526             :   Map<String, Object?> authData;
    3527             : 
    3528             :   /// The number of keys stored in the backup.
    3529             :   int count;
    3530             : 
    3531             :   /// An opaque string representing stored keys in the backup.
    3532             :   /// Clients can compare it with the `etag` value they received
    3533             :   /// in the request of their last key storage request.  If not
    3534             :   /// equal, another client has modified the backup.
    3535             :   String etag;
    3536             : 
    3537             :   /// The backup version.
    3538             :   String version;
    3539             : 
    3540           0 :   @override
    3541             :   bool operator ==(Object other) =>
    3542           0 :       other is GetRoomKeysVersionCurrentResponse &&
    3543           0 :       other.algorithm == algorithm &&
    3544           0 :       other.authData == authData &&
    3545           0 :       other.count == count &&
    3546           0 :       other.etag == etag &&
    3547           0 :       other.version == version;
    3548             : 
    3549           0 :   @override
    3550           0 :   int get hashCode => Object.hash(algorithm, authData, count, etag, version);
    3551             : 
    3552           0 :   @override
    3553             :   String toString() {
    3554           0 :     return toJson().toString();
    3555             :   }
    3556             : }
    3557             : 
    3558             : ///
    3559             : @_NameSource('generated')
    3560             : class GetRoomKeysVersionResponse {
    3561           0 :   GetRoomKeysVersionResponse({
    3562             :     required this.algorithm,
    3563             :     required this.authData,
    3564             :     required this.count,
    3565             :     required this.etag,
    3566             :     required this.version,
    3567             :   });
    3568             : 
    3569           0 :   GetRoomKeysVersionResponse.fromJson(Map<String, Object?> json)
    3570             :       : algorithm =
    3571           0 :             BackupAlgorithm.values.fromString(json['algorithm'] as String)!,
    3572           0 :         authData = json['auth_data'] as Map<String, Object?>,
    3573           0 :         count = json['count'] as int,
    3574           0 :         etag = json['etag'] as String,
    3575           0 :         version = json['version'] as String;
    3576           0 :   Map<String, Object?> toJson() => {
    3577           0 :         'algorithm': algorithm.name,
    3578           0 :         'auth_data': authData,
    3579           0 :         'count': count,
    3580           0 :         'etag': etag,
    3581           0 :         'version': version,
    3582             :       };
    3583             : 
    3584             :   /// The algorithm used for storing backups.
    3585             :   BackupAlgorithm algorithm;
    3586             : 
    3587             :   /// Algorithm-dependent data. See the documentation for the backup
    3588             :   /// algorithms in [Server-side key backups](https://spec.matrix.org/unstable/client-server-api/#server-side-key-backups) for more information on the
    3589             :   /// expected format of the data.
    3590             :   Map<String, Object?> authData;
    3591             : 
    3592             :   /// The number of keys stored in the backup.
    3593             :   int count;
    3594             : 
    3595             :   /// An opaque string representing stored keys in the backup.
    3596             :   /// Clients can compare it with the `etag` value they received
    3597             :   /// in the request of their last key storage request.  If not
    3598             :   /// equal, another client has modified the backup.
    3599             :   String etag;
    3600             : 
    3601             :   /// The backup version.
    3602             :   String version;
    3603             : 
    3604           0 :   @override
    3605             :   bool operator ==(Object other) =>
    3606           0 :       other is GetRoomKeysVersionResponse &&
    3607           0 :       other.algorithm == algorithm &&
    3608           0 :       other.authData == authData &&
    3609           0 :       other.count == count &&
    3610           0 :       other.etag == etag &&
    3611           0 :       other.version == version;
    3612             : 
    3613           0 :   @override
    3614           0 :   int get hashCode => Object.hash(algorithm, authData, count, etag, version);
    3615             : 
    3616           0 :   @override
    3617             :   String toString() {
    3618           0 :     return toJson().toString();
    3619             :   }
    3620             : }
    3621             : 
    3622             : /// The events and state surrounding the requested event.
    3623             : @_NameSource('rule override generated')
    3624             : class EventContext {
    3625           0 :   EventContext({
    3626             :     this.end,
    3627             :     this.event,
    3628             :     this.eventsAfter,
    3629             :     this.eventsBefore,
    3630             :     this.start,
    3631             :     this.state,
    3632             :   });
    3633             : 
    3634           0 :   EventContext.fromJson(Map<String, Object?> json)
    3635           0 :       : end = ((v) => v != null ? v as String : null)(json['end']),
    3636           0 :         event = ((v) => v != null
    3637           0 :             ? MatrixEvent.fromJson(v as Map<String, Object?>)
    3638           0 :             : null)(json['event']),
    3639           0 :         eventsAfter = ((v) => v != null
    3640             :             ? (v as List)
    3641           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3642           0 :                 .toList()
    3643           0 :             : null)(json['events_after']),
    3644           0 :         eventsBefore = ((v) => v != null
    3645             :             ? (v as List)
    3646           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3647           0 :                 .toList()
    3648           0 :             : null)(json['events_before']),
    3649           0 :         start = ((v) => v != null ? v as String : null)(json['start']),
    3650           0 :         state = ((v) => v != null
    3651             :             ? (v as List)
    3652           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3653           0 :                 .toList()
    3654           0 :             : null)(json['state']);
    3655           0 :   Map<String, Object?> toJson() {
    3656           0 :     final end = this.end;
    3657           0 :     final event = this.event;
    3658           0 :     final eventsAfter = this.eventsAfter;
    3659           0 :     final eventsBefore = this.eventsBefore;
    3660           0 :     final start = this.start;
    3661           0 :     final state = this.state;
    3662           0 :     return {
    3663           0 :       if (end != null) 'end': end,
    3664           0 :       if (event != null) 'event': event.toJson(),
    3665             :       if (eventsAfter != null)
    3666           0 :         'events_after': eventsAfter.map((v) => v.toJson()).toList(),
    3667             :       if (eventsBefore != null)
    3668           0 :         'events_before': eventsBefore.map((v) => v.toJson()).toList(),
    3669           0 :       if (start != null) 'start': start,
    3670           0 :       if (state != null) 'state': state.map((v) => v.toJson()).toList(),
    3671             :     };
    3672             :   }
    3673             : 
    3674             :   /// A token that can be used to paginate forwards with.
    3675             :   String? end;
    3676             : 
    3677             :   /// Details of the requested event.
    3678             :   MatrixEvent? event;
    3679             : 
    3680             :   /// A list of room events that happened just after the
    3681             :   /// requested event, in chronological order.
    3682             :   List<MatrixEvent>? eventsAfter;
    3683             : 
    3684             :   /// A list of room events that happened just before the
    3685             :   /// requested event, in reverse-chronological order.
    3686             :   List<MatrixEvent>? eventsBefore;
    3687             : 
    3688             :   /// A token that can be used to paginate backwards with.
    3689             :   String? start;
    3690             : 
    3691             :   /// The state of the room at the last event returned.
    3692             :   List<MatrixEvent>? state;
    3693             : 
    3694           0 :   @override
    3695             :   bool operator ==(Object other) =>
    3696           0 :       other is EventContext &&
    3697           0 :       other.end == end &&
    3698           0 :       other.event == event &&
    3699           0 :       other.eventsAfter == eventsAfter &&
    3700           0 :       other.eventsBefore == eventsBefore &&
    3701           0 :       other.start == start &&
    3702           0 :       other.state == state;
    3703             : 
    3704           0 :   @override
    3705             :   int get hashCode =>
    3706           0 :       Object.hash(end, event, eventsAfter, eventsBefore, start, state);
    3707             : 
    3708           0 :   @override
    3709             :   String toString() {
    3710           0 :     return toJson().toString();
    3711             :   }
    3712             : }
    3713             : 
    3714             : ///
    3715             : @_NameSource('spec')
    3716             : class RoomMember {
    3717           0 :   RoomMember({
    3718             :     this.avatarUrl,
    3719             :     this.displayName,
    3720             :   });
    3721             : 
    3722           0 :   RoomMember.fromJson(Map<String, Object?> json)
    3723           0 :       : avatarUrl = ((v) =>
    3724           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    3725             :         displayName =
    3726           0 :             ((v) => v != null ? v as String : null)(json['display_name']);
    3727           0 :   Map<String, Object?> toJson() {
    3728           0 :     final avatarUrl = this.avatarUrl;
    3729           0 :     final displayName = this.displayName;
    3730           0 :     return {
    3731           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    3732           0 :       if (displayName != null) 'display_name': displayName,
    3733             :     };
    3734             :   }
    3735             : 
    3736             :   /// The avatar of the user this object is representing, as an [`mxc://` URI](https://spec.matrix.org/unstable/client-server-api/#matrix-content-mxc-uris).
    3737             :   Uri? avatarUrl;
    3738             : 
    3739             :   /// The display name of the user this object is representing.
    3740             :   String? displayName;
    3741             : 
    3742           0 :   @override
    3743             :   bool operator ==(Object other) =>
    3744           0 :       other is RoomMember &&
    3745           0 :       other.avatarUrl == avatarUrl &&
    3746           0 :       other.displayName == displayName;
    3747             : 
    3748           0 :   @override
    3749           0 :   int get hashCode => Object.hash(avatarUrl, displayName);
    3750             : 
    3751           0 :   @override
    3752             :   String toString() {
    3753           0 :     return toJson().toString();
    3754             :   }
    3755             : }
    3756             : 
    3757             : ///
    3758             : @_NameSource('(generated, rule override generated)')
    3759             : @EnhancedEnum()
    3760             : enum Membership {
    3761             :   @EnhancedEnumValue(name: 'ban')
    3762             :   ban,
    3763             :   @EnhancedEnumValue(name: 'invite')
    3764             :   invite,
    3765             :   @EnhancedEnumValue(name: 'join')
    3766             :   join,
    3767             :   @EnhancedEnumValue(name: 'knock')
    3768             :   knock,
    3769             :   @EnhancedEnumValue(name: 'leave')
    3770             :   leave
    3771             : }
    3772             : 
    3773             : /// A list of messages with a new token to request more.
    3774             : @_NameSource('generated')
    3775             : class GetRoomEventsResponse {
    3776           0 :   GetRoomEventsResponse({
    3777             :     required this.chunk,
    3778             :     this.end,
    3779             :     required this.start,
    3780             :     this.state,
    3781             :   });
    3782             : 
    3783           4 :   GetRoomEventsResponse.fromJson(Map<String, Object?> json)
    3784           4 :       : chunk = (json['chunk'] as List)
    3785          12 :             .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3786           4 :             .toList(),
    3787          12 :         end = ((v) => v != null ? v as String : null)(json['end']),
    3788           4 :         start = json['start'] as String,
    3789           4 :         state = ((v) => v != null
    3790             :             ? (v as List)
    3791           4 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    3792           4 :                 .toList()
    3793           8 :             : null)(json['state']);
    3794           0 :   Map<String, Object?> toJson() {
    3795           0 :     final end = this.end;
    3796           0 :     final state = this.state;
    3797           0 :     return {
    3798           0 :       'chunk': chunk.map((v) => v.toJson()).toList(),
    3799           0 :       if (end != null) 'end': end,
    3800           0 :       'start': start,
    3801           0 :       if (state != null) 'state': state.map((v) => v.toJson()).toList(),
    3802             :     };
    3803             :   }
    3804             : 
    3805             :   /// A list of room events. The order depends on the `dir` parameter.
    3806             :   /// For `dir=b` events will be in reverse-chronological order,
    3807             :   /// for `dir=f` in chronological order. (The exact definition of `chronological`
    3808             :   /// is dependent on the server implementation.)
    3809             :   ///
    3810             :   /// Note that an empty `chunk` does not *necessarily* imply that no more events
    3811             :   /// are available. Clients should continue to paginate until no `end` property
    3812             :   /// is returned.
    3813             :   List<MatrixEvent> chunk;
    3814             : 
    3815             :   /// A token corresponding to the end of `chunk`. This token can be passed
    3816             :   /// back to this endpoint to request further events.
    3817             :   ///
    3818             :   /// If no further events are available (either because we have
    3819             :   /// reached the start of the timeline, or because the user does
    3820             :   /// not have permission to see any more events), this property
    3821             :   /// is omitted from the response.
    3822             :   String? end;
    3823             : 
    3824             :   /// A token corresponding to the start of `chunk`. This will be the same as
    3825             :   /// the value given in `from`.
    3826             :   String start;
    3827             : 
    3828             :   /// A list of state events relevant to showing the `chunk`. For example, if
    3829             :   /// `lazy_load_members` is enabled in the filter then this may contain
    3830             :   /// the membership events for the senders of events in the `chunk`.
    3831             :   ///
    3832             :   /// Unless `include_redundant_members` is `true`, the server
    3833             :   /// may remove membership events which would have already been
    3834             :   /// sent to the client in prior calls to this endpoint, assuming
    3835             :   /// the membership of those members has not changed.
    3836             :   List<MatrixEvent>? state;
    3837             : 
    3838           0 :   @override
    3839             :   bool operator ==(Object other) =>
    3840           0 :       other is GetRoomEventsResponse &&
    3841           0 :       other.chunk == chunk &&
    3842           0 :       other.end == end &&
    3843           0 :       other.start == start &&
    3844           0 :       other.state == state;
    3845             : 
    3846           0 :   @override
    3847           0 :   int get hashCode => Object.hash(chunk, end, start, state);
    3848             : 
    3849           0 :   @override
    3850             :   String toString() {
    3851           0 :     return toJson().toString();
    3852             :   }
    3853             : }
    3854             : 
    3855             : ///
    3856             : @_NameSource('generated')
    3857             : @EnhancedEnum()
    3858             : enum ReceiptType {
    3859             :   @EnhancedEnumValue(name: 'm.fully_read')
    3860             :   mFullyRead,
    3861             :   @EnhancedEnumValue(name: 'm.read')
    3862             :   mRead,
    3863             :   @EnhancedEnumValue(name: 'm.read.private')
    3864             :   mReadPrivate
    3865             : }
    3866             : 
    3867             : ///
    3868             : @_NameSource('spec')
    3869             : class IncludeEventContext {
    3870           0 :   IncludeEventContext({
    3871             :     this.afterLimit,
    3872             :     this.beforeLimit,
    3873             :     this.includeProfile,
    3874             :   });
    3875             : 
    3876           0 :   IncludeEventContext.fromJson(Map<String, Object?> json)
    3877           0 :       : afterLimit = ((v) => v != null ? v as int : null)(json['after_limit']),
    3878             :         beforeLimit =
    3879           0 :             ((v) => v != null ? v as int : null)(json['before_limit']),
    3880             :         includeProfile =
    3881           0 :             ((v) => v != null ? v as bool : null)(json['include_profile']);
    3882           0 :   Map<String, Object?> toJson() {
    3883           0 :     final afterLimit = this.afterLimit;
    3884           0 :     final beforeLimit = this.beforeLimit;
    3885           0 :     final includeProfile = this.includeProfile;
    3886           0 :     return {
    3887           0 :       if (afterLimit != null) 'after_limit': afterLimit,
    3888           0 :       if (beforeLimit != null) 'before_limit': beforeLimit,
    3889           0 :       if (includeProfile != null) 'include_profile': includeProfile,
    3890             :     };
    3891             :   }
    3892             : 
    3893             :   /// How many events after the result are
    3894             :   /// returned. By default, this is `5`.
    3895             :   int? afterLimit;
    3896             : 
    3897             :   /// How many events before the result are
    3898             :   /// returned. By default, this is `5`.
    3899             :   int? beforeLimit;
    3900             : 
    3901             :   /// Requests that the server returns the
    3902             :   /// historic profile information for the users
    3903             :   /// that sent the events that were returned.
    3904             :   /// By default, this is `false`.
    3905             :   bool? includeProfile;
    3906             : 
    3907           0 :   @override
    3908             :   bool operator ==(Object other) =>
    3909           0 :       other is IncludeEventContext &&
    3910           0 :       other.afterLimit == afterLimit &&
    3911           0 :       other.beforeLimit == beforeLimit &&
    3912           0 :       other.includeProfile == includeProfile;
    3913             : 
    3914           0 :   @override
    3915           0 :   int get hashCode => Object.hash(afterLimit, beforeLimit, includeProfile);
    3916             : 
    3917           0 :   @override
    3918             :   String toString() {
    3919           0 :     return toJson().toString();
    3920             :   }
    3921             : }
    3922             : 
    3923             : ///
    3924             : @_NameSource('spec')
    3925             : class EventFilter {
    3926           0 :   EventFilter({
    3927             :     this.limit,
    3928             :     this.notSenders,
    3929             :     this.notTypes,
    3930             :     this.senders,
    3931             :     this.types,
    3932             :   });
    3933             : 
    3934           0 :   EventFilter.fromJson(Map<String, Object?> json)
    3935           0 :       : limit = ((v) => v != null ? v as int : null)(json['limit']),
    3936           0 :         notSenders = ((v) => v != null
    3937           0 :             ? (v as List).map((v) => v as String).toList()
    3938           0 :             : null)(json['not_senders']),
    3939           0 :         notTypes = ((v) => v != null
    3940           0 :             ? (v as List).map((v) => v as String).toList()
    3941           0 :             : null)(json['not_types']),
    3942           0 :         senders = ((v) => v != null
    3943           0 :             ? (v as List).map((v) => v as String).toList()
    3944           0 :             : null)(json['senders']),
    3945           0 :         types = ((v) => v != null
    3946           0 :             ? (v as List).map((v) => v as String).toList()
    3947           0 :             : null)(json['types']);
    3948           0 :   Map<String, Object?> toJson() {
    3949           0 :     final limit = this.limit;
    3950           0 :     final notSenders = this.notSenders;
    3951           0 :     final notTypes = this.notTypes;
    3952           0 :     final senders = this.senders;
    3953           0 :     final types = this.types;
    3954           0 :     return {
    3955           0 :       if (limit != null) 'limit': limit,
    3956           0 :       if (notSenders != null) 'not_senders': notSenders.map((v) => v).toList(),
    3957           0 :       if (notTypes != null) 'not_types': notTypes.map((v) => v).toList(),
    3958           0 :       if (senders != null) 'senders': senders.map((v) => v).toList(),
    3959           0 :       if (types != null) 'types': types.map((v) => v).toList(),
    3960             :     };
    3961             :   }
    3962             : 
    3963             :   /// The maximum number of events to return, must be an integer greater than 0.
    3964             :   ///
    3965             :   /// Servers should apply a default value, and impose a maximum value to avoid
    3966             :   /// resource exhaustion.
    3967             :   ///
    3968             :   int? limit;
    3969             : 
    3970             :   /// 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.
    3971             :   List<String>? notSenders;
    3972             : 
    3973             :   /// 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.
    3974             :   List<String>? notTypes;
    3975             : 
    3976             :   /// A list of senders IDs to include. If this list is absent then all senders are included.
    3977             :   List<String>? senders;
    3978             : 
    3979             :   /// 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.
    3980             :   List<String>? types;
    3981             : 
    3982           0 :   @override
    3983             :   bool operator ==(Object other) =>
    3984           0 :       other is EventFilter &&
    3985           0 :       other.limit == limit &&
    3986           0 :       other.notSenders == notSenders &&
    3987           0 :       other.notTypes == notTypes &&
    3988           0 :       other.senders == senders &&
    3989           0 :       other.types == types;
    3990             : 
    3991           0 :   @override
    3992           0 :   int get hashCode => Object.hash(limit, notSenders, notTypes, senders, types);
    3993             : 
    3994           0 :   @override
    3995             :   String toString() {
    3996           0 :     return toJson().toString();
    3997             :   }
    3998             : }
    3999             : 
    4000             : ///
    4001             : @_NameSource('spec')
    4002             : class RoomEventFilter {
    4003           0 :   RoomEventFilter({
    4004             :     this.containsUrl,
    4005             :     this.includeRedundantMembers,
    4006             :     this.lazyLoadMembers,
    4007             :     this.notRooms,
    4008             :     this.rooms,
    4009             :     this.unreadThreadNotifications,
    4010             :   });
    4011             : 
    4012           0 :   RoomEventFilter.fromJson(Map<String, Object?> json)
    4013             :       : containsUrl =
    4014           0 :             ((v) => v != null ? v as bool : null)(json['contains_url']),
    4015           0 :         includeRedundantMembers = ((v) =>
    4016           0 :             v != null ? v as bool : null)(json['include_redundant_members']),
    4017             :         lazyLoadMembers =
    4018           0 :             ((v) => v != null ? v as bool : null)(json['lazy_load_members']),
    4019           0 :         notRooms = ((v) => v != null
    4020           0 :             ? (v as List).map((v) => v as String).toList()
    4021           0 :             : null)(json['not_rooms']),
    4022           0 :         rooms = ((v) => v != null
    4023           0 :             ? (v as List).map((v) => v as String).toList()
    4024           0 :             : null)(json['rooms']),
    4025           0 :         unreadThreadNotifications = ((v) =>
    4026           0 :             v != null ? v as bool : null)(json['unread_thread_notifications']);
    4027           0 :   Map<String, Object?> toJson() {
    4028           0 :     final containsUrl = this.containsUrl;
    4029           0 :     final includeRedundantMembers = this.includeRedundantMembers;
    4030           0 :     final lazyLoadMembers = this.lazyLoadMembers;
    4031           0 :     final notRooms = this.notRooms;
    4032           0 :     final rooms = this.rooms;
    4033           0 :     final unreadThreadNotifications = this.unreadThreadNotifications;
    4034           0 :     return {
    4035           0 :       if (containsUrl != null) 'contains_url': containsUrl,
    4036             :       if (includeRedundantMembers != null)
    4037           0 :         'include_redundant_members': includeRedundantMembers,
    4038           0 :       if (lazyLoadMembers != null) 'lazy_load_members': lazyLoadMembers,
    4039           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    4040           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    4041             :       if (unreadThreadNotifications != null)
    4042           0 :         'unread_thread_notifications': unreadThreadNotifications,
    4043             :     };
    4044             :   }
    4045             : 
    4046             :   /// 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.
    4047             :   bool? containsUrl;
    4048             : 
    4049             :   /// If `true`, sends all membership events for all events, even if they have already
    4050             :   /// been sent to the client. Does not
    4051             :   /// apply unless `lazy_load_members` is `true`. See
    4052             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    4053             :   /// for more information. Defaults to `false`.
    4054             :   bool? includeRedundantMembers;
    4055             : 
    4056             :   /// If `true`, enables lazy-loading of membership events. See
    4057             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    4058             :   /// for more information. Defaults to `false`.
    4059             :   bool? lazyLoadMembers;
    4060             : 
    4061             :   /// 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.
    4062             :   List<String>? notRooms;
    4063             : 
    4064             :   /// A list of room IDs to include. If this list is absent then all rooms are included.
    4065             :   List<String>? rooms;
    4066             : 
    4067             :   /// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
    4068             :   /// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
    4069             :   bool? unreadThreadNotifications;
    4070             : 
    4071           0 :   @override
    4072             :   bool operator ==(Object other) =>
    4073           0 :       other is RoomEventFilter &&
    4074           0 :       other.containsUrl == containsUrl &&
    4075           0 :       other.includeRedundantMembers == includeRedundantMembers &&
    4076           0 :       other.lazyLoadMembers == lazyLoadMembers &&
    4077           0 :       other.notRooms == notRooms &&
    4078           0 :       other.rooms == rooms &&
    4079           0 :       other.unreadThreadNotifications == unreadThreadNotifications;
    4080             : 
    4081           0 :   @override
    4082           0 :   int get hashCode => Object.hash(containsUrl, includeRedundantMembers,
    4083           0 :       lazyLoadMembers, notRooms, rooms, unreadThreadNotifications);
    4084             : 
    4085           0 :   @override
    4086             :   String toString() {
    4087           0 :     return toJson().toString();
    4088             :   }
    4089             : }
    4090             : 
    4091             : ///
    4092             : @_NameSource('rule override generated')
    4093             : class SearchFilter implements EventFilter, RoomEventFilter {
    4094           0 :   SearchFilter({
    4095             :     this.limit,
    4096             :     this.notSenders,
    4097             :     this.notTypes,
    4098             :     this.senders,
    4099             :     this.types,
    4100             :     this.containsUrl,
    4101             :     this.includeRedundantMembers,
    4102             :     this.lazyLoadMembers,
    4103             :     this.notRooms,
    4104             :     this.rooms,
    4105             :     this.unreadThreadNotifications,
    4106             :   });
    4107             : 
    4108           0 :   SearchFilter.fromJson(Map<String, Object?> json)
    4109           0 :       : limit = ((v) => v != null ? v as int : null)(json['limit']),
    4110           0 :         notSenders = ((v) => v != null
    4111           0 :             ? (v as List).map((v) => v as String).toList()
    4112           0 :             : null)(json['not_senders']),
    4113           0 :         notTypes = ((v) => v != null
    4114           0 :             ? (v as List).map((v) => v as String).toList()
    4115           0 :             : null)(json['not_types']),
    4116           0 :         senders = ((v) => v != null
    4117           0 :             ? (v as List).map((v) => v as String).toList()
    4118           0 :             : null)(json['senders']),
    4119           0 :         types = ((v) => v != null
    4120           0 :             ? (v as List).map((v) => v as String).toList()
    4121           0 :             : null)(json['types']),
    4122             :         containsUrl =
    4123           0 :             ((v) => v != null ? v as bool : null)(json['contains_url']),
    4124           0 :         includeRedundantMembers = ((v) =>
    4125           0 :             v != null ? v as bool : null)(json['include_redundant_members']),
    4126             :         lazyLoadMembers =
    4127           0 :             ((v) => v != null ? v as bool : null)(json['lazy_load_members']),
    4128           0 :         notRooms = ((v) => v != null
    4129           0 :             ? (v as List).map((v) => v as String).toList()
    4130           0 :             : null)(json['not_rooms']),
    4131           0 :         rooms = ((v) => v != null
    4132           0 :             ? (v as List).map((v) => v as String).toList()
    4133           0 :             : null)(json['rooms']),
    4134           0 :         unreadThreadNotifications = ((v) =>
    4135           0 :             v != null ? v as bool : null)(json['unread_thread_notifications']);
    4136           0 :   @override
    4137             :   Map<String, Object?> toJson() {
    4138           0 :     final limit = this.limit;
    4139           0 :     final notSenders = this.notSenders;
    4140           0 :     final notTypes = this.notTypes;
    4141           0 :     final senders = this.senders;
    4142           0 :     final types = this.types;
    4143           0 :     final containsUrl = this.containsUrl;
    4144           0 :     final includeRedundantMembers = this.includeRedundantMembers;
    4145           0 :     final lazyLoadMembers = this.lazyLoadMembers;
    4146           0 :     final notRooms = this.notRooms;
    4147           0 :     final rooms = this.rooms;
    4148           0 :     final unreadThreadNotifications = this.unreadThreadNotifications;
    4149           0 :     return {
    4150           0 :       if (limit != null) 'limit': limit,
    4151           0 :       if (notSenders != null) 'not_senders': notSenders.map((v) => v).toList(),
    4152           0 :       if (notTypes != null) 'not_types': notTypes.map((v) => v).toList(),
    4153           0 :       if (senders != null) 'senders': senders.map((v) => v).toList(),
    4154           0 :       if (types != null) 'types': types.map((v) => v).toList(),
    4155           0 :       if (containsUrl != null) 'contains_url': containsUrl,
    4156             :       if (includeRedundantMembers != null)
    4157           0 :         'include_redundant_members': includeRedundantMembers,
    4158           0 :       if (lazyLoadMembers != null) 'lazy_load_members': lazyLoadMembers,
    4159           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    4160           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    4161             :       if (unreadThreadNotifications != null)
    4162           0 :         'unread_thread_notifications': unreadThreadNotifications,
    4163             :     };
    4164             :   }
    4165             : 
    4166             :   /// The maximum number of events to return, must be an integer greater than 0.
    4167             :   ///
    4168             :   /// Servers should apply a default value, and impose a maximum value to avoid
    4169             :   /// resource exhaustion.
    4170             :   ///
    4171             :   @override
    4172             :   int? limit;
    4173             : 
    4174             :   /// 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.
    4175             :   @override
    4176             :   List<String>? notSenders;
    4177             : 
    4178             :   /// 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.
    4179             :   @override
    4180             :   List<String>? notTypes;
    4181             : 
    4182             :   /// A list of senders IDs to include. If this list is absent then all senders are included.
    4183             :   @override
    4184             :   List<String>? senders;
    4185             : 
    4186             :   /// 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.
    4187             :   @override
    4188             :   List<String>? types;
    4189             : 
    4190             :   /// 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.
    4191             :   @override
    4192             :   bool? containsUrl;
    4193             : 
    4194             :   /// If `true`, sends all membership events for all events, even if they have already
    4195             :   /// been sent to the client. Does not
    4196             :   /// apply unless `lazy_load_members` is `true`. See
    4197             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    4198             :   /// for more information. Defaults to `false`.
    4199             :   @override
    4200             :   bool? includeRedundantMembers;
    4201             : 
    4202             :   /// If `true`, enables lazy-loading of membership events. See
    4203             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    4204             :   /// for more information. Defaults to `false`.
    4205             :   @override
    4206             :   bool? lazyLoadMembers;
    4207             : 
    4208             :   /// 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.
    4209             :   @override
    4210             :   List<String>? notRooms;
    4211             : 
    4212             :   /// A list of room IDs to include. If this list is absent then all rooms are included.
    4213             :   @override
    4214             :   List<String>? rooms;
    4215             : 
    4216             :   /// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
    4217             :   /// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
    4218             :   @override
    4219             :   bool? unreadThreadNotifications;
    4220             : 
    4221           0 :   @override
    4222             :   bool operator ==(Object other) =>
    4223           0 :       other is SearchFilter &&
    4224           0 :       other.limit == limit &&
    4225           0 :       other.notSenders == notSenders &&
    4226           0 :       other.notTypes == notTypes &&
    4227           0 :       other.senders == senders &&
    4228           0 :       other.types == types &&
    4229           0 :       other.containsUrl == containsUrl &&
    4230           0 :       other.includeRedundantMembers == includeRedundantMembers &&
    4231           0 :       other.lazyLoadMembers == lazyLoadMembers &&
    4232           0 :       other.notRooms == notRooms &&
    4233           0 :       other.rooms == rooms &&
    4234           0 :       other.unreadThreadNotifications == unreadThreadNotifications;
    4235             : 
    4236           0 :   @override
    4237           0 :   int get hashCode => Object.hash(
    4238           0 :       limit,
    4239           0 :       notSenders,
    4240           0 :       notTypes,
    4241           0 :       senders,
    4242           0 :       types,
    4243           0 :       containsUrl,
    4244           0 :       includeRedundantMembers,
    4245           0 :       lazyLoadMembers,
    4246           0 :       notRooms,
    4247           0 :       rooms,
    4248           0 :       unreadThreadNotifications);
    4249             : 
    4250           0 :   @override
    4251             :   String toString() {
    4252           0 :     return toJson().toString();
    4253             :   }
    4254             : }
    4255             : 
    4256             : ///
    4257             : @_NameSource('rule override generated')
    4258             : @EnhancedEnum()
    4259             : enum GroupKey {
    4260             :   @EnhancedEnumValue(name: 'room_id')
    4261             :   roomId,
    4262             :   @EnhancedEnumValue(name: 'sender')
    4263             :   sender
    4264             : }
    4265             : 
    4266             : /// Configuration for group.
    4267             : @_NameSource('spec')
    4268             : class Group {
    4269           0 :   Group({
    4270             :     this.key,
    4271             :   });
    4272             : 
    4273           0 :   Group.fromJson(Map<String, Object?> json)
    4274           0 :       : key = ((v) => v != null
    4275           0 :             ? GroupKey.values.fromString(v as String)!
    4276           0 :             : null)(json['key']);
    4277           0 :   Map<String, Object?> toJson() {
    4278           0 :     final key = this.key;
    4279           0 :     return {
    4280           0 :       if (key != null) 'key': key.name,
    4281             :     };
    4282             :   }
    4283             : 
    4284             :   /// Key that defines the group.
    4285             :   GroupKey? key;
    4286             : 
    4287           0 :   @override
    4288           0 :   bool operator ==(Object other) => other is Group && other.key == key;
    4289             : 
    4290           0 :   @override
    4291           0 :   int get hashCode => key.hashCode;
    4292             : 
    4293           0 :   @override
    4294             :   String toString() {
    4295           0 :     return toJson().toString();
    4296             :   }
    4297             : }
    4298             : 
    4299             : ///
    4300             : @_NameSource('spec')
    4301             : class Groupings {
    4302           0 :   Groupings({
    4303             :     this.groupBy,
    4304             :   });
    4305             : 
    4306           0 :   Groupings.fromJson(Map<String, Object?> json)
    4307           0 :       : groupBy = ((v) => v != null
    4308             :             ? (v as List)
    4309           0 :                 .map((v) => Group.fromJson(v as Map<String, Object?>))
    4310           0 :                 .toList()
    4311           0 :             : null)(json['group_by']);
    4312           0 :   Map<String, Object?> toJson() {
    4313           0 :     final groupBy = this.groupBy;
    4314           0 :     return {
    4315           0 :       if (groupBy != null) 'group_by': groupBy.map((v) => v.toJson()).toList(),
    4316             :     };
    4317             :   }
    4318             : 
    4319             :   /// List of groups to request.
    4320             :   List<Group>? groupBy;
    4321             : 
    4322           0 :   @override
    4323             :   bool operator ==(Object other) =>
    4324           0 :       other is Groupings && other.groupBy == groupBy;
    4325             : 
    4326           0 :   @override
    4327           0 :   int get hashCode => groupBy.hashCode;
    4328             : 
    4329           0 :   @override
    4330             :   String toString() {
    4331           0 :     return toJson().toString();
    4332             :   }
    4333             : }
    4334             : 
    4335             : ///
    4336             : @_NameSource('rule override generated')
    4337             : @EnhancedEnum()
    4338             : enum KeyKind {
    4339             :   @EnhancedEnumValue(name: 'content.body')
    4340             :   contentBody,
    4341             :   @EnhancedEnumValue(name: 'content.name')
    4342             :   contentName,
    4343             :   @EnhancedEnumValue(name: 'content.topic')
    4344             :   contentTopic
    4345             : }
    4346             : 
    4347             : ///
    4348             : @_NameSource('rule override generated')
    4349             : @EnhancedEnum()
    4350             : enum SearchOrder {
    4351             :   @EnhancedEnumValue(name: 'rank')
    4352             :   rank,
    4353             :   @EnhancedEnumValue(name: 'recent')
    4354             :   recent
    4355             : }
    4356             : 
    4357             : ///
    4358             : @_NameSource('spec')
    4359             : class RoomEventsCriteria {
    4360           0 :   RoomEventsCriteria({
    4361             :     this.eventContext,
    4362             :     this.filter,
    4363             :     this.groupings,
    4364             :     this.includeState,
    4365             :     this.keys,
    4366             :     this.orderBy,
    4367             :     required this.searchTerm,
    4368             :   });
    4369             : 
    4370           0 :   RoomEventsCriteria.fromJson(Map<String, Object?> json)
    4371           0 :       : eventContext = ((v) => v != null
    4372           0 :             ? IncludeEventContext.fromJson(v as Map<String, Object?>)
    4373           0 :             : null)(json['event_context']),
    4374           0 :         filter = ((v) => v != null
    4375           0 :             ? SearchFilter.fromJson(v as Map<String, Object?>)
    4376           0 :             : null)(json['filter']),
    4377           0 :         groupings = ((v) => v != null
    4378           0 :             ? Groupings.fromJson(v as Map<String, Object?>)
    4379           0 :             : null)(json['groupings']),
    4380             :         includeState =
    4381           0 :             ((v) => v != null ? v as bool : null)(json['include_state']),
    4382           0 :         keys = ((v) => v != null
    4383             :             ? (v as List)
    4384           0 :                 .map((v) => KeyKind.values.fromString(v as String)!)
    4385           0 :                 .toList()
    4386           0 :             : null)(json['keys']),
    4387           0 :         orderBy = ((v) => v != null
    4388           0 :             ? SearchOrder.values.fromString(v as String)!
    4389           0 :             : null)(json['order_by']),
    4390           0 :         searchTerm = json['search_term'] as String;
    4391           0 :   Map<String, Object?> toJson() {
    4392           0 :     final eventContext = this.eventContext;
    4393           0 :     final filter = this.filter;
    4394           0 :     final groupings = this.groupings;
    4395           0 :     final includeState = this.includeState;
    4396           0 :     final keys = this.keys;
    4397           0 :     final orderBy = this.orderBy;
    4398           0 :     return {
    4399           0 :       if (eventContext != null) 'event_context': eventContext.toJson(),
    4400           0 :       if (filter != null) 'filter': filter.toJson(),
    4401           0 :       if (groupings != null) 'groupings': groupings.toJson(),
    4402           0 :       if (includeState != null) 'include_state': includeState,
    4403           0 :       if (keys != null) 'keys': keys.map((v) => v.name).toList(),
    4404           0 :       if (orderBy != null) 'order_by': orderBy.name,
    4405           0 :       'search_term': searchTerm,
    4406             :     };
    4407             :   }
    4408             : 
    4409             :   /// Configures whether any context for the events
    4410             :   /// returned are included in the response.
    4411             :   IncludeEventContext? eventContext;
    4412             : 
    4413             :   /// This takes a [filter](https://spec.matrix.org/unstable/client-server-api/#filtering).
    4414             :   SearchFilter? filter;
    4415             : 
    4416             :   /// Requests that the server partitions the result set
    4417             :   /// based on the provided list of keys.
    4418             :   Groupings? groupings;
    4419             : 
    4420             :   /// Requests the server return the current state for
    4421             :   /// each room returned.
    4422             :   bool? includeState;
    4423             : 
    4424             :   /// The keys to search. Defaults to all.
    4425             :   List<KeyKind>? keys;
    4426             : 
    4427             :   /// The order in which to search for results.
    4428             :   /// By default, this is `"rank"`.
    4429             :   SearchOrder? orderBy;
    4430             : 
    4431             :   /// The string to search events for
    4432             :   String searchTerm;
    4433             : 
    4434           0 :   @override
    4435             :   bool operator ==(Object other) =>
    4436           0 :       other is RoomEventsCriteria &&
    4437           0 :       other.eventContext == eventContext &&
    4438           0 :       other.filter == filter &&
    4439           0 :       other.groupings == groupings &&
    4440           0 :       other.includeState == includeState &&
    4441           0 :       other.keys == keys &&
    4442           0 :       other.orderBy == orderBy &&
    4443           0 :       other.searchTerm == searchTerm;
    4444             : 
    4445           0 :   @override
    4446           0 :   int get hashCode => Object.hash(
    4447           0 :       eventContext, filter, groupings, includeState, keys, orderBy, searchTerm);
    4448             : 
    4449           0 :   @override
    4450             :   String toString() {
    4451           0 :     return toJson().toString();
    4452             :   }
    4453             : }
    4454             : 
    4455             : ///
    4456             : @_NameSource('spec')
    4457             : class Categories {
    4458           0 :   Categories({
    4459             :     this.roomEvents,
    4460             :   });
    4461             : 
    4462           0 :   Categories.fromJson(Map<String, Object?> json)
    4463           0 :       : roomEvents = ((v) => v != null
    4464           0 :             ? RoomEventsCriteria.fromJson(v as Map<String, Object?>)
    4465           0 :             : null)(json['room_events']);
    4466           0 :   Map<String, Object?> toJson() {
    4467           0 :     final roomEvents = this.roomEvents;
    4468           0 :     return {
    4469           0 :       if (roomEvents != null) 'room_events': roomEvents.toJson(),
    4470             :     };
    4471             :   }
    4472             : 
    4473             :   /// Mapping of category name to search criteria.
    4474             :   RoomEventsCriteria? roomEvents;
    4475             : 
    4476           0 :   @override
    4477             :   bool operator ==(Object other) =>
    4478           0 :       other is Categories && other.roomEvents == roomEvents;
    4479             : 
    4480           0 :   @override
    4481           0 :   int get hashCode => roomEvents.hashCode;
    4482             : 
    4483           0 :   @override
    4484             :   String toString() {
    4485           0 :     return toJson().toString();
    4486             :   }
    4487             : }
    4488             : 
    4489             : /// The results for a particular group value.
    4490             : @_NameSource('spec')
    4491             : class GroupValue {
    4492           0 :   GroupValue({
    4493             :     this.nextBatch,
    4494             :     this.order,
    4495             :     this.results,
    4496             :   });
    4497             : 
    4498           0 :   GroupValue.fromJson(Map<String, Object?> json)
    4499           0 :       : nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    4500           0 :         order = ((v) => v != null ? v as int : null)(json['order']),
    4501           0 :         results = ((v) => v != null
    4502           0 :             ? (v as List).map((v) => v as String).toList()
    4503           0 :             : null)(json['results']);
    4504           0 :   Map<String, Object?> toJson() {
    4505           0 :     final nextBatch = this.nextBatch;
    4506           0 :     final order = this.order;
    4507           0 :     final results = this.results;
    4508           0 :     return {
    4509           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    4510           0 :       if (order != null) 'order': order,
    4511           0 :       if (results != null) 'results': results.map((v) => v).toList(),
    4512             :     };
    4513             :   }
    4514             : 
    4515             :   /// Token that can be used to get the next batch
    4516             :   /// of results in the group, by passing as the
    4517             :   /// `next_batch` parameter to the next call. If
    4518             :   /// this field is absent, there are no more
    4519             :   /// results in this group.
    4520             :   String? nextBatch;
    4521             : 
    4522             :   /// Key that can be used to order different
    4523             :   /// groups.
    4524             :   int? order;
    4525             : 
    4526             :   /// Which results are in this group.
    4527             :   List<String>? results;
    4528             : 
    4529           0 :   @override
    4530             :   bool operator ==(Object other) =>
    4531           0 :       other is GroupValue &&
    4532           0 :       other.nextBatch == nextBatch &&
    4533           0 :       other.order == order &&
    4534           0 :       other.results == results;
    4535             : 
    4536           0 :   @override
    4537           0 :   int get hashCode => Object.hash(nextBatch, order, results);
    4538             : 
    4539           0 :   @override
    4540             :   String toString() {
    4541           0 :     return toJson().toString();
    4542             :   }
    4543             : }
    4544             : 
    4545             : ///
    4546             : @_NameSource('spec')
    4547             : class UserProfile {
    4548           0 :   UserProfile({
    4549             :     this.avatarUrl,
    4550             :     this.displayname,
    4551             :   });
    4552             : 
    4553           0 :   UserProfile.fromJson(Map<String, Object?> json)
    4554           0 :       : avatarUrl = ((v) =>
    4555           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    4556             :         displayname =
    4557           0 :             ((v) => v != null ? v as String : null)(json['displayname']);
    4558           0 :   Map<String, Object?> toJson() {
    4559           0 :     final avatarUrl = this.avatarUrl;
    4560           0 :     final displayname = this.displayname;
    4561           0 :     return {
    4562           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    4563           0 :       if (displayname != null) 'displayname': displayname,
    4564             :     };
    4565             :   }
    4566             : 
    4567             :   ///
    4568             :   Uri? avatarUrl;
    4569             : 
    4570             :   ///
    4571             :   String? displayname;
    4572             : 
    4573           0 :   @override
    4574             :   bool operator ==(Object other) =>
    4575           0 :       other is UserProfile &&
    4576           0 :       other.avatarUrl == avatarUrl &&
    4577           0 :       other.displayname == displayname;
    4578             : 
    4579           0 :   @override
    4580           0 :   int get hashCode => Object.hash(avatarUrl, displayname);
    4581             : 
    4582           0 :   @override
    4583             :   String toString() {
    4584           0 :     return toJson().toString();
    4585             :   }
    4586             : }
    4587             : 
    4588             : ///
    4589             : @_NameSource('rule override spec')
    4590             : class SearchResultsEventContext {
    4591           0 :   SearchResultsEventContext({
    4592             :     this.end,
    4593             :     this.eventsAfter,
    4594             :     this.eventsBefore,
    4595             :     this.profileInfo,
    4596             :     this.start,
    4597             :   });
    4598             : 
    4599           0 :   SearchResultsEventContext.fromJson(Map<String, Object?> json)
    4600           0 :       : end = ((v) => v != null ? v as String : null)(json['end']),
    4601           0 :         eventsAfter = ((v) => v != null
    4602             :             ? (v as List)
    4603           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    4604           0 :                 .toList()
    4605           0 :             : null)(json['events_after']),
    4606           0 :         eventsBefore = ((v) => v != null
    4607             :             ? (v as List)
    4608           0 :                 .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    4609           0 :                 .toList()
    4610           0 :             : null)(json['events_before']),
    4611           0 :         profileInfo = ((v) => v != null
    4612           0 :             ? (v as Map<String, Object?>).map((k, v) =>
    4613           0 :                 MapEntry(k, UserProfile.fromJson(v as Map<String, Object?>)))
    4614           0 :             : null)(json['profile_info']),
    4615           0 :         start = ((v) => v != null ? v as String : null)(json['start']);
    4616           0 :   Map<String, Object?> toJson() {
    4617           0 :     final end = this.end;
    4618           0 :     final eventsAfter = this.eventsAfter;
    4619           0 :     final eventsBefore = this.eventsBefore;
    4620           0 :     final profileInfo = this.profileInfo;
    4621           0 :     final start = this.start;
    4622           0 :     return {
    4623           0 :       if (end != null) 'end': end,
    4624             :       if (eventsAfter != null)
    4625           0 :         'events_after': eventsAfter.map((v) => v.toJson()).toList(),
    4626             :       if (eventsBefore != null)
    4627           0 :         'events_before': eventsBefore.map((v) => v.toJson()).toList(),
    4628             :       if (profileInfo != null)
    4629           0 :         'profile_info': profileInfo.map((k, v) => MapEntry(k, v.toJson())),
    4630           0 :       if (start != null) 'start': start,
    4631             :     };
    4632             :   }
    4633             : 
    4634             :   /// Pagination token for the end of the chunk
    4635             :   String? end;
    4636             : 
    4637             :   /// Events just after the result.
    4638             :   List<MatrixEvent>? eventsAfter;
    4639             : 
    4640             :   /// Events just before the result.
    4641             :   List<MatrixEvent>? eventsBefore;
    4642             : 
    4643             :   /// The historic profile information of the
    4644             :   /// users that sent the events returned.
    4645             :   ///
    4646             :   /// The key is the user ID for which
    4647             :   /// the profile belongs to.
    4648             :   Map<String, UserProfile>? profileInfo;
    4649             : 
    4650             :   /// Pagination token for the start of the chunk
    4651             :   String? start;
    4652             : 
    4653           0 :   @override
    4654             :   bool operator ==(Object other) =>
    4655           0 :       other is SearchResultsEventContext &&
    4656           0 :       other.end == end &&
    4657           0 :       other.eventsAfter == eventsAfter &&
    4658           0 :       other.eventsBefore == eventsBefore &&
    4659           0 :       other.profileInfo == profileInfo &&
    4660           0 :       other.start == start;
    4661             : 
    4662           0 :   @override
    4663             :   int get hashCode =>
    4664           0 :       Object.hash(end, eventsAfter, eventsBefore, profileInfo, start);
    4665             : 
    4666           0 :   @override
    4667             :   String toString() {
    4668           0 :     return toJson().toString();
    4669             :   }
    4670             : }
    4671             : 
    4672             : /// The result object.
    4673             : @_NameSource('spec')
    4674             : class Result {
    4675           0 :   Result({
    4676             :     this.context,
    4677             :     this.rank,
    4678             :     this.result,
    4679             :   });
    4680             : 
    4681           0 :   Result.fromJson(Map<String, Object?> json)
    4682           0 :       : context = ((v) => v != null
    4683           0 :             ? SearchResultsEventContext.fromJson(v as Map<String, Object?>)
    4684           0 :             : null)(json['context']),
    4685           0 :         rank = ((v) => v != null ? (v as num).toDouble() : null)(json['rank']),
    4686           0 :         result = ((v) => v != null
    4687           0 :             ? MatrixEvent.fromJson(v as Map<String, Object?>)
    4688           0 :             : null)(json['result']);
    4689           0 :   Map<String, Object?> toJson() {
    4690           0 :     final context = this.context;
    4691           0 :     final rank = this.rank;
    4692           0 :     final result = this.result;
    4693           0 :     return {
    4694           0 :       if (context != null) 'context': context.toJson(),
    4695           0 :       if (rank != null) 'rank': rank,
    4696           0 :       if (result != null) 'result': result.toJson(),
    4697             :     };
    4698             :   }
    4699             : 
    4700             :   /// Context for result, if requested.
    4701             :   SearchResultsEventContext? context;
    4702             : 
    4703             :   /// A number that describes how closely this result matches the search. Higher is closer.
    4704             :   double? rank;
    4705             : 
    4706             :   /// The event that matched.
    4707             :   MatrixEvent? result;
    4708             : 
    4709           0 :   @override
    4710             :   bool operator ==(Object other) =>
    4711           0 :       other is Result &&
    4712           0 :       other.context == context &&
    4713           0 :       other.rank == rank &&
    4714           0 :       other.result == result;
    4715             : 
    4716           0 :   @override
    4717           0 :   int get hashCode => Object.hash(context, rank, result);
    4718             : 
    4719           0 :   @override
    4720             :   String toString() {
    4721           0 :     return toJson().toString();
    4722             :   }
    4723             : }
    4724             : 
    4725             : ///
    4726             : @_NameSource('spec')
    4727             : class ResultRoomEvents {
    4728           0 :   ResultRoomEvents({
    4729             :     this.count,
    4730             :     this.groups,
    4731             :     this.highlights,
    4732             :     this.nextBatch,
    4733             :     this.results,
    4734             :     this.state,
    4735             :   });
    4736             : 
    4737           0 :   ResultRoomEvents.fromJson(Map<String, Object?> json)
    4738           0 :       : count = ((v) => v != null ? v as int : null)(json['count']),
    4739           0 :         groups = ((v) => v != null
    4740           0 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    4741             :                 k,
    4742           0 :                 (v as Map<String, Object?>).map((k, v) => MapEntry(
    4743           0 :                     k, GroupValue.fromJson(v as Map<String, Object?>)))))
    4744           0 :             : null)(json['groups']),
    4745           0 :         highlights = ((v) => v != null
    4746           0 :             ? (v as List).map((v) => v as String).toList()
    4747           0 :             : null)(json['highlights']),
    4748           0 :         nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
    4749           0 :         results = ((v) => v != null
    4750             :             ? (v as List)
    4751           0 :                 .map((v) => Result.fromJson(v as Map<String, Object?>))
    4752           0 :                 .toList()
    4753           0 :             : null)(json['results']),
    4754           0 :         state = ((v) => v != null
    4755           0 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(
    4756             :                 k,
    4757             :                 (v as List)
    4758           0 :                     .map((v) => MatrixEvent.fromJson(v as Map<String, Object?>))
    4759           0 :                     .toList()))
    4760           0 :             : null)(json['state']);
    4761           0 :   Map<String, Object?> toJson() {
    4762           0 :     final count = this.count;
    4763           0 :     final groups = this.groups;
    4764           0 :     final highlights = this.highlights;
    4765           0 :     final nextBatch = this.nextBatch;
    4766           0 :     final results = this.results;
    4767           0 :     final state = this.state;
    4768           0 :     return {
    4769           0 :       if (count != null) 'count': count,
    4770             :       if (groups != null)
    4771           0 :         'groups': groups.map(
    4772           0 :             (k, v) => MapEntry(k, v.map((k, v) => MapEntry(k, v.toJson())))),
    4773           0 :       if (highlights != null) 'highlights': highlights.map((v) => v).toList(),
    4774           0 :       if (nextBatch != null) 'next_batch': nextBatch,
    4775           0 :       if (results != null) 'results': results.map((v) => v.toJson()).toList(),
    4776             :       if (state != null)
    4777           0 :         'state':
    4778           0 :             state.map((k, v) => MapEntry(k, v.map((v) => v.toJson()).toList())),
    4779             :     };
    4780             :   }
    4781             : 
    4782             :   /// An approximate count of the total number of results found.
    4783             :   int? count;
    4784             : 
    4785             :   /// Any groups that were requested.
    4786             :   ///
    4787             :   /// The outer `string` key is the group key requested (eg: `room_id`
    4788             :   /// or `sender`). The inner `string` key is the grouped value (eg:
    4789             :   /// a room's ID or a user's ID).
    4790             :   Map<String, Map<String, GroupValue>>? groups;
    4791             : 
    4792             :   /// List of words which should be highlighted, useful for stemming which may change the query terms.
    4793             :   List<String>? highlights;
    4794             : 
    4795             :   /// Token that can be used to get the next batch of
    4796             :   /// results, by passing as the `next_batch` parameter to
    4797             :   /// the next call. If this field is absent, there are no
    4798             :   /// more results.
    4799             :   String? nextBatch;
    4800             : 
    4801             :   /// List of results in the requested order.
    4802             :   List<Result>? results;
    4803             : 
    4804             :   /// The current state for every room in the results.
    4805             :   /// This is included if the request had the
    4806             :   /// `include_state` key set with a value of `true`.
    4807             :   ///
    4808             :   /// The key is the room ID for which the `State
    4809             :   /// Event` array belongs to.
    4810             :   Map<String, List<MatrixEvent>>? state;
    4811             : 
    4812           0 :   @override
    4813             :   bool operator ==(Object other) =>
    4814           0 :       other is ResultRoomEvents &&
    4815           0 :       other.count == count &&
    4816           0 :       other.groups == groups &&
    4817           0 :       other.highlights == highlights &&
    4818           0 :       other.nextBatch == nextBatch &&
    4819           0 :       other.results == results &&
    4820           0 :       other.state == state;
    4821             : 
    4822           0 :   @override
    4823             :   int get hashCode =>
    4824           0 :       Object.hash(count, groups, highlights, nextBatch, results, state);
    4825             : 
    4826           0 :   @override
    4827             :   String toString() {
    4828           0 :     return toJson().toString();
    4829             :   }
    4830             : }
    4831             : 
    4832             : ///
    4833             : @_NameSource('spec')
    4834             : class ResultCategories {
    4835           0 :   ResultCategories({
    4836             :     this.roomEvents,
    4837             :   });
    4838             : 
    4839           0 :   ResultCategories.fromJson(Map<String, Object?> json)
    4840           0 :       : roomEvents = ((v) => v != null
    4841           0 :             ? ResultRoomEvents.fromJson(v as Map<String, Object?>)
    4842           0 :             : null)(json['room_events']);
    4843           0 :   Map<String, Object?> toJson() {
    4844           0 :     final roomEvents = this.roomEvents;
    4845           0 :     return {
    4846           0 :       if (roomEvents != null) 'room_events': roomEvents.toJson(),
    4847             :     };
    4848             :   }
    4849             : 
    4850             :   /// Mapping of category name to search criteria.
    4851             :   ResultRoomEvents? roomEvents;
    4852             : 
    4853           0 :   @override
    4854             :   bool operator ==(Object other) =>
    4855           0 :       other is ResultCategories && other.roomEvents == roomEvents;
    4856             : 
    4857           0 :   @override
    4858           0 :   int get hashCode => roomEvents.hashCode;
    4859             : 
    4860           0 :   @override
    4861             :   String toString() {
    4862           0 :     return toJson().toString();
    4863             :   }
    4864             : }
    4865             : 
    4866             : ///
    4867             : @_NameSource('rule override spec')
    4868             : class SearchResults {
    4869           0 :   SearchResults({
    4870             :     required this.searchCategories,
    4871             :   });
    4872             : 
    4873           0 :   SearchResults.fromJson(Map<String, Object?> json)
    4874           0 :       : searchCategories = ResultCategories.fromJson(
    4875           0 :             json['search_categories'] as Map<String, Object?>);
    4876           0 :   Map<String, Object?> toJson() => {
    4877           0 :         'search_categories': searchCategories.toJson(),
    4878             :       };
    4879             : 
    4880             :   /// Describes which categories to search in and their criteria.
    4881             :   ResultCategories searchCategories;
    4882             : 
    4883           0 :   @override
    4884             :   bool operator ==(Object other) =>
    4885           0 :       other is SearchResults && other.searchCategories == searchCategories;
    4886             : 
    4887           0 :   @override
    4888           0 :   int get hashCode => searchCategories.hashCode;
    4889             : 
    4890           0 :   @override
    4891             :   String toString() {
    4892           0 :     return toJson().toString();
    4893             :   }
    4894             : }
    4895             : 
    4896             : ///
    4897             : @_NameSource('spec')
    4898             : class Location {
    4899           0 :   Location({
    4900             :     required this.alias,
    4901             :     required this.fields,
    4902             :     required this.protocol,
    4903             :   });
    4904             : 
    4905           0 :   Location.fromJson(Map<String, Object?> json)
    4906           0 :       : alias = json['alias'] as String,
    4907           0 :         fields = json['fields'] as Map<String, Object?>,
    4908           0 :         protocol = json['protocol'] as String;
    4909           0 :   Map<String, Object?> toJson() => {
    4910           0 :         'alias': alias,
    4911           0 :         'fields': fields,
    4912           0 :         'protocol': protocol,
    4913             :       };
    4914             : 
    4915             :   /// An alias for a matrix room.
    4916             :   String alias;
    4917             : 
    4918             :   /// Information used to identify this third-party location.
    4919             :   Map<String, Object?> fields;
    4920             : 
    4921             :   /// The protocol ID that the third-party location is a part of.
    4922             :   String protocol;
    4923             : 
    4924           0 :   @override
    4925             :   bool operator ==(Object other) =>
    4926           0 :       other is Location &&
    4927           0 :       other.alias == alias &&
    4928           0 :       other.fields == fields &&
    4929           0 :       other.protocol == protocol;
    4930             : 
    4931           0 :   @override
    4932           0 :   int get hashCode => Object.hash(alias, fields, protocol);
    4933             : 
    4934           0 :   @override
    4935             :   String toString() {
    4936           0 :     return toJson().toString();
    4937             :   }
    4938             : }
    4939             : 
    4940             : /// Definition of valid values for a field.
    4941             : @_NameSource('spec')
    4942             : class FieldType {
    4943           0 :   FieldType({
    4944             :     required this.placeholder,
    4945             :     required this.regexp,
    4946             :   });
    4947             : 
    4948           0 :   FieldType.fromJson(Map<String, Object?> json)
    4949           0 :       : placeholder = json['placeholder'] as String,
    4950           0 :         regexp = json['regexp'] as String;
    4951           0 :   Map<String, Object?> toJson() => {
    4952           0 :         'placeholder': placeholder,
    4953           0 :         'regexp': regexp,
    4954             :       };
    4955             : 
    4956             :   /// An placeholder serving as a valid example of the field value.
    4957             :   String placeholder;
    4958             : 
    4959             :   /// A regular expression for validation of a field's value. This may be relatively
    4960             :   /// coarse to verify the value as the application service providing this protocol
    4961             :   /// may apply additional validation or filtering.
    4962             :   String regexp;
    4963             : 
    4964           0 :   @override
    4965             :   bool operator ==(Object other) =>
    4966           0 :       other is FieldType &&
    4967           0 :       other.placeholder == placeholder &&
    4968           0 :       other.regexp == regexp;
    4969             : 
    4970           0 :   @override
    4971           0 :   int get hashCode => Object.hash(placeholder, regexp);
    4972             : 
    4973           0 :   @override
    4974             :   String toString() {
    4975           0 :     return toJson().toString();
    4976             :   }
    4977             : }
    4978             : 
    4979             : ///
    4980             : @_NameSource('spec')
    4981             : class ProtocolInstance {
    4982           0 :   ProtocolInstance({
    4983             :     required this.desc,
    4984             :     required this.fields,
    4985             :     this.icon,
    4986             :     required this.networkId,
    4987             :   });
    4988             : 
    4989           0 :   ProtocolInstance.fromJson(Map<String, Object?> json)
    4990           0 :       : desc = json['desc'] as String,
    4991           0 :         fields = json['fields'] as Map<String, Object?>,
    4992           0 :         icon = ((v) => v != null ? v as String : null)(json['icon']),
    4993           0 :         networkId = json['network_id'] as String;
    4994           0 :   Map<String, Object?> toJson() {
    4995           0 :     final icon = this.icon;
    4996           0 :     return {
    4997           0 :       'desc': desc,
    4998           0 :       'fields': fields,
    4999           0 :       if (icon != null) 'icon': icon,
    5000           0 :       'network_id': networkId,
    5001             :     };
    5002             :   }
    5003             : 
    5004             :   /// A human-readable description for the protocol, such as the name.
    5005             :   String desc;
    5006             : 
    5007             :   /// Preset values for `fields` the client may use to search by.
    5008             :   Map<String, Object?> fields;
    5009             : 
    5010             :   /// An optional content URI representing the protocol. Overrides the one provided
    5011             :   /// at the higher level Protocol object.
    5012             :   String? icon;
    5013             : 
    5014             :   /// A unique identifier across all instances.
    5015             :   String networkId;
    5016             : 
    5017           0 :   @override
    5018             :   bool operator ==(Object other) =>
    5019           0 :       other is ProtocolInstance &&
    5020           0 :       other.desc == desc &&
    5021           0 :       other.fields == fields &&
    5022           0 :       other.icon == icon &&
    5023           0 :       other.networkId == networkId;
    5024             : 
    5025           0 :   @override
    5026           0 :   int get hashCode => Object.hash(desc, fields, icon, networkId);
    5027             : 
    5028           0 :   @override
    5029             :   String toString() {
    5030           0 :     return toJson().toString();
    5031             :   }
    5032             : }
    5033             : 
    5034             : ///
    5035             : @_NameSource('spec')
    5036             : class Protocol {
    5037           0 :   Protocol({
    5038             :     required this.fieldTypes,
    5039             :     required this.icon,
    5040             :     required this.instances,
    5041             :     required this.locationFields,
    5042             :     required this.userFields,
    5043             :   });
    5044             : 
    5045           0 :   Protocol.fromJson(Map<String, Object?> json)
    5046           0 :       : fieldTypes = (json['field_types'] as Map<String, Object?>).map((k, v) =>
    5047           0 :             MapEntry(k, FieldType.fromJson(v as Map<String, Object?>))),
    5048           0 :         icon = json['icon'] as String,
    5049           0 :         instances = (json['instances'] as List)
    5050           0 :             .map((v) => ProtocolInstance.fromJson(v as Map<String, Object?>))
    5051           0 :             .toList(),
    5052             :         locationFields =
    5053           0 :             (json['location_fields'] as List).map((v) => v as String).toList(),
    5054             :         userFields =
    5055           0 :             (json['user_fields'] as List).map((v) => v as String).toList();
    5056           0 :   Map<String, Object?> toJson() => {
    5057           0 :         'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())),
    5058           0 :         'icon': icon,
    5059           0 :         'instances': instances.map((v) => v.toJson()).toList(),
    5060           0 :         'location_fields': locationFields.map((v) => v).toList(),
    5061           0 :         'user_fields': userFields.map((v) => v).toList(),
    5062             :       };
    5063             : 
    5064             :   /// The type definitions for the fields defined in the `user_fields` and
    5065             :   /// `location_fields`. Each entry in those arrays MUST have an entry here. The
    5066             :   /// `string` key for this object is field name itself.
    5067             :   ///
    5068             :   /// May be an empty object if no fields are defined.
    5069             :   Map<String, FieldType> fieldTypes;
    5070             : 
    5071             :   /// A content URI representing an icon for the third-party protocol.
    5072             :   String icon;
    5073             : 
    5074             :   /// A list of objects representing independent instances of configuration.
    5075             :   /// For example, multiple networks on IRC if multiple are provided by the
    5076             :   /// same application service.
    5077             :   List<ProtocolInstance> instances;
    5078             : 
    5079             :   /// Fields which may be used to identify a third-party location. These should be
    5080             :   /// ordered to suggest the way that entities may be grouped, where higher
    5081             :   /// groupings are ordered first. For example, the name of a network should be
    5082             :   /// searched before the name of a channel.
    5083             :   List<String> locationFields;
    5084             : 
    5085             :   /// Fields which may be used to identify a third-party user. These should be
    5086             :   /// ordered to suggest the way that entities may be grouped, where higher
    5087             :   /// groupings are ordered first. For example, the name of a network should be
    5088             :   /// searched before the nickname of a user.
    5089             :   List<String> userFields;
    5090             : 
    5091           0 :   @override
    5092             :   bool operator ==(Object other) =>
    5093           0 :       other is Protocol &&
    5094           0 :       other.fieldTypes == fieldTypes &&
    5095           0 :       other.icon == icon &&
    5096           0 :       other.instances == instances &&
    5097           0 :       other.locationFields == locationFields &&
    5098           0 :       other.userFields == userFields;
    5099             : 
    5100           0 :   @override
    5101             :   int get hashCode =>
    5102           0 :       Object.hash(fieldTypes, icon, instances, locationFields, userFields);
    5103             : 
    5104           0 :   @override
    5105             :   String toString() {
    5106           0 :     return toJson().toString();
    5107             :   }
    5108             : }
    5109             : 
    5110             : ///
    5111             : @_NameSource('rule override spec')
    5112             : class ThirdPartyUser {
    5113           0 :   ThirdPartyUser({
    5114             :     required this.fields,
    5115             :     required this.protocol,
    5116             :     required this.userid,
    5117             :   });
    5118             : 
    5119           0 :   ThirdPartyUser.fromJson(Map<String, Object?> json)
    5120           0 :       : fields = json['fields'] as Map<String, Object?>,
    5121           0 :         protocol = json['protocol'] as String,
    5122           0 :         userid = json['userid'] as String;
    5123           0 :   Map<String, Object?> toJson() => {
    5124           0 :         'fields': fields,
    5125           0 :         'protocol': protocol,
    5126           0 :         'userid': userid,
    5127             :       };
    5128             : 
    5129             :   /// Information used to identify this third-party location.
    5130             :   Map<String, Object?> fields;
    5131             : 
    5132             :   /// The protocol ID that the third-party location is a part of.
    5133             :   String protocol;
    5134             : 
    5135             :   /// A Matrix User ID represting a third-party user.
    5136             :   String userid;
    5137             : 
    5138           0 :   @override
    5139             :   bool operator ==(Object other) =>
    5140           0 :       other is ThirdPartyUser &&
    5141           0 :       other.fields == fields &&
    5142           0 :       other.protocol == protocol &&
    5143           0 :       other.userid == userid;
    5144             : 
    5145           0 :   @override
    5146           0 :   int get hashCode => Object.hash(fields, protocol, userid);
    5147             : 
    5148           0 :   @override
    5149             :   String toString() {
    5150           0 :     return toJson().toString();
    5151             :   }
    5152             : }
    5153             : 
    5154             : ///
    5155             : @_NameSource('generated')
    5156             : @EnhancedEnum()
    5157             : enum EventFormat {
    5158             :   @EnhancedEnumValue(name: 'client')
    5159             :   client,
    5160             :   @EnhancedEnumValue(name: 'federation')
    5161             :   federation
    5162             : }
    5163             : 
    5164             : ///
    5165             : @_NameSource('rule override generated')
    5166             : class StateFilter implements EventFilter, RoomEventFilter {
    5167          39 :   StateFilter({
    5168             :     this.limit,
    5169             :     this.notSenders,
    5170             :     this.notTypes,
    5171             :     this.senders,
    5172             :     this.types,
    5173             :     this.containsUrl,
    5174             :     this.includeRedundantMembers,
    5175             :     this.lazyLoadMembers,
    5176             :     this.notRooms,
    5177             :     this.rooms,
    5178             :     this.unreadThreadNotifications,
    5179             :   });
    5180             : 
    5181           0 :   StateFilter.fromJson(Map<String, Object?> json)
    5182           0 :       : limit = ((v) => v != null ? v as int : null)(json['limit']),
    5183           0 :         notSenders = ((v) => v != null
    5184           0 :             ? (v as List).map((v) => v as String).toList()
    5185           0 :             : null)(json['not_senders']),
    5186           0 :         notTypes = ((v) => v != null
    5187           0 :             ? (v as List).map((v) => v as String).toList()
    5188           0 :             : null)(json['not_types']),
    5189           0 :         senders = ((v) => v != null
    5190           0 :             ? (v as List).map((v) => v as String).toList()
    5191           0 :             : null)(json['senders']),
    5192           0 :         types = ((v) => v != null
    5193           0 :             ? (v as List).map((v) => v as String).toList()
    5194           0 :             : null)(json['types']),
    5195             :         containsUrl =
    5196           0 :             ((v) => v != null ? v as bool : null)(json['contains_url']),
    5197           0 :         includeRedundantMembers = ((v) =>
    5198           0 :             v != null ? v as bool : null)(json['include_redundant_members']),
    5199             :         lazyLoadMembers =
    5200           0 :             ((v) => v != null ? v as bool : null)(json['lazy_load_members']),
    5201           0 :         notRooms = ((v) => v != null
    5202           0 :             ? (v as List).map((v) => v as String).toList()
    5203           0 :             : null)(json['not_rooms']),
    5204           0 :         rooms = ((v) => v != null
    5205           0 :             ? (v as List).map((v) => v as String).toList()
    5206           0 :             : null)(json['rooms']),
    5207           0 :         unreadThreadNotifications = ((v) =>
    5208           0 :             v != null ? v as bool : null)(json['unread_thread_notifications']);
    5209          32 :   @override
    5210             :   Map<String, Object?> toJson() {
    5211          32 :     final limit = this.limit;
    5212          32 :     final notSenders = this.notSenders;
    5213          32 :     final notTypes = this.notTypes;
    5214          32 :     final senders = this.senders;
    5215          32 :     final types = this.types;
    5216          32 :     final containsUrl = this.containsUrl;
    5217          32 :     final includeRedundantMembers = this.includeRedundantMembers;
    5218          32 :     final lazyLoadMembers = this.lazyLoadMembers;
    5219          32 :     final notRooms = this.notRooms;
    5220          32 :     final rooms = this.rooms;
    5221          32 :     final unreadThreadNotifications = this.unreadThreadNotifications;
    5222          32 :     return {
    5223           3 :       if (limit != null) 'limit': limit,
    5224           0 :       if (notSenders != null) 'not_senders': notSenders.map((v) => v).toList(),
    5225           0 :       if (notTypes != null) 'not_types': notTypes.map((v) => v).toList(),
    5226           0 :       if (senders != null) 'senders': senders.map((v) => v).toList(),
    5227           0 :       if (types != null) 'types': types.map((v) => v).toList(),
    5228           0 :       if (containsUrl != null) 'contains_url': containsUrl,
    5229             :       if (includeRedundantMembers != null)
    5230           0 :         'include_redundant_members': includeRedundantMembers,
    5231          32 :       if (lazyLoadMembers != null) 'lazy_load_members': lazyLoadMembers,
    5232           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    5233           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    5234             :       if (unreadThreadNotifications != null)
    5235           0 :         'unread_thread_notifications': unreadThreadNotifications,
    5236             :     };
    5237             :   }
    5238             : 
    5239             :   /// The maximum number of events to return, must be an integer greater than 0.
    5240             :   ///
    5241             :   /// Servers should apply a default value, and impose a maximum value to avoid
    5242             :   /// resource exhaustion.
    5243             :   ///
    5244             :   @override
    5245             :   int? limit;
    5246             : 
    5247             :   /// 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.
    5248             :   @override
    5249             :   List<String>? notSenders;
    5250             : 
    5251             :   /// 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.
    5252             :   @override
    5253             :   List<String>? notTypes;
    5254             : 
    5255             :   /// A list of senders IDs to include. If this list is absent then all senders are included.
    5256             :   @override
    5257             :   List<String>? senders;
    5258             : 
    5259             :   /// 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.
    5260             :   @override
    5261             :   List<String>? types;
    5262             : 
    5263             :   /// 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.
    5264             :   @override
    5265             :   bool? containsUrl;
    5266             : 
    5267             :   /// If `true`, sends all membership events for all events, even if they have already
    5268             :   /// been sent to the client. Does not
    5269             :   /// apply unless `lazy_load_members` is `true`. See
    5270             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    5271             :   /// for more information. Defaults to `false`.
    5272             :   @override
    5273             :   bool? includeRedundantMembers;
    5274             : 
    5275             :   /// If `true`, enables lazy-loading of membership events. See
    5276             :   /// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
    5277             :   /// for more information. Defaults to `false`.
    5278             :   @override
    5279             :   bool? lazyLoadMembers;
    5280             : 
    5281             :   /// 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.
    5282             :   @override
    5283             :   List<String>? notRooms;
    5284             : 
    5285             :   /// A list of room IDs to include. If this list is absent then all rooms are included.
    5286             :   @override
    5287             :   List<String>? rooms;
    5288             : 
    5289             :   /// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
    5290             :   /// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
    5291             :   @override
    5292             :   bool? unreadThreadNotifications;
    5293             : 
    5294           0 :   @override
    5295             :   bool operator ==(Object other) =>
    5296           0 :       other is StateFilter &&
    5297           0 :       other.limit == limit &&
    5298           0 :       other.notSenders == notSenders &&
    5299           0 :       other.notTypes == notTypes &&
    5300           0 :       other.senders == senders &&
    5301           0 :       other.types == types &&
    5302           0 :       other.containsUrl == containsUrl &&
    5303           0 :       other.includeRedundantMembers == includeRedundantMembers &&
    5304           0 :       other.lazyLoadMembers == lazyLoadMembers &&
    5305           0 :       other.notRooms == notRooms &&
    5306           0 :       other.rooms == rooms &&
    5307           0 :       other.unreadThreadNotifications == unreadThreadNotifications;
    5308             : 
    5309           0 :   @override
    5310           0 :   int get hashCode => Object.hash(
    5311           0 :       limit,
    5312           0 :       notSenders,
    5313           0 :       notTypes,
    5314           0 :       senders,
    5315           0 :       types,
    5316           0 :       containsUrl,
    5317           0 :       includeRedundantMembers,
    5318           0 :       lazyLoadMembers,
    5319           0 :       notRooms,
    5320           0 :       rooms,
    5321           0 :       unreadThreadNotifications);
    5322             : 
    5323           0 :   @override
    5324             :   String toString() {
    5325           0 :     return toJson().toString();
    5326             :   }
    5327             : }
    5328             : 
    5329             : ///
    5330             : @_NameSource('spec')
    5331             : class RoomFilter {
    5332          39 :   RoomFilter({
    5333             :     this.accountData,
    5334             :     this.ephemeral,
    5335             :     this.includeLeave,
    5336             :     this.notRooms,
    5337             :     this.rooms,
    5338             :     this.state,
    5339             :     this.timeline,
    5340             :   });
    5341             : 
    5342           0 :   RoomFilter.fromJson(Map<String, Object?> json)
    5343           0 :       : accountData = ((v) => v != null
    5344           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    5345           0 :             : null)(json['account_data']),
    5346           0 :         ephemeral = ((v) => v != null
    5347           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    5348           0 :             : null)(json['ephemeral']),
    5349             :         includeLeave =
    5350           0 :             ((v) => v != null ? v as bool : null)(json['include_leave']),
    5351           0 :         notRooms = ((v) => v != null
    5352           0 :             ? (v as List).map((v) => v as String).toList()
    5353           0 :             : null)(json['not_rooms']),
    5354           0 :         rooms = ((v) => v != null
    5355           0 :             ? (v as List).map((v) => v as String).toList()
    5356           0 :             : null)(json['rooms']),
    5357           0 :         state = ((v) => v != null
    5358           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    5359           0 :             : null)(json['state']),
    5360           0 :         timeline = ((v) => v != null
    5361           0 :             ? StateFilter.fromJson(v as Map<String, Object?>)
    5362           0 :             : null)(json['timeline']);
    5363          32 :   Map<String, Object?> toJson() {
    5364          32 :     final accountData = this.accountData;
    5365          32 :     final ephemeral = this.ephemeral;
    5366          32 :     final includeLeave = this.includeLeave;
    5367          32 :     final notRooms = this.notRooms;
    5368          32 :     final rooms = this.rooms;
    5369          32 :     final state = this.state;
    5370          32 :     final timeline = this.timeline;
    5371          32 :     return {
    5372           0 :       if (accountData != null) 'account_data': accountData.toJson(),
    5373           0 :       if (ephemeral != null) 'ephemeral': ephemeral.toJson(),
    5374           3 :       if (includeLeave != null) 'include_leave': includeLeave,
    5375           0 :       if (notRooms != null) 'not_rooms': notRooms.map((v) => v).toList(),
    5376           0 :       if (rooms != null) 'rooms': rooms.map((v) => v).toList(),
    5377          64 :       if (state != null) 'state': state.toJson(),
    5378           6 :       if (timeline != null) 'timeline': timeline.toJson(),
    5379             :     };
    5380             :   }
    5381             : 
    5382             :   /// The per user account data to include for rooms.
    5383             :   StateFilter? accountData;
    5384             : 
    5385             :   /// The ephemeral events to include for rooms. These are the events that appear in the `ephemeral` property in the `/sync` response.
    5386             :   StateFilter? ephemeral;
    5387             : 
    5388             :   /// Include rooms that the user has left in the sync, default false
    5389             :   bool? includeLeave;
    5390             : 
    5391             :   /// 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`
    5392             :   List<String>? notRooms;
    5393             : 
    5394             :   /// 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`
    5395             :   List<String>? rooms;
    5396             : 
    5397             :   /// The state events to include for rooms.
    5398             :   StateFilter? state;
    5399             : 
    5400             :   /// The message and state update events to include for rooms.
    5401             :   StateFilter? timeline;
    5402             : 
    5403           0 :   @override
    5404             :   bool operator ==(Object other) =>
    5405           0 :       other is RoomFilter &&
    5406           0 :       other.accountData == accountData &&
    5407           0 :       other.ephemeral == ephemeral &&
    5408           0 :       other.includeLeave == includeLeave &&
    5409           0 :       other.notRooms == notRooms &&
    5410           0 :       other.rooms == rooms &&
    5411           0 :       other.state == state &&
    5412           0 :       other.timeline == timeline;
    5413             : 
    5414           0 :   @override
    5415           0 :   int get hashCode => Object.hash(
    5416           0 :       accountData, ephemeral, includeLeave, notRooms, rooms, state, timeline);
    5417             : 
    5418           0 :   @override
    5419             :   String toString() {
    5420           0 :     return toJson().toString();
    5421             :   }
    5422             : }
    5423             : 
    5424             : ///
    5425             : @_NameSource('spec')
    5426             : class Filter {
    5427          39 :   Filter({
    5428             :     this.accountData,
    5429             :     this.eventFields,
    5430             :     this.eventFormat,
    5431             :     this.presence,
    5432             :     this.room,
    5433             :   });
    5434             : 
    5435           0 :   Filter.fromJson(Map<String, Object?> json)
    5436           0 :       : accountData = ((v) => v != null
    5437           0 :             ? EventFilter.fromJson(v as Map<String, Object?>)
    5438           0 :             : null)(json['account_data']),
    5439           0 :         eventFields = ((v) => v != null
    5440           0 :             ? (v as List).map((v) => v as String).toList()
    5441           0 :             : null)(json['event_fields']),
    5442           0 :         eventFormat = ((v) => v != null
    5443           0 :             ? EventFormat.values.fromString(v as String)!
    5444           0 :             : null)(json['event_format']),
    5445           0 :         presence = ((v) => v != null
    5446           0 :             ? EventFilter.fromJson(v as Map<String, Object?>)
    5447           0 :             : null)(json['presence']),
    5448           0 :         room = ((v) => v != null
    5449           0 :             ? RoomFilter.fromJson(v as Map<String, Object?>)
    5450           0 :             : null)(json['room']);
    5451          32 :   Map<String, Object?> toJson() {
    5452          32 :     final accountData = this.accountData;
    5453          32 :     final eventFields = this.eventFields;
    5454          32 :     final eventFormat = this.eventFormat;
    5455          32 :     final presence = this.presence;
    5456          32 :     final room = this.room;
    5457          32 :     return {
    5458           0 :       if (accountData != null) 'account_data': accountData.toJson(),
    5459             :       if (eventFields != null)
    5460           0 :         'event_fields': eventFields.map((v) => v).toList(),
    5461           0 :       if (eventFormat != null) 'event_format': eventFormat.name,
    5462           0 :       if (presence != null) 'presence': presence.toJson(),
    5463          64 :       if (room != null) 'room': room.toJson(),
    5464             :     };
    5465             :   }
    5466             : 
    5467             :   /// The user account data that isn't associated with rooms to include.
    5468             :   EventFilter? accountData;
    5469             : 
    5470             :   /// List of event fields to include. If this list is absent then all fields are included. The entries are [dot-separated paths for each property](https://spec.matrix.org/unstable/appendices#dot-separated-property-paths) to include. So ['content.body'] will include the 'body' field of the 'content' object. A server may include more fields than were requested.
    5471             :   List<String>? eventFields;
    5472             : 
    5473             :   /// 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'.
    5474             :   EventFormat? eventFormat;
    5475             : 
    5476             :   /// The presence updates to include.
    5477             :   EventFilter? presence;
    5478             : 
    5479             :   /// Filters to be applied to room data.
    5480             :   RoomFilter? room;
    5481             : 
    5482           0 :   @override
    5483             :   bool operator ==(Object other) =>
    5484           0 :       other is Filter &&
    5485           0 :       other.accountData == accountData &&
    5486           0 :       other.eventFields == eventFields &&
    5487           0 :       other.eventFormat == eventFormat &&
    5488           0 :       other.presence == presence &&
    5489           0 :       other.room == room;
    5490             : 
    5491           0 :   @override
    5492             :   int get hashCode =>
    5493           0 :       Object.hash(accountData, eventFields, eventFormat, presence, room);
    5494             : 
    5495           0 :   @override
    5496             :   String toString() {
    5497           0 :     return toJson().toString();
    5498             :   }
    5499             : }
    5500             : 
    5501             : ///
    5502             : @_NameSource('spec')
    5503             : class OpenIdCredentials {
    5504           0 :   OpenIdCredentials({
    5505             :     required this.accessToken,
    5506             :     required this.expiresIn,
    5507             :     required this.matrixServerName,
    5508             :     required this.tokenType,
    5509             :   });
    5510             : 
    5511           0 :   OpenIdCredentials.fromJson(Map<String, Object?> json)
    5512           0 :       : accessToken = json['access_token'] as String,
    5513           0 :         expiresIn = json['expires_in'] as int,
    5514           0 :         matrixServerName = json['matrix_server_name'] as String,
    5515           0 :         tokenType = json['token_type'] as String;
    5516           0 :   Map<String, Object?> toJson() => {
    5517           0 :         'access_token': accessToken,
    5518           0 :         'expires_in': expiresIn,
    5519           0 :         'matrix_server_name': matrixServerName,
    5520           0 :         'token_type': tokenType,
    5521             :       };
    5522             : 
    5523             :   /// An access token the consumer may use to verify the identity of
    5524             :   /// the person who generated the token. This is given to the federation
    5525             :   /// API `GET /openid/userinfo` to verify the user's identity.
    5526             :   String accessToken;
    5527             : 
    5528             :   /// The number of seconds before this token expires and a new one must
    5529             :   /// be generated.
    5530             :   int expiresIn;
    5531             : 
    5532             :   /// The homeserver domain the consumer should use when attempting to
    5533             :   /// verify the user's identity.
    5534             :   String matrixServerName;
    5535             : 
    5536             :   /// The string `Bearer`.
    5537             :   String tokenType;
    5538             : 
    5539           0 :   @override
    5540             :   bool operator ==(Object other) =>
    5541           0 :       other is OpenIdCredentials &&
    5542           0 :       other.accessToken == accessToken &&
    5543           0 :       other.expiresIn == expiresIn &&
    5544           0 :       other.matrixServerName == matrixServerName &&
    5545           0 :       other.tokenType == tokenType;
    5546             : 
    5547           0 :   @override
    5548             :   int get hashCode =>
    5549           0 :       Object.hash(accessToken, expiresIn, matrixServerName, tokenType);
    5550             : 
    5551           0 :   @override
    5552             :   String toString() {
    5553           0 :     return toJson().toString();
    5554             :   }
    5555             : }
    5556             : 
    5557             : ///
    5558             : @_NameSource('spec')
    5559             : class Tag {
    5560          32 :   Tag({
    5561             :     this.order,
    5562             :     this.additionalProperties = const {},
    5563             :   });
    5564             : 
    5565           0 :   Tag.fromJson(Map<String, Object?> json)
    5566             :       : order =
    5567           0 :             ((v) => v != null ? (v as num).toDouble() : null)(json['order']),
    5568           0 :         additionalProperties = Map.fromEntries(json.entries
    5569           0 :             .where((e) => !['order'].contains(e.key))
    5570           0 :             .map((e) => MapEntry(e.key, e.value)));
    5571           2 :   Map<String, Object?> toJson() {
    5572           2 :     final order = this.order;
    5573           2 :     return {
    5574           2 :       ...additionalProperties,
    5575           2 :       if (order != null) 'order': order,
    5576             :     };
    5577             :   }
    5578             : 
    5579             :   /// A number in a range `[0,1]` describing a relative
    5580             :   /// position of the room under the given tag.
    5581             :   double? order;
    5582             : 
    5583             :   Map<String, Object?> additionalProperties;
    5584             : 
    5585           0 :   @override
    5586           0 :   bool operator ==(Object other) => other is Tag && other.order == order;
    5587             : 
    5588           0 :   @override
    5589           0 :   int get hashCode => order.hashCode;
    5590             : 
    5591           0 :   @override
    5592             :   String toString() {
    5593           0 :     return toJson().toString();
    5594             :   }
    5595             : }
    5596             : 
    5597             : ///
    5598             : @_NameSource('rule override spec')
    5599             : class Profile {
    5600           1 :   Profile({
    5601             :     this.avatarUrl,
    5602             :     this.displayName,
    5603             :     required this.userId,
    5604             :   });
    5605             : 
    5606           0 :   Profile.fromJson(Map<String, Object?> json)
    5607           0 :       : avatarUrl = ((v) =>
    5608           0 :             v != null ? Uri.parse(v as String) : null)(json['avatar_url']),
    5609             :         displayName =
    5610           0 :             ((v) => v != null ? v as String : null)(json['display_name']),
    5611           0 :         userId = json['user_id'] as String;
    5612           0 :   Map<String, Object?> toJson() {
    5613           0 :     final avatarUrl = this.avatarUrl;
    5614           0 :     final displayName = this.displayName;
    5615           0 :     return {
    5616           0 :       if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    5617           0 :       if (displayName != null) 'display_name': displayName,
    5618           0 :       'user_id': userId,
    5619             :     };
    5620             :   }
    5621             : 
    5622             :   /// The avatar url, as an [`mxc://` URI](https://spec.matrix.org/unstable/client-server-api/#matrix-content-mxc-uris), if one exists.
    5623             :   Uri? avatarUrl;
    5624             : 
    5625             :   /// The display name of the user, if one exists.
    5626             :   String? displayName;
    5627             : 
    5628             :   /// The user's matrix user ID.
    5629             :   String userId;
    5630             : 
    5631           0 :   @override
    5632             :   bool operator ==(Object other) =>
    5633           0 :       other is Profile &&
    5634           0 :       other.avatarUrl == avatarUrl &&
    5635           0 :       other.displayName == displayName &&
    5636           0 :       other.userId == userId;
    5637             : 
    5638           0 :   @override
    5639           0 :   int get hashCode => Object.hash(avatarUrl, displayName, userId);
    5640             : 
    5641           0 :   @override
    5642             :   String toString() {
    5643           0 :     return toJson().toString();
    5644             :   }
    5645             : }
    5646             : 
    5647             : ///
    5648             : @_NameSource('generated')
    5649             : class SearchUserDirectoryResponse {
    5650           0 :   SearchUserDirectoryResponse({
    5651             :     required this.limited,
    5652             :     required this.results,
    5653             :   });
    5654             : 
    5655           0 :   SearchUserDirectoryResponse.fromJson(Map<String, Object?> json)
    5656           0 :       : limited = json['limited'] as bool,
    5657           0 :         results = (json['results'] as List)
    5658           0 :             .map((v) => Profile.fromJson(v as Map<String, Object?>))
    5659           0 :             .toList();
    5660           0 :   Map<String, Object?> toJson() => {
    5661           0 :         'limited': limited,
    5662           0 :         'results': results.map((v) => v.toJson()).toList(),
    5663             :       };
    5664             : 
    5665             :   /// Indicates if the result list has been truncated by the limit.
    5666             :   bool limited;
    5667             : 
    5668             :   /// Ordered by rank and then whether or not profile info is available.
    5669             :   List<Profile> results;
    5670             : 
    5671           0 :   @override
    5672             :   bool operator ==(Object other) =>
    5673           0 :       other is SearchUserDirectoryResponse &&
    5674           0 :       other.limited == limited &&
    5675           0 :       other.results == results;
    5676             : 
    5677           0 :   @override
    5678           0 :   int get hashCode => Object.hash(limited, results);
    5679             : 
    5680           0 :   @override
    5681             :   String toString() {
    5682           0 :     return toJson().toString();
    5683             :   }
    5684             : }
    5685             : 
    5686             : ///
    5687             : @_NameSource('rule override generated')
    5688             : class TurnServerCredentials {
    5689           0 :   TurnServerCredentials({
    5690             :     required this.password,
    5691             :     required this.ttl,
    5692             :     required this.uris,
    5693             :     required this.username,
    5694             :   });
    5695             : 
    5696           2 :   TurnServerCredentials.fromJson(Map<String, Object?> json)
    5697           2 :       : password = json['password'] as String,
    5698           2 :         ttl = json['ttl'] as int,
    5699           8 :         uris = (json['uris'] as List).map((v) => v as String).toList(),
    5700           2 :         username = json['username'] as String;
    5701           0 :   Map<String, Object?> toJson() => {
    5702           0 :         'password': password,
    5703           0 :         'ttl': ttl,
    5704           0 :         'uris': uris.map((v) => v).toList(),
    5705           0 :         'username': username,
    5706             :       };
    5707             : 
    5708             :   /// The password to use.
    5709             :   String password;
    5710             : 
    5711             :   /// The time-to-live in seconds
    5712             :   int ttl;
    5713             : 
    5714             :   /// A list of TURN URIs
    5715             :   List<String> uris;
    5716             : 
    5717             :   /// The username to use.
    5718             :   String username;
    5719             : 
    5720           0 :   @override
    5721             :   bool operator ==(Object other) =>
    5722           0 :       other is TurnServerCredentials &&
    5723           0 :       other.password == password &&
    5724           0 :       other.ttl == ttl &&
    5725           0 :       other.uris == uris &&
    5726           0 :       other.username == username;
    5727             : 
    5728           0 :   @override
    5729           0 :   int get hashCode => Object.hash(password, ttl, uris, username);
    5730             : 
    5731           0 :   @override
    5732             :   String toString() {
    5733           0 :     return toJson().toString();
    5734             :   }
    5735             : }
    5736             : 
    5737             : ///
    5738             : @_NameSource('generated')
    5739             : class GetVersionsResponse {
    5740           0 :   GetVersionsResponse({
    5741             :     this.unstableFeatures,
    5742             :     required this.versions,
    5743             :   });
    5744             : 
    5745          34 :   GetVersionsResponse.fromJson(Map<String, Object?> json)
    5746          34 :       : unstableFeatures = ((v) => v != null
    5747         102 :             ? (v as Map<String, Object?>).map((k, v) => MapEntry(k, v as bool))
    5748          68 :             : null)(json['unstable_features']),
    5749         136 :         versions = (json['versions'] as List).map((v) => v as String).toList();
    5750           0 :   Map<String, Object?> toJson() {
    5751           0 :     final unstableFeatures = this.unstableFeatures;
    5752           0 :     return {
    5753             :       if (unstableFeatures != null)
    5754           0 :         'unstable_features': unstableFeatures.map((k, v) => MapEntry(k, v)),
    5755           0 :       'versions': versions.map((v) => v).toList(),
    5756             :     };
    5757             :   }
    5758             : 
    5759             :   /// Experimental features the server supports. Features not listed here,
    5760             :   /// or the lack of this property all together, indicate that a feature is
    5761             :   /// not supported.
    5762             :   Map<String, bool>? unstableFeatures;
    5763             : 
    5764             :   /// The supported versions.
    5765             :   List<String> versions;
    5766             : 
    5767           0 :   @override
    5768             :   bool operator ==(Object other) =>
    5769           0 :       other is GetVersionsResponse &&
    5770           0 :       other.unstableFeatures == unstableFeatures &&
    5771           0 :       other.versions == versions;
    5772             : 
    5773           0 :   @override
    5774           0 :   int get hashCode => Object.hash(unstableFeatures, versions);
    5775             : 
    5776           0 :   @override
    5777             :   String toString() {
    5778           0 :     return toJson().toString();
    5779             :   }
    5780             : }
    5781             : 
    5782             : ///
    5783             : @_NameSource('generated')
    5784             : class CreateContentResponse {
    5785           0 :   CreateContentResponse({
    5786             :     required this.contentUri,
    5787             :     this.unusedExpiresAt,
    5788             :   });
    5789             : 
    5790           0 :   CreateContentResponse.fromJson(Map<String, Object?> json)
    5791           0 :       : contentUri = ((json['content_uri'] as String).startsWith('mxc://')
    5792           0 :             ? Uri.parse(json['content_uri'] as String)
    5793           0 :             : throw Exception('Uri not an mxc URI')),
    5794             :         unusedExpiresAt =
    5795           0 :             ((v) => v != null ? v as int : null)(json['unused_expires_at']);
    5796           0 :   Map<String, Object?> toJson() {
    5797           0 :     final unusedExpiresAt = this.unusedExpiresAt;
    5798           0 :     return {
    5799           0 :       'content_uri': contentUri.toString(),
    5800           0 :       if (unusedExpiresAt != null) 'unused_expires_at': unusedExpiresAt,
    5801             :     };
    5802             :   }
    5803             : 
    5804             :   /// The [`mxc://` URI](https://spec.matrix.org/unstable/client-server-api/#matrix-content-mxc-uris) at
    5805             :   /// which the content will be available, once it is uploaded.
    5806             :   Uri contentUri;
    5807             : 
    5808             :   /// The timestamp (in milliseconds since the unix epoch) when the
    5809             :   /// generated media id will expire, if media is not uploaded.
    5810             :   int? unusedExpiresAt;
    5811             : 
    5812           0 :   @override
    5813             :   bool operator ==(Object other) =>
    5814           0 :       other is CreateContentResponse &&
    5815           0 :       other.contentUri == contentUri &&
    5816           0 :       other.unusedExpiresAt == unusedExpiresAt;
    5817             : 
    5818           0 :   @override
    5819           0 :   int get hashCode => Object.hash(contentUri, unusedExpiresAt);
    5820             : 
    5821           0 :   @override
    5822             :   String toString() {
    5823           0 :     return toJson().toString();
    5824             :   }
    5825             : }

Generated by: LCOV version 1.14