From f31357c4e12b744761dd488cc83db44b1d24be0f Mon Sep 17 00:00:00 2001 From: Devin R Date: Fri, 22 May 2020 18:05:12 -0400 Subject: [PATCH] async_client: read_marker endpoint, fix read_receipt docs --- matrix_sdk/src/client.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 72074b11..9e6c1cdf 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -228,6 +228,7 @@ use api::r0::membership::{ }; use api::r0::message::create_message_event; use api::r0::message::get_message_events; +use api::r0::read_marker::set_read_marker; use api::r0::receipt::create_receipt; use api::r0::room::create_room; use api::r0::session::login; @@ -733,7 +734,7 @@ impl Client { self.send(request).await } - /// Send a request to notify the room of a user typing. + /// Send a request to notify the room the user has read specific event. /// /// Returns a `create_receipt::Response`, an empty response. /// @@ -755,6 +756,31 @@ impl Client { self.send(request).await } + /// Send a request to notify the room user has read up to specific event. + /// + /// Returns a `create_typing_event::Response`, an empty response. + /// + /// # Arguments + /// + /// * room_id - The `RoomId` the user is typing in. + /// + /// * fully_read - The `EventId` of the event the user has read to. + /// + /// * read_receipt - The `EventId` to set the read receipt location at. + pub async fn read_marker( + &self, + room_id: &RoomId, + fully_read: &EventId, + read_receipt: Option<&EventId>, + ) -> Result { + let request = set_read_marker::Request { + room_id: room_id.clone(), + fully_read: fully_read.clone(), + read_receipt: read_receipt.cloned(), + }; + self.send(request).await + } + /// Synchronize the client's state with the latest state on the server. /// /// If a `StateStore` is provided and this is the initial sync state will