ruma_client_api/profile/
set_display_name.rs1pub mod v3 {
6 use ruma_common::{
11 OwnedUserId,
12 api::{auth_scheme::AccessToken, request, response},
13 metadata,
14 };
15
16 #[cfg(feature = "unstable-msc4466")]
17 use crate::profile::PropagateTo;
18
19 metadata! {
20 method: PUT,
21 rate_limited: true,
22 authentication: AccessToken,
23 history: {
24 1.0 => "/_matrix/client/r0/profile/{user_id}/displayname",
25 1.1 => "/_matrix/client/v3/profile/{user_id}/displayname",
26 }
27 }
28
29 #[request]
31 pub struct Request {
32 #[ruma_api(path)]
34 pub user_id: OwnedUserId,
35
36 #[serde(skip_serializing_if = "Option::is_none")]
38 pub displayname: Option<String>,
39
40 #[cfg(feature = "unstable-msc4466")]
42 #[ruma_api(query)]
43 #[serde(rename = "computer.gingershaped.msc4466.propagate_to")]
44 #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
45 pub propagate_to: PropagateTo,
46 }
47
48 #[response]
50 #[derive(Default)]
51 pub struct Response {}
52
53 impl Request {
54 #[deprecated = "Use the set_profile_field endpoint instead."]
56 pub fn new(user_id: OwnedUserId, displayname: Option<String>) -> Self {
57 Self {
58 user_id,
59 displayname,
60 #[cfg(feature = "unstable-msc4466")]
61 propagate_to: PropagateTo::default(),
62 }
63 }
64 }
65
66 impl Response {
67 pub fn new() -> Self {
69 Self {}
70 }
71 }
72}