mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-05-21 13:54:18 +00:00
parent
f57512216c
commit
9c365e6f84
@ -112,6 +112,7 @@ type SendMessageV2 struct {
|
||||
QuoteMessage *string `json:"quote_message"`
|
||||
QuoteMentions []client.MessageMention `json:"quote_mentions"`
|
||||
TextMode *string `json:"text_mode" enums:"normal,styled"`
|
||||
EditTimestamp *int64 `json:"edit_timestamp"`
|
||||
}
|
||||
|
||||
type TypingIndicatorRequest struct {
|
||||
@ -397,7 +398,7 @@ func (a *Api) SendV2(c *gin.Context) {
|
||||
|
||||
timestamps, err := a.signalClient.SendV2(
|
||||
req.Number, req.Message, req.Recipients, req.Base64Attachments, req.Sticker,
|
||||
req.Mentions, req.QuoteTimestamp, req.QuoteAuthor, req.QuoteMessage, req.QuoteMentions, req.TextMode)
|
||||
req.Mentions, req.QuoteTimestamp, req.QuoteAuthor, req.QuoteMessage, req.QuoteMentions, req.TextMode, req.EditTimestamp)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
|
||||
@ -343,7 +343,8 @@ func (s *MessageMention) toString() string {
|
||||
|
||||
func (s *SignalClient) send(number string, message string,
|
||||
recipients []string, base64Attachments []string, isGroup bool, sticker string, mentions []MessageMention,
|
||||
quoteTimestamp *int64, quoteAuthor *string, quoteMessage *string, quoteMentions []MessageMention, textMode *string) (*SendResponse, error) {
|
||||
quoteTimestamp *int64, quoteAuthor *string, quoteMessage *string, quoteMentions []MessageMention, textMode *string,
|
||||
editTimestamp *int64) (*SendResponse, error) {
|
||||
|
||||
var resp SendResponse
|
||||
|
||||
@ -400,6 +401,7 @@ func (s *SignalClient) send(number string, message string,
|
||||
QuoteMessage *string `json:"quote-message,omitempty"`
|
||||
QuoteMentions []string `json:"quote-mentions,omitempty"`
|
||||
TextStyles []string `json:"text-style,omitempty"`
|
||||
EditTimestamp *int64 `json:"edit-timestamp,omitempty"`
|
||||
}
|
||||
|
||||
request := Request{Message: message}
|
||||
@ -432,6 +434,7 @@ func (s *SignalClient) send(number string, message string,
|
||||
} else {
|
||||
request.QuoteMentions = nil
|
||||
}
|
||||
request.EditTimestamp = editTimestamp
|
||||
|
||||
if len(signalCliTextFormatStrings) > 0 {
|
||||
request.TextStyles = signalCliTextFormatStrings
|
||||
@ -500,6 +503,11 @@ func (s *SignalClient) send(number string, message string,
|
||||
cmd = append(cmd, mention.toString())
|
||||
}
|
||||
|
||||
if editTimestamp != nil {
|
||||
cmd = append(cmd, "--edit-timestamp")
|
||||
cmd = append(cmd, strconv.FormatInt(*editTimestamp, 10))
|
||||
}
|
||||
|
||||
rawData, err := s.cliClient.Execute(true, cmd, message)
|
||||
if err != nil {
|
||||
cleanupAttachmentEntries(attachmentEntries)
|
||||
@ -627,7 +635,7 @@ func (s *SignalClient) VerifyRegisteredNumber(number string, token string, pin s
|
||||
}
|
||||
|
||||
func (s *SignalClient) SendV1(number string, message string, recipients []string, base64Attachments []string, isGroup bool) (*SendResponse, error) {
|
||||
timestamp, err := s.send(number, message, recipients, base64Attachments, isGroup, "", nil, nil, nil, nil, nil, nil)
|
||||
timestamp, err := s.send(number, message, recipients, base64Attachments, isGroup, "", nil, nil, nil, nil, nil, nil, nil)
|
||||
return timestamp, err
|
||||
}
|
||||
|
||||
@ -647,7 +655,7 @@ func (s *SignalClient) getJsonRpc2Clients() []*JsonRpc2Client {
|
||||
}
|
||||
|
||||
func (s *SignalClient) SendV2(number string, message string, recps []string, base64Attachments []string, sticker string, mentions []MessageMention,
|
||||
quoteTimestamp *int64, quoteAuthor *string, quoteMessage *string, quoteMentions []MessageMention, textMode *string) (*[]SendResponse, error) {
|
||||
quoteTimestamp *int64, quoteAuthor *string, quoteMessage *string, quoteMentions []MessageMention, textMode *string, editTimestamp *int64) (*[]SendResponse, error) {
|
||||
if len(recps) == 0 {
|
||||
return nil, errors.New("Please provide at least one recipient")
|
||||
}
|
||||
@ -677,7 +685,8 @@ func (s *SignalClient) SendV2(number string, message string, recps []string, bas
|
||||
|
||||
timestamps := []SendResponse{}
|
||||
for _, group := range groups {
|
||||
timestamp, err := s.send(number, message, []string{group}, base64Attachments, true, sticker, mentions, quoteTimestamp, quoteAuthor, quoteMessage, quoteMentions, textMode)
|
||||
timestamp, err := s.send(number, message, []string{group}, base64Attachments, true, sticker,
|
||||
mentions, quoteTimestamp, quoteAuthor, quoteMessage, quoteMentions, textMode, editTimestamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -685,7 +694,8 @@ func (s *SignalClient) SendV2(number string, message string, recps []string, bas
|
||||
}
|
||||
|
||||
if len(recipients) > 0 {
|
||||
timestamp, err := s.send(number, message, recipients, base64Attachments, false, sticker, mentions, quoteTimestamp, quoteAuthor, quoteMessage, quoteMentions, textMode)
|
||||
timestamp, err := s.send(number, message, recipients, base64Attachments, false, sticker, mentions,
|
||||
quoteTimestamp, quoteAuthor, quoteMessage, quoteMentions, textMode, editTimestamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -2040,6 +2040,9 @@ var doc = `{
|
||||
"data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e"
|
||||
]
|
||||
},
|
||||
"edit_timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mentions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@ -2024,6 +2024,9 @@
|
||||
"data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e"
|
||||
]
|
||||
},
|
||||
"edit_timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mentions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@ -138,6 +138,8 @@ definitions:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
edit_timestamp:
|
||||
type: integer
|
||||
mentions:
|
||||
items:
|
||||
$ref: '#/definitions/client.MessageMention'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user