ruma_federation_api/event/
get_event_by_timestamp.rs1pub mod v1 {
6 use ruma_common::{
11 api::{request, response, Direction, Metadata},
12 metadata, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId,
13 };
14
15 const METADATA: Metadata = metadata! {
16 method: GET,
17 rate_limited: false,
18 authentication: ServerSignatures,
19 history: {
20 unstable => "/_matrix/federation/unstable/org.matrix.msc3030/timestamp_to_event/{room_id}",
21 1.6 => "/_matrix/federation/v1/timestamp_to_event/{room_id}",
22 }
23 };
24
25 #[request]
27 pub struct Request {
28 #[ruma_api(path)]
30 pub room_id: OwnedRoomId,
31
32 #[ruma_api(query)]
34 pub ts: MilliSecondsSinceUnixEpoch,
35
36 #[ruma_api(query)]
38 pub dir: Direction,
39 }
40
41 #[response]
43 pub struct Response {
44 pub event_id: OwnedEventId,
46
47 pub origin_server_ts: MilliSecondsSinceUnixEpoch,
49 }
50
51 impl Request {
52 pub fn new(room_id: OwnedRoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction) -> Self {
54 Self { room_id, ts, dir }
55 }
56 }
57
58 impl Response {
59 pub fn new(event_id: OwnedEventId, origin_server_ts: MilliSecondsSinceUnixEpoch) -> Self {
61 Self { event_id, origin_server_ts }
62 }
63 }
64}