getRoomKeysVersion method

Future<GetRoomKeysVersionResponse> getRoomKeysVersion(
  1. String version
)

Get information about an existing backup.

version The backup version to get, as returned in the version parameter of the response in POST /_matrix/client/v3/room_keys/version or this endpoint.

Implementation

Future<GetRoomKeysVersionResponse> getRoomKeysVersion(String version) async {
  final requestUri = Uri(
    path:
        '_matrix/client/v3/room_keys/version/${Uri.encodeComponent(version)}',
  );
  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 GetRoomKeysVersionResponse.fromJson(json as Map<String, Object?>);
}