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