model.go
1.8 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package push
type Options struct {
AppId string
AppKey string
AppSecret string
AppMasterSecret string
ClientId string
ClientIds []string
MsgType int //消息类型
PushType int //推送类型
Title string
Content string
Extra interface{} //扩展数据
TransmissionContent string //透传内容
DebugModule bool
}
type Option func(o *Options)
//个推appId
func AppId(id string) Option {
return func(o *Options) {
o.AppId = id
}
}
//个推appKey
func AppKey(key string) Option {
return func(o *Options) {
o.AppKey = key
}
}
//个推appSecret
func AppSecret(secret string) Option {
return func(o *Options) {
o.AppSecret = secret
}
}
//个推appMasterSecret
func AppMasterSecret(secret string) Option {
return func(o *Options) {
o.AppMasterSecret = secret
}
}
//个推 app clientId
func ClientId(clientId string) Option {
return func(o *Options) {
o.ClientId = clientId
}
}
func ClientIds(clientId []string) Option {
return func(o *Options) {
o.ClientIds = clientId
}
}
//消息类型
func MsgType(msgType int) Option {
return func(o *Options) {
o.MsgType = msgType
}
}
//推送类型
func PushType(pushType int) Option {
return func(o *Options) {
o.PushType = pushType
}
}
//消息内容
func Title(title string) Option {
return func(o *Options) {
o.Title = title
}
}
func Content(content string) Option {
return func(o *Options) {
o.Content = content
}
}
func Extra(extra interface{}) Option {
return func(o *Options) {
o.Extra = extra
}
}
func TransmissionContent(content string) Option {
return func(o *Options) {
o.TransmissionContent = content
}
}
func DebugModule(module bool) Option {
return func(o *Options) {
o.DebugModule = module
}
}
const (
Message = iota + 1
Notification
)