beautified code with gofmt

This commit is contained in:
Bernhard B
2024-06-18 19:49:47 +02:00
parent e7ebd010a3
commit 8929326f5f
2 changed files with 39 additions and 41 deletions

View File

@@ -15,8 +15,8 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/bbernhard/signal-cli-rest-api/client" "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" ds "github.com/bbernhard/signal-cli-rest-api/datastructs"
utils "github.com/bbernhard/signal-cli-rest-api/utils"
) )
const ( const (
@@ -107,19 +107,19 @@ type SendMessageV1 struct {
} }
type SendMessageV2 struct { type SendMessageV2 struct {
Number string `json:"number"` Number string `json:"number"`
Recipients []string `json:"recipients"` 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). 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"` 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>"` 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"` Sticker string `json:"sticker"`
Mentions []ds.MessageMention `json:"mentions"` Mentions []ds.MessageMention `json:"mentions"`
QuoteTimestamp *int64 `json:"quote_timestamp"` QuoteTimestamp *int64 `json:"quote_timestamp"`
QuoteAuthor *string `json:"quote_author"` QuoteAuthor *string `json:"quote_author"`
QuoteMessage *string `json:"quote_message"` QuoteMessage *string `json:"quote_message"`
QuoteMentions []ds.MessageMention `json:"quote_mentions"` QuoteMentions []ds.MessageMention `json:"quote_mentions"`
TextMode *string `json:"text_mode" enums:"normal,styled"` TextMode *string `json:"text_mode" enums:"normal,styled"`
EditTimestamp *int64 `json:"edit_timestamp"` EditTimestamp *int64 `json:"edit_timestamp"`
} }
type TypingIndicatorRequest struct { type TypingIndicatorRequest struct {
@@ -131,7 +131,7 @@ type Error struct {
} }
type SendMessageError struct { type SendMessageError struct {
Msg string `json:"error"` Msg string `json:"error"`
ChallengeTokens []string `json:"challenge_tokens,omitempty"` ChallengeTokens []string `json:"challenge_tokens,omitempty"`
} }
@@ -150,7 +150,7 @@ type TrustIdentityRequest struct {
} }
type SendMessageResponse struct { type SendMessageResponse struct {
Timestamp string `json:"timestamp"` Timestamp string `json:"timestamp"`
} }
type TrustModeRequest struct { type TrustModeRequest struct {
@@ -178,7 +178,7 @@ type AddDeviceRequest struct {
type RateLimitChallengeRequest struct { type RateLimitChallengeRequest struct {
ChallengeToken string `json:"challenge_token" example:"<challenge token>"` 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 { type UpdateAccountSettingsRequest struct {
@@ -191,7 +191,7 @@ type SetUsernameRequest struct {
} }
type AddStickerPackRequest 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"` PackKey string `json:"pack_key" example:"19546e18eba0ff69dea78eb591465289d39e16f35e58389ae779d4f9455aff3a"`
} }
@@ -1479,7 +1479,6 @@ func (a *Api) RemoveReaction(c *gin.Context) {
c.Status(http.StatusNoContent) c.Status(http.StatusNoContent)
} }
// @Summary Send a receipt. // @Summary Send a receipt.
// @Tags Receipts // @Tags Receipts
// @Description Send a read or viewed receipt // @Description Send a read or viewed receipt
@@ -1962,7 +1961,6 @@ func (a *Api) AddStickerPack(c *gin.Context) {
return return
} }
err = a.signalClient.AddStickerPack(number, req.PackId, req.PackKey) err = a.signalClient.AddStickerPack(number, req.PackId, req.PackKey)
if err != nil { if err != nil {
c.JSON(400, Error{Msg: err.Error()}) c.JSON(400, Error{Msg: err.Error()})

View File

@@ -186,13 +186,13 @@ type ListInstalledStickerPacksResponse struct {
} }
type ListContactsResponse struct { type ListContactsResponse struct {
Number string `json:"number"` Number string `json:"number"`
Uuid string `json:"uuid"` Uuid string `json:"uuid"`
Name string `json:"name"` Name string `json:"name"`
ProfileName string `json:"profile_name"` ProfileName string `json:"profile_name"`
Username string `json:"username"` Username string `json:"username"`
Color string `json:"color"` Color string `json:"color"`
Blocked bool `json:"blocked"` Blocked bool `json:"blocked"`
MessageExpiration string `json:"message_expiration"` 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) { func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, error) {
type ListContactsSignlCliResponse struct { type ListContactsSignlCliResponse struct {
Number string `json:"number"` Number string `json:"number"`
Uuid string `json:"uuid"` Uuid string `json:"uuid"`
Name string `json:"name"` Name string `json:"name"`
ProfileName string `json:"profileName"` ProfileName string `json:"profileName"`
Username string `json:"username"` Username string `json:"username"`
Color string `json:"color"` Color string `json:"color"`
Blocked bool `json:"blocked"` Blocked bool `json:"blocked"`
MessageExpiration string `json:"messageExpiration"` MessageExpiration string `json:"messageExpiration"`
} }
@@ -2166,13 +2166,13 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
for _, value := range signalCliResp { for _, value := range signalCliResp {
resp = append(resp, ListContactsResponse{ resp = append(resp, ListContactsResponse{
Number: value.Number, Number: value.Number,
Uuid: value.Uuid, Uuid: value.Uuid,
Name: value.Name, Name: value.Name,
ProfileName: value.ProfileName, ProfileName: value.ProfileName,
Username: value.Username, Username: value.Username,
Color: value.Color, Color: value.Color,
Blocked: value.Blocked, Blocked: value.Blocked,
MessageExpiration: value.MessageExpiration, MessageExpiration: value.MessageExpiration,
}) })
} }