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