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