ruma_federation_api/membership/create_invite/
v2.rs1#[cfg(feature = "unstable-msc4125")]
6use ruma_common::OwnedServerName;
7use ruma_common::{
8 OwnedEventId, OwnedRoomId, RoomVersionId,
9 api::{request, response},
10 metadata,
11};
12use serde_json::value::RawValue as RawJsonValue;
13
14use crate::{authentication::ServerSignatures, membership::RawStrippedState};
15
16metadata! {
17 method: PUT,
18 rate_limited: false,
19 authentication: ServerSignatures,
20 path: "/_matrix/federation/v2/invite/{room_id}/{event_id}",
21}
22
23#[request]
25pub struct Request {
26 #[ruma_api(path)]
28 pub room_id: OwnedRoomId,
29
30 #[ruma_api(path)]
32 pub event_id: OwnedEventId,
33
34 pub room_version: RoomVersionId,
36
37 pub event: Box<RawJsonValue>,
39
40 pub invite_room_state: Vec<RawStrippedState>,
42
43 #[cfg(feature = "unstable-msc4125")]
48 #[serde(skip_serializing_if = "Option::is_none", rename = "org.matrix.msc4125.via")]
49 pub via: Option<Vec<OwnedServerName>>,
50}
51
52#[response]
54pub struct Response {
55 pub event: Box<RawJsonValue>,
57}
58
59impl Request {
60 pub fn new(
63 room_id: OwnedRoomId,
64 event_id: OwnedEventId,
65 room_version: RoomVersionId,
66 event: Box<RawJsonValue>,
67 invite_room_state: Vec<RawStrippedState>,
68 ) -> Self {
69 Self {
70 room_id,
71 event_id,
72 room_version,
73 event,
74 invite_room_state,
75 #[cfg(feature = "unstable-msc4125")]
76 via: None,
77 }
78 }
79}
80
81impl Response {
82 pub fn new(event: Box<RawJsonValue>) -> Self {
84 Self { event }
85 }
86}