Merge pull request #2061 from famedly/td/specv1.14

feat: endpoints for spec v1.14
This commit is contained in:
Krille-chan 2025-03-28 08:39:03 +01:00 committed by GitHub
commit 65468bb0d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 484 additions and 96 deletions

View File

@ -1,2 +1,2 @@
flutter_version=3.24.3 flutter_version=3.27.4
dart_version=3.5.3 dart_version=3.6.2

View File

@ -1080,7 +1080,7 @@ class Api {
String clientSecret, String clientSecret,
String email, String email,
int sendAttempt, { int sendAttempt, {
String? nextLink, Uri? nextLink,
String? idAccessToken, String? idAccessToken,
String? idServer, String? idServer,
}) async { }) async {
@ -1092,7 +1092,7 @@ class Api {
jsonEncode({ jsonEncode({
'client_secret': clientSecret, 'client_secret': clientSecret,
'email': email, 'email': email,
if (nextLink != null) 'next_link': nextLink, if (nextLink != null) 'next_link': nextLink.toString(),
'send_attempt': sendAttempt, 'send_attempt': sendAttempt,
if (idAccessToken != null) 'id_access_token': idAccessToken, if (idAccessToken != null) 'id_access_token': idAccessToken,
if (idServer != null) 'id_server': idServer, if (idServer != null) 'id_server': idServer,
@ -1155,7 +1155,7 @@ class Api {
String country, String country,
String phoneNumber, String phoneNumber,
int sendAttempt, { int sendAttempt, {
String? nextLink, Uri? nextLink,
String? idAccessToken, String? idAccessToken,
String? idServer, String? idServer,
}) async { }) async {
@ -1167,7 +1167,7 @@ class Api {
jsonEncode({ jsonEncode({
'client_secret': clientSecret, 'client_secret': clientSecret,
'country': country, 'country': country,
if (nextLink != null) 'next_link': nextLink, if (nextLink != null) 'next_link': nextLink.toString(),
'phone_number': phoneNumber, 'phone_number': phoneNumber,
'send_attempt': sendAttempt, 'send_attempt': sendAttempt,
if (idAccessToken != null) 'id_access_token': idAccessToken, if (idAccessToken != null) 'id_access_token': idAccessToken,
@ -1408,7 +1408,7 @@ class Api {
String clientSecret, String clientSecret,
String email, String email,
int sendAttempt, { int sendAttempt, {
String? nextLink, Uri? nextLink,
String? idAccessToken, String? idAccessToken,
String? idServer, String? idServer,
}) async { }) async {
@ -1420,7 +1420,7 @@ class Api {
jsonEncode({ jsonEncode({
'client_secret': clientSecret, 'client_secret': clientSecret,
'email': email, 'email': email,
if (nextLink != null) 'next_link': nextLink, if (nextLink != null) 'next_link': nextLink.toString(),
'send_attempt': sendAttempt, 'send_attempt': sendAttempt,
if (idAccessToken != null) 'id_access_token': idAccessToken, if (idAccessToken != null) 'id_access_token': idAccessToken,
if (idServer != null) 'id_server': idServer, if (idServer != null) 'id_server': idServer,
@ -1490,7 +1490,7 @@ class Api {
String country, String country,
String phoneNumber, String phoneNumber,
int sendAttempt, { int sendAttempt, {
String? nextLink, Uri? nextLink,
String? idAccessToken, String? idAccessToken,
String? idServer, String? idServer,
}) async { }) async {
@ -1502,7 +1502,7 @@ class Api {
jsonEncode({ jsonEncode({
'client_secret': clientSecret, 'client_secret': clientSecret,
'country': country, 'country': country,
if (nextLink != null) 'next_link': nextLink, if (nextLink != null) 'next_link': nextLink.toString(),
'phone_number': phoneNumber, 'phone_number': phoneNumber,
'send_attempt': sendAttempt, 'send_attempt': sendAttempt,
if (idAccessToken != null) 'id_access_token': idAccessToken, 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`. /// *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 /// 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 /// allowed to see all current state events in the room, and all subsequent
/// events associated with the room until the user leaves the room. /// 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. /// [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 /// [via] The servers to attempt to join the room through. One of the servers
/// must be participating in the room. /// must be participating in the room.
/// ///
@ -2156,7 +2153,6 @@ class Api {
/// The joined room ID. /// The joined room ID.
Future<String> joinRoom( Future<String> joinRoom(
String roomIdOrAlias, { String roomIdOrAlias, {
List<String>? serverName,
List<String>? via, List<String>? via,
String? reason, String? reason,
ThirdPartySigned? thirdPartySigned, ThirdPartySigned? thirdPartySigned,
@ -2164,7 +2160,6 @@ class Api {
final requestUri = Uri( final requestUri = Uri(
path: '_matrix/client/v3/join/${Uri.encodeComponent(roomIdOrAlias)}', path: '_matrix/client/v3/join/${Uri.encodeComponent(roomIdOrAlias)}',
queryParameters: { queryParameters: {
if (serverName != null) 'server_name': serverName,
if (via != null) 'via': via, if (via != null) 'via': via,
}, },
); );
@ -2489,9 +2484,6 @@ class Api {
/// ///
/// [roomIdOrAlias] The room identifier or alias to knock upon. /// [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 /// [via] The servers to attempt to knock on the room through. One of the servers
/// must be participating in the room. /// must be participating in the room.
/// ///
@ -2502,14 +2494,12 @@ class Api {
/// The knocked room ID. /// The knocked room ID.
Future<String> knockRoom( Future<String> knockRoom(
String roomIdOrAlias, { String roomIdOrAlias, {
List<String>? serverName,
List<String>? via, List<String>? via,
String? reason, String? reason,
}) async { }) async {
final requestUri = Uri( final requestUri = Uri(
path: '_matrix/client/v3/knock/${Uri.encodeComponent(roomIdOrAlias)}', path: '_matrix/client/v3/knock/${Uri.encodeComponent(roomIdOrAlias)}',
queryParameters: { queryParameters: {
if (serverName != null) 'server_name': serverName,
if (via != null) 'via': via, if (via != null) 'via': via,
}, },
); );
@ -2935,6 +2925,9 @@ class Api {
/// ///
/// [thirdPartyInstanceId] The specific third-party network/protocol to request from the /// [thirdPartyInstanceId] The specific third-party network/protocol to request from the
/// homeserver. Can only be used if `include_all_networks` is false. /// 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<QueryPublicRoomsResponse> queryPublicRooms({ Future<QueryPublicRoomsResponse> queryPublicRooms({
String? server, String? server,
PublicRoomQueryFilter? filter, PublicRoomQueryFilter? filter,
@ -3478,7 +3471,7 @@ class Api {
String clientSecret, String clientSecret,
String email, String email,
int sendAttempt, { int sendAttempt, {
String? nextLink, Uri? nextLink,
String? idAccessToken, String? idAccessToken,
String? idServer, String? idServer,
}) async { }) async {
@ -3490,7 +3483,7 @@ class Api {
jsonEncode({ jsonEncode({
'client_secret': clientSecret, 'client_secret': clientSecret,
'email': email, 'email': email,
if (nextLink != null) 'next_link': nextLink, if (nextLink != null) 'next_link': nextLink.toString(),
'send_attempt': sendAttempt, 'send_attempt': sendAttempt,
if (idAccessToken != null) 'id_access_token': idAccessToken, if (idAccessToken != null) 'id_access_token': idAccessToken,
if (idServer != null) 'id_server': idServer, if (idServer != null) 'id_server': idServer,
@ -3549,7 +3542,7 @@ class Api {
String country, String country,
String phoneNumber, String phoneNumber,
int sendAttempt, { int sendAttempt, {
String? nextLink, Uri? nextLink,
String? idAccessToken, String? idAccessToken,
String? idServer, String? idServer,
}) async { }) async {
@ -3561,7 +3554,7 @@ class Api {
jsonEncode({ jsonEncode({
'client_secret': clientSecret, 'client_secret': clientSecret,
'country': country, 'country': country,
if (nextLink != null) 'next_link': nextLink, if (nextLink != null) 'next_link': nextLink.toString(),
'phone_number': phoneNumber, 'phone_number': phoneNumber,
'send_attempt': sendAttempt, 'send_attempt': sendAttempt,
if (idAccessToken != null) 'id_access_token': idAccessToken, 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. /// [roomId] The room identifier (not alias) to which to invite the user.
/// ///
/// [address] The invitee's third-party identifier. /// [body]
/// Future<void> inviteBy3PID(String roomId, Invite3pid body) async {
/// [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<void> inviteBy3PID(
String roomId,
String address,
String idAccessToken,
String idServer,
String medium,
) async {
final requestUri = Uri( final requestUri = Uri(
path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/invite', path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/invite',
); );
final request = Request('POST', baseUri!.resolveUri(requestUri)); final request = Request('POST', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}'; request.headers['authorization'] = 'Bearer ${bearerToken!}';
request.headers['content-type'] = 'application/json'; request.headers['content-type'] = 'application/json';
request.bodyBytes = utf8.encode( request.bodyBytes = utf8.encode(jsonEncode(body.toJson()));
jsonEncode({
'address': address,
'id_access_token': idAccessToken,
'id_server': idServer,
'medium': medium,
}),
);
final response = await httpClient.send(request); final response = await httpClient.send(request);
final responseBody = await response.stream.toBytes(); final responseBody = await response.stream.toBytes();
if (response.statusCode != 200) unexpectedResponse(response, responseBody); if (response.statusCode != 200) unexpectedResponse(response, responseBody);
@ -4234,7 +4205,7 @@ class Api {
/// *Note that this API requires a room ID, not alias.* /// *Note that this API requires a room ID, not alias.*
/// `/join/{roomIdOrAlias}` *exists if you have a room 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 /// 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 /// allowed to see all current state events in the room, and all subsequent
/// events associated with the room until the user leaves the room. /// 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` /// 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 /// 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 /// level is also greater than or equal to the `redact` power level of the room,
/// of the room, the user may redact events sent by other users. /// the user may redact events sent by other users.
/// ///
/// Server administrators may redact events sent by users on their server. /// Server administrators may redact events sent by users on their server.
/// ///
@ -4627,8 +4598,8 @@ class Api {
/// ///
/// [roomId] The room being reported. /// [roomId] The room being reported.
/// ///
/// [reason] The reason the room is being reported. /// [reason] The reason the room is being reported. May be blank.
Future<void> reportRoom(String roomId, {String? reason}) async { Future<void> reportRoom(String roomId, String reason) async {
final requestUri = Uri( final requestUri = Uri(
path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/report', path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/report',
); );
@ -4637,7 +4608,7 @@ class Api {
request.headers['content-type'] = 'application/json'; request.headers['content-type'] = 'application/json';
request.bodyBytes = utf8.encode( request.bodyBytes = utf8.encode(
jsonEncode({ jsonEncode({
if (reason != null) 'reason': reason, 'reason': reason,
}), }),
); );
final response = await httpClient.send(request); 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 /// the appropriate people. The caller must be joined to the room to report
/// it. /// it.
/// ///
/// It might be possible for clients to deduce whether an event exists by /// Furthermore, it might be possible for clients to deduce whether a reported
/// timing the response, as only a report for an event that does exist /// event exists by timing the response. This is because only a report for an
/// will require the homeserver to check whether a user is joined to /// existing event will require the homeserver to do further processing. To
/// the room. To combat this, homeserver implementations should add /// combat this, homeservers MAY add a random delay when generating a response.
/// a random delay when generating a response.
/// ///
/// [roomId] The room in which the event being reported is located. /// [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. /// Fetches the metadata from the homeserver about a particular third-party protocol.
/// ///
/// [protocol] The name of the protocol. /// [protocol] The name of the protocol.
Future<Protocol> getProtocolMetadata(String protocol) async { Future<GetProtocolMetadataResponse$2> getProtocolMetadata(
String protocol,
) async {
final requestUri = Uri( final requestUri = Uri(
path: path:
'_matrix/client/v3/thirdparty/protocol/${Uri.encodeComponent(protocol)}', '_matrix/client/v3/thirdparty/protocol/${Uri.encodeComponent(protocol)}',
@ -5174,13 +5146,13 @@ class Api {
if (response.statusCode != 200) unexpectedResponse(response, responseBody); if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody); final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString); final json = jsonDecode(responseString);
return Protocol.fromJson(json as Map<String, Object?>); return GetProtocolMetadataResponse$2.fromJson(json as Map<String, Object?>);
} }
/// Fetches the overall metadata about protocols supported by the /// Fetches the overall metadata about protocols supported by the
/// homeserver. Includes both the available protocols and all fields /// homeserver. Includes both the available protocols and all fields
/// required for queries against each protocol. /// required for queries against each protocol.
Future<Map<String, Protocol>> getProtocols() async { Future<Map<String, GetProtocolsResponse$2>> getProtocols() async {
final requestUri = Uri(path: '_matrix/client/v3/thirdparty/protocols'); final requestUri = Uri(path: '_matrix/client/v3/thirdparty/protocols');
final request = Request('GET', baseUri!.resolveUri(requestUri)); final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}'; request.headers['authorization'] = 'Bearer ${bearerToken!}';
@ -5190,7 +5162,10 @@ class Api {
final responseString = utf8.decode(responseBody); final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString); final json = jsonDecode(responseString);
return (json as Map<String, Object?>).map( return (json as Map<String, Object?>).map(
(k, v) => MapEntry(k, Protocol.fromJson(v as Map<String, Object?>)), (k, v) => MapEntry(
k,
GetProtocolsResponse$2.fromJson(v as Map<String, Object?>),
),
); );
} }
@ -5568,6 +5543,45 @@ class Api {
return SearchUserDirectoryResponse.fromJson(json as Map<String, Object?>); return SearchUserDirectoryResponse.fromJson(json as Map<String, Object?>);
} }
/// 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<Map<String, Object?>> 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<String, Object?>;
}
/// This API provides credentials for the client to use when initiating /// This API provides credentials for the client to use when initiating
/// calls. /// calls.
Future<TurnServerCredentials> getTurnServer() async { Future<TurnServerCredentials> getTurnServer() async {

View File

@ -685,6 +685,16 @@ class GetSpaceHierarchyResponse {
String? nextBatch; String? nextBatch;
/// The rooms for the current page, with the current filters. /// 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<SpaceRoomsChunk> rooms; List<SpaceRoomsChunk> rooms;
@dart.override @dart.override
@ -3414,7 +3424,9 @@ class RoomKeysUpdateResponse {
int count; int count;
/// The new etag value representing stored keys in the backup. /// 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; String etag;
@dart.override @dart.override
@ -5000,6 +5012,68 @@ class FieldType {
int get hashCode => Object.hash(placeholder, regexp); 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<String, Object?> json)
: fieldTypes = (json['field_types'] as Map<String, Object?>).map(
(k, v) => MapEntry(k, FieldType.fromJson(v as Map<String, Object?>)),
),
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<String, Object?> 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<String, FieldType> 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<String> 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<String> 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') @_NameSource('spec')
class ProtocolInstance { class ProtocolInstance {
@ -5053,77 +5127,378 @@ class ProtocolInstance {
} }
/// ///
@_NameSource('spec') @_NameSource('generated')
class Protocol { class Instances$1 {
Protocol({ Instances$1({
required this.fieldTypes, this.instanceId,
required this.icon,
required this.instances,
required this.locationFields,
required this.userFields,
}); });
Protocol.fromJson(Map<String, Object?> json) Instances$1.fromJson(Map<String, Object?> json)
: instanceId =
((v) => v != null ? v as String : null)(json['instance_id']);
Map<String, Object?> 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<String, Object?> json)
: desc = json['desc'] as String,
fields = json['fields'] as Map<String, Object?>,
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<String, Object?> 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<String, Object?> 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<String, Object?> json)
: instances = ((v) => v != null
? (v as List)
.map((v) => Instances$2.fromJson(v as Map<String, Object?>))
.toList()
: null)(json['instances']);
Map<String, Object?> 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$2>? 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<String, Object?> json)
: fieldTypes = (json['field_types'] as Map<String, Object?>).map( : fieldTypes = (json['field_types'] as Map<String, Object?>).map(
(k, v) => MapEntry(k, FieldType.fromJson(v as Map<String, Object?>)), (k, v) => MapEntry(k, FieldType.fromJson(v as Map<String, Object?>)),
), ),
icon = json['icon'] as String, icon = json['icon'] as String,
instances = (json['instances'] as List)
.map((v) => ProtocolInstance.fromJson(v as Map<String, Object?>))
.toList(),
locationFields = locationFields =
(json['location_fields'] as List).map((v) => v as String).toList(), (json['location_fields'] as List).map((v) => v as String).toList(),
userFields = userFields =
(json['user_fields'] as List).map((v) => v as String).toList(); (json['user_fields'] as List).map((v) => v as String).toList(),
Map<String, Object?> toJson() => { instances = ((v) => v != null
'field_types': fieldTypes.map((k, v) => MapEntry(k, v.toJson())), ? (v as List)
'icon': icon, .map((v) => Instances$2.fromJson(v as Map<String, Object?>))
.toList()
: null)(json['instances']);
@override
Map<String, Object?> 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(), '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 /// The type definitions for the fields defined in `user_fields` and
/// `location_fields`. Each entry in those arrays MUST have an entry here. /// `location_fields`. Each entry in those arrays MUST have an entry here.
/// The `string` key for this object is the field name itself. /// The `string` key for this object is the field name itself.
/// ///
/// May be an empty object if no fields are defined. /// May be an empty object if no fields are defined.
@override
Map<String, FieldType> fieldTypes; Map<String, FieldType> fieldTypes;
/// A content URI representing an icon for the third-party protocol. /// A content URI representing an icon for the third-party protocol.
@override
String icon; 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<ProtocolInstance> instances;
/// Fields which may be used to identify a third-party location. These should be /// 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 /// 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 /// groupings are ordered first. For example, the name of a network should be
/// searched before the name of a channel. /// searched before the name of a channel.
@override
List<String> locationFields; List<String> locationFields;
/// Fields which may be used to identify a third-party user. These should be /// 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 /// 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 /// groupings are ordered first. For example, the name of a network should be
/// searched before the nickname of a user. /// searched before the nickname of a user.
@override
List<String> userFields; List<String> 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$2>? instances;
@dart.override @dart.override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) ||
(other is Protocol && (other is GetProtocolMetadataResponse$2 &&
other.runtimeType == runtimeType && other.runtimeType == runtimeType &&
other.fieldTypes == fieldTypes && other.fieldTypes == fieldTypes &&
other.icon == icon && other.icon == icon &&
other.instances == instances &&
other.locationFields == locationFields && other.locationFields == locationFields &&
other.userFields == userFields); other.userFields == userFields &&
other.instances == instances);
@dart.override @dart.override
int get hashCode => 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<String, Object?> json)
: instances = ((v) => v != null
? (v as List)
.map((v) => Instances$2.fromJson(v as Map<String, Object?>))
.toList()
: null)(json['instances']);
Map<String, Object?> 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$2>? 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<String, Object?> json)
: fieldTypes = (json['field_types'] as Map<String, Object?>).map(
(k, v) => MapEntry(k, FieldType.fromJson(v as Map<String, Object?>)),
),
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<String, Object?>))
.toList()
: null)(json['instances']);
@override
Map<String, Object?> 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<String, FieldType> 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<String> 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<String> 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$2>? 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);
} }
/// ///

View File

@ -3676,7 +3676,6 @@ class Client extends MatrixApi {
}) => }) =>
super.joinRoom( super.joinRoom(
roomIdOrAlias, roomIdOrAlias,
serverName: via ?? serverName,
via: via ?? serverName, via: via ?? serverName,
reason: reason, reason: reason,
thirdPartySigned: thirdPartySigned, thirdPartySigned: thirdPartySigned,

View File

@ -35,7 +35,7 @@ dependencies:
webrtc_interface: ^1.2.2+hotfix.1 webrtc_interface: ^1.2.2+hotfix.1
dev_dependencies: dev_dependencies:
build_runner: ^2.4.13 build_runner: ^2.4.15
coverage: ">=0.15.0 <2.0.0" coverage: ">=0.15.0 <2.0.0"
file: ">=6.1.1 <8.0.0" file: ">=6.1.1 <8.0.0"
import_sorter: ^4.6.0 import_sorter: ^4.6.0