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/latest/application-service-api/#get_matrixappv1roomsroomalias
9
10    use ruma_common::{
11        OwnedRoomAliasId,
12        api::{auth_scheme::AccessToken, request, response},
13        metadata,
14    };
15
16    metadata! {
17        method: GET,
18        rate_limited: false,
19        authentication: AccessToken,
20        path: "/_matrix/app/v1/rooms/{room_alias}",
21    }
22
23    /// Request type for the `query_room_alias` endpoint.
24    #[request]
25    pub struct Request {
26        /// The room alias being queried.
27        #[ruma_api(path)]
28        pub room_alias: OwnedRoomAliasId,
29    }
30
31    /// Response type for the `query_room_alias` endpoint.
32    #[response]
33    #[derive(Default)]
34    pub struct Response {}
35
36    impl Request {
37        /// Creates a new `Request` with the given room alias.
38        pub fn new(room_alias: OwnedRoomAliasId) -> Self {
39            Self { room_alias }
40        }
41    }
42
43    impl Response {
44        /// Create an empty `Response`.
45        pub fn new() -> Self {
46            Self {}
47        }
48    }
49}