getKeysChanges method
Gets a list of users who have updated their device identity keys since a previous sync token.
The server should include in the results any users who:
- currently share a room with the calling user (ie, both users have
membership state
join
); and - added new device identity keys or removed an existing device with
identity keys, between
from
andto
.
from
The desired start point of the list. Should be the next_batch
field
from a response to an earlier call to /sync
. Users who have not
uploaded new device identity keys since this point, nor deleted
existing devices with identity keys since then, will be excluded
from the results.
to
The desired end point of the list. Should be the next_batch
field from a recent call to /sync
- typically the most recent
such call. This may be used by the server as a hint to check its
caches are up to date.
Implementation
Future<GetKeysChangesResponse> getKeysChanges(String from, String to) async {
final requestUri =
Uri(path: '_matrix/client/v3/keys/changes', queryParameters: {
'from': from,
'to': to,
});
final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}';
final response = await httpClient.send(request);
final responseBody = await response.stream.toBytes();
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return GetKeysChangesResponse.fromJson(json as Map<String, Object?>);
}