ruma_client_api/push/get_pushrules_all.rs
1//! `GET /_matrix/client/*/pushrules/`
2//!
3//! Retrieve all push rulesets for this user.
4
5pub mod v3 {
6 //! `/v3/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3pushrules
9
10 use ruma_common::{
11 api::{request, response},
12 metadata,
13 push::Ruleset,
14 };
15
16 metadata! {
17 method: GET,
18 rate_limited: false,
19 authentication: AccessToken,
20 history: {
21 1.0 => "/_matrix/client/r0/pushrules/",
22 1.1 => "/_matrix/client/v3/pushrules/",
23 }
24 }
25
26 /// Request type for the `get_pushrules_all` endpoint.
27 #[request(error = crate::Error)]
28 #[derive(Default)]
29 pub struct Request {}
30
31 /// Response type for the `get_pushrules_all` endpoint.
32 #[response(error = crate::Error)]
33 pub struct Response {
34 /// The global ruleset.
35 pub global: Ruleset,
36 }
37
38 impl Request {
39 /// Creates an empty `Request`.
40 pub fn new() -> Self {
41 Self {}
42 }
43 }
44
45 impl Response {
46 /// Creates a new `Response` with the given global ruleset.
47 pub fn new(global: Ruleset) -> Self {
48 Self { global }
49 }
50 }
51}