ruma_federation_api/membership/
create_knock_event.rs1pub mod v1 {
6 use ruma_common::{
11 api::{request, response, Metadata},
12 metadata, OwnedEventId, OwnedRoomId,
13 };
14 use serde_json::value::RawValue as RawJsonValue;
15
16 use crate::membership::RawStrippedState;
17
18 const METADATA: Metadata = metadata! {
19 method: PUT,
20 rate_limited: false,
21 authentication: ServerSignatures,
22 history: {
23 unstable => "/_matrix/federation/unstable/xyz.amorgan.knock/send_knock/{room_id}/{event_id}",
24 1.1 => "/_matrix/federation/v1/send_knock/{room_id}/{event_id}",
25 }
26 };
27
28 #[request]
30 pub struct Request {
31 #[ruma_api(path)]
33 pub room_id: OwnedRoomId,
34
35 #[ruma_api(path)]
37 pub event_id: OwnedEventId,
38
39 #[ruma_api(body)]
41 pub pdu: Box<RawJsonValue>,
42 }
43
44 #[response]
46 pub struct Response {
47 pub knock_room_state: Vec<RawStrippedState>,
49 }
50
51 impl Request {
52 pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
54 Self { room_id, event_id, pdu }
55 }
56 }
57
58 impl Response {
59 pub fn new(knock_room_state: Vec<RawStrippedState>) -> Self {
61 Self { knock_room_state }
62 }
63 }
64}