use ruma_common::{
api::{request, response, Metadata},
metadata, OwnedEventId, OwnedRoomId,
};
use serde_json::value::RawValue as RawJsonValue;
const METADATA: Metadata = metadata! {
method: PUT,
rate_limited: false,
authentication: ServerSignatures,
history: {
1.0 => "/_matrix/federation/v2/send_leave/:room_id/:event_id",
}
};
#[request]
pub struct Request {
#[ruma_api(path)]
pub room_id: OwnedRoomId,
#[ruma_api(path)]
pub event_id: OwnedEventId,
#[ruma_api(body)]
pub pdu: Box<RawJsonValue>,
}
#[response]
#[derive(Default)]
pub struct Response {}
impl Request {
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
Self { room_id, event_id, pdu }
}
}
impl Response {
pub fn new() -> Self {
Self {}
}
}
#[cfg(all(test, feature = "server"))]
mod tests {
use ruma_common::api::OutgoingResponse;
use super::Response;
#[test]
fn response_body() {
let res = Response::new().try_into_http_response::<Vec<u8>>().unwrap();
assert_eq!(res.body(), b"{}");
}
}