ruma_client_api/membership/
leave_room.rs1pub mod v3 {
6 use ruma_common::{
11 OwnedRoomId,
12 api::{auth_scheme::AccessToken, request, response},
13 metadata,
14 };
15
16 metadata! {
17 method: POST,
18 rate_limited: true,
19 authentication: AccessToken,
20 history: {
21 1.0 => "/_matrix/client/r0/rooms/{room_id}/leave",
22 1.1 => "/_matrix/client/v3/rooms/{room_id}/leave",
23 }
24 }
25
26 #[request(error = crate::Error)]
28 pub struct Request {
29 #[ruma_api(path)]
31 pub room_id: OwnedRoomId,
32
33 #[serde(skip_serializing_if = "Option::is_none")]
35 pub reason: Option<String>,
36 }
37
38 #[response(error = crate::Error)]
40 #[derive(Default)]
41 pub struct Response {}
42
43 impl Request {
44 pub fn new(room_id: OwnedRoomId) -> Self {
46 Self { room_id, reason: None }
47 }
48 }
49
50 impl Response {
51 pub fn new() -> Self {
53 Self {}
54 }
55 }
56}