deleteRoomKeyBySessionId method

Future<RoomKeysUpdateResponse> deleteRoomKeyBySessionId(
  1. String roomId,
  2. String sessionId,
  3. String version
)
inherited

Delete a key from the backup.

roomId The ID of the room that the specified key is for.

sessionId The ID of the megolm session whose key is to be deleted.

version The backup from which to delete the key

Implementation

Future<RoomKeysUpdateResponse> deleteRoomKeyBySessionId(
    String roomId, String sessionId, String version) async {
  final requestUri = Uri(
      path:
          '_api/client/v3/room_keys/keys/${Uri.encodeComponent(roomId)}/${Uri.encodeComponent(sessionId)}',
      queryParameters: {
        'version': 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 RoomKeysUpdateResponse.fromJson(json as Map<String, Object?>);
}