ruma_federation_api/membership/create_leave_event/
v2.rs1use ruma_common::{
6 OwnedEventId, OwnedRoomId,
7 api::{request, response},
8 metadata,
9};
10use serde_json::value::RawValue as RawJsonValue;
11
12use crate::authentication::ServerSignatures;
13
14metadata! {
15 method: PUT,
16 rate_limited: false,
17 authentication: ServerSignatures,
18 path: "/_matrix/federation/v2/send_leave/{room_id}/{event_id}",
19}
20
21#[request]
23pub struct Request {
24 #[ruma_api(path)]
28 pub room_id: OwnedRoomId,
29
30 #[ruma_api(path)]
32 pub event_id: OwnedEventId,
33
34 #[ruma_api(body)]
36 pub pdu: Box<RawJsonValue>,
37}
38
39#[response]
41#[derive(Default)]
42pub struct Response {}
43
44impl Request {
45 pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
47 Self { room_id, event_id, pdu }
48 }
49}
50
51impl Response {
52 pub fn new() -> Self {
54 Self {}
55 }
56}
57
58#[cfg(all(test, feature = "server"))]
59mod tests {
60 use ruma_common::api::OutgoingResponse;
61
62 use super::Response;
63
64 #[test]
65 fn response_body() {
66 let res = Response::new().try_into_http_response::<Vec<u8>>().unwrap();
67
68 assert_eq!(res.body(), b"{}");
69 }
70}