mirror of https://github.com/matrix-org/gomatrix
Add PUT /room/roomId/state/type/key endpoint
This commit is contained in:
parent
373dfc2ff2
commit
52bfdcb6fa
|
@ -386,6 +386,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