ruma_appservice_api/thirdparty/get_user_for_user_id.rs
1//! `GET /_matrix/app/*/thirdparty/user`
2//!
3//! Retrieve an array of third party users from a Matrix User ID.
4
5pub mod v1 {
6 //! `/v1/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/v1.19/application-service-api/#get_matrixappv1thirdpartyuser
9
10 use ruma_common::{
11 OwnedUserId,
12 api::{request, response},
13 metadata,
14 thirdparty::User,
15 };
16
17 use crate::HomeserverToken;
18
19 metadata! {
20 method: GET,
21 rate_limited: false,
22 authentication: HomeserverToken,
23 path: "/_matrix/app/v1/thirdparty/user",
24 }
25
26 /// Request type for the `get_user_for_user_id` endpoint.
27 #[request]
28 pub struct Request {
29 /// The Matrix User ID to look up.
30 #[ruma_api(query)]
31 pub userid: OwnedUserId,
32 }
33
34 /// Response type for the `get_user_for_user_id` endpoint.
35 #[response]
36 pub struct Response {
37 /// List of matched third party users.
38 #[ruma_api(body)]
39 pub users: Vec<User>,
40 }
41
42 impl Request {
43 /// Creates a new `Request` with the given user id.
44 pub fn new(userid: OwnedUserId) -> Self {
45 Self { userid }
46 }
47 }
48
49 impl Response {
50 /// Creates a new `Response` with the given users.
51 pub fn new(users: Vec<User>) -> Self {
52 Self { users }
53 }
54 }
55}