-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.go
52 lines (45 loc) · 968 Bytes
/
response.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
package qcloudsms
type QStatus struct {
Result int `json:"result"`
ErrMsg string `json:"errmsg"`
Mobile string `json:"mobile"`
NationCode string `json:"nationcode"`
Sid string `json:"sid"`
Fee int `json:"fee"`
}
// QResponse to retrieve QCloud API Response.
type QResponse struct {
Result int `json:"result"`
ErrMsg string `json:"errmsg"`
Sid string `json:"sid"`
Fee int `json:"fee"`
Ext string `json:"ext"`
Detail []QStatus `json:"detail"`
Data interface{} `json:"data"`
}
func (qr *QResponse) Error() int {
return qr.Result
}
func (qr *QResponse) Desc() string {
return qr.ErrMsg
}
func (qr *QResponse) Status() (status []QSMSStatus) {
if qr.Data == nil {
return
}
status, ok := qr.Data.([]QSMSStatus)
if !ok {
return
}
return
}
func (qr *QResponse) Reply() (status []QSMSReply) {
if qr.Data == nil {
return
}
status, ok := qr.Data.([]QSMSReply)
if !ok {
return
}
return
}