diff --git a/.github/workflows/versions.env b/.github/workflows/versions.env index 4913196f..3fb81f74 100644 --- a/.github/workflows/versions.env +++ b/.github/workflows/versions.env @@ -1,2 +1,2 @@ -flutter_version=3.24.3 -dart_version=3.5.3 \ No newline at end of file +flutter_version=3.27.4 +dart_version=3.6.2 \ No newline at end of file diff --git a/lib/matrix_api_lite/generated/api.dart b/lib/matrix_api_lite/generated/api.dart index b2552767..c571cf34 100644 --- a/lib/matrix_api_lite/generated/api.dart +++ b/lib/matrix_api_lite/generated/api.dart @@ -1080,7 +1080,7 @@ class Api { String clientSecret, String email, int sendAttempt, { - String? nextLink, + Uri? nextLink, String? idAccessToken, String? idServer, }) async { @@ -1092,7 +1092,7 @@ class Api { jsonEncode({ 'client_secret': clientSecret, 'email': email, - if (nextLink != null) 'next_link': nextLink, + if (nextLink != null) 'next_link': nextLink.toString(), 'send_attempt': sendAttempt, if (idAccessToken != null) 'id_access_token': idAccessToken, if (idServer != null) 'id_server': idServer, @@ -1155,7 +1155,7 @@ class Api { String country, String phoneNumber, int sendAttempt, { - String? nextLink, + Uri? nextLink, String? idAccessToken, String? idServer, }) async { @@ -1167,7 +1167,7 @@ class Api { jsonEncode({ 'client_secret': clientSecret, 'country': country, - if (nextLink != null) 'next_link': nextLink, + if (nextLink != null) 'next_link': nextLink.toString(), 'phone_number': phoneNumber, 'send_attempt': sendAttempt, if (idAccessToken != null) 'id_access_token': idAccessToken, @@ -1408,7 +1408,7 @@ class Api { String clientSecret, String email, int sendAttempt, { - String? nextLink, + Uri? nextLink, String? idAccessToken, String? idServer, }) async { @@ -1420,7 +1420,7 @@ class Api { jsonEncode({ 'client_secret': clientSecret, 'email': email, - if (nextLink != null) 'next_link': nextLink, + if (nextLink != null) 'next_link': nextLink.toString(), 'send_attempt': sendAttempt, if (idAccessToken != null) 'id_access_token': idAccessToken, if (idServer != null) 'id_server': idServer, @@ -1490,7 +1490,7 @@ class Api { String country, String phoneNumber, int sendAttempt, { - String? nextLink, + Uri? nextLink, String? idAccessToken, String? idServer, }) async { @@ -1502,7 +1502,7 @@ class Api { jsonEncode({ 'client_secret': clientSecret, 'country': country, - if (nextLink != null) 'next_link': nextLink, + if (nextLink != null) 'next_link': nextLink.toString(), 'phone_number': phoneNumber, 'send_attempt': sendAttempt, if (idAccessToken != null) 'id_access_token': idAccessToken, @@ -2128,7 +2128,7 @@ class Api { /// *Note that this API takes either a room ID or alias, unlike* `/rooms/{roomId}/join`. /// - /// This API starts a user participating in a particular room, if that user + /// This API starts a user's participation in a particular room, if that user /// is allowed to participate in that room. After this call, the client is /// allowed to see all current state events in the room, and all subsequent /// events associated with the room until the user leaves the room. @@ -2139,9 +2139,6 @@ class Api { /// /// [roomIdOrAlias] The room identifier or alias to join. /// - /// [serverName] The servers to attempt to join the room through. One of the servers - /// must be participating in the room. - /// /// [via] The servers to attempt to join the room through. One of the servers /// must be participating in the room. /// @@ -2156,7 +2153,6 @@ class Api { /// The joined room ID. Future joinRoom( String roomIdOrAlias, { - List? serverName, List? via, String? reason, ThirdPartySigned? thirdPartySigned, @@ -2164,7 +2160,6 @@ class Api { final requestUri = Uri( path: '_matrix/client/v3/join/${Uri.encodeComponent(roomIdOrAlias)}', queryParameters: { - if (serverName != null) 'server_name': serverName, if (via != null) 'via': via, }, ); @@ -2489,9 +2484,6 @@ class Api { /// /// [roomIdOrAlias] The room identifier or alias to knock upon. /// - /// [serverName] The servers to attempt to knock on the room through. One of the servers - /// must be participating in the room. - /// /// [via] The servers to attempt to knock on the room through. One of the servers /// must be participating in the room. /// @@ -2502,14 +2494,12 @@ class Api { /// The knocked room ID. Future knockRoom( String roomIdOrAlias, { - List? serverName, List? via, String? reason, }) async { final requestUri = Uri( path: '_matrix/client/v3/knock/${Uri.encodeComponent(roomIdOrAlias)}', queryParameters: { - if (serverName != null) 'server_name': serverName, if (via != null) 'via': via, }, ); @@ -2935,6 +2925,9 @@ class Api { /// /// [thirdPartyInstanceId] The specific third-party network/protocol to request from the /// homeserver. Can only be used if `include_all_networks` is false. + /// + /// This is the `instance_id` of a `Protocol Instance` returned by + /// [`GET /_matrix/client/v3/thirdparty/protocols`](https://spec.matrix.org/unstable/client-server-api/#get_matrixclientv3thirdpartyprotocols). Future queryPublicRooms({ String? server, PublicRoomQueryFilter? filter, @@ -3478,7 +3471,7 @@ class Api { String clientSecret, String email, int sendAttempt, { - String? nextLink, + Uri? nextLink, String? idAccessToken, String? idServer, }) async { @@ -3490,7 +3483,7 @@ class Api { jsonEncode({ 'client_secret': clientSecret, 'email': email, - if (nextLink != null) 'next_link': nextLink, + if (nextLink != null) 'next_link': nextLink.toString(), 'send_attempt': sendAttempt, if (idAccessToken != null) 'id_access_token': idAccessToken, if (idServer != null) 'id_server': idServer, @@ -3549,7 +3542,7 @@ class Api { String country, String phoneNumber, int sendAttempt, { - String? nextLink, + Uri? nextLink, String? idAccessToken, String? idServer, }) async { @@ -3561,7 +3554,7 @@ class Api { jsonEncode({ 'client_secret': clientSecret, 'country': country, - if (nextLink != null) 'next_link': nextLink, + if (nextLink != null) 'next_link': nextLink.toString(), 'phone_number': phoneNumber, 'send_attempt': sendAttempt, if (idAccessToken != null) 'id_access_token': idAccessToken, @@ -4146,37 +4139,15 @@ class Api { /// /// [roomId] The room identifier (not alias) to which to invite the user. /// - /// [address] The invitee's third-party identifier. - /// - /// [idAccessToken] An access token previously registered with the identity server. Servers - /// can treat this as optional to distinguish between r0.5-compatible clients - /// and this specification version. - /// - /// [idServer] The hostname+port of the identity server which should be used for third-party identifier lookups. - /// - /// [medium] The kind of address being passed in the address field, for example - /// `email` (see [the list of recognised values](https://spec.matrix.org/unstable/appendices/#3pid-types)). - Future inviteBy3PID( - String roomId, - String address, - String idAccessToken, - String idServer, - String medium, - ) async { + /// [body] + Future inviteBy3PID(String roomId, Invite3pid body) async { final requestUri = Uri( path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/invite', ); final request = Request('POST', baseUri!.resolveUri(requestUri)); request.headers['authorization'] = 'Bearer ${bearerToken!}'; request.headers['content-type'] = 'application/json'; - request.bodyBytes = utf8.encode( - jsonEncode({ - 'address': address, - 'id_access_token': idAccessToken, - 'id_server': idServer, - 'medium': medium, - }), - ); + request.bodyBytes = utf8.encode(jsonEncode(body.toJson())); final response = await httpClient.send(request); final responseBody = await response.stream.toBytes(); if (response.statusCode != 200) unexpectedResponse(response, responseBody); @@ -4234,7 +4205,7 @@ class Api { /// *Note that this API requires a room ID, not alias.* /// `/join/{roomIdOrAlias}` *exists if you have a room alias.* /// - /// This API starts a user participating in a particular room, if that user + /// This API starts a user's participation in a particular room, if that user /// is allowed to participate in that room. After this call, the client is /// allowed to see all current state events in the room, and all subsequent /// events associated with the room until the user leaves the room. @@ -4578,8 +4549,8 @@ class Api { /// /// Any user with a power level greater than or equal to the `m.room.redaction` /// event power level may send redaction events in the room. If the user's power - /// level greater is also greater than or equal to the `redact` power level - /// of the room, the user may redact events sent by other users. + /// level is also greater than or equal to the `redact` power level of the room, + /// the user may redact events sent by other users. /// /// Server administrators may redact events sent by users on their server. /// @@ -4627,8 +4598,8 @@ class Api { /// /// [roomId] The room being reported. /// - /// [reason] The reason the room is being reported. - Future reportRoom(String roomId, {String? reason}) async { + /// [reason] The reason the room is being reported. May be blank. + Future reportRoom(String roomId, String reason) async { final requestUri = Uri( path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/report', ); @@ -4637,7 +4608,7 @@ class Api { request.headers['content-type'] = 'application/json'; request.bodyBytes = utf8.encode( jsonEncode({ - if (reason != null) 'reason': reason, + 'reason': reason, }), ); final response = await httpClient.send(request); @@ -4652,11 +4623,10 @@ class Api { /// the appropriate people. The caller must be joined to the room to report /// it. /// - /// It might be possible for clients to deduce whether an event exists by - /// timing the response, as only a report for an event that does exist - /// will require the homeserver to check whether a user is joined to - /// the room. To combat this, homeserver implementations should add - /// a random delay when generating a response. + /// Furthermore, it might be possible for clients to deduce whether a reported + /// event exists by timing the response. This is because only a report for an + /// existing event will require the homeserver to do further processing. To + /// combat this, homeservers MAY add a random delay when generating a response. /// /// [roomId] The room in which the event being reported is located. /// @@ -5162,7 +5132,9 @@ class Api { /// Fetches the metadata from the homeserver about a particular third-party protocol. /// /// [protocol] The name of the protocol. - Future getProtocolMetadata(String protocol) async { + Future getProtocolMetadata( + String protocol, + ) async { final requestUri = Uri( path: '_matrix/client/v3/thirdparty/protocol/${Uri.encodeComponent(protocol)}', @@ -5174,13 +5146,13 @@ class Api { if (response.statusCode != 200) unexpectedResponse(response, responseBody); final responseString = utf8.decode(responseBody); final json = jsonDecode(responseString); - return Protocol.fromJson(json as Map); + return GetProtocolMetadataResponse$2.fromJson(json as Map); } /// Fetches the overall metadata about protocols supported by the /// homeserver. Includes both the available protocols and all fields /// required for queries against each protocol. - Future> getProtocols() async { + Future> getProtocols() async { final requestUri = Uri(path: '_matrix/client/v3/thirdparty/protocols'); final request = Request('GET', baseUri!.resolveUri(requestUri)); request.headers['authorization'] = 'Bearer ${bearerToken!}'; @@ -5190,7 +5162,10 @@ class Api { final responseString = utf8.decode(responseBody); final json = jsonDecode(responseString); return (json as Map).map( - (k, v) => MapEntry(k, Protocol.fromJson(v as Map)), + (k, v) => MapEntry( + k, + GetProtocolsResponse$2.fromJson(v as Map), + ), ); } @@ -5568,6 +5543,45 @@ class Api { return SearchUserDirectoryResponse.fromJson(json as Map); } + /// Reports a user as inappropriate to the server, which may then notify + /// the appropriate people. How such information is delivered is left up to + /// implementations. The caller is not required to be joined to any rooms + /// that the reported user is joined to. + /// + /// Clients may wish to [ignore](#ignoring-users) users after reporting them. + /// + /// Clients could infer whether a reported user exists based on the 404 response. + /// Homeservers that wish to conceal this information MAY return 200 responses + /// regardless of the existence of the reported user. + /// + /// Furthermore, it might be possible for clients to deduce whether a reported + /// user exists by timing the response. This is because only a report for an + /// existing user will require the homeserver to do further processing. To + /// combat this, homeservers MAY add a random delay when generating a response. + /// + /// [userId] The user being reported. + /// + /// [reason] The reason the room is being reported. May be blank. + Future> reportUser(String userId, String reason) async { + final requestUri = Uri( + path: '_matrix/client/v3/users/${Uri.encodeComponent(userId)}/report', + ); + final request = Request('POST', baseUri!.resolveUri(requestUri)); + request.headers['authorization'] = 'Bearer ${bearerToken!}'; + request.headers['content-type'] = 'application/json'; + request.bodyBytes = utf8.encode( + jsonEncode({ + 'reason': reason, + }), + ); + final response = await httpClient.send(request); + final responseBody = await response.stream.toBytes(); + if (response.statusCode != 200) unexpectedResponse(response, responseBody); + final responseString = utf8.decode(responseBody); + final json = jsonDecode(responseString); + return json as Map; + } + /// This API provides credentials for the client to use when initiating /// calls. Future getTurnServer() async { diff --git a/lib/matrix_api_lite/generated/model.dart b/lib/matrix_api_lite/generated/model.dart index 685dcf34..d31e6cba 100644 --- a/lib/matrix_api_lite/generated/model.dart +++ b/lib/matrix_api_lite/generated/model.dart @@ -685,6 +685,16 @@ class GetSpaceHierarchyResponse { String? nextBatch; /// The rooms for the current page, with the current filters. + /// + /// The server should return any rooms where at least one of the following conditions is true: + /// + /// * The requesting user is currently a member (their [room membership](#room-membership) is `join`). + /// * The requesting user already has permission to join, i.e. one of the following: + /// * The user's room membership is `invite`. + /// * The room's [join rules](#mroomjoin_rules) are set to `public`. + /// * The room's join rules are set to [`restricted`](#restricted-rooms), provided the user meets one of the specified conditions. + /// * The room is "knockable" (the room's join rules are set to `knock`, or `knock_restricted`, in a room version that supports those settings). + /// * The room's [`m.room.history_visibility`](#room-history-visibility) is set to `world_readable`. List rooms; @dart.override @@ -3414,7 +3424,9 @@ class RoomKeysUpdateResponse { int count; /// The new etag value representing stored keys in the backup. - /// See `GET /room_keys/version/{version}` for more details. + /// + /// See [`GET /room_keys/version/{version}`](client-server-api/#get_matrixclientv3room_keysversionversion) + /// for more details. String etag; @dart.override @@ -5000,6 +5012,68 @@ class FieldType { int get hashCode => Object.hash(placeholder, regexp); } +/// +@_NameSource('spec') +class Protocol { + Protocol({ + required this.fieldTypes, + required this.icon, + required this.locationFields, + required this.userFields, + }); + + Protocol.fromJson(Map json) + : fieldTypes = (json['field_types'] as Map).map( + (k, v) => MapEntry(k, FieldType.fromJson(v as Map)), + ), + icon = json['icon'] as String, + locationFields = + (json['location_fields'] as List).map((v) => v as String).toList(), + userFields = + (json['user_fields'] as List).map((v) => v as String).toList(); + Map toJson() => { + 'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())), + 'icon': icon, + 'location_fields': locationFields.map((v) => v).toList(), + 'user_fields': userFields.map((v) => v).toList(), + }; + + /// The type definitions for the fields defined in `user_fields` and + /// `location_fields`. Each entry in those arrays MUST have an entry here. + /// The `string` key for this object is the field name itself. + /// + /// May be an empty object if no fields are defined. + Map fieldTypes; + + /// A content URI representing an icon for the third-party protocol. + String icon; + + /// Fields which may be used to identify a third-party location. These should be + /// ordered to suggest the way that entities may be grouped, where higher + /// groupings are ordered first. For example, the name of a network should be + /// searched before the name of a channel. + List locationFields; + + /// Fields which may be used to identify a third-party user. These should be + /// ordered to suggest the way that entities may be grouped, where higher + /// groupings are ordered first. For example, the name of a network should be + /// searched before the nickname of a user. + List userFields; + + @dart.override + bool operator ==(Object other) => + identical(this, other) || + (other is Protocol && + other.runtimeType == runtimeType && + other.fieldTypes == fieldTypes && + other.icon == icon && + other.locationFields == locationFields && + other.userFields == userFields); + + @dart.override + int get hashCode => Object.hash(fieldTypes, icon, locationFields, userFields); +} + /// @_NameSource('spec') class ProtocolInstance { @@ -5053,77 +5127,378 @@ class ProtocolInstance { } /// -@_NameSource('spec') -class Protocol { - Protocol({ - required this.fieldTypes, - required this.icon, - required this.instances, - required this.locationFields, - required this.userFields, +@_NameSource('generated') +class Instances$1 { + Instances$1({ + this.instanceId, }); - Protocol.fromJson(Map json) + Instances$1.fromJson(Map json) + : instanceId = + ((v) => v != null ? v as String : null)(json['instance_id']); + Map toJson() { + final instanceId = this.instanceId; + return { + if (instanceId != null) 'instance_id': instanceId, + }; + } + + /// A unique identifier for this instance on the homeserver. This field is added + /// to the response of [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](https://spec.matrix.org/unstable/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol) + /// by the homeserver. + /// + /// This is the identifier to use as the `third_party_instance_id` in a request to + /// [`POST /_matrix/client/v3/publicRooms`](https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv3publicrooms). + String? instanceId; + + @dart.override + bool operator ==(Object other) => + identical(this, other) || + (other is Instances$1 && + other.runtimeType == runtimeType && + other.instanceId == instanceId); + + @dart.override + int get hashCode => instanceId.hashCode; +} + +/// +@_NameSource('generated') +class Instances$2 implements ProtocolInstance, Instances$1 { + Instances$2({ + required this.desc, + required this.fields, + this.icon, + required this.networkId, + this.instanceId, + }); + + Instances$2.fromJson(Map json) + : desc = json['desc'] as String, + fields = json['fields'] as Map, + icon = ((v) => v != null ? v as String : null)(json['icon']), + networkId = json['network_id'] as String, + instanceId = + ((v) => v != null ? v as String : null)(json['instance_id']); + @override + Map toJson() { + final icon = this.icon; + final instanceId = this.instanceId; + return { + 'desc': desc, + 'fields': fields, + if (icon != null) 'icon': icon, + 'network_id': networkId, + if (instanceId != null) 'instance_id': instanceId, + }; + } + + /// A human-readable description for the protocol, such as the name. + @override + String desc; + + /// Preset values for `fields` the client may use to search by. + @override + Map fields; + + /// An optional content URI representing the protocol. Overrides the one provided + /// at the higher level Protocol object. + @override + String? icon; + + /// A unique identifier across all instances. + @override + String networkId; + + /// A unique identifier for this instance on the homeserver. This field is added + /// to the response of [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](https://spec.matrix.org/unstable/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol) + /// by the homeserver. + /// + /// This is the identifier to use as the `third_party_instance_id` in a request to + /// [`POST /_matrix/client/v3/publicRooms`](https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv3publicrooms). + @override + String? instanceId; + + @dart.override + bool operator ==(Object other) => + identical(this, other) || + (other is Instances$2 && + other.runtimeType == runtimeType && + other.desc == desc && + other.fields == fields && + other.icon == icon && + other.networkId == networkId && + other.instanceId == instanceId); + + @dart.override + int get hashCode => Object.hash(desc, fields, icon, networkId, instanceId); +} + +/// +@_NameSource('generated') +class GetProtocolMetadataResponse$1 { + GetProtocolMetadataResponse$1({ + this.instances, + }); + + GetProtocolMetadataResponse$1.fromJson(Map json) + : instances = ((v) => v != null + ? (v as List) + .map((v) => Instances$2.fromJson(v as Map)) + .toList() + : null)(json['instances']); + Map toJson() { + final instances = this.instances; + return { + if (instances != null) + 'instances': instances.map((v) => v.toJson()).toList(), + }; + } + + /// A list of objects representing independent instances of configuration. + /// For example, multiple networks on IRC if multiple are provided by the + /// same application service. + /// + /// The instances are modified by the homeserver from the response of + /// [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](https://spec.matrix.org/unstable/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol) + /// to include an `instance_id` to serve as a unique identifier for each + /// instance on the homeserver. + List? instances; + + @dart.override + bool operator ==(Object other) => + identical(this, other) || + (other is GetProtocolMetadataResponse$1 && + other.runtimeType == runtimeType && + other.instances == instances); + + @dart.override + int get hashCode => instances.hashCode; +} + +/// +@_NameSource('generated') +class GetProtocolMetadataResponse$2 + implements Protocol, GetProtocolMetadataResponse$1 { + GetProtocolMetadataResponse$2({ + required this.fieldTypes, + required this.icon, + required this.locationFields, + required this.userFields, + this.instances, + }); + + GetProtocolMetadataResponse$2.fromJson(Map json) : fieldTypes = (json['field_types'] as Map).map( (k, v) => MapEntry(k, FieldType.fromJson(v as Map)), ), icon = json['icon'] as String, - instances = (json['instances'] as List) - .map((v) => ProtocolInstance.fromJson(v as Map)) - .toList(), locationFields = (json['location_fields'] as List).map((v) => v as String).toList(), userFields = - (json['user_fields'] as List).map((v) => v as String).toList(); - Map toJson() => { - 'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())), - 'icon': icon, + (json['user_fields'] as List).map((v) => v as String).toList(), + instances = ((v) => v != null + ? (v as List) + .map((v) => Instances$2.fromJson(v as Map)) + .toList() + : null)(json['instances']); + @override + Map toJson() { + final instances = this.instances; + return { + 'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())), + 'icon': icon, + 'location_fields': locationFields.map((v) => v).toList(), + 'user_fields': userFields.map((v) => v).toList(), + if (instances != null) 'instances': instances.map((v) => v.toJson()).toList(), - 'location_fields': locationFields.map((v) => v).toList(), - 'user_fields': userFields.map((v) => v).toList(), - }; + }; + } /// The type definitions for the fields defined in `user_fields` and /// `location_fields`. Each entry in those arrays MUST have an entry here. /// The `string` key for this object is the field name itself. /// /// May be an empty object if no fields are defined. + @override Map fieldTypes; /// A content URI representing an icon for the third-party protocol. + @override String icon; - /// A list of objects representing independent instances of configuration. - /// For example, multiple networks on IRC if multiple are provided by the - /// same application service. - List instances; - /// Fields which may be used to identify a third-party location. These should be /// ordered to suggest the way that entities may be grouped, where higher /// groupings are ordered first. For example, the name of a network should be /// searched before the name of a channel. + @override List locationFields; /// Fields which may be used to identify a third-party user. These should be /// ordered to suggest the way that entities may be grouped, where higher /// groupings are ordered first. For example, the name of a network should be /// searched before the nickname of a user. + @override List userFields; + /// A list of objects representing independent instances of configuration. + /// For example, multiple networks on IRC if multiple are provided by the + /// same application service. + /// + /// The instances are modified by the homeserver from the response of + /// [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](https://spec.matrix.org/unstable/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol) + /// to include an `instance_id` to serve as a unique identifier for each + /// instance on the homeserver. + @override + List? instances; + @dart.override bool operator ==(Object other) => identical(this, other) || - (other is Protocol && + (other is GetProtocolMetadataResponse$2 && other.runtimeType == runtimeType && other.fieldTypes == fieldTypes && other.icon == icon && - other.instances == instances && other.locationFields == locationFields && - other.userFields == userFields); + other.userFields == userFields && + other.instances == instances); @dart.override int get hashCode => - Object.hash(fieldTypes, icon, instances, locationFields, userFields); + Object.hash(fieldTypes, icon, locationFields, userFields, instances); +} + +/// +@_NameSource('generated') +class GetProtocolsResponse$1 { + GetProtocolsResponse$1({ + this.instances, + }); + + GetProtocolsResponse$1.fromJson(Map json) + : instances = ((v) => v != null + ? (v as List) + .map((v) => Instances$2.fromJson(v as Map)) + .toList() + : null)(json['instances']); + Map toJson() { + final instances = this.instances; + return { + if (instances != null) + 'instances': instances.map((v) => v.toJson()).toList(), + }; + } + + /// A list of objects representing independent instances of configuration. + /// For example, multiple networks on IRC if multiple are provided by the + /// same application service. + /// + /// The instances are modified by the homeserver from the response of + /// [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](https://spec.matrix.org/unstable/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol) + /// to include an `instance_id` to serve as a unique identifier for each + /// instance on the homeserver. + List? instances; + + @dart.override + bool operator ==(Object other) => + identical(this, other) || + (other is GetProtocolsResponse$1 && + other.runtimeType == runtimeType && + other.instances == instances); + + @dart.override + int get hashCode => instances.hashCode; +} + +/// +@_NameSource('generated') +class GetProtocolsResponse$2 implements Protocol, GetProtocolsResponse$1 { + GetProtocolsResponse$2({ + required this.fieldTypes, + required this.icon, + required this.locationFields, + required this.userFields, + this.instances, + }); + + GetProtocolsResponse$2.fromJson(Map json) + : fieldTypes = (json['field_types'] as Map).map( + (k, v) => MapEntry(k, FieldType.fromJson(v as Map)), + ), + icon = json['icon'] as String, + locationFields = + (json['location_fields'] as List).map((v) => v as String).toList(), + userFields = + (json['user_fields'] as List).map((v) => v as String).toList(), + instances = ((v) => v != null + ? (v as List) + .map((v) => Instances$2.fromJson(v as Map)) + .toList() + : null)(json['instances']); + @override + Map toJson() { + final instances = this.instances; + return { + 'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())), + 'icon': icon, + 'location_fields': locationFields.map((v) => v).toList(), + 'user_fields': userFields.map((v) => v).toList(), + if (instances != null) + 'instances': instances.map((v) => v.toJson()).toList(), + }; + } + + /// The type definitions for the fields defined in `user_fields` and + /// `location_fields`. Each entry in those arrays MUST have an entry here. + /// The `string` key for this object is the field name itself. + /// + /// May be an empty object if no fields are defined. + @override + Map fieldTypes; + + /// A content URI representing an icon for the third-party protocol. + @override + String icon; + + /// Fields which may be used to identify a third-party location. These should be + /// ordered to suggest the way that entities may be grouped, where higher + /// groupings are ordered first. For example, the name of a network should be + /// searched before the name of a channel. + @override + List locationFields; + + /// Fields which may be used to identify a third-party user. These should be + /// ordered to suggest the way that entities may be grouped, where higher + /// groupings are ordered first. For example, the name of a network should be + /// searched before the nickname of a user. + @override + List userFields; + + /// A list of objects representing independent instances of configuration. + /// For example, multiple networks on IRC if multiple are provided by the + /// same application service. + /// + /// The instances are modified by the homeserver from the response of + /// [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](https://spec.matrix.org/unstable/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol) + /// to include an `instance_id` to serve as a unique identifier for each + /// instance on the homeserver. + @override + List? instances; + + @dart.override + bool operator ==(Object other) => + identical(this, other) || + (other is GetProtocolsResponse$2 && + other.runtimeType == runtimeType && + other.fieldTypes == fieldTypes && + other.icon == icon && + other.locationFields == locationFields && + other.userFields == userFields && + other.instances == instances); + + @dart.override + int get hashCode => + Object.hash(fieldTypes, icon, locationFields, userFields, instances); } /// diff --git a/lib/src/client.dart b/lib/src/client.dart index d0372b17..76451cad 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -3676,7 +3676,6 @@ class Client extends MatrixApi { }) => super.joinRoom( roomIdOrAlias, - serverName: via ?? serverName, via: via ?? serverName, reason: reason, thirdPartySigned: thirdPartySigned, diff --git a/pubspec.yaml b/pubspec.yaml index ec2f5d04..54c9d663 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: webrtc_interface: ^1.2.2+hotfix.1 dev_dependencies: - build_runner: ^2.4.13 + build_runner: ^2.4.15 coverage: ">=0.15.0 <2.0.0" file: ">=6.1.1 <8.0.0" import_sorter: ^4.6.0