diff --git a/matrix_client/api.py b/matrix_client/api.py index aae52f99..dcf6d213 100644 --- a/matrix_client/api.py +++ b/matrix_client/api.py @@ -284,6 +284,22 @@ def get_state_event(self, room_id, event_type): """ return self._send("GET", "/rooms/{}/state/{}".format(quote(room_id), event_type)) + def send_read_markers(self, room_id, mfully_read, mread=None): + """Perform PUT /rooms/$room_id/read_markers + + Args: + room_id(str): The room ID. + mfully_read (str): event_id the read marker should located at. + mread (str): (optional) The event ID to set the read receipt location at. + """ + + content = {"m.fully_read": mfully_read} + if mread: + content['m.read'] = mread + + path = "/rooms/{}/read_markers".format(quote(room_id)) + return self._send("POST", path, content) + def send_message_event(self, room_id, event_type, content, txn_id=None, timestamp=None): """Perform PUT /rooms/$room_id/send/$event_type diff --git a/matrix_client/room.py b/matrix_client/room.py index 9083ed4a..1233afc7 100644 --- a/matrix_client/room.py +++ b/matrix_client/room.py @@ -426,6 +426,19 @@ def send_state_event(self, event_type, content, state_key=""): state_key ) + def send_read_markers(self, mfully_read, mread=None): + """ Send read markers + Args: + room_id(str): The room ID. + mfully_read (str): event_id the read marker should located at. + mread (str): (optional) The event ID to set the read receipt location at. + """ + + return self.client.api.send_read_markers( + self.room_id, + mfully_read, + mread) + def update_room_topic(self): """Updates self.topic and returns True if room topic has changed.""" try: