From 015e6dc5a1f137b99f677d4d3961b54a0e8f9666 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 16 May 2020 14:49:02 +0100 Subject: [PATCH] Add Event --- client.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client.go b/client.go index 68a7bdd..cc62143 100644 --- a/client.go +++ b/client.go @@ -615,6 +615,15 @@ func (cli *Client) UserTyping(roomID string, typing bool, timeout int64) (resp * return } +// Event gets a single event in a room. It will attempt to JSON unmarshal into the given "outContent" struct with +// the HTTP response body, or return an error. +// See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-statekey +func (cli *Client) Event(roomID, eventID string, outContent interface{}) (err error) { + u := cli.BuildURL("rooms", roomID, "event", eventID) + err = cli.MakeRequest("GET", u, nil, outContent) + return +} + // StateEvent gets a single state event in a room. It will attempt to JSON unmarshal into the given "outContent" struct with // the HTTP response body, or return an error. // See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-statekey