ruma_federation_api/membership/create_join_event/
v1.rs1use ruma_common::{
6 api::{request, response},
7 metadata, OwnedEventId, OwnedRoomId,
8};
9use serde::{Deserialize, Serialize};
10use serde_json::value::RawValue as RawJsonValue;
11
12use crate::authentication::ServerSignatures;
13
14metadata! {
15 method: PUT,
16 rate_limited: false,
17 authentication: ServerSignatures,
18 path: "/_matrix/federation/v1/send_join/{room_id}/{event_id}",
19}
20
21#[request]
23#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
24pub struct Request {
25 #[ruma_api(path)]
29 pub room_id: OwnedRoomId,
30
31 #[ruma_api(path)]
33 pub event_id: OwnedEventId,
34
35 #[ruma_api(body)]
37 pub pdu: Box<RawJsonValue>,
38}
39
40#[response]
42#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."]
43pub struct Response {
44 #[ruma_api(body)]
46 #[serde(with = "crate::serde::v1_pdu")]
47 pub room_state: RoomState,
48}
49
50#[allow(deprecated)]
51impl 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#[allow(deprecated)]
59impl Response {
60 pub fn new(room_state: RoomState) -> Self {
62 Self { room_state }
63 }
64}
65
66#[derive(Clone, Debug, Default, Deserialize, Serialize)]
68#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
69pub struct RoomState {
70 pub auth_chain: Vec<Box<RawJsonValue>>,
73
74 pub state: Vec<Box<RawJsonValue>>,
76
77 #[serde(skip_serializing_if = "Option::is_none")]
82 pub event: Option<Box<RawJsonValue>>,
83}
84
85impl RoomState {
86 pub fn new() -> Self {
88 Self::default()
89 }
90}