mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-23 01:24:25 +01:00
activate endpoint and write swagger documentation
This commit is contained in:
17
src/main.go
17
src/main.go
@@ -46,6 +46,9 @@ import (
|
||||
// @tag.name Identities
|
||||
// @tag.description List and Trust Identities.
|
||||
|
||||
// @tag.name Reaction
|
||||
// @tag.description React to messages.
|
||||
|
||||
// @host 127.0.0.1:8080
|
||||
// @BasePath /
|
||||
func main() {
|
||||
@@ -114,7 +117,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jsonRpc2ClientConfigPathPath := *signalCliConfig + "/jsonrpc2.yml"
|
||||
signalClient := client.NewSignalClient(*signalCliConfig, *attachmentTmpDir, *avatarTmpDir, signalCliMode, jsonRpc2ClientConfigPathPath)
|
||||
err = signalClient.Init()
|
||||
@@ -196,6 +198,12 @@ func main() {
|
||||
typingIndicator.PUT(":number", api.SendStartTyping)
|
||||
typingIndicator.DELETE(":number", api.SendStopTyping)
|
||||
}
|
||||
|
||||
reaction := v1.Group("/reaction")
|
||||
{
|
||||
reaction.POST(":number", api.SendReaction)
|
||||
reaction.DELETE(":number", api.RemoveReaction)
|
||||
}
|
||||
}
|
||||
|
||||
v2 := router.Group("/v2")
|
||||
@@ -228,7 +236,7 @@ func main() {
|
||||
filename := filepath.Base(path)
|
||||
if strings.HasPrefix(filename, "+") && info.Mode().IsRegular() {
|
||||
log.Debug("AUTO_RECEIVE_SCHEDULE: Calling receive for number ", filename)
|
||||
resp, err := http.Get("http://127.0.0.1:" + port + "/v1/receive/"+filename)
|
||||
resp, err := http.Get("http://127.0.0.1:" + port + "/v1/receive/" + filename)
|
||||
if err != nil {
|
||||
log.Error("AUTO_RECEIVE_SCHEDULE: Couldn't call receive for number ", filename, ": ", err.Error())
|
||||
}
|
||||
@@ -241,7 +249,7 @@ func main() {
|
||||
}
|
||||
|
||||
type ReceiveResponse struct {
|
||||
Error string `json:"error"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
var receiveResponse ReceiveResponse
|
||||
err = json.Unmarshal(jsonResp, &receiveResponse)
|
||||
@@ -264,8 +272,5 @@ func main() {
|
||||
c.Start()
|
||||
}
|
||||
|
||||
|
||||
router.Run()
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user