From ec8e3230ccf49ba5bf75aaf62ed41e8146a2bb47 Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Fri, 25 Sep 2020 15:33:55 +0200
Subject: [PATCH] Allow to mark messages as read

A new feature introduced in https://code.briarproject.org/briar/briar/-/merge_requests/1285.

Fixes #18
---
 briar_wrapper/models/private_chat.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/briar_wrapper/models/private_chat.py b/briar_wrapper/models/private_chat.py
index d9bf4fe..483edda 100644
--- a/briar_wrapper/models/private_chat.py
+++ b/briar_wrapper/models/private_chat.py
@@ -50,3 +50,16 @@ class PrivateChat(Model):
         url = urljoin(BASE_HTTP_URL,
                       self._API_ENDPOINT + str(self._contact_id))
         requests.post(url, headers=self._headers, json={"text": message})
+
+    def mark_read(self, messageId):
+        # pylint: disable=line-too-long
+        """
+        Marks message as read
+
+        [Upstream documentation](https://code.briarproject.org/briar/briar/blob/master/briar-headless/README.md#marking-messages-as-read)
+
+        .. versionadded:: 0.0.5
+        """
+        url = urljoin(BASE_HTTP_URL,
+                      self._API_ENDPOINT + "read/" + str(self._contact_id))
+        requests.post(url, headers=self._headers, json={"messageId": messageId})
-- 
GitLab