From 5891715dc5e0374586a2e47a8eb269e3e052a253 Mon Sep 17 00:00:00 2001 From: TheDiscordian <43145244+TheDiscordian@users.noreply.github.com> Date: Thu, 27 Aug 2020 08:08:51 -0400 Subject: [PATCH] MarkRead method for // MarkRead marks eventID in roomID as read, signifying the event, and all before it have been read. See https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid (#81) --- client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client.go b/client.go index eeaed99..0ab2d1d 100644 --- a/client.go +++ b/client.go @@ -578,6 +578,12 @@ func (cli *Client) RedactEvent(roomID, eventID string, req *ReqRedact) (resp *Re return } +// MarkRead marks eventID in roomID as read, signifying the event, and all before it have been read. See https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid +func (cli *Client) MarkRead(roomID, eventID string) error { + urlPath := cli.BuildURL("rooms", roomID, "receipt", "m.read", eventID) + return cli.MakeRequest("POST", urlPath, nil, nil) +} + // CreateRoom creates a new Matrix room. See https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom // resp, err := cli.CreateRoom(&gomatrix.ReqCreateRoom{ // Preset: "public_chat",