Skip to main content

ruma_appservice_api/query/
query_room_alias.rs

1//! `GET /_matrix/app/*/rooms/{roomAlias}`
2//!
3//! Endpoint to query the existence of a given room alias.
4
5pub mod v1 {
6    //! `/v1/` ([spec])
7    //!
8    //! [spec]: https://spec.matrix.org/v1.19/application-service-api/#get_matrixappv1roomsroomalias
9
10    use ruma_common::{
11        OwnedRoomAliasId,
12        api::{request, response},
13        metadata,
14    };
15
16    use crate::HomeserverToken;
17
18    metadata! {
19        method: GET,
20        rate_limited: false,
21        authentication: HomeserverToken,
22        path: "/_matrix/app/v1/rooms/{room_alias}",
23    }
24
25    /// Request type for the `query_room_alias` endpoint.
26    #[request]
27    pub struct Request {
28        /// The room alias being queried.
29        #[ruma_api(path)]
30        pub room_alias: OwnedRoomAliasId,
31    }
32
33    /// Response type for the `query_room_alias` endpoint.
34    #[response]
35    #[derive(Default)]
36    pub struct Response {}
37
38    impl Request {
39        /// Creates a new `Request` with the given room alias.
40        pub fn new(room_alias: OwnedRoomAliasId) -> Self {
41            Self { room_alias }
42        }
43    }
44
45    impl Response {
46        /// Create an empty `Response`.
47        pub fn new() -> Self {
48            Self {}
49        }
50    }
51}