Skip to content

Commit 0d77156

Browse files
committed
feat(sdk): Simplify the API of Common::event
1 parent c35f8c5 commit 0d77156

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

crates/matrix-sdk/src/room/common.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use ruma::{
1212
room::history_visibility::HistoryVisibility, AnyStateEvent, AnySyncStateEvent, EventType,
1313
},
1414
serde::Raw,
15-
UserId,
15+
EventId, UserId,
1616
};
1717

1818
use crate::{
@@ -190,14 +190,9 @@ impl Common {
190190
Ok(response)
191191
}
192192

193-
/// Sends a request to `/_matrix/client/r0/rooms/{roomId}/event/{eventId}`
194-
/// and returns a `get_room_event::Response` that contains a event
195-
/// (`AnyRoomEvent`).
196-
pub async fn event(
197-
&self,
198-
request: impl Into<get_room_event::Request<'_>>,
199-
) -> Result<RoomEvent> {
200-
let request = request.into();
193+
/// Fetch the event with the given `EventId` in this room.
194+
pub async fn event(&self, event_id: &EventId) -> Result<RoomEvent> {
195+
let request = get_room_event::Request::new(self.room_id(), event_id);
201196
let event = self.client.send(request, None).await?.event.deserialize()?;
202197

203198
#[cfg(feature = "encryption")]

0 commit comments

Comments
 (0)