Use Pdu
on create_join_event
endpoints
Sending requests to this endpoints to Synapse/Dendrite homeservers leads to some deserialization errors. After claryfing it (https://github.com/matrix-org/matrix-doc/issues/2856), `room_id` and `event_id` fields are expected to appear on request's body and also on path params. It seems that there's some initiative, in any case, to remove the parameters from path: https://github.com/matrix-org/matrix-doc/issues/2330
This commit is contained in:
parent
9a4206b1b2
commit
b168c38d83
@ -5,6 +5,7 @@ Breaking Changes:
|
|||||||
* Replace `directory::get_public_rooms::v1::{PublicRoomsChunk, RoomNetwork}` with types from
|
* Replace `directory::get_public_rooms::v1::{PublicRoomsChunk, RoomNetwork}` with types from
|
||||||
`ruma_common::directory`
|
`ruma_common::directory`
|
||||||
* Wrap `PduStub`s in `membership::create_join_event` in `Raw`
|
* Wrap `PduStub`s in `membership::create_join_event` in `Raw`
|
||||||
|
* Use `Pdu` instead of `PduStub` in `membership::create_join_event` endpoints
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::Raw;
|
use ruma_common::Raw;
|
||||||
use ruma_events::pdu::PduStub;
|
use ruma_events::pdu::Pdu;
|
||||||
use ruma_identifiers::{EventId, RoomId};
|
use ruma_identifiers::{EventId, RoomId};
|
||||||
|
|
||||||
use super::RoomState;
|
use super::RoomState;
|
||||||
@ -26,9 +26,9 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub event_id: &'a EventId,
|
pub event_id: &'a EventId,
|
||||||
|
|
||||||
/// PDU type without event and room IDs.
|
/// PDU type
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub pdu_stub: Raw<PduStub>,
|
pub pdu_stub: Raw<Pdu>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
@ -39,10 +39,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Construct from Pdu, same for similar endpoints
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a `Request` from the given room ID, event ID and `PduStub`.
|
/// Creates a `Request` from the given room ID, event ID and `Pdu`.
|
||||||
pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu_stub: Raw<PduStub>) -> Self {
|
pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu_stub: Raw<Pdu>) -> Self {
|
||||||
Self { room_id, event_id, pdu_stub }
|
Self { room_id, event_id, pdu_stub }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::Raw;
|
use ruma_common::Raw;
|
||||||
use ruma_events::pdu::PduStub;
|
use ruma_events::pdu::Pdu;
|
||||||
use ruma_identifiers::{EventId, RoomId};
|
use ruma_identifiers::{EventId, RoomId};
|
||||||
|
|
||||||
use super::RoomState;
|
use super::RoomState;
|
||||||
@ -26,9 +26,9 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub event_id: &'a EventId,
|
pub event_id: &'a EventId,
|
||||||
|
|
||||||
/// PDU type without event and room IDs.
|
/// PDU type
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub pdu_stub: Raw<PduStub>,
|
pub pdu_stub: Raw<Pdu>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
@ -38,10 +38,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Construct from Pdu, same for similar endpoints
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a `Request` from the given room ID, event ID and `PduStub`.
|
/// Creates a `Request` from the given room ID, event ID and `Pdu`.
|
||||||
pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu_stub: Raw<PduStub>) -> Self {
|
pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu_stub: Raw<Pdu>) -> Self {
|
||||||
Self { room_id, event_id, pdu_stub }
|
Self { room_id, event_id, pdu_stub }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user