summaryrefslogtreecommitdiff
path: root/lib/polyjuice/client/room.ex
diff options
context:
space:
mode:
authormulti prise <korokoko.toi@gmail.com>2020-12-26 22:46:17 +0000
committerHubert Chathi <hubert@uhoreg.ca>2020-12-26 22:46:17 +0000
commitd3f257a3a3399361a0bb48cbfa1b1cfcba447e61 (patch)
treeee4a68d05956f0188aa28c6e74bb6fd8c9337897 /lib/polyjuice/client/room.ex
parentrelease 0.3.1 (diff)
wrote functions
corrected the tests
Diffstat (limited to '')
-rw-r--r--lib/polyjuice/client/room.ex28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/polyjuice/client/room.ex b/lib/polyjuice/client/room.ex
index 62009f9..7435244 100644
--- a/lib/polyjuice/client/room.ex
+++ b/lib/polyjuice/client/room.ex
@@ -334,4 +334,32 @@ defmodule Polyjuice.Client.Room do
}
)
end
+
+ @doc """
+ Set up the read receipt marker positions for a given room
+ The history for a given room may be split into three sections:
+ messages the user has read (or indicated they aren't interested in them),
+ messages the user might have read some but not others, and messages the user hasn't seen yet.
+ The "fully read marker" (also known as a "read marker") marks the last event of the first section,
+ whereas the user's read receipt marks the last event of the second section.
+ it takes:
+ `fully_read`: the event id the read marker should be located at
+ `read`: the event id the to which the read receipt should be be up to
+ """
+ @spec update_read_markers(
+ client_api :: Polyjuice.Client.API.t(),
+ room :: String.t(),
+ fully_read :: String.t(),
+ read :: String.t() | nil
+ ) :: {:ok} | any
+ def update_read_markers(client_api, room, fully_read, read \\ nil) do
+ Polyjuice.Client.API.call(
+ client_api,
+ %Polyjuice.Client.Endpoint.PostRoomsReadMarkers{
+ room: room,
+ fully_read: fully_read,
+ read: read
+ }
+ )
+ end
end