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        api::{request, response, Metadata},
12        metadata, OwnedEventId, OwnedRoomId,
13    };
14
15    const METADATA: Metadata = metadata! {
16        method: POST,
17        rate_limited: false,
18        authentication: ServerSignatures,
19        history: {
20            unstable => "/_matrix/federation/unstable/org.matrix.msc3843/rooms/:room_id/report/:event_id",
21        }
22    };
23
24    /// Request type for the `report_content` endpoint.
25    #[request]
26    pub struct Request {
27        /// The room ID that the reported event was sent in.
28        #[ruma_api(path)]
29        pub room_id: OwnedRoomId,
30
31        /// The event being reported.
32        #[ruma_api(path)]
33        pub event_id: OwnedEventId,
34
35        /// The reason that the event is being reported.
36        pub reason: String,
37    }
38
39    /// Response type for the `report_content` endpoint.
40    #[response]
41    pub struct Response {}
42
43    impl Request {
44        /// Creates a `Request` with the given room ID, event ID and reason.
45        pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, reason: String) -> Self {
46            Self { room_id, event_id, reason }
47        }
48    }
49
50    impl Response {
51        /// Creates a new empty `Response`.
52        pub fn new() -> Self {
53            Self {}
54        }
55    }
56}