Add Event

This commit is contained in:
Neil Alexander 2020-05-16 14:49:02 +01:00
parent e5578b12c7
commit 015e6dc5a1
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
1 changed files with 9 additions and 0 deletions

View File

@ -615,6 +615,15 @@ func (cli *Client) UserTyping(roomID string, typing bool, timeout int64) (resp *
return 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 // 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. // 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 // See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-statekey