mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-09-23 06:39:14 +00:00
Compare commits
9 Commits
ac26b319f0
...
3ce75b20e3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ce75b20e3 | ||
|
|
bdaf55a68f | ||
|
|
59f9cd3140 | ||
|
|
eece5f4e92 | ||
|
|
5fcaa2ca2c | ||
|
|
6ec6e198d7 | ||
|
|
379ff16ca6 | ||
|
|
8ea7456812 | ||
|
|
95c14a5f2b |
@ -2408,6 +2408,7 @@ func (a *Api) AddStickerPack(c *gin.Context) {
|
||||
// @Produce json
|
||||
// @Success 200 {object} []client.ListContactsResponse
|
||||
// @Param number path string true "Registered Phone Number"
|
||||
// @Param all_recipients query string false "Include all known recipients, not only contacts." (default: false)"
|
||||
// @Router /v1/contacts/{number} [get]
|
||||
func (a *Api) ListContacts(c *gin.Context) {
|
||||
number, err := url.PathUnescape(c.Param("number"))
|
||||
@ -2421,8 +2422,12 @@ func (a *Api) ListContacts(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
contacts, err := a.signalClient.ListContacts(number)
|
||||
|
||||
allRecipients := c.DefaultQuery("all_recipients", "false")
|
||||
if allRecipients != "true" && allRecipients != "false" {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - all_recipients parameter needs to be either 'true' or 'false'"})
|
||||
return
|
||||
}
|
||||
contacts, err := a.signalClient.ListContacts(number, StringToBool(allRecipients), "")
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
@ -2437,6 +2442,7 @@ func (a *Api) ListContacts(c *gin.Context) {
|
||||
// @Produce json
|
||||
// @Success 200 {object} client.ListContactsResponse
|
||||
// @Param number path string true "Registered Phone Number"
|
||||
// @Param all_recipients query string false "Include all known recipients, not only contacts." (default: false)"
|
||||
// @Router /v1/contacts/{number}/{uuid} [get]
|
||||
func (a *Api) ListContact(c *gin.Context) {
|
||||
number, err := url.PathUnescape(c.Param("number"))
|
||||
@ -2456,7 +2462,13 @@ func (a *Api) ListContact(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
contact, err := a.signalClient.ListContact(number, uuid)
|
||||
allRecipients := c.DefaultQuery("all_recipients", "false")
|
||||
if allRecipients != "true" && allRecipients != "false" {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - all_recipients parameter needs to be either 'true' or 'false'"})
|
||||
return
|
||||
}
|
||||
|
||||
contacts, err := a.signalClient.ListContacts(number, StringToBool(allRecipients), uuid)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *client.NotFoundError:
|
||||
@ -2468,7 +2480,7 @@ func (a *Api) ListContact(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(200, contact)
|
||||
c.JSON(200, contacts[0])
|
||||
}
|
||||
|
||||
// @Summary Returns the avatar of a contact
|
||||
|
||||
211
src/api/graylogapi.go
Normal file
211
src/api/graylogapi.go
Normal file
@ -0,0 +1,211 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strconv"
|
||||
"strings"
|
||||
"fmt"
|
||||
|
||||
_ "runtime/debug"
|
||||
_ "github.com/yassinebenaid/godump"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/bbernhard/signal-cli-rest-api/client"
|
||||
)
|
||||
|
||||
type AlertManagerNotification struct {
|
||||
Receiver string `json:"receiver"`
|
||||
Status string `json:"status"`
|
||||
Alerts []Alert `json:"alerts"`
|
||||
GroupLabels Labels `json:"groupLabels"`
|
||||
CommonLabels Labels `json:"commonLabels"`
|
||||
CommonAnnotations Annotations `json:"commonAnnotations"`
|
||||
ExternalURL string `json:"externalURL"`
|
||||
Version string `json:"version"`
|
||||
GroupKey string `json:"groupKey"`
|
||||
TruncatedAlerts int64 `json:"truncatedAlerts"`
|
||||
OrgID int64 `json:"orgId"`
|
||||
Title string `json:"title"`
|
||||
State string `json:"state"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type Alert struct {
|
||||
Status string `json:"status"`
|
||||
Labels Labels `json:"labels"`
|
||||
Annotations Annotations `json:"annotations"`
|
||||
StartsAt string `json:"startsAt"`
|
||||
EndsAt string `json:"endsAt"`
|
||||
GeneratorURL string `json:"generatorURL"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
SilenceURL string `json:"silenceURL"`
|
||||
DashboardURL string `json:"dashboardURL"`
|
||||
PanelURL string `json:"panelURL"`
|
||||
Values interface{} `json:"values"`
|
||||
ValueString string `json:"valueString"`
|
||||
}
|
||||
|
||||
type Annotations struct {
|
||||
Summary string `json:"summary"`
|
||||
}
|
||||
|
||||
type Labels struct {
|
||||
Alertname string `json:"alertname"`
|
||||
Instance string `json:"instance"`
|
||||
}
|
||||
|
||||
type GrafanaMessage struct {
|
||||
Number string `json:"number"`
|
||||
Recipients string `json:"recipients"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type GraylogNotification struct {
|
||||
EventDefinitionID string `json:"event_definition_id"`
|
||||
EventDefinitionType string `json:"event_definition_type"`
|
||||
EventDefinitionTitle string `json:"event_definition_title"`
|
||||
EventDefinitionDescription string `json:"event_definition_description"`
|
||||
JobDefinitionID string `json:"job_definition_id"`
|
||||
JobTriggerID string `json:"job_trigger_id"`
|
||||
Event GraylogEvent `json:"event"`
|
||||
Backlog []interface{} `json:"backlog"`
|
||||
}
|
||||
|
||||
type GraylogEvent struct {
|
||||
ID string `json:"id"`
|
||||
EventDefinitionType string `json:"event_definition_type"`
|
||||
EventDefinitionID string `json:"event_definition_id"`
|
||||
OriginContext string `json:"origin_context"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
TimestampProcessing string `json:"timestamp_processing"`
|
||||
TimerangeStart interface{} `json:"timerange_start"`
|
||||
TimerangeEnd interface{} `json:"timerange_end"`
|
||||
Streams []string `json:"streams"`
|
||||
SourceStreams []interface{} `json:"source_streams"`
|
||||
Message string `json:"message"`
|
||||
Source string `json:"source"`
|
||||
KeyTuple []string `json:"key_tuple"`
|
||||
Key string `json:"key"`
|
||||
Priority int64 `json:"priority"`
|
||||
Alert bool `json:"alert"`
|
||||
Fields Fields `json:"fields"`
|
||||
}
|
||||
|
||||
type Fields struct {
|
||||
Recipients string `json:"recipients"`
|
||||
FromNumber string `json:"fromnumber"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// @Summary Send a signal message.
|
||||
// @Tags Messages
|
||||
// @Description Send a signal message. Set the text_mode to 'styled' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 201 {object} SendMessageResponse
|
||||
// @Failure 400 {object} SendMessageError
|
||||
// @Param data body SendMessageV2 true "Input Data"
|
||||
// @Router /v2/send [post]
|
||||
func (a *Api) SendAlertManagerV2(c *gin.Context) {
|
||||
var req AlertManagerNotification
|
||||
var msg GrafanaMessage
|
||||
base64Attachments := []string{}
|
||||
|
||||
err := c.BindJSON(&req)
|
||||
if err != nil {
|
||||
c.JSON(400, gin.H{"error": "Couldn't process request - invalid request"})
|
||||
log.Error(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
//fmt.Printf(">>>%s\n",[]byte(req.Message))
|
||||
|
||||
// Unmarshal or Decode the JSON to the interface.
|
||||
json.Unmarshal([]byte(req.Message), &msg)
|
||||
|
||||
// timestamp, err := a.signalClient.SendV1(msg.Number, msg.Message, msg.Recipients, base64Attachments, msg.IsGroup)
|
||||
// if err != nil {
|
||||
// c.JSON(400, Error{Msg: err.Error()})
|
||||
// return
|
||||
// }
|
||||
// c.JSON(201, SendMessageResponse{Timestamp: strconv.FormatInt(timestamp.Timestamp, 10)})
|
||||
|
||||
data, err := a.signalClient.SendV2(msg.Number, msg.Message, strings.Split(msg.Recipients,","), base64Attachments, "", nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *client.RateLimitErrorType:
|
||||
if rateLimitError, ok := err.(*client.RateLimitErrorType); ok {
|
||||
extendedError := errors.New(err.Error() + ". Use the attached challenge tokens to lift the rate limit restrictions via the '/v1/accounts/{number}/rate-limit-challenge' endpoint.")
|
||||
c.JSON(429, SendMessageError{Msg: extendedError.Error(), ChallengeTokens: rateLimitError.ChallengeTokens, Account: msg.Number})
|
||||
return
|
||||
} else {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
default:
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(201, SendMessageResponse{Timestamp: strconv.FormatInt((*data)[0].Timestamp, 10)})
|
||||
|
||||
}
|
||||
|
||||
// @Summary Send a signal message.
|
||||
// @Tags Messages
|
||||
// @Description Send a signal message. Set the text_mode to 'styled' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 201 {object} SendMessageResponse
|
||||
// @Failure 400 {object} SendMessageError
|
||||
// @Param data body SendMessageV2 true "Input Data"
|
||||
// @Router /v2/send [post]
|
||||
func (a *Api) SendGraylogNotificationV2(c *gin.Context) {
|
||||
var req GraylogNotification
|
||||
base64Attachments := []string{}
|
||||
// jsonData,err2 := io.ReadAll(c.Request.Body)
|
||||
//if err2 != nil {
|
||||
// log.Error(err2.Error())
|
||||
//}
|
||||
//fmt.Printf("<<<%s\n",jsonData)
|
||||
|
||||
err := c.BindJSON(&req)
|
||||
if err != nil {
|
||||
c.JSON(400, gin.H{"error": "Couldn't process request - invalid requestttttt"})
|
||||
log.Error(err.Error())
|
||||
fmt.Printf("<<<%s\n",c.Request.Body)
|
||||
return
|
||||
}
|
||||
|
||||
data, err := a.signalClient.SendV2(req.Event.Fields.FromNumber, req.Event.Fields.Message, strings.Split(req.Event.Fields.Recipients,","), base64Attachments, "", nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *client.RateLimitErrorType:
|
||||
if rateLimitError, ok := err.(*client.RateLimitErrorType); ok {
|
||||
extendedError := errors.New(err.Error() + ". Use the attached challenge tokens to lift the rate limit restrictions via the '/v1/accounts/{number}/rate-limit-challenge' endpoint.")
|
||||
c.JSON(429, SendMessageError{Msg: extendedError.Error(), ChallengeTokens: rateLimitError.ChallengeTokens, Account: req.Event.Fields.FromNumber})
|
||||
return
|
||||
} else {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
default:
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(201, SendMessageResponse{Timestamp: strconv.FormatInt((*data)[0].Timestamp, 10)})
|
||||
}
|
||||
|
||||
|
||||
@ -2602,7 +2602,7 @@ func (s *SignalClient) AddStickerPack(number string, packId string, packKey stri
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, error) {
|
||||
func (s *SignalClient) ListContacts(number string, allRecipients bool, recipient string) ([]ListContactsResponse, error) {
|
||||
type SignalCliProfileResponse struct {
|
||||
LastUpdateTimestamp int64 `json:"lastUpdateTimestamp"`
|
||||
GivenName string `json:"givenName"`
|
||||
@ -2611,7 +2611,7 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
|
||||
HasAvatar bool `json:"hasAvatar"`
|
||||
}
|
||||
|
||||
type ListContactsSignlCliResponse struct {
|
||||
type ListContactsSignalCliResponse struct {
|
||||
Number string `json:"number"`
|
||||
Uuid string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
@ -2634,29 +2634,51 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
|
||||
var rawData string
|
||||
|
||||
if s.signalCliMode == JsonRpc {
|
||||
type Request struct {
|
||||
AllRecipients bool `json:"allRecipients,omitempty"`
|
||||
Recipient string `json:"recipient,omitempty"`
|
||||
}
|
||||
req := Request{}
|
||||
if allRecipients {
|
||||
req.AllRecipients = allRecipients
|
||||
}
|
||||
if recipient != "" {
|
||||
req.Recipient = recipient
|
||||
}
|
||||
|
||||
jsonRpc2Client, err := s.getJsonRpc2Client()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rawData, err = jsonRpc2Client.getRaw("listContacts", &number, nil)
|
||||
rawData, err = jsonRpc2Client.getRaw("listContacts", &number, req)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
} else {
|
||||
cmd := []string{"--config", s.signalCliConfig, "-o", "json", "-a", number, "listContacts"}
|
||||
if allRecipients {
|
||||
cmd = append(cmd, "--all-recipients")
|
||||
}
|
||||
if recipient != "" {
|
||||
cmd = append(cmd, recipient)
|
||||
}
|
||||
rawData, err = s.cliClient.Execute(true, cmd, "")
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
}
|
||||
|
||||
var signalCliResp []ListContactsSignlCliResponse
|
||||
var signalCliResp []ListContactsSignalCliResponse
|
||||
err = json.Unmarshal([]byte(rawData), &signalCliResp)
|
||||
if err != nil {
|
||||
log.Error("Couldn't list contacts", err.Error())
|
||||
return resp, errors.New("Couldn't process request - invalid signal-cli response")
|
||||
}
|
||||
|
||||
if recipient != "" && len(signalCliResp) == 0 {
|
||||
return resp, &NotFoundError{Description: "No user with that id (" + recipient + ") found"}
|
||||
}
|
||||
|
||||
for _, value := range signalCliResp {
|
||||
entry := ListContactsResponse{
|
||||
Number: value.Number,
|
||||
@ -2684,20 +2706,6 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *SignalClient) ListContact(number string, uuid string) (ListContactsResponse, error) {
|
||||
contacts, err := s.ListContacts(number)
|
||||
if err != nil {
|
||||
return ListContactsResponse{}, err
|
||||
}
|
||||
|
||||
for _, contact := range contacts {
|
||||
if contact.Uuid == uuid {
|
||||
return contact, nil
|
||||
}
|
||||
}
|
||||
|
||||
return ListContactsResponse{}, &NotFoundError{Description: "No contact with that id (" + uuid + ") found"}
|
||||
}
|
||||
|
||||
func (s *SignalClient) SetPin(number string, registrationLockPin string) error {
|
||||
if s.signalCliMode == JsonRpc {
|
||||
|
||||
@ -573,6 +573,12 @@ const docTemplate = `{
|
||||
"name": "number",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Include all known recipients, not only contacts.",
|
||||
"name": "all_recipients",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -682,6 +688,12 @@ const docTemplate = `{
|
||||
"name": "number",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Include all known recipients, not only contacts.",
|
||||
"name": "all_recipients",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -2653,7 +2665,7 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/api.GroupPermissions"
|
||||
"$ref": "#/definitions/data.GroupPermissions"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2727,32 +2739,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.GroupPermissions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"add_members": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"edit_group": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"send_messages": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.LoggingConfiguration": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -3085,7 +3071,7 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/api.GroupPermissions"
|
||||
"$ref": "#/definitions/data.GroupPermissions"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3230,6 +3216,9 @@ const docTemplate = `{
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/data.GroupPermissions"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3359,6 +3348,32 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"data.GroupPermissions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"add_members": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"edit_group": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"send_messages": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"data.LinkPreviewType": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -570,6 +570,12 @@
|
||||
"name": "number",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Include all known recipients, not only contacts.",
|
||||
"name": "all_recipients",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -679,6 +685,12 @@
|
||||
"name": "number",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Include all known recipients, not only contacts.",
|
||||
"name": "all_recipients",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -2650,7 +2662,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/api.GroupPermissions"
|
||||
"$ref": "#/definitions/data.GroupPermissions"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2724,32 +2736,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.GroupPermissions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"add_members": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"edit_group": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"send_messages": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.LoggingConfiguration": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -3082,7 +3068,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/api.GroupPermissions"
|
||||
"$ref": "#/definitions/data.GroupPermissions"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3227,6 +3213,9 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/data.GroupPermissions"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3356,6 +3345,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"data.GroupPermissions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"add_members": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"edit_group": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
},
|
||||
"send_messages": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"only-admins",
|
||||
"every-member"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"data.LinkPreviewType": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -61,7 +61,7 @@ definitions:
|
||||
name:
|
||||
type: string
|
||||
permissions:
|
||||
$ref: '#/definitions/api.GroupPermissions'
|
||||
$ref: '#/definitions/data.GroupPermissions'
|
||||
type: object
|
||||
api.CreateGroupResponse:
|
||||
properties:
|
||||
@ -110,24 +110,6 @@ definitions:
|
||||
error:
|
||||
type: string
|
||||
type: object
|
||||
api.GroupPermissions:
|
||||
properties:
|
||||
add_members:
|
||||
enum:
|
||||
- only-admins
|
||||
- every-member
|
||||
type: string
|
||||
edit_group:
|
||||
enum:
|
||||
- only-admins
|
||||
- every-member
|
||||
type: string
|
||||
send_messages:
|
||||
enum:
|
||||
- only-admins
|
||||
- every-member
|
||||
type: string
|
||||
type: object
|
||||
api.LoggingConfiguration:
|
||||
properties:
|
||||
Level:
|
||||
@ -349,7 +331,7 @@ definitions:
|
||||
name:
|
||||
type: string
|
||||
permissions:
|
||||
$ref: '#/definitions/api.GroupPermissions'
|
||||
$ref: '#/definitions/data.GroupPermissions'
|
||||
type: object
|
||||
api.UpdateProfileRequest:
|
||||
properties:
|
||||
@ -445,6 +427,8 @@ definitions:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
permissions:
|
||||
$ref: '#/definitions/data.GroupPermissions'
|
||||
type: object
|
||||
client.IdentityEntry:
|
||||
properties:
|
||||
@ -528,6 +512,24 @@ definitions:
|
||||
username_link:
|
||||
type: string
|
||||
type: object
|
||||
data.GroupPermissions:
|
||||
properties:
|
||||
add_members:
|
||||
enum:
|
||||
- only-admins
|
||||
- every-member
|
||||
type: string
|
||||
edit_group:
|
||||
enum:
|
||||
- only-admins
|
||||
- every-member
|
||||
type: string
|
||||
send_messages:
|
||||
enum:
|
||||
- only-admins
|
||||
- every-member
|
||||
type: string
|
||||
type: object
|
||||
data.LinkPreviewType:
|
||||
properties:
|
||||
base64_thumbnail:
|
||||
@ -928,6 +930,10 @@ paths:
|
||||
name: number
|
||||
required: true
|
||||
type: string
|
||||
- description: Include all known recipients, not only contacts.
|
||||
in: query
|
||||
name: all_recipients
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -978,6 +984,10 @@ paths:
|
||||
name: number
|
||||
required: true
|
||||
type: string
|
||||
- description: Include all known recipients, not only contacts.
|
||||
in: query
|
||||
name: all_recipients
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
||||
@ -366,6 +366,14 @@ func main() {
|
||||
{
|
||||
sendV2.POST("", api.SendV2)
|
||||
}
|
||||
sendalertmanagerV2 := v2.Group("/sendalertmanager")
|
||||
{
|
||||
sendalertmanagerV2.POST("", api.SendAlertManagerV2)
|
||||
}
|
||||
sendgraylognotificationV2 := v2.Group("/sendgraylognotification")
|
||||
{
|
||||
sendgraylognotificationV2.POST("", api.SendGraylogNotificationV2)
|
||||
}
|
||||
}
|
||||
|
||||
protocol := "http"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user