ruma_client_api/profile/
get_display_name.rs1pub mod v3 {
6    use ruma_common::{
11        api::{request, response, Metadata},
12        metadata, OwnedUserId,
13    };
14
15    const METADATA: Metadata = metadata! {
16        method: GET,
17        rate_limited: false,
18        authentication: None,
19        history: {
20            1.0 => "/_matrix/client/r0/profile/:user_id/displayname",
21            1.1 => "/_matrix/client/v3/profile/:user_id/displayname",
22        }
23    };
24
25    #[request(error = crate::Error)]
27    pub struct Request {
28        #[ruma_api(path)]
30        pub user_id: OwnedUserId,
31    }
32
33    #[response(error = crate::Error)]
35    #[derive(Default)]
36    pub struct Response {
37        #[serde(skip_serializing_if = "Option::is_none")]
39        pub displayname: Option<String>,
40    }
41
42    impl Request {
43        pub fn new(user_id: OwnedUserId) -> Self {
45            Self { user_id }
46        }
47    }
48
49    impl Response {
50        pub fn new(displayname: Option<String>) -> Self {
52            Self { displayname }
53        }
54    }
55}