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