ruma_client_api/profile/
get_display_name.rs1pub mod v3 {
6 use ruma_common::{
11 OwnedUserId,
12 api::{auth_scheme::NoAuthentication, request, response},
13 metadata,
14 };
15
16 metadata! {
17 method: GET,
18 rate_limited: false,
19 authentication: NoAuthentication,
20 history: {
21 1.0 => "/_matrix/client/r0/profile/{user_id}/displayname",
22 1.1 => "/_matrix/client/v3/profile/{user_id}/displayname",
23 }
24 }
25
26 #[request(error = crate::Error)]
28 pub struct Request {
29 #[ruma_api(path)]
31 pub user_id: OwnedUserId,
32 }
33
34 #[response(error = crate::Error)]
36 #[derive(Default)]
37 pub struct Response {
38 #[serde(skip_serializing_if = "Option::is_none")]
40 pub displayname: Option<String>,
41 }
42
43 impl Request {
44 #[deprecated = "Use the get_profile_field endpoint instead."]
46 pub fn new(user_id: OwnedUserId) -> Self {
47 Self { user_id }
48 }
49 }
50
51 impl Response {
52 pub fn new(displayname: Option<String>) -> Self {
54 Self { displayname }
55 }
56 }
57}