Use Raw<Pdu> in get_event Response over Pdu

This commit is contained in:
Devin Ragotzy 2020-12-06 03:20:48 -08:00 committed by GitHub
parent e8882fe814
commit f17c5fc619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,11 @@
//! [GET /_matrix/federation/v1/event/{eventId}](https://matrix.org/docs/spec/server_server/r0.1.4#get-matrix-federation-v1-event-eventid) //! [GET /_matrix/federation/v1/event/{eventId}](https://matrix.org/docs/spec/server_server/r0.1.4#get-matrix-federation-v1-event-eventid)
use std::time::SystemTime;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_events::pdu::Pdu; use ruma_events::pdu::Pdu;
use ruma_identifiers::{EventId, ServerNameBox}; use ruma_identifiers::{EventId, ServerNameBox};
use std::time::SystemTime; use ruma_serde::Raw;
ruma_api! { ruma_api! {
metadata: { metadata: {
@ -31,7 +33,7 @@ ruma_api! {
/// The event. /// The event.
#[serde(rename = "pdus", with = "ruma_serde::single_element_seq")] #[serde(rename = "pdus", with = "ruma_serde::single_element_seq")]
pub pdu: Pdu, pub pdu: Raw<Pdu>,
} }
} }
@ -44,7 +46,7 @@ impl<'a> Request<'a> {
impl Response { impl Response {
/// Creates a new `Response` with the given server name, timestamp, and event. /// Creates a new `Response` with the given server name, timestamp, and event.
pub fn new(origin: ServerNameBox, origin_server_ts: SystemTime, pdu: Pdu) -> Self { pub fn new(origin: ServerNameBox, origin_server_ts: SystemTime, pdu: Raw<Pdu>) -> Self {
Self { origin, origin_server_ts, pdu } Self { origin, origin_server_ts, pdu }
} }
} }