diff --git a/crates/ruma-federation-api/CHANGELOG.md b/crates/ruma-federation-api/CHANGELOG.md index 2efe349d..4a8c3931 100644 --- a/crates/ruma-federation-api/CHANGELOG.md +++ b/crates/ruma-federation-api/CHANGELOG.md @@ -2,7 +2,8 @@ Breaking changes: -* Replace `Raw` with `Box` +* Replace `Raw` with `Box` or `&RawJsonValue` +* Borrow more request fields # 0.3.1 diff --git a/crates/ruma-federation-api/src/membership/create_invite/v2.rs b/crates/ruma-federation-api/src/membership/create_invite/v2.rs index 3d657390..0f8d19e6 100644 --- a/crates/ruma-federation-api/src/membership/create_invite/v2.rs +++ b/crates/ruma-federation-api/src/membership/create_invite/v2.rs @@ -19,20 +19,20 @@ ruma_api! { request: { /// The room ID that the user is being invited to. #[ruma_api(path)] - pub room_id: RoomId, + pub room_id: &'a RoomId, /// The event ID for the invite event, generated by the inviting server. #[ruma_api(path)] - pub event_id: EventId, + pub event_id: &'a EventId, /// The version of the room where the user is being invited to. - pub room_version: RoomVersionId, + pub room_version: &'a RoomVersionId, /// The invite event which needs to be signed. - pub event: Box, + pub event: &'a RawJsonValue, /// An optional list of simplified events to help the receiver of the invite identify the room. - pub invite_room_state: Vec>, + pub invite_room_state: &'a [Raw], } response: { @@ -41,15 +41,15 @@ ruma_api! { } } -impl Request { +impl<'a> Request<'a> { /// Creates a new `Request` with the given room ID, event ID, room version, event and invite /// room state. pub fn new( - room_id: RoomId, - event_id: EventId, - room_version: RoomVersionId, - event: Box, - invite_room_state: Vec>, + room_id: &'a RoomId, + event_id: &'a EventId, + room_version: &'a RoomVersionId, + event: &'a RawJsonValue, + invite_room_state: &'a [Raw], ) -> Self { Self { room_id, event_id, room_version, event, invite_room_state } } diff --git a/crates/ruma-federation-api/src/membership/create_join_event/v1.rs b/crates/ruma-federation-api/src/membership/create_join_event/v1.rs index cfed6809..ba00302c 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event/v1.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event/v1.rs @@ -30,7 +30,7 @@ ruma_api! { /// The PDU. #[ruma_api(body)] - pub pdu: Box, + pub pdu: &'a RawJsonValue, } response: { @@ -43,7 +43,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` from the given room ID, event ID and PDU. - pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: Box) -> Self { + pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: &'a RawJsonValue) -> Self { Self { room_id, event_id, pdu } } } diff --git a/crates/ruma-federation-api/src/membership/create_join_event/v2.rs b/crates/ruma-federation-api/src/membership/create_join_event/v2.rs index 1768f56b..ce136525 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event/v2.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event/v2.rs @@ -30,7 +30,7 @@ ruma_api! { /// The PDU. #[ruma_api(body)] - pub pdu: Box, + pub pdu: &'a RawJsonValue, } response: { @@ -42,7 +42,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` from the given room ID, event ID and PDU. - pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: Box) -> Self { + pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: &'a RawJsonValue) -> Self { Self { room_id, event_id, pdu } } } diff --git a/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs b/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs index b1a55d99..e2574e48 100644 --- a/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs +++ b/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs @@ -28,7 +28,7 @@ ruma_api! { /// The PDU. #[ruma_api(body)] - pub pdu: Box, + pub pdu: &'a RawJsonValue, } #[derive(Default)] @@ -37,7 +37,7 @@ ruma_api! { impl<'a> Request<'a> { /// Creates a new `Request` from the given room ID, event ID and PDU. - pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: Box) -> Self { + pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: &'a RawJsonValue) -> Self { Self { room_id, event_id, pdu } } }