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