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