Skip to main content

ruma_client_api/rtc/
transports.rs

1//! `GET /_matrix/client/*/rtc/transports`
2//!
3//! Discover the RTC transports advertised by the homeserver.
4
5pub mod v1 {
6    //! `/v1/` ([MSC])
7    //!
8    //! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/4143
9
10    use ruma_common::{
11        api::{auth_scheme::AccessToken, request, response},
12        metadata,
13    };
14
15    use crate::rtc::RtcTransport;
16
17    metadata! {
18        method: GET,
19        rate_limited: false,
20        authentication: AccessToken,
21        history: {
22            unstable => "/_matrix/client/unstable/org.matrix.msc4143/rtc/transports",
23        }
24    }
25
26    /// Request type for the `transports` endpoint.
27    #[request]
28    #[derive(Default)]
29    pub struct Request {}
30
31    impl Request {
32        /// Creates a new empty `Request`.
33        pub fn new() -> Self {
34            Self {}
35        }
36    }
37
38    /// Response type for the `transports` endpoint.
39    #[response]
40    #[derive(Default)]
41    pub struct Response {
42        /// The RTC transports advertised by the homeserver.
43        pub rtc_transports: Vec<RtcTransport>,
44    }
45
46    impl Response {
47        /// Creates a `Response` with the given RTC transports.
48        pub fn new(rtc_transports: Vec<RtcTransport>) -> Self {
49            Self { rtc_transports }
50        }
51    }
52}