deleteRoomKeysVersion method
Delete an existing key backup. Both the information about the backup, as well as all key data related to the backup will be deleted.
version
The backup version to delete, as returned in the version
parameter in the response of
POST /_api/client/v3/room_keys/version
or GET /_api/client/v3/room_keys/version/{version}
.
Implementation
Future<void> deleteRoomKeysVersion(String version) async {
final requestUri = Uri(
path:
'_api/client/v3/room_keys/version/${Uri.encodeComponent(version)}');
final request = Request('DELETE', 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 ignore(json);
}