mirror of https://github.com/matrix-org/gomatrix
Merge pull request #12 from matrix-org/kegan/api-put-state-event
Add PUT /room/roomId/state/type/key endpoint
This commit is contained in:
commit
fd0a0c56cc
|
@ -393,6 +393,14 @@ func (cli *Client) SendMessageEvent(roomID string, eventType string, contentJSON
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SendStateEvent sends a state event into a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey
|
||||||
|
// contentJSON should be a pointer to something that can be encoded as JSON using json.Marshal.
|
||||||
|
func (cli *Client) SendStateEvent(roomID, eventType, stateKey string, contentJSON interface{}) (resp *RespSendEvent, err error) {
|
||||||
|
urlPath := cli.BuildURL("rooms", roomID, "state", eventType, stateKey)
|
||||||
|
_, err = cli.MakeRequest("PUT", urlPath, contentJSON, &resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// SendText sends an m.room.message event into the given room with a msgtype of m.text
|
// SendText sends an m.room.message event into the given room with a msgtype of m.text
|
||||||
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-text
|
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-text
|
||||||
func (cli *Client) SendText(roomID, text string) (*RespSendEvent, error) {
|
func (cli *Client) SendText(roomID, text string) (*RespSendEvent, error) {
|
||||||
|
|
Loading…
Reference in New Issue