Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Receipt client function #51

Description

Any interest in adding a receipt client function to send receipts using the API endpoints

e.g.

diff --git a/client.go b/client.go
index 7725ac3..2819d8d 100644
--- a/client.go
+++ b/client.go
@@ -449,6 +449,13 @@ func (cli *Client) SendMessageEvent(roomID string, eventType string, contentJSON
        return
 }
 
+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
+}
+
+
 // 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) {
diff --git a/requests.go b/requests.go
index af99a22..f044fff 100644
--- a/requests.go
+++ b/requests.go
@@ -76,3 +76,6 @@ type ReqTyping struct {
        Typing  bool  `json:"typing"`
        Timeout int64 `json:"timeout"`
 }
+
+type ReqReceipt struct {
+}
diff --git a/responses.go b/responses.go
index fe0eeb3..8539969 100644
--- a/responses.go
+++ b/responses.go
@@ -174,3 +174,6 @@ type RespTurnServer struct {
        TTL      int      `json:"ttl"`
        URIs     []string `json:"uris"`
 }
+
+type RespReceipt struct {
+}

Happy to cleanup and submit this as a PR if it seems reasonable

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions