ruma_client_api/rendezvous/
get_rendezvous_session.rs

1//! `GET /_matrix/client/*/rendezvous/{id}`
2//!
3//! Get a rendezvous session.
4
5pub mod unstable {
6    //! `unstable/io.element.msc4388` ([MSC])
7    //!
8    //! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/4388
9
10    use std::time::Duration;
11
12    use ruma_common::{
13        api::{auth_scheme::NoAuthentication, request, response},
14        metadata,
15    };
16
17    metadata! {
18        method: GET,
19        rate_limited: true,
20        authentication: NoAuthentication,
21        history: {
22            unstable("io.element.msc4388") => "/_matrix/client/unstable/io.element.msc4388/rendezvous/{id}",
23        }
24    }
25
26    /// Request type for the `GET` `rendezvous` endpoint.
27    #[request(error = crate::Error)]
28    pub struct Request {
29        /// The ID of the rendezvous session to get.
30        #[ruma_api(path)]
31        pub id: String,
32    }
33
34    impl Request {
35        /// Creates a new `Request` with the given id.
36        pub fn new(id: String) -> Self {
37            Self { id }
38        }
39    }
40
41    #[response(error = crate::Error)]
42    /// Response type for the `GET` `rendezvous` endpoint.
43    pub struct Response {
44        /// The current sequence token for the session.
45        pub sequence_token: String,
46
47        /// The current data for the session.
48        pub data: String,
49
50        /// The time remaining in milliseconds until the session expires.
51        #[serde(with = "ruma_common::serde::duration::ms", rename = "expires_in_ms")]
52        pub expires_in: Duration,
53    }
54
55    impl Response {
56        /// Creates a new `Response` with the given sequence token and data.
57        pub fn new(sequence_token: String, data: String, expires_in: Duration) -> Self {
58            Self { sequence_token, data, expires_in }
59        }
60    }
61}