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