-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest_image.go
More file actions
70 lines (58 loc) · 1.62 KB
/
request_image.go
File metadata and controls
70 lines (58 loc) · 1.62 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
package jpushclient
import "encoding/json"
type ImageRequest struct {
ImageType int `json:"image_type"`
ImageUrl string `json:"image_url,omitempty"`
JiGuangImageUrl string `json:"jiguang_image_url,omitempty"`
XiaomiImageUrl string `json:"xiaomi_image_url,omitempty"`
OppoImageUrl string `json:"oppo_image_url,omitempty"`
HuaweiImageUrl string `json:"huawei_image_url,omitempty"`
HonorImageUrl string `json:"honor_image_url,omitempty"`
FcmImageUrl string `json:"fcm_image_url,omitempty"`
}
func (img *ImageRequest) SetImageType(c int) *ImageRequest {
img.ImageType = c
return img
}
func (img *ImageRequest) SetImageUrl(t string) *ImageRequest {
img.ImageUrl = t
return img
}
func (img *ImageRequest) setJiGuangImageUrl(t string) *ImageRequest {
img.JiGuangImageUrl = t
return img
}
func (img *ImageRequest) SetXiaomiImageUrl(t string) *ImageRequest {
img.XiaomiImageUrl = t
return img
}
func (img *ImageRequest) SetOppoImageUrl(t string) *ImageRequest {
img.OppoImageUrl = t
return img
}
func (img *ImageRequest) SetHuaweiImageUrl(t string) *ImageRequest {
img.HuaweiImageUrl = t
return img
}
func (img *ImageRequest) SetHonorImageUrl(t string) *ImageRequest {
img.HonorImageUrl = t
return img
}
func (img *ImageRequest) SetFcmImageUrl(t string) *ImageRequest {
img.FcmImageUrl = t
return img
}
func (img *ImageRequest) ToJson() (string, error) {
content, err := json.Marshal(img)
if err != nil {
return "", err
}
return string(content), nil
}
func (img *ImageRequest) ToBytes() ([]byte, error) {
content, err := json.Marshal(img)
if err != nil {
return nil, err
}
return content, nil
}