ruma_client_api/session/
logout_all.rs1pub mod v3 {
6 #[cfg(feature = "client")]
11 use ruma_common::api::EmptyBody;
12 use ruma_common::{
13 api::{auth_scheme::AccessToken, error::Error, response},
14 metadata,
15 };
16
17 metadata! {
18 method: POST,
19 rate_limited: false,
20 authentication: AccessToken,
21 history: {
22 1.0 => "/_matrix/client/r0/logout/all",
23 1.1 => "/_matrix/client/v3/logout/all",
24 }
25 }
26
27 #[derive(Debug, Clone, Default)]
29 #[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
30 pub struct Request {}
31
32 impl Request {
33 pub fn new() -> Self {
35 Self {}
36 }
37 }
38
39 #[cfg(feature = "client")]
40 impl ruma_common::api::OutgoingRequest for Request {
41 type Body = EmptyBody;
42 type EndpointError = Error;
43 type IncomingResponse = Response;
44
45 fn try_into_http_request_inner(
46 self,
47 base_url: &str,
48 considering: std::borrow::Cow<'_, ruma_common::api::SupportedVersions>,
49 ) -> Result<http::Request<EmptyBody>, ruma_common::api::error::IntoHttpError> {
50 use ruma_common::api::Metadata;
51
52 let url = Self::make_endpoint_url(considering, base_url, &[], "")?;
53
54 let http_request =
55 http::Request::builder().method(Self::METHOD).uri(url).body(EmptyBody)?;
56
57 Ok(http_request)
58 }
59 }
60
61 #[cfg(feature = "server")]
62 impl ruma_common::api::IncomingRequest for Request {
63 type EndpointError = Error;
64 type OutgoingResponse = Response;
65
66 fn try_from_http_request<B, S>(
67 request: http::Request<B>,
68 _path_args: &[S],
69 ) -> Result<Self, ruma_common::api::error::FromHttpRequestError>
70 where
71 B: AsRef<[u8]>,
72 S: AsRef<str>,
73 {
74 Self::check_request_method(request.method())?;
75
76 Ok(Self {})
77 }
78 }
79
80 #[response]
82 #[derive(Default)]
83 pub struct Response {}
84
85 impl Response {
86 pub fn new() -> Self {
88 Self {}
89 }
90 }
91}