ruma_federation_api/membership/create_join_event/
v1.rs1use ruma_common::{
6 api::{request, response, Metadata},
7 metadata, OwnedEventId, OwnedRoomId,
8};
9use serde::{Deserialize, Serialize};
10use serde_json::value::RawValue as RawJsonValue;
11
12const METADATA: Metadata = metadata! {
13 method: PUT,
14 rate_limited: false,
15 authentication: ServerSignatures,
16 history: {
17 1.0 => "/_matrix/federation/v1/send_join/:room_id/:event_id",
18 1.0 => deprecated,
19 }
20};
21
22#[request]
24#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
25pub struct Request {
26 #[ruma_api(path)]
30 pub room_id: OwnedRoomId,
31
32 #[ruma_api(path)]
34 pub event_id: OwnedEventId,
35
36 #[ruma_api(body)]
38 pub pdu: Box<RawJsonValue>,
39}
40
41#[response]
43#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
44pub struct Response {
45 #[ruma_api(body)]
47 #[serde(with = "crate::serde::v1_pdu")]
48 pub room_state: RoomState,
49}
50
51#[allow(deprecated)]
52impl Request {
53 pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box<RawJsonValue>) -> Self {
55 Self { room_id, event_id, pdu }
56 }
57}
58
59#[allow(deprecated)]
60impl Response {
61 pub fn new(room_state: RoomState) -> Self {
63 Self { room_state }
64 }
65}
66
67#[derive(Clone, Debug, Default, Deserialize, Serialize)]
69#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
70pub struct RoomState {
71 pub auth_chain: Vec<Box<RawJsonValue>>,
74
75 pub state: Vec<Box<RawJsonValue>>,
77
78 #[serde(skip_serializing_if = "Option::is_none")]
83 pub event: Option<Box<RawJsonValue>>,
84}
85
86impl RoomState {
87 pub fn new() -> Self {
89 Self::default()
90 }
91}