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