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