ruma_federation_api/event/get_event_by_timestamp/
v1.rs1use ruma_common::{
6 MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId,
7 api::{Direction, request, response},
8 metadata,
9};
10
11use crate::authentication::ServerSignatures;
12
13metadata! {
14 method: GET,
15 rate_limited: false,
16 authentication: ServerSignatures,
17 path: "/_matrix/federation/v1/timestamp_to_event/{room_id}",
18}
19
20#[request]
22pub struct Request {
23 #[ruma_api(path)]
25 pub room_id: OwnedRoomId,
26
27 #[ruma_api(query)]
29 pub ts: MilliSecondsSinceUnixEpoch,
30
31 #[ruma_api(query)]
33 pub dir: Direction,
34}
35
36#[response]
38pub struct Response {
39 pub event_id: OwnedEventId,
41
42 pub origin_server_ts: MilliSecondsSinceUnixEpoch,
44}
45
46impl Request {
47 pub fn new(room_id: OwnedRoomId, ts: MilliSecondsSinceUnixEpoch, dir: Direction) -> Self {
49 Self { room_id, ts, dir }
50 }
51}
52
53impl Response {
54 pub fn new(event_id: OwnedEventId, origin_server_ts: MilliSecondsSinceUnixEpoch) -> Self {
56 Self { event_id, origin_server_ts }
57 }
58}