mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 23:54:22 +01:00
beautified code with gofmt
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/bbernhard/signal-cli-rest-api/client"
|
||||
utils "github.com/bbernhard/signal-cli-rest-api/utils"
|
||||
ds "github.com/bbernhard/signal-cli-rest-api/datastructs"
|
||||
utils "github.com/bbernhard/signal-cli-rest-api/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -107,19 +107,19 @@ type SendMessageV1 struct {
|
||||
}
|
||||
|
||||
type SendMessageV2 struct {
|
||||
Number string `json:"number"`
|
||||
Recipients []string `json:"recipients"`
|
||||
Recipient string `json:"recipient" swaggerignore:"true"` //some REST API consumers (like the Synology NAS) do not support an array as recipients, so we provide this string parameter here as backup. In order to not confuse anyone, the parameter won't be exposed in the Swagger UI (most users are fine with the recipients parameter).
|
||||
Message string `json:"message"`
|
||||
Base64Attachments []string `json:"base64_attachments" example:"<BASE64 ENCODED DATA>,data:<MIME-TYPE>;base64<comma><BASE64 ENCODED DATA>,data:<MIME-TYPE>;filename=<FILENAME>;base64<comma><BASE64 ENCODED DATA>"`
|
||||
Sticker string `json:"sticker"`
|
||||
Mentions []ds.MessageMention `json:"mentions"`
|
||||
QuoteTimestamp *int64 `json:"quote_timestamp"`
|
||||
QuoteAuthor *string `json:"quote_author"`
|
||||
QuoteMessage *string `json:"quote_message"`
|
||||
QuoteMentions []ds.MessageMention `json:"quote_mentions"`
|
||||
TextMode *string `json:"text_mode" enums:"normal,styled"`
|
||||
EditTimestamp *int64 `json:"edit_timestamp"`
|
||||
Number string `json:"number"`
|
||||
Recipients []string `json:"recipients"`
|
||||
Recipient string `json:"recipient" swaggerignore:"true"` //some REST API consumers (like the Synology NAS) do not support an array as recipients, so we provide this string parameter here as backup. In order to not confuse anyone, the parameter won't be exposed in the Swagger UI (most users are fine with the recipients parameter).
|
||||
Message string `json:"message"`
|
||||
Base64Attachments []string `json:"base64_attachments" example:"<BASE64 ENCODED DATA>,data:<MIME-TYPE>;base64<comma><BASE64 ENCODED DATA>,data:<MIME-TYPE>;filename=<FILENAME>;base64<comma><BASE64 ENCODED DATA>"`
|
||||
Sticker string `json:"sticker"`
|
||||
Mentions []ds.MessageMention `json:"mentions"`
|
||||
QuoteTimestamp *int64 `json:"quote_timestamp"`
|
||||
QuoteAuthor *string `json:"quote_author"`
|
||||
QuoteMessage *string `json:"quote_message"`
|
||||
QuoteMentions []ds.MessageMention `json:"quote_mentions"`
|
||||
TextMode *string `json:"text_mode" enums:"normal,styled"`
|
||||
EditTimestamp *int64 `json:"edit_timestamp"`
|
||||
}
|
||||
|
||||
type TypingIndicatorRequest struct {
|
||||
@@ -131,7 +131,7 @@ type Error struct {
|
||||
}
|
||||
|
||||
type SendMessageError struct {
|
||||
Msg string `json:"error"`
|
||||
Msg string `json:"error"`
|
||||
ChallengeTokens []string `json:"challenge_tokens,omitempty"`
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ type TrustIdentityRequest struct {
|
||||
}
|
||||
|
||||
type SendMessageResponse struct {
|
||||
Timestamp string `json:"timestamp"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
}
|
||||
|
||||
type TrustModeRequest struct {
|
||||
@@ -178,7 +178,7 @@ type AddDeviceRequest struct {
|
||||
|
||||
type RateLimitChallengeRequest struct {
|
||||
ChallengeToken string `json:"challenge_token" example:"<challenge token>"`
|
||||
Captcha string `json:"captcha" example:"signalcaptcha://{captcha value}"`
|
||||
Captcha string `json:"captcha" example:"signalcaptcha://{captcha value}"`
|
||||
}
|
||||
|
||||
type UpdateAccountSettingsRequest struct {
|
||||
@@ -191,7 +191,7 @@ type SetUsernameRequest struct {
|
||||
}
|
||||
|
||||
type AddStickerPackRequest struct {
|
||||
PackId string `json:"pack_id" example:"9a32eda01a7a28574f2eb48668ae0dc4"`
|
||||
PackId string `json:"pack_id" example:"9a32eda01a7a28574f2eb48668ae0dc4"`
|
||||
PackKey string `json:"pack_key" example:"19546e18eba0ff69dea78eb591465289d39e16f35e58389ae779d4f9455aff3a"`
|
||||
}
|
||||
|
||||
@@ -1479,7 +1479,6 @@ func (a *Api) RemoveReaction(c *gin.Context) {
|
||||
c.Status(http.StatusNoContent)
|
||||
}
|
||||
|
||||
|
||||
// @Summary Send a receipt.
|
||||
// @Tags Receipts
|
||||
// @Description Send a read or viewed receipt
|
||||
@@ -1962,7 +1961,6 @@ func (a *Api) AddStickerPack(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
err = a.signalClient.AddStickerPack(number, req.PackId, req.PackKey)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
|
||||
@@ -186,13 +186,13 @@ type ListInstalledStickerPacksResponse struct {
|
||||
}
|
||||
|
||||
type ListContactsResponse struct {
|
||||
Number string `json:"number"`
|
||||
Uuid string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
ProfileName string `json:"profile_name"`
|
||||
Username string `json:"username"`
|
||||
Color string `json:"color"`
|
||||
Blocked bool `json:"blocked"`
|
||||
Number string `json:"number"`
|
||||
Uuid string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
ProfileName string `json:"profile_name"`
|
||||
Username string `json:"username"`
|
||||
Color string `json:"color"`
|
||||
Blocked bool `json:"blocked"`
|
||||
MessageExpiration string `json:"message_expiration"`
|
||||
}
|
||||
|
||||
@@ -2126,13 +2126,13 @@ func (s *SignalClient) AddStickerPack(number string, packId string, packKey stri
|
||||
|
||||
func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, error) {
|
||||
type ListContactsSignlCliResponse struct {
|
||||
Number string `json:"number"`
|
||||
Uuid string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
ProfileName string `json:"profileName"`
|
||||
Username string `json:"username"`
|
||||
Color string `json:"color"`
|
||||
Blocked bool `json:"blocked"`
|
||||
Number string `json:"number"`
|
||||
Uuid string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
ProfileName string `json:"profileName"`
|
||||
Username string `json:"username"`
|
||||
Color string `json:"color"`
|
||||
Blocked bool `json:"blocked"`
|
||||
MessageExpiration string `json:"messageExpiration"`
|
||||
}
|
||||
|
||||
@@ -2166,13 +2166,13 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
|
||||
|
||||
for _, value := range signalCliResp {
|
||||
resp = append(resp, ListContactsResponse{
|
||||
Number: value.Number,
|
||||
Uuid: value.Uuid,
|
||||
Name: value.Name,
|
||||
ProfileName: value.ProfileName,
|
||||
Username: value.Username,
|
||||
Color: value.Color,
|
||||
Blocked: value.Blocked,
|
||||
Number: value.Number,
|
||||
Uuid: value.Uuid,
|
||||
Name: value.Name,
|
||||
ProfileName: value.ProfileName,
|
||||
Username: value.Username,
|
||||
Color: value.Color,
|
||||
Blocked: value.Blocked,
|
||||
MessageExpiration: value.MessageExpiration,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user