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