-
Notifications
You must be signed in to change notification settings - Fork 0
/
request_report.go
40 lines (33 loc) · 919 Bytes
/
request_report.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
package jpushclient
import "encoding/json"
type ReportStatusRequest struct {
MsgId int `json:"msg_id"`
RegistrationIds []string `json:"registration_ids"`
Date string `json:"date,omitempty"`
}
func (report *ReportStatusRequest) SetMsgId(id int) *ReportStatusRequest {
report.MsgId = id
return report
}
func (report *ReportStatusRequest) SetRegistrationIds(ids []string) *ReportStatusRequest {
report.RegistrationIds = ids
return report
}
func (report *ReportStatusRequest) SetDate(d string) *ReportStatusRequest {
report.Date = d
return report
}
func (report *ReportStatusRequest) ToJson() (string, error) {
content, err := json.Marshal(report)
if err != nil {
return "", err
}
return string(content), nil
}
func (report *ReportStatusRequest) ToBytes() ([]byte, error) {
content, err := json.Marshal(report)
if err != nil {
return nil, err
}
return content, nil
}