ruma_client_api/presence/
set_presence.rs1pub mod v3 {
6    use ruma_common::{
11        api::{request, response, Metadata},
12        metadata,
13        presence::PresenceState,
14        OwnedUserId,
15    };
16
17    const METADATA: Metadata = metadata! {
18        method: PUT,
19        rate_limited: true,
20        authentication: AccessToken,
21        history: {
22            1.0 => "/_matrix/client/r0/presence/:user_id/status",
23            1.1 => "/_matrix/client/v3/presence/:user_id/status",
24        }
25    };
26
27    #[request(error = crate::Error)]
29    pub struct Request {
30        #[ruma_api(path)]
32        pub user_id: OwnedUserId,
33
34        pub presence: PresenceState,
36
37        #[serde(skip_serializing_if = "Option::is_none")]
39        pub status_msg: Option<String>,
40    }
41
42    #[response(error = crate::Error)]
44    #[derive(Default)]
45    pub struct Response {}
46
47    impl Request {
48        pub fn new(user_id: OwnedUserId, presence: PresenceState) -> Self {
50            Self { user_id, presence, status_msg: None }
51        }
52    }
53
54    impl Response {
55        pub fn new() -> Self {
57            Self {}
58        }
59    }
60}