mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
Add support for read receipts on /receive
This commit is contained in:
@@ -540,6 +540,7 @@ func StringToBool(input string) bool {
|
||||
// @Param ignore_attachments query string false "Specify whether the attachments of the received message should be ignored" (default: false)"
|
||||
// @Param ignore_stories query string false "Specify whether stories should be ignored when receiving messages" (default: false)"
|
||||
// @Param max_messages query string false "Specify the maximum number of messages to receive (default: unlimited)". Not available in json-rpc mode.
|
||||
// @Param send_read_receipts query string false "Specify whether read receipts should be sent when receiving messages" (default: false)"
|
||||
// @Router /v1/receive/{number} [get]
|
||||
func (a *Api) Receive(c *gin.Context) {
|
||||
number := c.Param("number")
|
||||
@@ -582,7 +583,13 @@ func (a *Api) Receive(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
jsonStr, err := a.signalClient.Receive(number, timeoutInt, StringToBool(ignoreAttachments), StringToBool(ignoreStories), maxMessagesInt)
|
||||
sendReadReceipts := c.DefaultQuery("send_read_receipts", "false")
|
||||
if sendReadReceipts != "true" && sendReadReceipts != "false" {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - send_read_receipts parameter needs to be either 'true' or 'false'"})
|
||||
return
|
||||
}
|
||||
|
||||
jsonStr, err := a.signalClient.Receive(number, timeoutInt, StringToBool(ignoreAttachments), StringToBool(ignoreStories), maxMessagesInt, StringToBool(sendReadReceipts))
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user