pub mod v1 {
use ruma_common::{
MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedServerName,
api::{request, response},
metadata,
};
use serde_json::value::RawValue as RawJsonValue;
use crate::authentication::ServerSignatures;
metadata! {
method: GET,
rate_limited: false,
authentication: ServerSignatures,
path: "/_matrix/federation/v1/event/{event_id}",
}
#[request]
pub struct Request {
#[ruma_api(path)]
pub event_id: OwnedEventId,
}
#[response]
pub struct Response {
pub origin: OwnedServerName,
pub origin_server_ts: MilliSecondsSinceUnixEpoch,
#[serde(rename = "pdus", with = "ruma_common::serde::single_element_seq")]
pub pdu: Box<RawJsonValue>,
}
impl Request {
pub fn new(event_id: OwnedEventId) -> Self {
Self { event_id }
}
}
impl Response {
pub fn new(
origin: OwnedServerName,
origin_server_ts: MilliSecondsSinceUnixEpoch,
pdu: Box<RawJsonValue>,
) -> Self {
Self { origin, origin_server_ts, pdu }
}
}
}