From 0314384c60c9d2c85fdef9224d0916901c54d6d2 Mon Sep 17 00:00:00 2001 From: iinuwa Date: Tue, 14 Jan 2020 08:20:31 -0600 Subject: [PATCH] Add content reporting endpoint --- src/r0/room.rs | 1 + src/r0/room/report_content.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/r0/room/report_content.rs diff --git a/src/r0/room.rs b/src/r0/room.rs index f386bf85..c0ab2146 100644 --- a/src/r0/room.rs +++ b/src/r0/room.rs @@ -2,6 +2,7 @@ pub mod create_room; pub mod get_room_event; +pub mod report_content; use serde::{Deserialize, Serialize}; diff --git a/src/r0/room/report_content.rs b/src/r0/room/report_content.rs new file mode 100644 index 00000000..43713bea --- /dev/null +++ b/src/r0/room/report_content.rs @@ -0,0 +1,31 @@ +//! [POST /_matrix/client/r0/rooms/{roomId}/report/{eventId}](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-rooms-roomid-report-eventid) + +use js_int::Int; +use ruma_api::ruma_api; +use ruma_identifiers::{EventId, RoomId}; + +ruma_api! { + metadata { + description: "Report content as inappropriate.", + method: POST, + name: "report_content", + path: "/rooms/:room_id/report/:event_id", + rate_limited: false, + requires_authentication: true, + } + + request { + /// Room in which the event to be reported is located. + #[ruma_api(path)] + room_id: RoomId, + /// Event to report. + #[ruma_api(path)] + event_id: EventId, + /// Integer between -100 and 0 rating offensivness. + score: Int, + /// Reason to report content. May be blank. + reason: String, + } + + response {} +}