deletePushRule method

Future<void> deletePushRule(
  1. PushRuleKind kind,
  2. String ruleId
)

This endpoint removes the push rule defined in the path.

kind The kind of rule

ruleId The identifier for the rule.

Implementation

Future<void> deletePushRule(PushRuleKind kind, String ruleId) async {
  final requestUri = Uri(
    path:
        '_matrix/client/v3/pushrules/global/${Uri.encodeComponent(kind.name)}/${Uri.encodeComponent(ruleId)}',
  );
  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);
}