Read receipt resp/req/client functions which resolves #51

This commit is contained in:
Sean Enck 2018-07-09 19:53:52 -04:00
parent eb6a57bae9
commit b7c900e0bb
No known key found for this signature in database
GPG Key ID: F08D2E576641A175
3 changed files with 17 additions and 0 deletions

View File

@ -493,6 +493,15 @@ func (cli *Client) SendNotice(roomID, text string) (*RespSendEvent, error) {
TextMessage{"m.notice", text})
}
// Receipt updates the marker for the given receipt type to the event ID specified.
// See https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid
func (cli *Client) Receipt(roomID, receiptType, eventID string, req *ReqReceipt) (resp *RespReceipt, err error) {
urlPath := cli.BuildURL("rooms", roomID, "receipt", receiptType, eventID)
_, err = cli.MakeRequest("POST", urlPath, req, nil)
return
}
// RedactEvent redacts the given event. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid
func (cli *Client) RedactEvent(roomID, eventID string, req *ReqRedact) (resp *RespSendEvent, err error) {
txnID := txnID()

View File

@ -76,3 +76,7 @@ type ReqTyping struct {
Typing bool `json:"typing"`
Timeout int64 `json:"timeout"`
}
// ReqReceipt is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid
type ReqReceipt struct {
}

View File

@ -174,3 +174,7 @@ type RespTurnServer struct {
TTL int `json:"ttl"`
URIs []string `json:"uris"`
}
// RespReceipt is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid
type RespReceipt struct {
}