refactor: migrate to null safety
This commit is contained in:
parent
1b84de0b44
commit
d9c1fdb78a
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -83,9 +83,9 @@ class FakeMatrixApi extends MockClient {
|
||||||
if (!calledEndpoints.containsKey(action)) {
|
if (!calledEndpoints.containsKey(action)) {
|
||||||
calledEndpoints[action] = <dynamic>[];
|
calledEndpoints[action] = <dynamic>[];
|
||||||
}
|
}
|
||||||
calledEndpoints[action].add(data);
|
calledEndpoints[action]!.add(data);
|
||||||
if (api.containsKey(method) && api[method].containsKey(action)) {
|
if (api.containsKey(method) && api[method]!.containsKey(action)) {
|
||||||
res = api[method][action](data);
|
res = api[method];
|
||||||
if (res is Map && res.containsKey('errcode')) {
|
if (res is Map && res.containsKey('errcode')) {
|
||||||
statusCode = 405;
|
statusCode = 405;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -54,13 +54,13 @@ String describeEnum(Object enumEntry) {
|
||||||
|
|
||||||
class MatrixApi extends Api {
|
class MatrixApi extends Api {
|
||||||
/// The homeserver this client is communicating with.
|
/// The homeserver this client is communicating with.
|
||||||
Uri get homeserver => baseUri;
|
Uri? get homeserver => baseUri;
|
||||||
set homeserver(Uri uri) => baseUri = uri;
|
set homeserver(Uri? uri) => baseUri = uri;
|
||||||
|
|
||||||
/// This is the access token for the matrix client. When it is undefined, then
|
/// This is the access token for the matrix client. When it is undefined, then
|
||||||
/// the user needs to sign in first.
|
/// the user needs to sign in first.
|
||||||
String get accessToken => bearerToken;
|
String? get accessToken => bearerToken;
|
||||||
set accessToken(String token) => bearerToken = token;
|
set accessToken(String? token) => bearerToken = token;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Null unexpectedResponse(http.BaseResponse response, Uint8List responseBody) {
|
Null unexpectedResponse(http.BaseResponse response, Uint8List responseBody) {
|
||||||
|
|
@ -71,9 +71,9 @@ class MatrixApi extends Api {
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixApi({
|
MatrixApi({
|
||||||
Uri homeserver,
|
Uri? homeserver,
|
||||||
String accessToken,
|
String? accessToken,
|
||||||
http.Client httpClient,
|
http.Client? httpClient,
|
||||||
}) : super(
|
}) : super(
|
||||||
httpClient: httpClient,
|
httpClient: httpClient,
|
||||||
baseUri: homeserver,
|
baseUri: homeserver,
|
||||||
|
|
@ -102,7 +102,7 @@ class MatrixApi extends Api {
|
||||||
String action, {
|
String action, {
|
||||||
dynamic data = '',
|
dynamic data = '',
|
||||||
String contentType = 'application/json',
|
String contentType = 'application/json',
|
||||||
Map<String, dynamic> query,
|
Map<String, dynamic>? query,
|
||||||
}) async {
|
}) async {
|
||||||
if (homeserver == null) {
|
if (homeserver == null) {
|
||||||
throw ('No homeserver specified.');
|
throw ('No homeserver specified.');
|
||||||
|
|
@ -111,7 +111,7 @@ class MatrixApi extends Api {
|
||||||
(!(data is String)) ? json = jsonEncode(data) : json = data;
|
(!(data is String)) ? json = jsonEncode(data) : json = data;
|
||||||
if (data is List<int> || action.startsWith('/media/r0/upload')) json = data;
|
if (data is List<int> || action.startsWith('/media/r0/upload')) json = data;
|
||||||
|
|
||||||
final url = homeserver
|
final url = homeserver!
|
||||||
.resolveUri(Uri(path: '_matrix$action', queryParameters: query));
|
.resolveUri(Uri(path: '_matrix$action', queryParameters: query));
|
||||||
|
|
||||||
final headers = <String, String>{};
|
final headers = <String, String>{};
|
||||||
|
|
@ -122,8 +122,8 @@ class MatrixApi extends Api {
|
||||||
headers['Authorization'] = 'Bearer $accessToken';
|
headers['Authorization'] = 'Bearer $accessToken';
|
||||||
}
|
}
|
||||||
|
|
||||||
http.Response resp;
|
late http.Response resp;
|
||||||
var jsonResp = <String, dynamic>{};
|
Map<String, dynamic>? jsonResp = <String, dynamic>{};
|
||||||
try {
|
try {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RequestType.GET:
|
case RequestType.GET:
|
||||||
|
|
@ -153,7 +153,7 @@ class MatrixApi extends Api {
|
||||||
jsonString = '\{"chunk":$jsonString\}';
|
jsonString = '\{"chunk":$jsonString\}';
|
||||||
}
|
}
|
||||||
jsonResp = jsonDecode(jsonString)
|
jsonResp = jsonDecode(jsonString)
|
||||||
as Map<String, dynamic>; // May throw FormatException
|
as Map<String, dynamic>?; // May throw FormatException
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
throw MatrixConnectionException(e, s);
|
throw MatrixConnectionException(e, s);
|
||||||
}
|
}
|
||||||
|
|
@ -161,7 +161,7 @@ class MatrixApi extends Api {
|
||||||
throw MatrixException(resp);
|
throw MatrixException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonResp;
|
return jsonResp!;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The homeserver must check that the given email address is not already associated
|
/// The homeserver must check that the given email address is not already associated
|
||||||
|
|
@ -173,9 +173,9 @@ class MatrixApi extends Api {
|
||||||
String email,
|
String email,
|
||||||
String clientSecret,
|
String clientSecret,
|
||||||
int sendAttempt, {
|
int sendAttempt, {
|
||||||
String nextLink,
|
String? nextLink,
|
||||||
String idServer,
|
String? idServer,
|
||||||
String idAccessToken,
|
String? idAccessToken,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST, '/client/r0/register/email/requestToken',
|
RequestType.POST, '/client/r0/register/email/requestToken',
|
||||||
|
|
@ -199,9 +199,9 @@ class MatrixApi extends Api {
|
||||||
String phoneNumber,
|
String phoneNumber,
|
||||||
String clientSecret,
|
String clientSecret,
|
||||||
int sendAttempt, {
|
int sendAttempt, {
|
||||||
String nextLink,
|
String? nextLink,
|
||||||
String idServer,
|
String? idServer,
|
||||||
String idAccessToken,
|
String? idAccessToken,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST, '/client/r0/register/msisdn/requestToken',
|
RequestType.POST, '/client/r0/register/msisdn/requestToken',
|
||||||
|
|
@ -225,9 +225,9 @@ class MatrixApi extends Api {
|
||||||
String email,
|
String email,
|
||||||
String clientSecret,
|
String clientSecret,
|
||||||
int sendAttempt, {
|
int sendAttempt, {
|
||||||
String nextLink,
|
String? nextLink,
|
||||||
String idServer,
|
String? idServer,
|
||||||
String idAccessToken,
|
String? idAccessToken,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST, '/client/r0/account/password/email/requestToken',
|
RequestType.POST, '/client/r0/account/password/email/requestToken',
|
||||||
|
|
@ -251,9 +251,9 @@ class MatrixApi extends Api {
|
||||||
String phoneNumber,
|
String phoneNumber,
|
||||||
String clientSecret,
|
String clientSecret,
|
||||||
int sendAttempt, {
|
int sendAttempt, {
|
||||||
String nextLink,
|
String? nextLink,
|
||||||
String idServer,
|
String? idServer,
|
||||||
String idAccessToken,
|
String? idAccessToken,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST, '/client/r0/account/password/msisdn/requestToken',
|
RequestType.POST, '/client/r0/account/password/msisdn/requestToken',
|
||||||
|
|
@ -275,9 +275,9 @@ class MatrixApi extends Api {
|
||||||
String email,
|
String email,
|
||||||
String clientSecret,
|
String clientSecret,
|
||||||
int sendAttempt, {
|
int sendAttempt, {
|
||||||
String nextLink,
|
String? nextLink,
|
||||||
String idServer,
|
String? idServer,
|
||||||
String idAccessToken,
|
String? idAccessToken,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST, '/client/r0/account/3pid/email/requestToken',
|
RequestType.POST, '/client/r0/account/3pid/email/requestToken',
|
||||||
|
|
@ -299,9 +299,9 @@ class MatrixApi extends Api {
|
||||||
String phoneNumber,
|
String phoneNumber,
|
||||||
String clientSecret,
|
String clientSecret,
|
||||||
int sendAttempt, {
|
int sendAttempt, {
|
||||||
String nextLink,
|
String? nextLink,
|
||||||
String idServer,
|
String? idServer,
|
||||||
String idAccessToken,
|
String? idAccessToken,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST, '/client/r0/account/3pid/msisdn/requestToken',
|
RequestType.POST, '/client/r0/account/3pid/msisdn/requestToken',
|
||||||
|
|
@ -323,7 +323,7 @@ class MatrixApi extends Api {
|
||||||
/// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-state-eventtype-statekey
|
/// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-state-eventtype-statekey
|
||||||
Future<Map<String, dynamic>> requestStateContent(
|
Future<Map<String, dynamic>> requestStateContent(
|
||||||
String roomId, String eventType,
|
String roomId, String eventType,
|
||||||
[String stateKey]) async {
|
[String? stateKey]) async {
|
||||||
var url =
|
var url =
|
||||||
'/client/r0/rooms/${Uri.encodeComponent(roomId)}/state/${Uri.encodeComponent(eventType)}/';
|
'/client/r0/rooms/${Uri.encodeComponent(roomId)}/state/${Uri.encodeComponent(eventType)}/';
|
||||||
if (stateKey != null) {
|
if (stateKey != null) {
|
||||||
|
|
@ -364,9 +364,9 @@ class MatrixApi extends Api {
|
||||||
/// Publishes end-to-end encryption keys for the device.
|
/// Publishes end-to-end encryption keys for the device.
|
||||||
/// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-query
|
/// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-query
|
||||||
Future<Map<String, int>> uploadKeys(
|
Future<Map<String, int>> uploadKeys(
|
||||||
{MatrixDeviceKeys deviceKeys,
|
{MatrixDeviceKeys? deviceKeys,
|
||||||
Map<String, dynamic> oneTimeKeys,
|
Map<String, dynamic>? oneTimeKeys,
|
||||||
Map<String, dynamic> fallbackKeys}) async {
|
Map<String, dynamic>? fallbackKeys}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST,
|
RequestType.POST,
|
||||||
'/client/r0/keys/upload',
|
'/client/r0/keys/upload',
|
||||||
|
|
@ -385,10 +385,10 @@ class MatrixApi extends Api {
|
||||||
/// Uploads your own cross-signing keys.
|
/// Uploads your own cross-signing keys.
|
||||||
/// https://github.com/matrix-org/matrix-doc/pull/2536
|
/// https://github.com/matrix-org/matrix-doc/pull/2536
|
||||||
Future<void> uploadDeviceSigningKeys({
|
Future<void> uploadDeviceSigningKeys({
|
||||||
MatrixCrossSigningKey masterKey,
|
MatrixCrossSigningKey? masterKey,
|
||||||
MatrixCrossSigningKey selfSigningKey,
|
MatrixCrossSigningKey? selfSigningKey,
|
||||||
MatrixCrossSigningKey userSigningKey,
|
MatrixCrossSigningKey? userSigningKey,
|
||||||
AuthenticationData auth,
|
AuthenticationData? auth,
|
||||||
}) async {
|
}) async {
|
||||||
await request(
|
await request(
|
||||||
RequestType.POST,
|
RequestType.POST,
|
||||||
|
|
@ -410,7 +410,7 @@ class MatrixApi extends Api {
|
||||||
for (final key in keys) {
|
for (final key in keys) {
|
||||||
if (key.identifier == null ||
|
if (key.identifier == null ||
|
||||||
key.signatures == null ||
|
key.signatures == null ||
|
||||||
key.signatures.isEmpty) {
|
key.signatures!.isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!payload.containsKey(key.userId)) {
|
if (!payload.containsKey(key.userId)) {
|
||||||
|
|
@ -437,7 +437,7 @@ class MatrixApi extends Api {
|
||||||
/// for this user ID. The behaviour of this endpoint varies depending on the
|
/// for this user ID. The behaviour of this endpoint varies depending on the
|
||||||
/// values in the JSON body.
|
/// values in the JSON body.
|
||||||
/// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-pushers-set
|
/// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-pushers-set
|
||||||
Future<void> postPusher(Pusher pusher, {bool append}) async {
|
Future<void> postPusher(Pusher pusher, {bool? append}) async {
|
||||||
final data = pusher.toJson();
|
final data = pusher.toJson();
|
||||||
if (append != null) {
|
if (append != null) {
|
||||||
data['append'] = append;
|
data['append'] = append;
|
||||||
|
|
@ -454,9 +454,9 @@ class MatrixApi extends Api {
|
||||||
/// caller. This will block until an event is received, or until the timeout is reached.
|
/// caller. This will block until an event is received, or until the timeout is reached.
|
||||||
/// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-events
|
/// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-events
|
||||||
Future<EventsSyncUpdate> getEvents({
|
Future<EventsSyncUpdate> getEvents({
|
||||||
String from,
|
String? from,
|
||||||
int timeout,
|
int? timeout,
|
||||||
String roomId,
|
String? roomId,
|
||||||
}) async {
|
}) async {
|
||||||
final response =
|
final response =
|
||||||
await request(RequestType.GET, '/client/r0/events', query: {
|
await request(RequestType.GET, '/client/r0/events', query: {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -24,9 +24,9 @@
|
||||||
|
|
||||||
class AuthenticationData {
|
class AuthenticationData {
|
||||||
String type;
|
String type;
|
||||||
String session;
|
String?/*?*//*?*/ session;
|
||||||
|
|
||||||
AuthenticationData({this.type, this.session});
|
AuthenticationData({required this.type, this.session});
|
||||||
|
|
||||||
AuthenticationData.fromJson(Map<String, dynamic> json)
|
AuthenticationData.fromJson(Map<String, dynamic> json)
|
||||||
: type = json['type'],
|
: type = json['type'],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -30,7 +30,7 @@ import 'authentication_third_party_identifier.dart';
|
||||||
class AuthenticationIdentifier {
|
class AuthenticationIdentifier {
|
||||||
String type;
|
String type;
|
||||||
|
|
||||||
AuthenticationIdentifier({this.type});
|
AuthenticationIdentifier({required this.type});
|
||||||
|
|
||||||
AuthenticationIdentifier.fromJson(Map<String, dynamic> json)
|
AuthenticationIdentifier.fromJson(Map<String, dynamic> json)
|
||||||
: type = json['type'];
|
: type = json['type'];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,7 +29,7 @@ import 'authentication_identifier.dart';
|
||||||
import 'authentication_types.dart';
|
import 'authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationPassword extends AuthenticationData {
|
class AuthenticationPassword extends AuthenticationData {
|
||||||
String user;
|
String? user;
|
||||||
String password;
|
String password;
|
||||||
|
|
||||||
/// You may want to cast this as [AuthenticationUserIdentifier] or other
|
/// You may want to cast this as [AuthenticationUserIdentifier] or other
|
||||||
|
|
@ -37,7 +37,7 @@ class AuthenticationPassword extends AuthenticationData {
|
||||||
AuthenticationIdentifier identifier;
|
AuthenticationIdentifier identifier;
|
||||||
|
|
||||||
AuthenticationPassword(
|
AuthenticationPassword(
|
||||||
{String session, this.password, this.user, this.identifier})
|
{String? session, required this.password, this.user, required this.identifier})
|
||||||
: super(
|
: super(
|
||||||
type: AuthenticationTypes.password,
|
type: AuthenticationTypes.password,
|
||||||
session: session,
|
session: session,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,7 +29,7 @@ class AuthenticationPhoneIdentifier extends AuthenticationIdentifier {
|
||||||
String country;
|
String country;
|
||||||
String phone;
|
String phone;
|
||||||
|
|
||||||
AuthenticationPhoneIdentifier({this.country, this.phone})
|
AuthenticationPhoneIdentifier({required this.country, required this.phone})
|
||||||
: super(type: AuthenticationIdentifierTypes.phone);
|
: super(type: AuthenticationIdentifierTypes.phone);
|
||||||
|
|
||||||
AuthenticationPhoneIdentifier.fromJson(Map<String, dynamic> json)
|
AuthenticationPhoneIdentifier.fromJson(Map<String, dynamic> json)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -28,7 +28,7 @@ import 'authentication_types.dart';
|
||||||
class AuthenticationRecaptcha extends AuthenticationData {
|
class AuthenticationRecaptcha extends AuthenticationData {
|
||||||
String response;
|
String response;
|
||||||
|
|
||||||
AuthenticationRecaptcha({String session, this.response})
|
AuthenticationRecaptcha({required String session, required this.response})
|
||||||
: super(
|
: super(
|
||||||
type: AuthenticationTypes.recaptcha,
|
type: AuthenticationTypes.recaptcha,
|
||||||
session: session,
|
session: session,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,7 +29,7 @@ class AuthenticationThirdPartyIdentifier extends AuthenticationIdentifier {
|
||||||
String medium;
|
String medium;
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
AuthenticationThirdPartyIdentifier({this.medium, this.address})
|
AuthenticationThirdPartyIdentifier({required this.medium, required this.address})
|
||||||
: super(type: AuthenticationIdentifierTypes.thirdParty);
|
: super(type: AuthenticationIdentifierTypes.thirdParty);
|
||||||
|
|
||||||
AuthenticationThirdPartyIdentifier.fromJson(Map<String, dynamic> json)
|
AuthenticationThirdPartyIdentifier.fromJson(Map<String, dynamic> json)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,9 +29,9 @@ import 'authentication_data.dart';
|
||||||
/// Or phone number based identity:
|
/// Or phone number based identity:
|
||||||
/// https://matrix.org/docs/spec/client_server/r0.6.1#phone-number-msisdn-based-identity-homeserver
|
/// https://matrix.org/docs/spec/client_server/r0.6.1#phone-number-msisdn-based-identity-homeserver
|
||||||
class AuthenticationThreePidCreds extends AuthenticationData {
|
class AuthenticationThreePidCreds extends AuthenticationData {
|
||||||
List<ThreepidCreds> threepidCreds;
|
late List<ThreepidCreds> threepidCreds;
|
||||||
|
|
||||||
AuthenticationThreePidCreds({String session, String type, this.threepidCreds})
|
AuthenticationThreePidCreds({String? session, required String type, required this.threepidCreds})
|
||||||
: super(
|
: super(
|
||||||
type: type,
|
type: type,
|
||||||
session: session,
|
session: session,
|
||||||
|
|
@ -65,13 +65,13 @@ class AuthenticationThreePidCreds extends AuthenticationData {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ThreepidCreds {
|
class ThreepidCreds {
|
||||||
String sid;
|
String/*!*/ sid;
|
||||||
String clientSecret;
|
String clientSecret;
|
||||||
String idServer;
|
String idServer;
|
||||||
String idAccessToken;
|
String idAccessToken;
|
||||||
|
|
||||||
ThreepidCreds(
|
ThreepidCreds(
|
||||||
{this.sid, this.clientSecret, this.idServer, this.idAccessToken});
|
{required this.sid, required this.clientSecret, required this.idServer, required this.idAccessToken});
|
||||||
|
|
||||||
ThreepidCreds.fromJson(Map<String, dynamic> json)
|
ThreepidCreds.fromJson(Map<String, dynamic> json)
|
||||||
: sid = json['sid'],
|
: sid = json['sid'],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -27,9 +27,9 @@ import 'authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationToken extends AuthenticationData {
|
class AuthenticationToken extends AuthenticationData {
|
||||||
String token;
|
String token;
|
||||||
String txnId;
|
String? txnId;
|
||||||
|
|
||||||
AuthenticationToken({String session, this.token, this.txnId})
|
AuthenticationToken({String? session, required this.token, this.txnId})
|
||||||
: super(
|
: super(
|
||||||
type: AuthenticationTypes.token,
|
type: AuthenticationTypes.token,
|
||||||
session: session,
|
session: session,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -28,7 +28,7 @@ import 'authentication_types.dart';
|
||||||
class AuthenticationUserIdentifier extends AuthenticationIdentifier {
|
class AuthenticationUserIdentifier extends AuthenticationIdentifier {
|
||||||
String user;
|
String user;
|
||||||
|
|
||||||
AuthenticationUserIdentifier({this.user})
|
AuthenticationUserIdentifier({required this.user})
|
||||||
: super(type: AuthenticationIdentifierTypes.userId);
|
: super(type: AuthenticationIdentifierTypes.userId);
|
||||||
|
|
||||||
AuthenticationUserIdentifier.fromJson(Map<String, dynamic> json)
|
AuthenticationUserIdentifier.fromJson(Map<String, dynamic> json)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,8 +29,8 @@ class BasicEvent {
|
||||||
Map<String, dynamic> content;
|
Map<String, dynamic> content;
|
||||||
|
|
||||||
BasicEvent({
|
BasicEvent({
|
||||||
this.type,
|
required this.type,
|
||||||
this.content,
|
required this.content,
|
||||||
});
|
});
|
||||||
|
|
||||||
BasicEvent.fromJson(Map<String, dynamic> json)
|
BasicEvent.fromJson(Map<String, dynamic> json)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -25,12 +25,12 @@
|
||||||
import 'basic_event.dart';
|
import 'basic_event.dart';
|
||||||
|
|
||||||
class BasicRoomEvent extends BasicEvent {
|
class BasicRoomEvent extends BasicEvent {
|
||||||
String roomId;
|
String? roomId;
|
||||||
|
|
||||||
BasicRoomEvent({
|
BasicRoomEvent({
|
||||||
this.roomId,
|
this.roomId,
|
||||||
Map<String, dynamic> content,
|
required Map<String, dynamic> content,
|
||||||
String type,
|
required String type,
|
||||||
}) : super(
|
}) : super(
|
||||||
content: content,
|
content: content,
|
||||||
type: type,
|
type: type,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -25,12 +25,12 @@
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import '../../utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
class OlmPlaintextPayload {
|
class OlmPlaintextPayload {
|
||||||
String type;
|
String? type;
|
||||||
Map<String, dynamic> content;
|
Map<String, dynamic>? content;
|
||||||
String sender;
|
String? sender;
|
||||||
String recipient;
|
String? recipient;
|
||||||
Map<String, String> recipientKeys;
|
Map<String, String>? recipientKeys;
|
||||||
Map<String, String> keys;
|
Map<String, String>? keys;
|
||||||
|
|
||||||
OlmPlaintextPayload({
|
OlmPlaintextPayload({
|
||||||
this.type,
|
this.type,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -35,10 +35,10 @@ extension RoomEncryptedContentBasicEventExtension on BasicEvent {
|
||||||
class RoomEncryptedContent {
|
class RoomEncryptedContent {
|
||||||
String algorithm;
|
String algorithm;
|
||||||
String senderKey;
|
String senderKey;
|
||||||
String deviceId;
|
String? deviceId;
|
||||||
String sessionId;
|
String? sessionId;
|
||||||
String ciphertextMegolm;
|
String? ciphertextMegolm;
|
||||||
Map<String, CiphertextInfo> ciphertextOlm;
|
Map<String, CiphertextInfo>? ciphertextOlm;
|
||||||
|
|
||||||
RoomEncryptedContent.fromJson(Map<String, dynamic> json)
|
RoomEncryptedContent.fromJson(Map<String, dynamic> json)
|
||||||
: algorithm = json.tryGet<String>('algorithm', ''),
|
: algorithm = json.tryGet<String>('algorithm', ''),
|
||||||
|
|
@ -68,7 +68,7 @@ class RoomEncryptedContent {
|
||||||
data['ciphertext'] = ciphertextMegolm;
|
data['ciphertext'] = ciphertextMegolm;
|
||||||
}
|
}
|
||||||
if (ciphertextOlm != null) {
|
if (ciphertextOlm != null) {
|
||||||
data['ciphertext'] = ciphertextOlm.map((k, v) => MapEntry(k, v.toJson()));
|
data['ciphertext'] = ciphertextOlm!.map((k, v) => MapEntry(k, v.toJson()));
|
||||||
if (ciphertextMegolm != null) {
|
if (ciphertextMegolm != null) {
|
||||||
Logs().wtf(
|
Logs().wtf(
|
||||||
'ciphertextOlm and ciphertextMegolm are both set, which should never happen!');
|
'ciphertextOlm and ciphertextMegolm are both set, which should never happen!');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -32,13 +32,13 @@ extension RoomEncryptionContentBasicEventExtension on BasicEvent {
|
||||||
|
|
||||||
class RoomEncryptionContent {
|
class RoomEncryptionContent {
|
||||||
String algorithm;
|
String algorithm;
|
||||||
int rotationPeriodMs;
|
int? rotationPeriodMs;
|
||||||
int rotationPeriodMsgs;
|
int? rotationPeriodMsgs;
|
||||||
|
|
||||||
RoomEncryptionContent.fromJson(Map<String, dynamic> json)
|
RoomEncryptionContent.fromJson(Map<String, dynamic> json)
|
||||||
: algorithm = json.tryGet<String>('algorithm', ''),
|
: algorithm = json.tryGet<String>('algorithm', ''),
|
||||||
rotationPeriodMs = json.tryGet<int>('rotation_period_ms'),
|
rotationPeriodMs = json.tryGet<int?>('rotation_period_ms'),
|
||||||
rotationPeriodMsgs = json.tryGet<int>('rotation_period_msgs');
|
rotationPeriodMsgs = json.tryGet<int?>('rotation_period_msgs');
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -31,7 +31,7 @@ extension RoomKeyRequestContentBasicEventExtension on BasicEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RoomKeyRequestContent {
|
class RoomKeyRequestContent {
|
||||||
RequestedKeyInfo body;
|
RequestedKeyInfo? body;
|
||||||
String action;
|
String action;
|
||||||
String requestingDeviceId;
|
String requestingDeviceId;
|
||||||
String requestId;
|
String requestId;
|
||||||
|
|
@ -45,7 +45,7 @@ class RoomKeyRequestContent {
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (body != null) data['body'] = body.toJson();
|
if (body != null) data['body'] = body!.toJson();
|
||||||
data['action'] = action;
|
data['action'] = action;
|
||||||
data['requesting_device_id'] = requestingDeviceId;
|
data['requesting_device_id'] = requestingDeviceId;
|
||||||
data['request_id'] = requestId;
|
data['request_id'] = requestId;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -31,10 +31,10 @@ extension SecretStorageKeyContentBasicEventExtension on BasicEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SecretStorageKeyContent {
|
class SecretStorageKeyContent {
|
||||||
PassphraseInfo passphrase;
|
PassphraseInfo? passphrase;
|
||||||
String iv;
|
String? iv;
|
||||||
String mac;
|
String? mac;
|
||||||
String algorithm;
|
String? algorithm;
|
||||||
|
|
||||||
SecretStorageKeyContent();
|
SecretStorageKeyContent();
|
||||||
|
|
||||||
|
|
@ -42,13 +42,13 @@ class SecretStorageKeyContent {
|
||||||
: passphrase = json['passphrase'] is Map<String, dynamic>
|
: passphrase = json['passphrase'] is Map<String, dynamic>
|
||||||
? PassphraseInfo.fromJson(json['passphrase'])
|
? PassphraseInfo.fromJson(json['passphrase'])
|
||||||
: null,
|
: null,
|
||||||
iv = json.tryGet<String>('iv'),
|
iv = json.tryGet<String?>('iv'),
|
||||||
mac = json.tryGet<String>('mac'),
|
mac = json.tryGet<String?>('mac'),
|
||||||
algorithm = json.tryGet<String>('algorithm');
|
algorithm = json.tryGet<String?>('algorithm');
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (passphrase != null) data['passphrase'] = passphrase.toJson();
|
if (passphrase != null) data['passphrase'] = passphrase!.toJson();
|
||||||
if (iv != null) data['iv'] = iv;
|
if (iv != null) data['iv'] = iv;
|
||||||
if (mac != null) data['mac'] = mac;
|
if (mac != null) data['mac'] = mac;
|
||||||
if (algorithm != null) data['algorithm'] = algorithm;
|
if (algorithm != null) data['algorithm'] = algorithm;
|
||||||
|
|
@ -60,7 +60,7 @@ class PassphraseInfo {
|
||||||
String algorithm;
|
String algorithm;
|
||||||
String salt;
|
String salt;
|
||||||
int iterations;
|
int iterations;
|
||||||
int bits;
|
int? bits;
|
||||||
|
|
||||||
PassphraseInfo();
|
PassphraseInfo();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
import 'matrix_event.dart';
|
import 'matrix_event.dart';
|
||||||
|
|
||||||
class EventsSyncUpdate {
|
class EventsSyncUpdate {
|
||||||
String start;
|
String? start;
|
||||||
String end;
|
String? end;
|
||||||
List<MatrixEvent> chunk;
|
List<MatrixEvent>? chunk;
|
||||||
|
|
||||||
EventsSyncUpdate.fromJson(Map<String, dynamic> json)
|
EventsSyncUpdate.fromJson(Map<String, dynamic> json)
|
||||||
: start = json['start'],
|
: start = json['start'],
|
||||||
|
|
@ -47,7 +47,7 @@ class EventsSyncUpdate {
|
||||||
data['end'] = end;
|
data['end'] = end;
|
||||||
}
|
}
|
||||||
if (chunk != null) {
|
if (chunk != null) {
|
||||||
data['chunk'] = chunk.map((i) => i.toJson()).toList();
|
data['chunk'] = chunk!.map((i) => i.toJson()).toList();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -27,11 +27,11 @@ import '../utils/map_copy_extension.dart';
|
||||||
|
|
||||||
class MatrixEvent extends StrippedStateEvent {
|
class MatrixEvent extends StrippedStateEvent {
|
||||||
String eventId;
|
String eventId;
|
||||||
String roomId;
|
String? roomId;
|
||||||
DateTime originServerTs;
|
late DateTime originServerTs;
|
||||||
Map<String, dynamic> unsigned;
|
Map<String, dynamic>? unsigned;
|
||||||
Map<String, dynamic> prevContent;
|
Map<String, dynamic>? prevContent;
|
||||||
String redacts;
|
String? redacts;
|
||||||
|
|
||||||
MatrixEvent();
|
MatrixEvent();
|
||||||
|
|
||||||
|
|
@ -40,8 +40,8 @@ class MatrixEvent extends StrippedStateEvent {
|
||||||
roomId = json['room_id'],
|
roomId = json['room_id'],
|
||||||
originServerTs =
|
originServerTs =
|
||||||
DateTime.fromMillisecondsSinceEpoch(json['origin_server_ts']),
|
DateTime.fromMillisecondsSinceEpoch(json['origin_server_ts']),
|
||||||
unsigned = (json['unsigned'] as Map<String, dynamic>)?.copy(),
|
unsigned = (json['unsigned'] as Map<String, dynamic>?)?.copy(),
|
||||||
prevContent = (json['prev_content'] as Map<String, dynamic>)?.copy(),
|
prevContent = (json['prev_content'] as Map<String, dynamic>?)?.copy(),
|
||||||
redacts = json['redacts'],
|
redacts = json['redacts'],
|
||||||
super.fromJson(json);
|
super.fromJson(json);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -60,9 +60,9 @@ class MatrixException implements Exception {
|
||||||
: 'Unknown error');
|
: 'Unknown error');
|
||||||
|
|
||||||
/// The frozen request which triggered this Error
|
/// The frozen request which triggered this Error
|
||||||
http.Response response;
|
http.Response? response;
|
||||||
|
|
||||||
MatrixException(this.response) : raw = json.decode(response.body);
|
MatrixException(Response this.response) : raw = json.decode(response.body);
|
||||||
MatrixException.fromJson(Map<String, dynamic> content) : raw = content;
|
MatrixException.fromJson(Map<String, dynamic> content) : raw = content;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -73,21 +73,21 @@ class MatrixException implements Exception {
|
||||||
(e) => e.toString() == 'MatrixError.${(raw["errcode"] ?? "")}',
|
(e) => e.toString() == 'MatrixError.${(raw["errcode"] ?? "")}',
|
||||||
orElse: () => MatrixError.M_UNKNOWN);
|
orElse: () => MatrixError.M_UNKNOWN);
|
||||||
|
|
||||||
int get retryAfterMs => raw['retry_after_ms'];
|
int? get retryAfterMs => raw['retry_after_ms'];
|
||||||
|
|
||||||
/// This is a session identifier that the client must pass back to the homeserver, if one is provided,
|
/// This is a session identifier that the client must pass back to the homeserver, if one is provided,
|
||||||
/// in subsequent attempts to authenticate in the same API call.
|
/// in subsequent attempts to authenticate in the same API call.
|
||||||
String get session => raw['session'];
|
String? get session => raw['session'];
|
||||||
|
|
||||||
/// Returns true if the server requires additional authentication.
|
/// Returns true if the server requires additional authentication.
|
||||||
bool get requireAdditionalAuthentication => response != null
|
bool get requireAdditionalAuthentication => response != null
|
||||||
? response.statusCode == 401
|
? response!.statusCode == 401
|
||||||
: authenticationFlows != null;
|
: authenticationFlows != null;
|
||||||
|
|
||||||
/// For each endpoint, a server offers one or more 'flows' that the client can use
|
/// For each endpoint, a server offers one or more 'flows' that the client can use
|
||||||
/// to authenticate itself. Each flow comprises a series of stages. If this request
|
/// to authenticate itself. Each flow comprises a series of stages. If this request
|
||||||
/// doesn't need additional authentication, then this is null.
|
/// doesn't need additional authentication, then this is null.
|
||||||
List<AuthenticationFlow> get authenticationFlows {
|
List<AuthenticationFlow>?/*?*/ get authenticationFlows {
|
||||||
if (!raw.containsKey('flows') || !(raw['flows'] is List)) return null;
|
if (!raw.containsKey('flows') || !(raw['flows'] is List)) return null;
|
||||||
return (raw['flows'] as List)
|
return (raw['flows'] as List)
|
||||||
.map((flow) => flow['stages'])
|
.map((flow) => flow['stages'])
|
||||||
|
|
@ -99,7 +99,7 @@ class MatrixException implements Exception {
|
||||||
/// This section contains any information that the client will need to know in order to use a given type
|
/// This section contains any information that the client will need to know in order to use a given type
|
||||||
/// of authentication. For each authentication type presented, that type may be present as a key in this
|
/// of authentication. For each authentication type presented, that type may be present as a key in this
|
||||||
/// dictionary. For example, the public part of an OAuth client ID could be given here.
|
/// dictionary. For example, the public part of an OAuth client ID could be given here.
|
||||||
Map<String, dynamic> get authenticationParams => raw['params'];
|
Map<String, dynamic>? get authenticationParams => raw['params'];
|
||||||
|
|
||||||
/// Returns the list of already completed authentication flows from previous requests.
|
/// Returns the list of already completed authentication flows from previous requests.
|
||||||
List<String> get completedAuthenticationFlows =>
|
List<String> get completedAuthenticationFlows =>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -26,16 +26,16 @@ import '../utils/map_copy_extension.dart';
|
||||||
|
|
||||||
class MatrixSignableKey {
|
class MatrixSignableKey {
|
||||||
String userId;
|
String userId;
|
||||||
String identifier;
|
String? identifier;
|
||||||
Map<String, String> keys;
|
Map<String, String> keys;
|
||||||
Map<String, Map<String, String>> signatures;
|
Map<String, Map<String, String>>? signatures;
|
||||||
Map<String, dynamic> unsigned;
|
Map<String, dynamic>? unsigned;
|
||||||
|
|
||||||
MatrixSignableKey(this.userId, this.identifier, this.keys, this.signatures,
|
MatrixSignableKey(this.userId, this.identifier, this.keys, this.signatures,
|
||||||
{this.unsigned});
|
{this.unsigned});
|
||||||
|
|
||||||
// This object is used for signing so we need the raw json too
|
// This object is used for signing so we need the raw json too
|
||||||
Map<String, dynamic> _json;
|
Map<String, dynamic>? _json;
|
||||||
|
|
||||||
MatrixSignableKey.fromJson(Map<String, dynamic> json)
|
MatrixSignableKey.fromJson(Map<String, dynamic> json)
|
||||||
: _json = json,
|
: _json = json,
|
||||||
|
|
@ -46,7 +46,7 @@ class MatrixSignableKey {
|
||||||
? Map<String, Map<String, String>>.from((json['signatures'] as Map)
|
? Map<String, Map<String, String>>.from((json['signatures'] as Map)
|
||||||
.map((k, v) => MapEntry(k, Map<String, String>.from(v))))
|
.map((k, v) => MapEntry(k, Map<String, String>.from(v))))
|
||||||
: null,
|
: null,
|
||||||
unsigned = (json['unsigned'] as Map<String, dynamic>)?.copy();
|
unsigned = (json['unsigned'] as Map<String, dynamic>?)?.copy();
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = _json ?? <String, dynamic>{};
|
final data = _json ?? <String, dynamic>{};
|
||||||
|
|
@ -65,14 +65,14 @@ class MatrixSignableKey {
|
||||||
|
|
||||||
class MatrixCrossSigningKey extends MatrixSignableKey {
|
class MatrixCrossSigningKey extends MatrixSignableKey {
|
||||||
List<String> usage;
|
List<String> usage;
|
||||||
String get publicKey => identifier;
|
String? get publicKey => identifier;
|
||||||
|
|
||||||
MatrixCrossSigningKey(
|
MatrixCrossSigningKey(
|
||||||
String userId,
|
String userId,
|
||||||
this.usage,
|
this.usage,
|
||||||
Map<String, String> keys,
|
Map<String, String> keys,
|
||||||
Map<String, Map<String, String>> signatures, {
|
Map<String, Map<String, String>> signatures, {
|
||||||
Map<String, dynamic> unsigned,
|
Map<String, dynamic>? unsigned,
|
||||||
}) : super(userId, keys?.values?.first, keys, signatures, unsigned: unsigned);
|
}) : super(userId, keys?.values?.first, keys, signatures, unsigned: unsigned);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -91,10 +91,10 @@ class MatrixCrossSigningKey extends MatrixSignableKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MatrixDeviceKeys extends MatrixSignableKey {
|
class MatrixDeviceKeys extends MatrixSignableKey {
|
||||||
String get deviceId => identifier;
|
String get deviceId => identifier!;
|
||||||
List<String> algorithms;
|
List<String> algorithms;
|
||||||
String get deviceDisplayName =>
|
String? get deviceDisplayName =>
|
||||||
unsigned != null ? unsigned['device_display_name'] : null;
|
unsigned != null ? unsigned!['device_display_name'] : null;
|
||||||
|
|
||||||
MatrixDeviceKeys(
|
MatrixDeviceKeys(
|
||||||
String userId,
|
String userId,
|
||||||
|
|
@ -102,7 +102,7 @@ class MatrixDeviceKeys extends MatrixSignableKey {
|
||||||
this.algorithms,
|
this.algorithms,
|
||||||
Map<String, String> keys,
|
Map<String, String> keys,
|
||||||
Map<String, Map<String, String>> signatures, {
|
Map<String, Map<String, String>> signatures, {
|
||||||
Map<String, dynamic> unsigned,
|
Map<String, dynamic>? unsigned,
|
||||||
}) : super(userId, deviceId, keys, signatures, unsigned: unsigned);
|
}) : super(userId, deviceId, keys, signatures, unsigned: unsigned);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -26,9 +26,9 @@ import '../generated/model.dart';
|
||||||
|
|
||||||
class PresenceContent {
|
class PresenceContent {
|
||||||
PresenceType presence;
|
PresenceType presence;
|
||||||
int lastActiveAgo;
|
int? lastActiveAgo;
|
||||||
String statusMsg;
|
String? statusMsg;
|
||||||
bool currentlyActive;
|
bool? currentlyActive;
|
||||||
|
|
||||||
PresenceContent.fromJson(Map<String, dynamic> json)
|
PresenceContent.fromJson(Map<String, dynamic> json)
|
||||||
: presence = PresenceType.values.firstWhere(
|
: presence = PresenceType.values.firstWhere(
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
class RequestTokenResponse {
|
class RequestTokenResponse {
|
||||||
String sid;
|
String sid;
|
||||||
String submitUrl;
|
String? submitUrl;
|
||||||
|
|
||||||
RequestTokenResponse.fromJson(Map<String, dynamic> json)
|
RequestTokenResponse.fromJson(Map<String, dynamic> json)
|
||||||
: sid = json['sid'],
|
: sid = json['sid'],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
abstract class RoomCreationTypes {
|
abstract class RoomCreationTypes {
|
||||||
static const String mSpace = 'm.space';
|
static const String mSpace = 'm.space';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,10 +29,10 @@ class RoomKeysSingleKey {
|
||||||
Map<String, dynamic> sessionData;
|
Map<String, dynamic> sessionData;
|
||||||
|
|
||||||
RoomKeysSingleKey(
|
RoomKeysSingleKey(
|
||||||
{this.firstMessageIndex,
|
{required this.firstMessageIndex,
|
||||||
this.forwardedCount,
|
required this.forwardedCount,
|
||||||
this.isVerified,
|
required this.isVerified,
|
||||||
this.sessionData});
|
required this.sessionData});
|
||||||
|
|
||||||
RoomKeysSingleKey.fromJson(Map<String, dynamic> json)
|
RoomKeysSingleKey.fromJson(Map<String, dynamic> json)
|
||||||
: firstMessageIndex = json['first_message_index'],
|
: firstMessageIndex = json['first_message_index'],
|
||||||
|
|
@ -53,7 +53,7 @@ class RoomKeysSingleKey {
|
||||||
class RoomKeysRoom {
|
class RoomKeysRoom {
|
||||||
Map<String, RoomKeysSingleKey> sessions;
|
Map<String, RoomKeysSingleKey> sessions;
|
||||||
|
|
||||||
RoomKeysRoom({this.sessions}) {
|
RoomKeysRoom({required this.sessions}) {
|
||||||
sessions ??= <String, RoomKeysSingleKey>{};
|
sessions ??= <String, RoomKeysSingleKey>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class RoomSummary {
|
class RoomSummary {
|
||||||
List<String> mHeroes;
|
List<String>? mHeroes;
|
||||||
int mJoinedMemberCount;
|
int? mJoinedMemberCount;
|
||||||
int mInvitedMemberCount;
|
int? mInvitedMemberCount;
|
||||||
RoomSummary.fromJson(Map<String, dynamic> json)
|
RoomSummary.fromJson(Map<String, dynamic> json)
|
||||||
: mHeroes = json['m.heroes'] != null
|
: mHeroes = json['m.heroes'] != null
|
||||||
? List<String>.from(json['m.heroes'])
|
? List<String>.from(json['m.heroes'])
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
import 'basic_event_with_sender.dart';
|
import 'basic_event_with_sender.dart';
|
||||||
|
|
||||||
class StrippedStateEvent extends BasicEventWithSender {
|
class StrippedStateEvent extends BasicEventWithSender {
|
||||||
String stateKey;
|
String? stateKey;
|
||||||
|
|
||||||
StrippedStateEvent();
|
StrippedStateEvent();
|
||||||
StrippedStateEvent.fromJson(Map<String, dynamic> json)
|
StrippedStateEvent.fromJson(Map<String, dynamic> json)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -72,7 +72,7 @@ class ProtocolFieldType {
|
||||||
class ProtocolInstance {
|
class ProtocolInstance {
|
||||||
String networkId;
|
String networkId;
|
||||||
String desc;
|
String desc;
|
||||||
String icon;
|
String? icon;
|
||||||
dynamic fields;
|
dynamic fields;
|
||||||
|
|
||||||
ProtocolInstance.fromJson(Map<String, dynamic> json) {
|
ProtocolInstance.fromJson(Map<String, dynamic> json) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -32,13 +32,13 @@ import 'stripped_state_event.dart';
|
||||||
|
|
||||||
class SyncUpdate {
|
class SyncUpdate {
|
||||||
String nextBatch;
|
String nextBatch;
|
||||||
RoomsUpdate rooms;
|
RoomsUpdate? rooms;
|
||||||
List<Presence> presence;
|
List<Presence>? presence;
|
||||||
List<BasicEvent> accountData;
|
List<BasicEvent>? accountData;
|
||||||
List<BasicEventWithSender> toDevice;
|
List<BasicEventWithSender>? toDevice;
|
||||||
DeviceListsUpdate deviceLists;
|
DeviceListsUpdate? deviceLists;
|
||||||
Map<String, int> deviceOneTimeKeysCount;
|
Map<String, int>? deviceOneTimeKeysCount;
|
||||||
List<String> deviceUnusedFallbackKeyTypes;
|
List<String>? deviceUnusedFallbackKeyTypes;
|
||||||
|
|
||||||
SyncUpdate();
|
SyncUpdate();
|
||||||
|
|
||||||
|
|
@ -83,25 +83,25 @@ class SyncUpdate {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
data['next_batch'] = nextBatch;
|
data['next_batch'] = nextBatch;
|
||||||
if (rooms != null) {
|
if (rooms != null) {
|
||||||
data['rooms'] = rooms.toJson();
|
data['rooms'] = rooms!.toJson();
|
||||||
}
|
}
|
||||||
if (presence != null) {
|
if (presence != null) {
|
||||||
data['presence'] = {
|
data['presence'] = {
|
||||||
'events': presence.map((i) => i.toJson()).toList(),
|
'events': presence!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (accountData != null) {
|
if (accountData != null) {
|
||||||
data['account_data'] = {
|
data['account_data'] = {
|
||||||
'events': accountData.map((i) => i.toJson()).toList(),
|
'events': accountData!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (toDevice != null) {
|
if (toDevice != null) {
|
||||||
data['to_device'] = {
|
data['to_device'] = {
|
||||||
'events': toDevice.map((i) => i.toJson()).toList(),
|
'events': toDevice!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (deviceLists != null) {
|
if (deviceLists != null) {
|
||||||
data['device_lists'] = deviceLists.toJson();
|
data['device_lists'] = deviceLists!.toJson();
|
||||||
}
|
}
|
||||||
if (deviceOneTimeKeysCount != null) {
|
if (deviceOneTimeKeysCount != null) {
|
||||||
data['device_one_time_keys_count'] = deviceOneTimeKeysCount;
|
data['device_one_time_keys_count'] = deviceOneTimeKeysCount;
|
||||||
|
|
@ -116,9 +116,9 @@ class SyncUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RoomsUpdate {
|
class RoomsUpdate {
|
||||||
Map<String, JoinedRoomUpdate> join;
|
Map<String, JoinedRoomUpdate>? join;
|
||||||
Map<String, InvitedRoomUpdate> invite;
|
Map<String, InvitedRoomUpdate>? invite;
|
||||||
Map<String, LeftRoomUpdate> leave;
|
Map<String, LeftRoomUpdate>? leave;
|
||||||
|
|
||||||
RoomsUpdate();
|
RoomsUpdate();
|
||||||
|
|
||||||
|
|
@ -139,13 +139,13 @@ class RoomsUpdate {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (join != null) {
|
if (join != null) {
|
||||||
data['join'] = join.map((k, v) => MapEntry(k, v.toJson()));
|
data['join'] = join!.map((k, v) => MapEntry(k, v.toJson()));
|
||||||
}
|
}
|
||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
data['invite'] = invite.map((k, v) => MapEntry(k, v.toJson()));
|
data['invite'] = invite!.map((k, v) => MapEntry(k, v.toJson()));
|
||||||
}
|
}
|
||||||
if (leave != null) {
|
if (leave != null) {
|
||||||
data['leave'] = leave.map((k, v) => MapEntry(k, v.toJson()));
|
data['leave'] = leave!.map((k, v) => MapEntry(k, v.toJson()));
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -154,12 +154,12 @@ class RoomsUpdate {
|
||||||
abstract class SyncRoomUpdate {}
|
abstract class SyncRoomUpdate {}
|
||||||
|
|
||||||
class JoinedRoomUpdate extends SyncRoomUpdate {
|
class JoinedRoomUpdate extends SyncRoomUpdate {
|
||||||
RoomSummary summary;
|
RoomSummary? summary;
|
||||||
List<MatrixEvent> state;
|
List<MatrixEvent>? state;
|
||||||
TimelineUpdate timeline;
|
TimelineUpdate? timeline;
|
||||||
List<BasicRoomEvent> ephemeral;
|
List<BasicRoomEvent>? ephemeral;
|
||||||
List<BasicRoomEvent> accountData;
|
List<BasicRoomEvent>? accountData;
|
||||||
UnreadNotificationCounts unreadNotifications;
|
UnreadNotificationCounts? unreadNotifications;
|
||||||
|
|
||||||
JoinedRoomUpdate();
|
JoinedRoomUpdate();
|
||||||
|
|
||||||
|
|
@ -195,35 +195,35 @@ class JoinedRoomUpdate extends SyncRoomUpdate {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (summary != null) {
|
if (summary != null) {
|
||||||
data['summary'] = summary.toJson();
|
data['summary'] = summary!.toJson();
|
||||||
}
|
}
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
data['state'] = {
|
data['state'] = {
|
||||||
'events': state.map((i) => i.toJson()).toList(),
|
'events': state!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (timeline != null) {
|
if (timeline != null) {
|
||||||
data['timeline'] = timeline.toJson();
|
data['timeline'] = timeline!.toJson();
|
||||||
}
|
}
|
||||||
if (ephemeral != null) {
|
if (ephemeral != null) {
|
||||||
data['ephemeral'] = {
|
data['ephemeral'] = {
|
||||||
'events': ephemeral.map((i) => i.toJson()).toList(),
|
'events': ephemeral!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (accountData != null) {
|
if (accountData != null) {
|
||||||
data['account_data'] = {
|
data['account_data'] = {
|
||||||
'events': accountData.map((i) => i.toJson()).toList(),
|
'events': accountData!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (unreadNotifications != null) {
|
if (unreadNotifications != null) {
|
||||||
data['unread_notifications'] = unreadNotifications.toJson();
|
data['unread_notifications'] = unreadNotifications!.toJson();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InvitedRoomUpdate extends SyncRoomUpdate {
|
class InvitedRoomUpdate extends SyncRoomUpdate {
|
||||||
List<StrippedStateEvent> inviteState;
|
List<StrippedStateEvent>? inviteState;
|
||||||
InvitedRoomUpdate.fromJson(Map<String, dynamic> json) {
|
InvitedRoomUpdate.fromJson(Map<String, dynamic> json) {
|
||||||
inviteState =
|
inviteState =
|
||||||
(json['invite_state'] != null && json['invite_state']['events'] != null)
|
(json['invite_state'] != null && json['invite_state']['events'] != null)
|
||||||
|
|
@ -236,7 +236,7 @@ class InvitedRoomUpdate extends SyncRoomUpdate {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (inviteState != null) {
|
if (inviteState != null) {
|
||||||
data['invite_state'] = {
|
data['invite_state'] = {
|
||||||
'events': inviteState.map((i) => i.toJson()).toList(),
|
'events': inviteState!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
|
@ -244,9 +244,9 @@ class InvitedRoomUpdate extends SyncRoomUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LeftRoomUpdate extends SyncRoomUpdate {
|
class LeftRoomUpdate extends SyncRoomUpdate {
|
||||||
List<MatrixEvent> state;
|
List<MatrixEvent>? state;
|
||||||
TimelineUpdate timeline;
|
TimelineUpdate? timeline;
|
||||||
List<BasicRoomEvent> accountData;
|
List<BasicRoomEvent>? accountData;
|
||||||
|
|
||||||
LeftRoomUpdate();
|
LeftRoomUpdate();
|
||||||
|
|
||||||
|
|
@ -270,15 +270,15 @@ class LeftRoomUpdate extends SyncRoomUpdate {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
data['state'] = {
|
data['state'] = {
|
||||||
'events': state.map((i) => i.toJson()).toList(),
|
'events': state!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (timeline != null) {
|
if (timeline != null) {
|
||||||
data['timeline'] = timeline.toJson();
|
data['timeline'] = timeline!.toJson();
|
||||||
}
|
}
|
||||||
if (accountData != null) {
|
if (accountData != null) {
|
||||||
data['account_data'] = {
|
data['account_data'] = {
|
||||||
'events': accountData.map((i) => i.toJson()).toList(),
|
'events': accountData!.map((i) => i.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
|
@ -286,9 +286,9 @@ class LeftRoomUpdate extends SyncRoomUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimelineUpdate {
|
class TimelineUpdate {
|
||||||
List<MatrixEvent> events;
|
List<MatrixEvent>? events;
|
||||||
bool limited;
|
bool? limited;
|
||||||
String prevBatch;
|
String? prevBatch;
|
||||||
|
|
||||||
TimelineUpdate();
|
TimelineUpdate();
|
||||||
|
|
||||||
|
|
@ -303,7 +303,7 @@ class TimelineUpdate {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (events != null) {
|
if (events != null) {
|
||||||
data['events'] = events.map((i) => i.toJson()).toList();
|
data['events'] = events!.map((i) => i.toJson()).toList();
|
||||||
}
|
}
|
||||||
if (limited != null) {
|
if (limited != null) {
|
||||||
data['limited'] = limited;
|
data['limited'] = limited;
|
||||||
|
|
@ -316,8 +316,8 @@ class TimelineUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnreadNotificationCounts {
|
class UnreadNotificationCounts {
|
||||||
int highlightCount;
|
int? highlightCount;
|
||||||
int notificationCount;
|
int? notificationCount;
|
||||||
UnreadNotificationCounts.fromJson(Map<String, dynamic> json) {
|
UnreadNotificationCounts.fromJson(Map<String, dynamic> json) {
|
||||||
highlightCount = json['highlight_count'];
|
highlightCount = json['highlight_count'];
|
||||||
notificationCount = json['notification_count'];
|
notificationCount = json['notification_count'];
|
||||||
|
|
@ -335,8 +335,8 @@ class UnreadNotificationCounts {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeviceListsUpdate {
|
class DeviceListsUpdate {
|
||||||
List<String> changed;
|
List<String>? changed;
|
||||||
List<String> left;
|
List<String>? left;
|
||||||
DeviceListsUpdate.fromJson(Map<String, dynamic> json) {
|
DeviceListsUpdate.fromJson(Map<String, dynamic> json) {
|
||||||
changed = List<String>.from(json['changed'] ?? []);
|
changed = List<String>.from(json['changed'] ?? []);
|
||||||
left = List<String>.from(json['left'] ?? []);
|
left = List<String>.from(json['left'] ?? []);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
import 'matrix_exception.dart';
|
import 'matrix_exception.dart';
|
||||||
|
|
||||||
class UploadKeySignaturesResponse {
|
class UploadKeySignaturesResponse {
|
||||||
Map<String, Map<String, MatrixException>> failures;
|
Map<String, Map<String, MatrixException>>? failures;
|
||||||
|
|
||||||
UploadKeySignaturesResponse.fromJson(Map<String, dynamic> json)
|
UploadKeySignaturesResponse.fromJson(Map<String, dynamic> json)
|
||||||
: failures = json['failures'] != null
|
: failures = json['failures'] != null
|
||||||
|
|
@ -43,7 +43,7 @@ class UploadKeySignaturesResponse {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (failures != null) {
|
if (failures != null) {
|
||||||
data['failures'] = failures.map(
|
data['failures'] = failures!.map(
|
||||||
(k, v) => MapEntry(
|
(k, v) => MapEntry(
|
||||||
k,
|
k,
|
||||||
v.map(
|
v.map(
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -51,7 +51,7 @@ class Logs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wtf(String title, [Object exception, StackTrace stackTrace]) =>
|
void wtf(String title, [Object? exception, StackTrace? stackTrace]) =>
|
||||||
addLogEvent(
|
addLogEvent(
|
||||||
LogEvent(
|
LogEvent(
|
||||||
title,
|
title,
|
||||||
|
|
@ -61,7 +61,7 @@ class Logs {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
void e(String title, [Object exception, StackTrace stackTrace]) =>
|
void e(String title, [Object? exception, StackTrace? stackTrace]) =>
|
||||||
addLogEvent(
|
addLogEvent(
|
||||||
LogEvent(
|
LogEvent(
|
||||||
title,
|
title,
|
||||||
|
|
@ -71,7 +71,7 @@ class Logs {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
void w(String title, [Object exception, StackTrace stackTrace]) =>
|
void w(String title, [Object? exception, StackTrace? stackTrace]) =>
|
||||||
addLogEvent(
|
addLogEvent(
|
||||||
LogEvent(
|
LogEvent(
|
||||||
title,
|
title,
|
||||||
|
|
@ -81,7 +81,7 @@ class Logs {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
void i(String title, [Object exception, StackTrace stackTrace]) =>
|
void i(String title, [Object? exception, StackTrace? stackTrace]) =>
|
||||||
addLogEvent(
|
addLogEvent(
|
||||||
LogEvent(
|
LogEvent(
|
||||||
title,
|
title,
|
||||||
|
|
@ -91,7 +91,7 @@ class Logs {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
void d(String title, [Object exception, StackTrace stackTrace]) =>
|
void d(String title, [Object? exception, StackTrace? stackTrace]) =>
|
||||||
addLogEvent(
|
addLogEvent(
|
||||||
LogEvent(
|
LogEvent(
|
||||||
title,
|
title,
|
||||||
|
|
@ -101,7 +101,7 @@ class Logs {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
void v(String title, [Object exception, StackTrace stackTrace]) =>
|
void v(String title, [Object? exception, StackTrace? stackTrace]) =>
|
||||||
addLogEvent(
|
addLogEvent(
|
||||||
LogEvent(
|
LogEvent(
|
||||||
title,
|
title,
|
||||||
|
|
@ -115,8 +115,8 @@ class Logs {
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
class LogEvent {
|
class LogEvent {
|
||||||
final String title;
|
final String title;
|
||||||
final Object exception;
|
final Object? exception;
|
||||||
final StackTrace stackTrace;
|
final StackTrace? stackTrace;
|
||||||
final Level level;
|
final Level level;
|
||||||
|
|
||||||
LogEvent(
|
LogEvent(
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -29,7 +29,7 @@ import 'dart:convert';
|
||||||
void main() {
|
void main() {
|
||||||
group('Event Content tests', () {
|
group('Event Content tests', () {
|
||||||
test('Room Encryption Content', () {
|
test('Room Encryption Content', () {
|
||||||
var json = <String, dynamic>{
|
Map<String, dynamic>? json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
'algorithm': 'm.megolm.v1.aes-sha2',
|
'algorithm': 'm.megolm.v1.aes-sha2',
|
||||||
'rotation_period_ms': 604800000,
|
'rotation_period_ms': 604800000,
|
||||||
|
|
@ -44,11 +44,11 @@ void main() {
|
||||||
'unsigned': {'age': 1234}
|
'unsigned': {'age': 1234}
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(MatrixEvent.fromJson(json).parsedRoomEncryptionContent.toJson(),
|
expect(MatrixEvent.fromJson(json!).parsedRoomEncryptionContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
});
|
});
|
||||||
test('Room Encrypted Content', () {
|
test('Room Encrypted Content', () {
|
||||||
var json = <String, dynamic>{
|
Map<String, dynamic>? json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
'algorithm': 'm.megolm.v1.aes-sha2',
|
'algorithm': 'm.megolm.v1.aes-sha2',
|
||||||
'ciphertext': 'AwgAEnACgAkLmt6qF84IK++J7UDH2Za1YVchHyprqTqsg...',
|
'ciphertext': 'AwgAEnACgAkLmt6qF84IK++J7UDH2Za1YVchHyprqTqsg...',
|
||||||
|
|
@ -64,7 +64,7 @@ void main() {
|
||||||
'unsigned': {'age': 1234}
|
'unsigned': {'age': 1234}
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(MatrixEvent.fromJson(json).parsedRoomEncryptedContent.toJson(),
|
expect(MatrixEvent.fromJson(json!).parsedRoomEncryptedContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
json = <String, dynamic>{
|
json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
|
|
@ -85,11 +85,11 @@ void main() {
|
||||||
'unsigned': {'age': 1234}
|
'unsigned': {'age': 1234}
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(MatrixEvent.fromJson(json).parsedRoomEncryptedContent.toJson(),
|
expect(MatrixEvent.fromJson(json!).parsedRoomEncryptedContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
});
|
});
|
||||||
test('Room Key Content', () {
|
test('Room Key Content', () {
|
||||||
var json = <String, dynamic>{
|
Map<String, dynamic>? json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
'algorithm': 'm.megolm.v1.aes-sha2',
|
'algorithm': 'm.megolm.v1.aes-sha2',
|
||||||
'room_id': '!Cuyf34gef24t:localhost',
|
'room_id': '!Cuyf34gef24t:localhost',
|
||||||
|
|
@ -99,11 +99,11 @@ void main() {
|
||||||
'type': 'm.room_key'
|
'type': 'm.room_key'
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(BasicEvent.fromJson(json).parsedRoomKeyContent.toJson(),
|
expect(BasicEvent.fromJson(json!).parsedRoomKeyContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
});
|
});
|
||||||
test('Room Key Request Content', () {
|
test('Room Key Request Content', () {
|
||||||
var json = <String, dynamic>{
|
Map<String, dynamic>? json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
'action': 'request_cancellation',
|
'action': 'request_cancellation',
|
||||||
'request_id': '1495474790150.19',
|
'request_id': '1495474790150.19',
|
||||||
|
|
@ -112,7 +112,7 @@ void main() {
|
||||||
'type': 'm.room_key_request'
|
'type': 'm.room_key_request'
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(BasicEvent.fromJson(json).parsedRoomKeyRequestContent.toJson(),
|
expect(BasicEvent.fromJson(json!).parsedRoomKeyRequestContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
json = <String, dynamic>{
|
json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
|
|
@ -129,11 +129,11 @@ void main() {
|
||||||
'type': 'm.room_key_request'
|
'type': 'm.room_key_request'
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(BasicEvent.fromJson(json).parsedRoomKeyRequestContent.toJson(),
|
expect(BasicEvent.fromJson(json!).parsedRoomKeyRequestContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
});
|
});
|
||||||
test('Forwarded Room Key Content', () {
|
test('Forwarded Room Key Content', () {
|
||||||
var json = <String, dynamic>{
|
Map<String, dynamic>? json = <String, dynamic>{
|
||||||
'content': {
|
'content': {
|
||||||
'algorithm': 'm.megolm.v1.aes-sha2',
|
'algorithm': 'm.megolm.v1.aes-sha2',
|
||||||
'forwarding_curve25519_key_chain': [
|
'forwarding_curve25519_key_chain': [
|
||||||
|
|
@ -149,11 +149,11 @@ void main() {
|
||||||
'type': 'm.forwarded_room_key'
|
'type': 'm.forwarded_room_key'
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(BasicEvent.fromJson(json).parsedForwardedRoomKeyContent.toJson(),
|
expect(BasicEvent.fromJson(json!).parsedForwardedRoomKeyContent.toJson(),
|
||||||
json['content']);
|
json['content']);
|
||||||
});
|
});
|
||||||
test('OLM Plaintext Payload', () {
|
test('OLM Plaintext Payload', () {
|
||||||
var json = <String, dynamic>{
|
Map<String, dynamic>? json = <String, dynamic>{
|
||||||
'type': '<type of the plaintext event>',
|
'type': '<type of the plaintext event>',
|
||||||
'content': <String, dynamic>{
|
'content': <String, dynamic>{
|
||||||
'msgtype': 'm.text',
|
'msgtype': 'm.text',
|
||||||
|
|
@ -165,7 +165,7 @@ void main() {
|
||||||
'keys': {'ed25519': '<sender_ed25519_key>'}
|
'keys': {'ed25519': '<sender_ed25519_key>'}
|
||||||
};
|
};
|
||||||
json = jsonDecode(jsonEncode(json));
|
json = jsonDecode(jsonEncode(json));
|
||||||
expect(OlmPlaintextPayload.fromJson(json).toJson(), json);
|
expect(OlmPlaintextPayload.fromJson(json!).toJson(), json);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -61,8 +61,8 @@ void main() {
|
||||||
'completed': ['example.type.foo']
|
'completed': ['example.type.foo']
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
exception.authenticationFlows.first.stages.first, 'example.type.foo');
|
exception.authenticationFlows!.first.stages.first, 'example.type.foo');
|
||||||
expect(exception.authenticationParams['example.type.baz'],
|
expect(exception.authenticationParams!['example.type.baz'],
|
||||||
{'example_key': 'foobar'});
|
{'example_key': 'foobar'});
|
||||||
expect(exception.session, 'xxxxxxyz');
|
expect(exception.session, 'xxxxxxyz');
|
||||||
expect(exception.completedAuthenticationFlows, ['example.type.foo']);
|
expect(exception.completedAuthenticationFlows, ['example.type.foo']);
|
||||||
|
|
@ -109,12 +109,12 @@ void main() {
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
expect(exception is MatrixException, true);
|
expect(exception is MatrixException, true);
|
||||||
expect((exception as MatrixException).errcode, 'M_FORBIDDEN');
|
expect((exception as MatrixException).errcode, 'M_FORBIDDEN');
|
||||||
expect((exception as MatrixException).error, MatrixError.M_FORBIDDEN);
|
expect(exception.error, MatrixError.M_FORBIDDEN);
|
||||||
expect((exception as MatrixException).errorMessage, 'Blabla');
|
expect(exception.errorMessage, 'Blabla');
|
||||||
expect((exception as MatrixException).requireAdditionalAuthentication,
|
expect(exception.requireAdditionalAuthentication,
|
||||||
false);
|
false);
|
||||||
expect(
|
expect(
|
||||||
(exception as MatrixException).toString(), 'M_FORBIDDEN: Blabla');
|
exception.toString(), 'M_FORBIDDEN: Blabla');
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
expect(error, true);
|
expect(error, true);
|
||||||
|
|
@ -124,8 +124,8 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
final supportedVersions = await matrixApi.getVersions();
|
final supportedVersions = await matrixApi.getVersions();
|
||||||
expect(supportedVersions.versions.contains('r0.5.0'), true);
|
expect(supportedVersions.versions.contains('r0.5.0'), true);
|
||||||
expect(supportedVersions.unstableFeatures['m.lazy_load_members'], true);
|
expect(supportedVersions.unstableFeatures!['m.lazy_load_members'], true);
|
||||||
expect(FakeMatrixApi.api['GET']['/client/versions']({}),
|
expect(FakeMatrixApi.api['GET'],
|
||||||
supportedVersions.toJson());
|
supportedVersions.toJson());
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -146,9 +146,9 @@ void main() {
|
||||||
});
|
});
|
||||||
test('getLoginTypes', () async {
|
test('getLoginTypes', () async {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
final loginTypes = await matrixApi.getLoginFlows();
|
final loginTypes = await (matrixApi.getLoginFlows() as FutureOr<List<LoginFlow>>);
|
||||||
expect(loginTypes.first.type, 'm.login.password');
|
expect(loginTypes.first.type, 'm.login.password');
|
||||||
expect(FakeMatrixApi.api['GET']['/client/r0/login']({}),
|
expect(FakeMatrixApi.api['GET'],
|
||||||
{'flows': loginTypes.map((x) => x.toJson()).toList()});
|
{'flows': loginTypes.map((x) => x.toJson()).toList()});
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -158,7 +158,7 @@ void main() {
|
||||||
LoginType.mLoginPassword,
|
LoginType.mLoginPassword,
|
||||||
identifier: AuthenticationUserIdentifier(user: 'username'),
|
identifier: AuthenticationUserIdentifier(user: 'username'),
|
||||||
);
|
);
|
||||||
expect(FakeMatrixApi.api['POST']['/client/r0/login']({}),
|
expect(FakeMatrixApi.api['POST'],
|
||||||
loginResponse.toJson());
|
loginResponse.toJson());
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -178,7 +178,7 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
final registerResponse =
|
final registerResponse =
|
||||||
await matrixApi.register(kind: AccountKind.guest, username: 'test');
|
await matrixApi.register(kind: AccountKind.guest, username: 'test');
|
||||||
expect(FakeMatrixApi.api['POST']['/client/r0/register?kind=guest']({}),
|
expect(FakeMatrixApi.api['POST'],
|
||||||
registerResponse.toJson());
|
registerResponse.toJson());
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -194,7 +194,7 @@ void main() {
|
||||||
idAccessToken: '1234',
|
idAccessToken: '1234',
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']
|
FakeMatrixApi.api['POST']!
|
||||||
['/client/r0/register/email/requestToken']({}),
|
['/client/r0/register/email/requestToken']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -212,7 +212,7 @@ void main() {
|
||||||
idAccessToken: '1234',
|
idAccessToken: '1234',
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']
|
FakeMatrixApi.api['POST']!
|
||||||
['/client/r0/register/email/requestToken']({}),
|
['/client/r0/register/email/requestToken']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -281,8 +281,8 @@ void main() {
|
||||||
test('getThirdPartyIdentifiers', () async {
|
test('getThirdPartyIdentifiers', () async {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
final response = await matrixApi.getAccount3PIDs();
|
final response = await (matrixApi.getAccount3PIDs() as FutureOr<List<ThirdPartyIdentifier>>);
|
||||||
expect(FakeMatrixApi.api['GET']['/client/r0/account/3pid']({}),
|
expect(FakeMatrixApi.api['GET'],
|
||||||
{'threepids': response.map((t) => t.toJson()).toList()});
|
{'threepids': response.map((t) => t.toJson()).toList()});
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -364,7 +364,7 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
final response = await matrixApi.getCapabilities();
|
final response = await matrixApi.getCapabilities();
|
||||||
expect(FakeMatrixApi.api['GET']['/client/r0/capabilities']({}),
|
expect(FakeMatrixApi.api['GET'],
|
||||||
{'capabilities': response.toJson()});
|
{'capabilities': response.toJson()});
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -498,9 +498,9 @@ void main() {
|
||||||
timeout: 15,
|
timeout: 15,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'] as Map,
|
{}) as Map?,
|
||||||
response.toJson());
|
response.toJson());
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -537,12 +537,12 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final states = await matrixApi.getMembersByRoom(
|
final states = await (matrixApi.getMembersByRoom(
|
||||||
'!localpart:server.abc',
|
'!localpart:server.abc',
|
||||||
at: '1234',
|
at: '1234',
|
||||||
membership: Membership.join,
|
membership: Membership.join,
|
||||||
notMembership: Membership.leave,
|
notMembership: Membership.leave,
|
||||||
);
|
) as FutureOr<List<MatrixEvent>>);
|
||||||
expect(states.length, 1);
|
expect(states.length, 1);
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -551,11 +551,11 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final states = await matrixApi.getJoinedMembersByRoom(
|
final states = await (matrixApi.getJoinedMembersByRoom(
|
||||||
'!localpart:server.abc',
|
'!localpart:server.abc',
|
||||||
);
|
) as FutureOr<Map<String, RoomMember>>);
|
||||||
expect(states.length, 1);
|
expect(states.length, 1);
|
||||||
expect(states['@bar:example.com'].toJson(), {
|
expect(states['@bar:example.com']!.toJson(), {
|
||||||
'display_name': 'Bar',
|
'display_name': 'Bar',
|
||||||
'avatar_url': 'mxc://riot.ovh/printErCATzZijQsSDWorRaK'
|
'avatar_url': 'mxc://riot.ovh/printErCATzZijQsSDWorRaK'
|
||||||
});
|
});
|
||||||
|
|
@ -576,9 +576,9 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'] as Map,
|
{}) as Map?,
|
||||||
timelineHistoryResponse.toJson());
|
timelineHistoryResponse.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -667,7 +667,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/directory/room/%23testalias%3Aexample.com']({}),
|
['/client/r0/directory/room/%23testalias%3Aexample.com']({}),
|
||||||
roomAliasInformation.toJson());
|
roomAliasInformation.toJson());
|
||||||
|
|
||||||
|
|
@ -829,7 +829,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'],
|
'/client/r0/publicRooms?limit=10&since=1234&server=example.com']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
|
|
@ -851,7 +851,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']
|
FakeMatrixApi.api['POST']!
|
||||||
['/client/r0/publicRooms?server=example.com']({}),
|
['/client/r0/publicRooms?server=example.com']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
|
|
@ -866,7 +866,7 @@ void main() {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(FakeMatrixApi.api['POST']['/client/r0/user_directory/search']({}),
|
expect(FakeMatrixApi.api['POST'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -913,7 +913,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.getUserProfile('@alice:example.com');
|
final response = await matrixApi.getUserProfile('@alice:example.com');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/profile/%40alice%3Aexample.com']({}),
|
['/client/r0/profile/%40alice%3Aexample.com']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
|
|
@ -924,7 +924,7 @@ void main() {
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final response = await matrixApi.getTurnServer();
|
final response = await matrixApi.getTurnServer();
|
||||||
expect(FakeMatrixApi.api['GET']['/client/r0/voip/turnServer']({}),
|
expect(FakeMatrixApi.api['GET'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -987,7 +987,7 @@ void main() {
|
||||||
'@alice:example.com',
|
'@alice:example.com',
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'],
|
'/client/r0/presence/${Uri.encodeComponent('@alice:example.com')}/status']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
|
|
@ -1017,7 +1017,7 @@ void main() {
|
||||||
ts: 10,
|
ts: 10,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/media/r0/preview_url?url=https%3A%2F%2Fmatrix.org&ts=10']({}),
|
['/media/r0/preview_url?url=https%3A%2F%2Fmatrix.org&ts=10']({}),
|
||||||
openGraphData.toJson());
|
openGraphData.toJson());
|
||||||
|
|
||||||
|
|
@ -1048,8 +1048,8 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final devices = await matrixApi.getDevices();
|
final devices = await (matrixApi.getDevices() as FutureOr<List<Device>>);
|
||||||
expect(FakeMatrixApi.api['GET']['/client/r0/devices']({})['devices'],
|
expect(FakeMatrixApi.api['GET']['devices'],
|
||||||
devices.map((i) => i.toJson()).toList());
|
devices.map((i) => i.toJson()).toList());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -1118,10 +1118,10 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
response
|
response
|
||||||
.deviceKeys['@alice:example.com']['JLAFKJWSCS'].deviceDisplayName,
|
.deviceKeys!['@alice:example.com']!['JLAFKJWSCS']!.deviceDisplayName,
|
||||||
'Alices mobile phone');
|
'Alices mobile phone');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']
|
FakeMatrixApi.api['POST']!
|
||||||
['/client/r0/keys/query']({'device_keys': {}}),
|
['/client/r0/keys/query']({'device_keys': {}}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
|
|
@ -1138,7 +1138,7 @@ void main() {
|
||||||
timeout: 10,
|
timeout: 10,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']['/client/r0/keys/claim']({
|
FakeMatrixApi.api['POST'] {
|
||||||
});
|
});
|
||||||
final ret = await matrixApi.uploadKeySignatures([key1, key2]);
|
final ret = await matrixApi.uploadKeySignatures([key1, key2]);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']['/client/r0/keys/signatures/upload']({}),
|
FakeMatrixApi.api['POST'],
|
||||||
ret.toJson(),
|
ret.toJson(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -1242,9 +1242,9 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final response = await matrixApi.getPushers();
|
final response = await (matrixApi.getPushers() as FutureOr<List<Pusher>>);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/pushers']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
{'pushers': response.map((i) => i.toJson()).toList()},
|
{'pushers': response.map((i) => i.toJson()).toList()},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1281,7 +1281,7 @@ void main() {
|
||||||
only: '1234',
|
only: '1234',
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/notifications?from=1234&limit=10&only=1234']({}),
|
['/client/r0/notifications?from=1234&limit=10&only=1234']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
@ -1294,7 +1294,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.getPushRules();
|
final response = await matrixApi.getPushRules();
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/pushrules']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
{'global': response.toJson()},
|
{'global': response.toJson()},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1307,7 +1307,7 @@ void main() {
|
||||||
final response =
|
final response =
|
||||||
await matrixApi.getPushRule('global', PushRuleKind.content, 'nocake');
|
await matrixApi.getPushRule('global', PushRuleKind.content, 'nocake');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/pushrules/global/content/nocake']({}),
|
['/client/r0/pushrules/global/content/nocake']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
@ -1407,7 +1407,7 @@ void main() {
|
||||||
final response =
|
final response =
|
||||||
await matrixApi.getEvents(from: '1234', roomId: '!1234', timeout: 10);
|
await matrixApi.getEvents(from: '1234', roomId: '!1234', timeout: 10);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/events?from=1234&timeout=10&roomId=%211234']({}),
|
['/client/r0/events?from=1234&timeout=10&roomId=%211234']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
@ -1418,10 +1418,10 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final response = await matrixApi.getRoomTags(
|
final response = await (matrixApi.getRoomTags(
|
||||||
'@alice:example.com', '!localpart:example.com');
|
'@alice:example.com', '!localpart:example.com') as FutureOr<Map<String, Tag>>);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'],
|
'/client/r0/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags']({}),
|
||||||
{'tags': response.map((k, v) => MapEntry(k, v.toJson()))},
|
{'tags': response.map((k, v) => MapEntry(k, v.toJson()))},
|
||||||
);
|
);
|
||||||
|
|
@ -1507,7 +1507,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.getWhoIs('@alice:example.com');
|
final response = await matrixApi.getWhoIs('@alice:example.com');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/admin/whois/%40alice%3Aexample.com']({}),
|
['/client/r0/admin/whois/%40alice%3Aexample.com']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
@ -1521,7 +1521,7 @@ void main() {
|
||||||
final response = await matrixApi.getEventContext('1234', '1234',
|
final response = await matrixApi.getEventContext('1234', '1234',
|
||||||
limit: 10, filter: '{}');
|
limit: 10, filter: '{}');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/rooms/1234/context/1234?limit=10&filter=%7B%7D']({}),
|
['/client/r0/rooms/1234/context/1234?limit=10&filter=%7B%7D']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
@ -1547,7 +1547,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.requestSupportedProtocols();
|
final response = await matrixApi.requestSupportedProtocols();
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/thirdparty/protocols']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((k, v) => MapEntry(k, v.toJson())),
|
response.map((k, v) => MapEntry(k, v.toJson())),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1559,7 +1559,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.requestSupportedProtocol('irc');
|
final response = await matrixApi.requestSupportedProtocol('irc');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/thirdparty/protocol/irc']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1571,7 +1571,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.requestThirdPartyLocations('irc');
|
final response = await matrixApi.requestThirdPartyLocations('irc');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/thirdparty/location/irc']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1583,7 +1583,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.requestThirdPartyUsers('irc');
|
final response = await matrixApi.requestThirdPartyUsers('irc');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/thirdparty/user/irc']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1596,7 +1596,7 @@ void main() {
|
||||||
final response =
|
final response =
|
||||||
await matrixApi.requestThirdPartyLocationsByAlias('1234');
|
await matrixApi.requestThirdPartyLocationsByAlias('1234');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/r0/thirdparty/location?alias=1234']({}),
|
['/client/r0/thirdparty/location?alias=1234']({}),
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
@ -1609,7 +1609,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.requestThirdPartyUsersByUserId('1234');
|
final response = await matrixApi.requestThirdPartyUsersByUserId('1234');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']['/client/r0/thirdparty/user?userid=1234']({}),
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1621,7 +1621,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.requestOpenIdToken('1234', {});
|
final response = await matrixApi.requestOpenIdToken('1234', {});
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']
|
FakeMatrixApi.api['POST']!
|
||||||
['/client/r0/user/1234/openid/request_token']({}),
|
['/client/r0/user/1234/openid/request_token']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
@ -1647,7 +1647,7 @@ void main() {
|
||||||
};
|
};
|
||||||
final ret = await matrixApi.postRoomKeysVersion(algorithm, authData);
|
final ret = await matrixApi.postRoomKeysVersion(algorithm, authData);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']
|
FakeMatrixApi.api['POST']!
|
||||||
['/client/unstable/room_keys/version']({})['version'],
|
['/client/unstable/room_keys/version']({})['version'],
|
||||||
ret);
|
ret);
|
||||||
});
|
});
|
||||||
|
|
@ -1656,7 +1656,7 @@ void main() {
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final ret = await matrixApi.getRoomKeysVersionCurrent();
|
final ret = await matrixApi.getRoomKeysVersionCurrent();
|
||||||
expect(FakeMatrixApi.api['GET']['/client/unstable/room_keys/version']({}),
|
expect(FakeMatrixApi.api['GET'],
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('putRoomKeysVersion', () async {
|
test('putRoomKeysVersion', () async {
|
||||||
|
|
@ -1696,7 +1696,7 @@ void main() {
|
||||||
final ret = await matrixApi.postRoomKeysKeyRoomIdSessionId(
|
final ret = await matrixApi.postRoomKeysKeyRoomIdSessionId(
|
||||||
roomId, sessionId, '5', session);
|
roomId, sessionId, '5', session);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['PUT'][
|
FakeMatrixApi.api['PUT'],
|
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1708,7 +1708,7 @@ void main() {
|
||||||
final sessionId = 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU';
|
final sessionId = 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU';
|
||||||
final ret = await matrixApi.getRoomKeysSingleKey(roomId, sessionId, '5');
|
final ret = await matrixApi.getRoomKeysSingleKey(roomId, sessionId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'],
|
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1721,7 +1721,7 @@ void main() {
|
||||||
final ret =
|
final ret =
|
||||||
await matrixApi.deleteRoomKeysSingleKey(roomId, sessionId, '5');
|
await matrixApi.deleteRoomKeysSingleKey(roomId, sessionId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['DELETE'][
|
FakeMatrixApi.api['DELETE'],
|
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1748,7 +1748,7 @@ void main() {
|
||||||
});
|
});
|
||||||
final ret = await matrixApi.postRoomKeysKeyRoomId(roomId, '5', session);
|
final ret = await matrixApi.postRoomKeysKeyRoomId(roomId, '5', session);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['PUT'][
|
FakeMatrixApi.api['PUT'],
|
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1759,7 +1759,7 @@ void main() {
|
||||||
final roomId = '!726s6s6q:example.com';
|
final roomId = '!726s6s6q:example.com';
|
||||||
final ret = await matrixApi.getRoomKeysRoom(roomId, '5');
|
final ret = await matrixApi.getRoomKeysRoom(roomId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'][
|
FakeMatrixApi.api['GET'],
|
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1770,7 +1770,7 @@ void main() {
|
||||||
final roomId = '!726s6s6q:example.com';
|
final roomId = '!726s6s6q:example.com';
|
||||||
final ret = await matrixApi.deleteRoomKeysRoom(roomId, '5');
|
final ret = await matrixApi.deleteRoomKeysRoom(roomId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['DELETE'][
|
FakeMatrixApi.api['DELETE'],
|
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1801,7 +1801,7 @@ void main() {
|
||||||
});
|
});
|
||||||
final ret = await matrixApi.postRoomKeysKey('5', session);
|
final ret = await matrixApi.postRoomKeysKey('5', session);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['PUT']
|
FakeMatrixApi.api['PUT']!
|
||||||
['/client/unstable/room_keys/keys?version=5']({}),
|
['/client/unstable/room_keys/keys?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1811,7 +1811,7 @@ void main() {
|
||||||
|
|
||||||
final ret = await matrixApi.getRoomKeys('5');
|
final ret = await matrixApi.getRoomKeys('5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']
|
FakeMatrixApi.api['GET']!
|
||||||
['/client/unstable/room_keys/keys?version=5']({}),
|
['/client/unstable/room_keys/keys?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
@ -1821,7 +1821,7 @@ void main() {
|
||||||
|
|
||||||
final ret = await matrixApi.deleteRoomKeys('5');
|
final ret = await matrixApi.deleteRoomKeys('5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['DELETE']
|
FakeMatrixApi.api['DELETE']!
|
||||||
['/client/unstable/room_keys/keys?version=5']({}),
|
['/client/unstable/room_keys/keys?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// @dart=2.9
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue