-
Notifications
You must be signed in to change notification settings - Fork 5
/
pushtarget.go
73 lines (60 loc) · 1.65 KB
/
pushtarget.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
67
68
69
70
71
72
73
package mob_push_sdk
type TargetType int
const (
TARGET_ALL TargetType = 1
TARGET_ALIAS TargetType = 2
TARGET_TAGS TargetType = 3
TARGET_RIDS TargetType = 4
TARGET_AREAS TargetType = 9
)
type PushTarget struct {
Target int `json:"target"`
Tags []string `json:"tags"`
TagsType string `json:"tagsType"`
Alias []string `json:"alias"`
Rids []string `json:"rids"`
Block string `json:"block"`
City string `json:"city"`
Country string `json:"country"`
Province string `json:"province"`
SmartLabels []PushLabel `json:"smartLabels"`
PushAreas *PushAreas `json:"pushAreas,omitempty"`
}
type PushLabel struct {
LabelIds []string `json:"labelIds"`
MobId string `json:"mobId"`
Type int `json:"type"`
}
type PushAreas struct {
Countries []PushCountry `json:"countries"`
}
type PushCountry struct {
Country string `json:"country"`
Provinces []PushProvince `json:"provinces"`
ExcludeProvinces []string `json:"excludeProvinces"`
}
type PushProvince struct {
Province string `json:"province"`
Cities []string `json:"cities"`
ExcludeCities []string `json:"excludeCities"`
}
func (p *Push) setTarget(targetType TargetType) *Push {
p.PushTarget.Target = int(targetType)
return p
}
func (p *Push) setAlias(alias []string) *Push {
p.PushTarget.Alias = alias
return p
}
func (p *Push) setTags(tags []string) *Push {
p.PushTarget.Tags = tags
return p
}
func (p *Push) setRids(rids []string) *Push {
p.PushTarget.Rids = rids
return p
}
func (p *Push) setPushAreas(pushAreas PushAreas) *Push {
p.PushTarget.PushAreas = &pushAreas
return p
}