Skip to main content

ruma_appservice_api/ping/
send_ping.rs

1//! `PUT /_matrix/app/*/ping`
2//!
3//! Endpoint to ping the application service.
4
5pub mod unstable {
6    //! `/unstable/fi.mau.msc2659/` ([MSC])
7    //!
8    //! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/2659
9
10    use ruma_common::{
11        OwnedTransactionId,
12        api::{request, response},
13        metadata,
14    };
15
16    use crate::HomeserverToken;
17
18    metadata! {
19        method: POST,
20        rate_limited: false,
21        authentication: HomeserverToken,
22        path: "/_matrix/app/unstable/fi.mau.msc2659/ping",
23    }
24
25    /// Request type for the `send_ping` endpoint.
26    #[request]
27    #[derive(Default)]
28    pub struct Request {
29        /// A transaction ID for the ping, copied directly from the `POST
30        /// /_matrix/client/v1/appservice/{appserviceId}/ping` call.
31        #[serde(skip_serializing_if = "Option::is_none")]
32        pub transaction_id: Option<OwnedTransactionId>,
33    }
34
35    /// Response type for the `send_ping` endpoint.
36    #[response]
37    #[derive(Default)]
38    pub struct Response {}
39
40    impl Request {
41        /// Creates a new empty `Request`.
42        pub fn new() -> Self {
43            Self::default()
44        }
45    }
46
47    impl Response {
48        /// Creates a new empty `Response`.
49        pub fn new() -> Self {
50            Self::default()
51        }
52    }
53}
54
55pub mod v1 {
56    //! `/v1/` ([spec])
57    //!
58    //! [spec]: https://spec.matrix.org/v1.19/application-service-api/#post_matrixappv1ping
59
60    use ruma_common::{
61        OwnedTransactionId,
62        api::{request, response},
63        metadata,
64    };
65
66    use crate::HomeserverToken;
67
68    metadata! {
69        method: POST,
70        rate_limited: false,
71        authentication: HomeserverToken,
72        path: "/_matrix/app/v1/ping",
73    }
74
75    /// Request type for the `send_ping` endpoint.
76    #[request]
77    #[derive(Default)]
78    pub struct Request {
79        /// A transaction ID for the ping, copied directly from the `POST
80        /// /_matrix/client/v1/appservice/{appserviceId}/ping` call.
81        #[serde(skip_serializing_if = "Option::is_none")]
82        pub transaction_id: Option<OwnedTransactionId>,
83    }
84
85    /// Response type for the `send_ping` endpoint.
86    #[response]
87    #[derive(Default)]
88    pub struct Response {}
89
90    impl Request {
91        /// Creates a new empty `Request`.
92        pub fn new() -> Self {
93            Self::default()
94        }
95    }
96
97    impl Response {
98        /// Creates a new empty `Response`.
99        pub fn new() -> Self {
100            Self::default()
101        }
102    }
103}