-
Notifications
You must be signed in to change notification settings - Fork 0
/
request_device.go
55 lines (49 loc) · 1.32 KB
/
request_device.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
package jpushclient
import "encoding/json"
type DeviceSettingRequest struct {
Tags *DeviceSettingRequestTags `json:"tags"`
Alias string `json:"alias"`
Mobile string `json:"mobile"`
}
type DeviceSettingEmptyTagsRequest struct {
Tags string `json:"tags"`
Alias string `json:"alias"`
Mobile string `json:"mobile"`
}
type DeviceSettingRequestAlias struct {
Remove []string `json:"remove,omitempty"`
}
type DeviceSettingRequestTags struct {
Add []string `json:"add,omitempty"`
Remove []string `json:"remove,omitempty"`
}
type DeviceBindTagsRequest struct {
Add []string `json:"add,omitempty"`
Remove []string `json:"remove,omitempty"`
}
func (d *DeviceSettingRequest) SetTags(tags *DeviceSettingRequestTags) *DeviceSettingRequest {
d.Tags = tags
return d
}
func (d *DeviceSettingRequest) SetAlias(alias string) *DeviceSettingRequest {
d.Alias = alias
return d
}
func (d *DeviceSettingRequest) SetMobile(mobile string) *DeviceSettingRequest {
d.Mobile = mobile
return d
}
func (d *DeviceSettingRequest) ToJson() (string, error) {
content, err := json.Marshal(d)
if err != nil {
return "", err
}
return string(content), nil
}
func (d *DeviceSettingRequest) ToBytes() ([]byte, error) {
content, err := json.Marshal(d)
if err != nil {
return nil, err
}
return content, nil
}