chore: operation names from OpenAPI spec
This commit is contained in:
parent
70ee808911
commit
c196610998
|
|
@ -235,7 +235,7 @@ class OlmManager {
|
||||||
if (updateDatabase) {
|
if (updateDatabase) {
|
||||||
await client.database?.updateClientKeys(pickledOlmAccount, client.id);
|
await client.database?.updateClientKeys(pickledOlmAccount, client.id);
|
||||||
}
|
}
|
||||||
final response = await client.uploadDeviceKeys(
|
final response = await client.uploadKeys(
|
||||||
deviceKeys: uploadDeviceKeys
|
deviceKeys: uploadDeviceKeys
|
||||||
? MatrixDeviceKeys.fromJson(keysContent['device_keys'])
|
? MatrixDeviceKeys.fromJson(keysContent['device_keys'])
|
||||||
: null,
|
: null,
|
||||||
|
|
@ -526,8 +526,7 @@ class OlmManager {
|
||||||
requestingKeysFrom[device.userId][device.deviceId] = 'signed_curve25519';
|
requestingKeysFrom[device.userId][device.deviceId] = 'signed_curve25519';
|
||||||
}
|
}
|
||||||
|
|
||||||
final response =
|
final response = await client.claimKeys(requestingKeysFrom, timeout: 10000);
|
||||||
await client.requestOneTimeKeys(requestingKeysFrom, timeout: 10000);
|
|
||||||
|
|
||||||
for (final userKeysEntry in response.oneTimeKeys.entries) {
|
for (final userKeysEntry in response.oneTimeKeys.entries) {
|
||||||
final userId = userKeysEntry.key;
|
final userId = userKeysEntry.key;
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ class Client extends MatrixApi {
|
||||||
WellKnownInformation wellKnown;
|
WellKnownInformation wellKnown;
|
||||||
if (checkWellKnown) {
|
if (checkWellKnown) {
|
||||||
try {
|
try {
|
||||||
wellKnown = await requestWellKnownInformation();
|
wellKnown = await getWellknown();
|
||||||
homeserverUrl = wellKnown.mHomeserver.baseUrl.trim();
|
homeserverUrl = wellKnown.mHomeserver.baseUrl.trim();
|
||||||
// strip a trailing slash
|
// strip a trailing slash
|
||||||
if (homeserverUrl.endsWith('/')) {
|
if (homeserverUrl.endsWith('/')) {
|
||||||
|
|
@ -343,14 +343,14 @@ class Client extends MatrixApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if server supports at least one supported version
|
// Check if server supports at least one supported version
|
||||||
final versions = await requestSupportedVersions();
|
final versions = await getVersions();
|
||||||
if (!versions.versions
|
if (!versions.versions
|
||||||
.any((version) => supportedVersions.contains(version))) {
|
.any((version) => supportedVersions.contains(version))) {
|
||||||
throw BadServerVersionsException(
|
throw BadServerVersionsException(
|
||||||
versions.versions.toSet(), supportedVersions);
|
versions.versions.toSet(), supportedVersions);
|
||||||
}
|
}
|
||||||
|
|
||||||
final loginTypes = await requestLoginTypes();
|
final loginTypes = await getLoginFlows();
|
||||||
if (!loginTypes.flows.any((f) => supportedLoginTypes.contains(f.type))) {
|
if (!loginTypes.flows.any((f) => supportedLoginTypes.contains(f.type))) {
|
||||||
throw BadServerLoginTypesException(
|
throw BadServerLoginTypesException(
|
||||||
loginTypes.flows.map((f) => f.type).toSet(), supportedLoginTypes);
|
loginTypes.flows.map((f) => f.type).toSet(), supportedLoginTypes);
|
||||||
|
|
@ -596,7 +596,7 @@ class Client extends MatrixApi {
|
||||||
if (cache && _profileCache.containsKey(userId)) {
|
if (cache && _profileCache.containsKey(userId)) {
|
||||||
return _profileCache[userId];
|
return _profileCache[userId];
|
||||||
}
|
}
|
||||||
final profile = await requestProfile(userId);
|
final profile = await getUserProfile(userId);
|
||||||
_profileCache[userId] = profile;
|
_profileCache[userId] = profile;
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
@ -646,9 +646,10 @@ class Client extends MatrixApi {
|
||||||
/// Uploads a file and automatically caches it in the database, if it is small enough
|
/// Uploads a file and automatically caches it in the database, if it is small enough
|
||||||
/// and returns the mxc url as a string.
|
/// and returns the mxc url as a string.
|
||||||
@override
|
@override
|
||||||
Future<String> upload(Uint8List file, String fileName,
|
Future<String> uploadContent(Uint8List file, String fileName,
|
||||||
{String contentType}) async {
|
{String contentType}) async {
|
||||||
final mxc = await super.upload(file, fileName, contentType: contentType);
|
final mxc =
|
||||||
|
await super.uploadContent(file, fileName, contentType: contentType);
|
||||||
final storeable = database != null && file.length <= database.maxFileSize;
|
final storeable = database != null && file.length <= database.maxFileSize;
|
||||||
if (storeable) {
|
if (storeable) {
|
||||||
await database.storeFile(
|
await database.storeFile(
|
||||||
|
|
@ -659,14 +660,13 @@ class Client extends MatrixApi {
|
||||||
|
|
||||||
/// Sends a typing notification and initiates a megolm session, if needed
|
/// Sends a typing notification and initiates a megolm session, if needed
|
||||||
@override
|
@override
|
||||||
Future<void> sendTypingNotification(
|
Future<void> setTyping(
|
||||||
String userId,
|
String userId,
|
||||||
String roomId,
|
String roomId,
|
||||||
bool typing, {
|
bool typing, {
|
||||||
int timeout,
|
int timeout,
|
||||||
}) async {
|
}) async {
|
||||||
await super
|
await super.setTyping(userId, roomId, typing, timeout: timeout);
|
||||||
.sendTypingNotification(userId, roomId, typing, timeout: timeout);
|
|
||||||
final room = getRoomById(roomId);
|
final room = getRoomById(roomId);
|
||||||
if (typing && room != null && encryptionEnabled && room.encrypted) {
|
if (typing && room != null && encryptionEnabled && room.encrypted) {
|
||||||
unawaited(encryption.keyManager.prepareOutboundGroupSession(roomId));
|
unawaited(encryption.keyManager.prepareOutboundGroupSession(roomId));
|
||||||
|
|
@ -675,7 +675,7 @@ class Client extends MatrixApi {
|
||||||
|
|
||||||
/// Uploads a new user avatar for this user.
|
/// Uploads a new user avatar for this user.
|
||||||
Future<void> setAvatar(MatrixFile file) async {
|
Future<void> setAvatar(MatrixFile file) async {
|
||||||
final uploadResp = await upload(file.bytes, file.name);
|
final uploadResp = await uploadContent(file.bytes, file.name);
|
||||||
await setAvatarUrl(userID, Uri.parse(uploadResp));
|
await setAvatarUrl(userID, Uri.parse(uploadResp));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -990,7 +990,7 @@ class Client extends MatrixApi {
|
||||||
|
|
||||||
Future<void> _checkSyncFilter() async {
|
Future<void> _checkSyncFilter() async {
|
||||||
if (syncFilterId == null) {
|
if (syncFilterId == null) {
|
||||||
syncFilterId = await uploadFilter(userID, syncFilter);
|
syncFilterId = await defineFilter(userID, syncFilter);
|
||||||
await database?.storeSyncFilterId(syncFilterId, id);
|
await database?.storeSyncFilterId(syncFilterId, id);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -1563,7 +1563,7 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
|
|
||||||
if (outdatedLists.isNotEmpty) {
|
if (outdatedLists.isNotEmpty) {
|
||||||
// Request the missing device key lists from the server.
|
// Request the missing device key lists from the server.
|
||||||
final response = await requestDeviceKeys(outdatedLists, timeout: 10000);
|
final response = await queryKeys(outdatedLists, timeout: 10000);
|
||||||
if (!isLogged()) return;
|
if (!isLogged()) return;
|
||||||
|
|
||||||
for (final rawDeviceKeyListEntry in response.deviceKeys.entries) {
|
for (final rawDeviceKeyListEntry in response.deviceKeys.entries) {
|
||||||
|
|
@ -1905,7 +1905,7 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setMuteAllPushNotifications(bool muted) async {
|
Future<void> setMuteAllPushNotifications(bool muted) async {
|
||||||
await enablePushRule(
|
await setPushRuleEnabled(
|
||||||
'global',
|
'global',
|
||||||
PushRuleKind.override,
|
PushRuleKind.override,
|
||||||
'.m.rule.master',
|
'.m.rule.master',
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ class Event extends MatrixEvent {
|
||||||
bool get canRedact => senderId == room.client.userID || room.canRedact;
|
bool get canRedact => senderId == room.client.userID || room.canRedact;
|
||||||
|
|
||||||
/// Redacts this event. Throws `ErrorResponse` on error.
|
/// Redacts this event. Throws `ErrorResponse` on error.
|
||||||
Future<dynamic> redact({String reason, String txid}) =>
|
Future<dynamic> redactEvent({String reason, String txid}) =>
|
||||||
room.redactEvent(eventId, reason: reason, txid: txid);
|
room.redactEvent(eventId, reason: reason, txid: txid);
|
||||||
|
|
||||||
/// Searches for the reply event in the given timeline.
|
/// Searches for the reply event in the given timeline.
|
||||||
|
|
|
||||||
|
|
@ -254,11 +254,11 @@ class Room {
|
||||||
/// Sets the canonical alias. If the [canonicalAlias] is not yet an alias of
|
/// Sets the canonical alias. If the [canonicalAlias] is not yet an alias of
|
||||||
/// this room, it will create one.
|
/// this room, it will create one.
|
||||||
Future<void> setCanonicalAlias(String canonicalAlias) async {
|
Future<void> setCanonicalAlias(String canonicalAlias) async {
|
||||||
final aliases = await client.requestRoomAliases(id);
|
final aliases = await client.getLocalAliases(id);
|
||||||
if (!aliases.contains(canonicalAlias)) {
|
if (!aliases.contains(canonicalAlias)) {
|
||||||
await client.createRoomAlias(canonicalAlias, id);
|
await client.setRoomAlias(canonicalAlias, id);
|
||||||
}
|
}
|
||||||
await client.sendState(id, EventTypes.RoomCanonicalAlias, {
|
await client.setRoomStateWithKey(id, EventTypes.RoomCanonicalAlias, {
|
||||||
'alias': canonicalAlias,
|
'alias': canonicalAlias,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -419,21 +419,21 @@ class Room {
|
||||||
|
|
||||||
/// Call the Matrix API to change the name of this room. Returns the event ID of the
|
/// Call the Matrix API to change the name of this room. Returns the event ID of the
|
||||||
/// new m.room.name event.
|
/// new m.room.name event.
|
||||||
Future<String> setName(String newName) => client.sendState(
|
Future<String> setName(String newName) => client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.RoomName,
|
EventTypes.RoomName,
|
||||||
{'name': newName},
|
{'name': newName},
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Call the Matrix API to change the topic of this room.
|
/// Call the Matrix API to change the topic of this room.
|
||||||
Future<String> setDescription(String newName) => client.sendState(
|
Future<String> setDescription(String newName) => client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.RoomTopic,
|
EventTypes.RoomTopic,
|
||||||
{'topic': newName},
|
{'topic': newName},
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Add a tag to the room.
|
/// Add a tag to the room.
|
||||||
Future<void> addTag(String tag, {double order}) => client.addRoomTag(
|
Future<void> addTag(String tag, {double order}) => client.setRoomTag(
|
||||||
client.userID,
|
client.userID,
|
||||||
id,
|
id,
|
||||||
tag,
|
tag,
|
||||||
|
|
@ -441,7 +441,7 @@ class Room {
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Removes a tag from the room.
|
/// Removes a tag from the room.
|
||||||
Future<void> removeTag(String tag) => client.removeRoomTag(
|
Future<void> removeTag(String tag) => client.deleteRoomTag(
|
||||||
client.userID,
|
client.userID,
|
||||||
id,
|
id,
|
||||||
tag,
|
tag,
|
||||||
|
|
@ -482,14 +482,14 @@ class Room {
|
||||||
..roomId = id
|
..roomId = id
|
||||||
..type = EventType.markedUnread
|
..type = EventType.markedUnread
|
||||||
])))));
|
])))));
|
||||||
await client.setRoomAccountData(
|
await client.setAccountDataPerRoom(
|
||||||
client.userID,
|
client.userID,
|
||||||
id,
|
id,
|
||||||
EventType.markedUnread,
|
EventType.markedUnread,
|
||||||
content,
|
content,
|
||||||
);
|
);
|
||||||
if (unread == false && lastEvent != null) {
|
if (unread == false && lastEvent != null) {
|
||||||
await sendReadMarker(
|
await setReadMarker(
|
||||||
lastEvent.eventId,
|
lastEvent.eventId,
|
||||||
readReceiptLocationEventId: lastEvent.eventId,
|
readReceiptLocationEventId: lastEvent.eventId,
|
||||||
);
|
);
|
||||||
|
|
@ -505,7 +505,7 @@ class Room {
|
||||||
|
|
||||||
/// Call the Matrix API to change the pinned events of this room.
|
/// Call the Matrix API to change the pinned events of this room.
|
||||||
Future<String> setPinnedEvents(List<String> pinnedEventIds) =>
|
Future<String> setPinnedEvents(List<String> pinnedEventIds) =>
|
||||||
client.sendState(
|
client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.RoomPinnedEvents,
|
EventTypes.RoomPinnedEvents,
|
||||||
{'pinned': pinnedEventIds},
|
{'pinned': pinnedEventIds},
|
||||||
|
|
@ -674,13 +674,13 @@ class Room {
|
||||||
uploadThumbnail = encryptedThumbnail.toMatrixFile();
|
uploadThumbnail = encryptedThumbnail.toMatrixFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final uploadResp = await client.upload(
|
final uploadResp = await client.uploadContent(
|
||||||
uploadFile.bytes,
|
uploadFile.bytes,
|
||||||
uploadFile.name,
|
uploadFile.name,
|
||||||
contentType: uploadFile.mimeType,
|
contentType: uploadFile.mimeType,
|
||||||
);
|
);
|
||||||
final thumbnailUploadResp = uploadThumbnail != null
|
final thumbnailUploadResp = uploadThumbnail != null
|
||||||
? await client.upload(
|
? await client.uploadContent(
|
||||||
uploadThumbnail.bytes,
|
uploadThumbnail.bytes,
|
||||||
uploadThumbnail.name,
|
uploadThumbnail.name,
|
||||||
contentType: uploadThumbnail.mimeType,
|
contentType: uploadThumbnail.mimeType,
|
||||||
|
|
@ -881,7 +881,7 @@ class Room {
|
||||||
/// automatically be set.
|
/// automatically be set.
|
||||||
Future<void> join({bool leaveIfNotFound = true}) async {
|
Future<void> join({bool leaveIfNotFound = true}) async {
|
||||||
try {
|
try {
|
||||||
await client.joinRoom(id);
|
await client.joinRoomById(id);
|
||||||
final invitation = getState(EventTypes.RoomMember, client.userID);
|
final invitation = getState(EventTypes.RoomMember, client.userID);
|
||||||
if (invitation != null &&
|
if (invitation != null &&
|
||||||
invitation.content['is_direct'] is bool &&
|
invitation.content['is_direct'] is bool &&
|
||||||
|
|
@ -929,13 +929,13 @@ class Room {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call the Matrix API to kick a user from this room.
|
/// Call the Matrix API to kick a user from this room.
|
||||||
Future<void> kick(String userID) => client.kickFromRoom(id, userID);
|
Future<void> kick(String userID) => client.kick(id, userID);
|
||||||
|
|
||||||
/// Call the Matrix API to ban a user from this room.
|
/// Call the Matrix API to ban a user from this room.
|
||||||
Future<void> ban(String userID) => client.banFromRoom(id, userID);
|
Future<void> ban(String userID) => client.ban(id, userID);
|
||||||
|
|
||||||
/// Call the Matrix API to unban a banned user from this room.
|
/// Call the Matrix API to unban a banned user from this room.
|
||||||
Future<void> unban(String userID) => client.unbanInRoom(id, userID);
|
Future<void> unban(String userID) => client.unban(id, userID);
|
||||||
|
|
||||||
/// Set the power level of the user with the [userID] to the value [power].
|
/// Set the power level of the user with the [userID] to the value [power].
|
||||||
/// Returns the event ID of the new state event. If there is no known
|
/// Returns the event ID of the new state event. If there is no known
|
||||||
|
|
@ -947,7 +947,7 @@ class Room {
|
||||||
if (powerMap['users'] == null) powerMap['users'] = {};
|
if (powerMap['users'] == null) powerMap['users'] = {};
|
||||||
powerMap['users'][userID] = power;
|
powerMap['users'][userID] = power;
|
||||||
|
|
||||||
return await client.sendState(
|
return await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.RoomPowerLevels,
|
EventTypes.RoomPowerLevels,
|
||||||
powerMap,
|
powerMap,
|
||||||
|
|
@ -962,7 +962,7 @@ class Room {
|
||||||
/// the historical events will be published in the onEvent stream.
|
/// the historical events will be published in the onEvent stream.
|
||||||
Future<void> requestHistory(
|
Future<void> requestHistory(
|
||||||
{int historyCount = defaultHistoryCount, onHistoryReceived}) async {
|
{int historyCount = defaultHistoryCount, onHistoryReceived}) async {
|
||||||
final resp = await client.requestMessages(
|
final resp = await client.getRoomEvents(
|
||||||
id,
|
id,
|
||||||
prev_batch,
|
prev_batch,
|
||||||
Direction.b,
|
Direction.b,
|
||||||
|
|
@ -1030,7 +1030,7 @@ class Room {
|
||||||
return;
|
return;
|
||||||
} // Nothing to do here
|
} // Nothing to do here
|
||||||
|
|
||||||
await client.setRoomAccountData(
|
await client.setAccountDataPerRoom(
|
||||||
client.userID,
|
client.userID,
|
||||||
id,
|
id,
|
||||||
'm.direct',
|
'm.direct',
|
||||||
|
|
@ -1041,13 +1041,13 @@ class Room {
|
||||||
|
|
||||||
/// Sets the position of the read marker for a given room, and optionally the
|
/// Sets the position of the read marker for a given room, and optionally the
|
||||||
/// read receipt's location.
|
/// read receipt's location.
|
||||||
Future<void> sendReadMarker(String eventId,
|
Future<void> setReadMarker(String eventId,
|
||||||
{String readReceiptLocationEventId}) async {
|
{String readReceiptLocationEventId}) async {
|
||||||
if (readReceiptLocationEventId != null) {
|
if (readReceiptLocationEventId != null) {
|
||||||
notificationCount = 0;
|
notificationCount = 0;
|
||||||
await client.database?.resetNotificationCount(client.id, id);
|
await client.database?.resetNotificationCount(client.id, id);
|
||||||
}
|
}
|
||||||
await client.sendReadMarker(
|
await client.setReadMarker(
|
||||||
id,
|
id,
|
||||||
eventId,
|
eventId,
|
||||||
readReceiptLocationEventId: readReceiptLocationEventId,
|
readReceiptLocationEventId: readReceiptLocationEventId,
|
||||||
|
|
@ -1057,10 +1057,10 @@ class Room {
|
||||||
|
|
||||||
/// This API updates the marker for the given receipt type to the event ID
|
/// This API updates the marker for the given receipt type to the event ID
|
||||||
/// specified.
|
/// specified.
|
||||||
Future<void> sendReceiptMarker(String eventId) async {
|
Future<void> postReceipt(String eventId) async {
|
||||||
notificationCount = 0;
|
notificationCount = 0;
|
||||||
await client.database?.resetNotificationCount(client.id, id);
|
await client.database?.resetNotificationCount(client.id, id);
|
||||||
await client.sendReceiptMarker(
|
await client.postReceipt(
|
||||||
id,
|
id,
|
||||||
eventId,
|
eventId,
|
||||||
);
|
);
|
||||||
|
|
@ -1072,7 +1072,7 @@ class Room {
|
||||||
Future<void> sendReadReceipt(String eventID) async {
|
Future<void> sendReadReceipt(String eventID) async {
|
||||||
notificationCount = 0;
|
notificationCount = 0;
|
||||||
await client.database?.resetNotificationCount(client.id, id);
|
await client.database?.resetNotificationCount(client.id, id);
|
||||||
await client.sendReadMarker(
|
await client.setReadMarker(
|
||||||
id,
|
id,
|
||||||
eventID,
|
eventID,
|
||||||
readReceiptLocationEventId: eventID,
|
readReceiptLocationEventId: eventID,
|
||||||
|
|
@ -1199,7 +1199,7 @@ class Room {
|
||||||
if (_requestedParticipants || participantListComplete) {
|
if (_requestedParticipants || participantListComplete) {
|
||||||
return getParticipants();
|
return getParticipants();
|
||||||
}
|
}
|
||||||
final matrixEvents = await client.requestMembers(id);
|
final matrixEvents = await client.getMembersByRoom(id);
|
||||||
final users =
|
final users =
|
||||||
matrixEvents.map((e) => Event.fromMatrixEvent(e, this).asUser).toList();
|
matrixEvents.map((e) => Event.fromMatrixEvent(e, this).asUser).toList();
|
||||||
for (final user in users) {
|
for (final user in users) {
|
||||||
|
|
@ -1294,7 +1294,7 @@ class Room {
|
||||||
}
|
}
|
||||||
if (resp == null && requestProfile) {
|
if (resp == null && requestProfile) {
|
||||||
try {
|
try {
|
||||||
final profile = await client.requestProfile(mxID);
|
final profile = await client.getUserProfile(mxID);
|
||||||
resp = {
|
resp = {
|
||||||
'displayname': profile.displayname,
|
'displayname': profile.displayname,
|
||||||
'avatar_url': profile.avatarUrl.toString(),
|
'avatar_url': profile.avatarUrl.toString(),
|
||||||
|
|
@ -1340,7 +1340,7 @@ class Room {
|
||||||
/// Searches for the event on the server. Returns null if not found.
|
/// Searches for the event on the server. Returns null if not found.
|
||||||
Future<Event> getEventById(String eventID) async {
|
Future<Event> getEventById(String eventID) async {
|
||||||
try {
|
try {
|
||||||
final matrixEvent = await client.requestEvent(id, eventID);
|
final matrixEvent = await client.getOneRoomEvent(id, eventID);
|
||||||
final event = Event.fromMatrixEvent(matrixEvent, this);
|
final event = Event.fromMatrixEvent(matrixEvent, this);
|
||||||
if (event.type == EventTypes.Encrypted && client.encryptionEnabled) {
|
if (event.type == EventTypes.Encrypted && client.encryptionEnabled) {
|
||||||
// attempt decryption
|
// attempt decryption
|
||||||
|
|
@ -1388,8 +1388,8 @@ class Room {
|
||||||
/// Uploads a new user avatar for this room. Returns the event ID of the new
|
/// Uploads a new user avatar for this room. Returns the event ID of the new
|
||||||
/// m.room.avatar event.
|
/// m.room.avatar event.
|
||||||
Future<String> setAvatar(MatrixFile file) async {
|
Future<String> setAvatar(MatrixFile file) async {
|
||||||
final uploadResp = await client.upload(file.bytes, file.name);
|
final uploadResp = await client.uploadContent(file.bytes, file.name);
|
||||||
return await client.sendState(
|
return await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.RoomAvatar,
|
EventTypes.RoomAvatar,
|
||||||
{'url': uploadResp},
|
{'url': uploadResp},
|
||||||
|
|
@ -1538,7 +1538,7 @@ class Room {
|
||||||
}
|
}
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (reason != null) data['reason'] = reason;
|
if (reason != null) data['reason'] = reason;
|
||||||
return await client.redact(
|
return await client.redactEvent(
|
||||||
id,
|
id,
|
||||||
eventId,
|
eventId,
|
||||||
messageID,
|
messageID,
|
||||||
|
|
@ -1549,12 +1549,12 @@ class Room {
|
||||||
/// This tells the server that the user is typing for the next N milliseconds
|
/// This tells the server that the user is typing for the next N milliseconds
|
||||||
/// where N is the value specified in the timeout key. Alternatively, if typing is false,
|
/// where N is the value specified in the timeout key. Alternatively, if typing is false,
|
||||||
/// it tells the server that the user has stopped typing.
|
/// it tells the server that the user has stopped typing.
|
||||||
Future<void> sendTypingNotification(bool isTyping, {int timeout}) => client
|
Future<void> setTyping(bool isTyping, {int timeout}) =>
|
||||||
.sendTypingNotification(client.userID, id, isTyping, timeout: timeout);
|
client.setTyping(client.userID, id, isTyping, timeout: timeout);
|
||||||
|
|
||||||
@Deprecated('Use sendTypingNotification instead')
|
@Deprecated('Use sendTypingNotification instead')
|
||||||
Future<void> sendTypingInfo(bool isTyping, {int timeout}) =>
|
Future<void> sendTypingInfo(bool isTyping, {int timeout}) =>
|
||||||
sendTypingNotification(isTyping, timeout: timeout);
|
setTyping(isTyping, timeout: timeout);
|
||||||
|
|
||||||
/// This is sent by the caller when they wish to establish a call.
|
/// This is sent by the caller when they wish to establish a call.
|
||||||
/// [callId] is a unique identifier for the call.
|
/// [callId] is a unique identifier for the call.
|
||||||
|
|
@ -1669,7 +1669,7 @@ class Room {
|
||||||
|
|
||||||
/// Changes the join rules. You should check first if the user is able to change it.
|
/// Changes the join rules. You should check first if the user is able to change it.
|
||||||
Future<void> setJoinRules(JoinRules joinRules) async {
|
Future<void> setJoinRules(JoinRules joinRules) async {
|
||||||
await client.sendState(
|
await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.RoomJoinRules,
|
EventTypes.RoomJoinRules,
|
||||||
{
|
{
|
||||||
|
|
@ -1691,7 +1691,7 @@ class Room {
|
||||||
|
|
||||||
/// Changes the guest access. You should check first if the user is able to change it.
|
/// Changes the guest access. You should check first if the user is able to change it.
|
||||||
Future<void> setGuestAccess(GuestAccess guestAccess) async {
|
Future<void> setGuestAccess(GuestAccess guestAccess) async {
|
||||||
await client.sendState(
|
await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.GuestAccess,
|
EventTypes.GuestAccess,
|
||||||
{
|
{
|
||||||
|
|
@ -1714,7 +1714,7 @@ class Room {
|
||||||
|
|
||||||
/// Changes the history visibility. You should check first if the user is able to change it.
|
/// Changes the history visibility. You should check first if the user is able to change it.
|
||||||
Future<void> setHistoryVisibility(HistoryVisibility historyVisibility) async {
|
Future<void> setHistoryVisibility(HistoryVisibility historyVisibility) async {
|
||||||
await client.sendState(
|
await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.HistoryVisibility,
|
EventTypes.HistoryVisibility,
|
||||||
{
|
{
|
||||||
|
|
@ -1739,7 +1739,7 @@ class Room {
|
||||||
Future<void> enableEncryption({int algorithmIndex = 0}) async {
|
Future<void> enableEncryption({int algorithmIndex = 0}) async {
|
||||||
if (encrypted) throw ('Encryption is already enabled!');
|
if (encrypted) throw ('Encryption is already enabled!');
|
||||||
final algorithm = Client.supportedGroupEncryptionAlgorithms[algorithmIndex];
|
final algorithm = Client.supportedGroupEncryptionAlgorithms[algorithmIndex];
|
||||||
await client.sendState(
|
await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.Encryption,
|
EventTypes.Encryption,
|
||||||
{
|
{
|
||||||
|
|
@ -1836,7 +1836,7 @@ class Room {
|
||||||
}) async {
|
}) async {
|
||||||
if (!isSpace) throw Exception('Room is not a space!');
|
if (!isSpace) throw Exception('Room is not a space!');
|
||||||
via ??= [roomId.domain];
|
via ??= [roomId.domain];
|
||||||
await client.sendState(
|
await client.setRoomStateWithKey(
|
||||||
id,
|
id,
|
||||||
EventTypes.spaceChild,
|
EventTypes.spaceChild,
|
||||||
{
|
{
|
||||||
|
|
@ -1845,7 +1845,7 @@ class Room {
|
||||||
if (suggested != null) 'suggested': suggested,
|
if (suggested != null) 'suggested': suggested,
|
||||||
},
|
},
|
||||||
roomId);
|
roomId);
|
||||||
await client.sendState(
|
await client.setRoomStateWithKey(
|
||||||
roomId,
|
roomId,
|
||||||
EventTypes.spaceParent,
|
EventTypes.spaceParent,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ extension CommandsClientExtension on Client {
|
||||||
return await args.room.sendReaction(args.inReplyTo.eventId, args.msg);
|
return await args.room.sendReaction(args.inReplyTo.eventId, args.msg);
|
||||||
});
|
});
|
||||||
addCommand('join', (CommandArgs args) async {
|
addCommand('join', (CommandArgs args) async {
|
||||||
await args.room.client.joinRoomOrAlias(args.msg);
|
await args.room.client.joinRoom(args.msg);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
addCommand('leave', (CommandArgs args) async {
|
addCommand('leave', (CommandArgs args) async {
|
||||||
|
|
@ -169,7 +169,7 @@ extension CommandsClientExtension on Client {
|
||||||
.content
|
.content
|
||||||
.copy();
|
.copy();
|
||||||
currentEventJson['displayname'] = args.msg;
|
currentEventJson['displayname'] = args.msg;
|
||||||
return await args.room.client.sendState(
|
return await args.room.client.setRoomStateWithKey(
|
||||||
args.room.id,
|
args.room.id,
|
||||||
EventTypes.RoomMember,
|
EventTypes.RoomMember,
|
||||||
currentEventJson,
|
currentEventJson,
|
||||||
|
|
@ -182,7 +182,7 @@ extension CommandsClientExtension on Client {
|
||||||
.content
|
.content
|
||||||
.copy();
|
.copy();
|
||||||
currentEventJson['avatar_url'] = args.msg;
|
currentEventJson['avatar_url'] = args.msg;
|
||||||
return await args.room.client.sendState(
|
return await args.room.client.setRoomStateWithKey(
|
||||||
args.room.id,
|
args.room.id,
|
||||||
EventTypes.RoomMember,
|
EventTypes.RoomMember,
|
||||||
currentEventJson,
|
currentEventJson,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ dependencies:
|
||||||
olm: ^2.0.0
|
olm: ^2.0.0
|
||||||
isolate: ^2.0.3
|
isolate: ^2.0.3
|
||||||
logger: ^1.0.0
|
logger: ^1.0.0
|
||||||
matrix_api_lite: ^0.2.6
|
matrix_api_lite: 0.3.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.15.7
|
test: ^1.15.7
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ void main() {
|
||||||
checkWellKnown: false);
|
checkWellKnown: false);
|
||||||
expect(matrix.homeserver.toString(), 'https://fakeserver.notexisting');
|
expect(matrix.homeserver.toString(), 'https://fakeserver.notexisting');
|
||||||
|
|
||||||
final available = await matrix.usernameAvailable('testuser');
|
final available = await matrix.checkUsernameAvailability('testuser');
|
||||||
expect(available, true);
|
expect(available, true);
|
||||||
|
|
||||||
final loginStateFuture = matrix.onLoginStateChanged.stream.first;
|
final loginStateFuture = matrix.onLoginStateChanged.stream.first;
|
||||||
|
|
@ -589,7 +589,7 @@ void main() {
|
||||||
});
|
});
|
||||||
test('upload', () async {
|
test('upload', () async {
|
||||||
final client = await getClient();
|
final client = await getClient();
|
||||||
final response = await client.upload(Uint8List(0), 'file.jpeg');
|
final response = await client.uploadContent(Uint8List(0), 'file.jpeg');
|
||||||
expect(response, 'mxc://example.com/AQwafuaFswefuhsfAFAgsw');
|
expect(response, 'mxc://example.com/AQwafuaFswefuhsfAFAgsw');
|
||||||
expect(await client.database.getFile(response) != null, true);
|
expect(await client.database.getFile(response) != null, true);
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sendReadMarker', () async {
|
test('sendReadMarker', () async {
|
||||||
await room.sendReadMarker('§1234:fakeServer.notExisting');
|
await room.setReadMarker('§1234:fakeServer.notExisting');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('requestParticipants', () async {
|
test('requestParticipants', () async {
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ void main() {
|
||||||
expect(timeline.events[1].eventId, '2143273582443PhrSn:example.org');
|
expect(timeline.events[1].eventId, '2143273582443PhrSn:example.org');
|
||||||
expect(timeline.events[2].eventId, '1143273582443PhrSn:example.org');
|
expect(timeline.events[2].eventId, '1143273582443PhrSn:example.org');
|
||||||
expect(room.prev_batch, 't47409-4357353_219380_26003_2265');
|
expect(room.prev_batch, 't47409-4357353_219380_26003_2265');
|
||||||
await timeline.events[2].redact(reason: 'test', txid: '1234');
|
await timeline.events[2].redactEvent(reason: 'test', txid: '1234');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Clear cache on limited timeline', () async {
|
test('Clear cache on limited timeline', () async {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue