room: Add event() method to retrieve a room event
@@ -6,6 +6,7 @@ use ruma::{
api::client::r0::{
membership::{get_member_events, join_room_by_id, leave_room},
message::get_message_events,
+ room::get_room_event,
},
events::room::history_visibility::HistoryVisibility,
UserId,
@@ -146,6 +147,17 @@ impl Common {
self.client.send(request, None).await
}
+ /// Sends a request to `/_matrix/client/r0/rooms/{roomId}/event/{eventId}`
+ /// and returns a `get_room_event::Response` that contains a event
+ /// (`AnyRoomEvent`).
+ pub async fn event(
+ &self,
+ request: impl Into<get_room_event::Request<'_>>,
+ ) -> Result<get_room_event::Response> {
+ let request = request.into();
+ self.client.send(request, None).await
+ }
+
pub(crate) async fn request_members(&self) -> Result<Option<MembersResponse>> {
#[allow(clippy::map_clone)]
if let Some(mutex) =
