ruma_federation_api/event/
get_event.rs1pub mod v1 {
6 use ruma_common::{
11 MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedServerName,
12 api::{request, response},
13 metadata,
14 };
15 use serde_json::value::RawValue as RawJsonValue;
16
17 use crate::authentication::ServerSignatures;
18
19 metadata! {
20 method: GET,
21 rate_limited: false,
22 authentication: ServerSignatures,
23 path: "/_matrix/federation/v1/event/{event_id}",
24 }
25
26 #[request]
28 pub struct Request {
29 #[ruma_api(path)]
31 pub event_id: OwnedEventId,
32 }
33
34 #[response]
36 pub struct Response {
37 pub origin: OwnedServerName,
39
40 pub origin_server_ts: MilliSecondsSinceUnixEpoch,
42
43 #[serde(rename = "pdus", with = "ruma_common::serde::single_element_seq")]
45 pub pdu: Box<RawJsonValue>,
46 }
47
48 impl Request {
49 pub fn new(event_id: OwnedEventId) -> Self {
51 Self { event_id }
52 }
53 }
54
55 impl Response {
56 pub fn new(
58 origin: OwnedServerName,
59 origin_server_ts: MilliSecondsSinceUnixEpoch,
60 pdu: Box<RawJsonValue>,
61 ) -> Self {
62 Self { origin, origin_server_ts, pdu }
63 }
64 }
65}