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