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