Skip to content

Commit

Permalink
formatting fixups on infobip provider
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmoljanovic committed Nov 23, 2021
1 parent 7d92aae commit 48f50e2
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions provider/infobip/infobip.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ type Infobip struct {
}

type InfobipDestination struct {
To string `json:"to"`
To string `json:"to"`
}

type InfobipMessage struct {
From string `json:"from"`
Destinations []InfobipDestination `json:"destinations"`
Text string `json:"text"`
From string `json:"from"`
Destinations []InfobipDestination `json:"destinations"`
Text string `json:"text"`
}

type InfobipPayload struct {
Messages []InfobipMessage `json:"messages"`
Messages []InfobipMessage `json:"messages"`
}

//NewInfobip creates a new
Expand All @@ -51,19 +51,19 @@ func (c *Infobip) Send(message sachet.Message) (err error) {
var request *http.Request
var resp *http.Response

payload := InfobipPayload{}
payload.Messages = append(payload.Messages, InfobipMessage{})
payload.Messages[0].From = message.From
payload.Messages[0].Text = message.Text

for _, destination := range message.To {
payload.Messages[0].Destinations = append(
payload.Messages[0].Destinations,
InfobipDestination{
To: destination,
},
)
}
payload := InfobipPayload{}
payload.Messages = append(payload.Messages, InfobipMessage{})
payload.Messages[0].From = message.From
payload.Messages[0].Text = message.Text

for _, destination := range message.To {
payload.Messages[0].Destinations = append(
payload.Messages[0].Destinations,
InfobipDestination{
To: destination,
},
)
}

data, err := json.Marshal(payload)
if err != nil {
Expand Down

0 comments on commit 48f50e2

Please sign in to comment.