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