ruma_appservice_api/query/query_user_id.rs
1//! `GET /_matrix/app/*/users/{userId}`
2//!
3//! Endpoint to query the existence of a given user ID.
4
5pub mod v1 {
6 //! `/v1/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/application-service-api/#get_matrixappv1usersuserid
9
10 use ruma_common::{
11 OwnedUserId,
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/users/{user_id}",
21 }
22
23 /// Request type for the `query_user_id` endpoint.
24 #[request]
25 pub struct Request {
26 /// The user ID being queried.
27 #[ruma_api(path)]
28 pub user_id: OwnedUserId,
29 }
30
31 /// Response type for the `query_user_id` endpoint.
32 #[response]
33 #[derive(Default)]
34 pub struct Response {}
35
36 impl Request {
37 /// Creates a new `Request` with the given user id.
38 pub fn new(user_id: OwnedUserId) -> Self {
39 Self { user_id }
40 }
41 }
42
43 impl Response {
44 /// Creates an empty `Response`.
45 pub fn new() -> Self {
46 Self {}
47 }
48 }
49}