ruma_federation_api/room/
report_content.rs

1//! `GET /_matrix/federation/*/rooms/{roomId}/report/{eventId}`
2//!
3//! Send a request to report an event originating from another server.
4
5pub mod msc3843 {
6    //! `MSC3843` ([MSC])
7    //!
8    //! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/3843
9
10    use ruma_common::{
11        OwnedEventId, OwnedRoomId,
12        api::{request, response},
13        metadata,
14    };
15
16    use crate::authentication::ServerSignatures;
17
18    metadata! {
19        method: POST,
20        rate_limited: false,
21        authentication: ServerSignatures,
22        path: "/_matrix/federation/unstable/org.matrix.msc3843/rooms/{room_id}/report/{event_id}",
23    }
24
25    /// Request type for the `report_content` endpoint.
26    #[request]
27    pub struct Request {
28        /// The room ID that the reported event was sent in.
29        #[ruma_api(path)]
30        pub room_id: OwnedRoomId,
31
32        /// The event being reported.
33        #[ruma_api(path)]
34        pub event_id: OwnedEventId,
35
36        /// The reason that the event is being reported.
37        pub reason: String,
38    }
39
40    /// Response type for the `report_content` endpoint.
41    #[response]
42    pub struct Response {}
43
44    impl Request {
45        /// Creates a `Request` with the given room ID, event ID and reason.
46        pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, reason: String) -> Self {
47            Self { room_id, event_id, reason }
48        }
49    }
50
51    impl Response {
52        /// Creates a new empty `Response`.
53        pub fn new() -> Self {
54            Self {}
55        }
56    }
57}