matrix-sdk: Add method to get room as room::Common

master
Julian Sparber 2021-03-08 23:00:19 +01:00
parent 88e230689e
commit 2d6502247b
1 changed files with 11 additions and 0 deletions

View File

@ -599,6 +599,17 @@ impl Client {
.collect() .collect()
} }
/// Get a room with the given room id.
///
/// # Arguments
///
/// `room_id` - The unique id of the room that should be fetched.
pub fn get_room(&self, room_id: &RoomId) -> Option<room::Common> {
self.store()
.get_room(room_id)
.map(|room| room::Common::new(self.clone(), room))
}
/// Get a joined room with the given room id. /// Get a joined room with the given room id.
/// ///
/// # Arguments /// # Arguments