getPushRules method
Retrieve all push rulesets for this user. Currently the only push ruleset
defined is global
.
returns global
:
The global ruleset.
Implementation
Future<PushRuleSet> getPushRules() async {
final requestUri = Uri(path: '_matrix/client/v3/pushrules/');
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 PushRuleSet.fromJson(json['global'] as Map<String, Object?>);
}