-
Notifications
You must be signed in to change notification settings - Fork 0
/
delivery_reports.go
66 lines (58 loc) · 1.95 KB
/
delivery_reports.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package infobip
import (
"github.com/shopspring/decimal"
)
// Amount is a thin wrapper around decimal to support json unmarshal.
type Amount struct {
decimal.Decimal
}
// UnmarshalJSON is an implementation of Unmarshaler interface for the Amount type.
func (a *Amount) UnmarshalJSON(data []byte) error {
v, err := decimal.NewFromString(string(data))
if err != nil {
return err
}
a.Decimal = v
return nil
}
// SentSmsStatus indicates whether the message is successfully sent,
// not sent, delivered, not delivered, waiting for delivery or any other possible status.
type SentSmsStatus struct {
GroupID int `json:"groupId"`
GroupName string `json:"groupName"`
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Action string `json:"action"`
}
// SentSmsPrice is a Sent SMS price info: amount and currency.
type SentSmsPrice struct {
PricePerMessage Amount `json:"pricePerMessage"`
Currency string `json:"currency"`
}
// SentSmsError indicates whether the error occurred during the query execution.
type SentSmsError struct {
GroupID int `json:"groupId"`
GroupName string `json:"groupName"`
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Permanent bool `json:"permanent"`
}
// SentSmsReport is a message-specific delivery report.
type SentSmsReport struct {
BulkID string `json:"bulkId"`
To string `json:"to"`
SentAt string `json:"sentAt"`
DoneAt string `json:"doneAt"`
Status SentSmsStatus `json:"status"`
SmsCount int `json:"smsCount"`
MessageID string `json:"messageId"`
MccMnc string `json:"mccMnc"`
Price SentSmsPrice `json:"price"`
Error SentSmsError `json:"error"`
}
// SmsReportResponse contains a collection of reports, one per every message.
type SmsReportResponse struct {
Results []SentSmsReport `json:"results"`
}