-
Notifications
You must be signed in to change notification settings - Fork 271
/
push.go
166 lines (157 loc) · 9.02 KB
/
push.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package push
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)
// Push invokes the push.Push API synchronously
func (client *Client) Push(request *PushRequest) (response *PushResponse, err error) {
response = CreatePushResponse()
err = client.DoAction(request, response)
return
}
// PushWithChan invokes the push.Push API asynchronously
func (client *Client) PushWithChan(request *PushRequest) (<-chan *PushResponse, <-chan error) {
responseChan := make(chan *PushResponse, 1)
errChan := make(chan error, 1)
err := client.AddAsyncTask(func() {
defer close(responseChan)
defer close(errChan)
response, err := client.Push(request)
if err != nil {
errChan <- err
} else {
responseChan <- response
}
})
if err != nil {
errChan <- err
close(responseChan)
close(errChan)
}
return responseChan, errChan
}
// PushWithCallback invokes the push.Push API asynchronously
func (client *Client) PushWithCallback(request *PushRequest, callback func(response *PushResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *PushResponse
var err error
defer close(result)
response, err = client.Push(request)
callback(response, err)
result <- 1
})
if err != nil {
defer close(result)
callback(nil, err)
result <- 0
}
return result
}
// PushRequest is the request struct for api Push
type PushRequest struct {
*requests.RpcRequest
AndroidNotificationBarType requests.Integer `position:"Query" name:"AndroidNotificationBarType"`
SmsSendPolicy requests.Integer `position:"Query" name:"SmsSendPolicy"`
Body string `position:"Query" name:"Body"`
DeviceType string `position:"Query" name:"DeviceType"`
PushTime string `position:"Query" name:"PushTime"`
SendSpeed requests.Integer `position:"Query" name:"SendSpeed"`
AndroidNotificationHuaweiChannel string `position:"Query" name:"AndroidNotificationHuaweiChannel"`
AndroidPopupActivity string `position:"Query" name:"AndroidPopupActivity"`
IOSRemindBody string `position:"Query" name:"iOSRemindBody"`
Trim requests.Boolean `position:"Query" name:"Trim"`
AndroidNotifyType string `position:"Query" name:"AndroidNotifyType"`
AndroidPopupTitle string `position:"Query" name:"AndroidPopupTitle"`
AndroidMessageHuaweiCategory string `position:"Query" name:"AndroidMessageHuaweiCategory"`
IOSMusic string `position:"Query" name:"iOSMusic"`
IOSApnsEnv string `position:"Query" name:"iOSApnsEnv"`
IOSMutableContent requests.Boolean `position:"Query" name:"iOSMutableContent"`
AndroidNotificationBarPriority requests.Integer `position:"Query" name:"AndroidNotificationBarPriority"`
ExpireTime string `position:"Query" name:"ExpireTime"`
AndroidImageUrl string `position:"Query" name:"AndroidImageUrl"`
AndroidNotificationVivoChannel string `position:"Query" name:"AndroidNotificationVivoChannel"`
IOSNotificationCategory string `position:"Query" name:"iOSNotificationCategory"`
AndroidNotificationXiaomiChannel string `position:"Query" name:"AndroidNotificationXiaomiChannel"`
StoreOffline requests.Boolean `position:"Query" name:"StoreOffline"`
IOSRelevanceScore string `position:"Query" name:"iOSRelevanceScore"`
SmsParams string `position:"Query" name:"SmsParams"`
AndroidVivoPushMode requests.Integer `position:"Query" name:"AndroidVivoPushMode"`
AndroidInboxBody string `position:"Query" name:"AndroidInboxBody"`
JobKey string `position:"Query" name:"JobKey"`
AndroidOpenUrl string `position:"Query" name:"AndroidOpenUrl"`
AndroidXiaoMiNotifyBody string `position:"Query" name:"AndroidXiaoMiNotifyBody"`
IOSSubtitle string `position:"Query" name:"iOSSubtitle"`
AndroidXiaomiBigPictureUrl string `position:"Query" name:"AndroidXiaomiBigPictureUrl"`
IOSRemind requests.Boolean `position:"Query" name:"iOSRemind"`
IOSNotificationThreadId string `position:"Query" name:"iOSNotificationThreadId"`
AndroidMusic string `position:"Query" name:"AndroidMusic"`
IOSNotificationCollapseId string `position:"Query" name:"iOSNotificationCollapseId"`
AndroidMessageHuaweiUrgency string `position:"Query" name:"AndroidMessageHuaweiUrgency"`
PushType string `position:"Query" name:"PushType"`
IOSInterruptionLevel string `position:"Query" name:"iOSInterruptionLevel"`
AndroidExtParameters string `position:"Query" name:"AndroidExtParameters"`
IOSBadge requests.Integer `position:"Query" name:"iOSBadge"`
AndroidBigBody string `position:"Query" name:"AndroidBigBody"`
IOSBadgeAutoIncrement requests.Boolean `position:"Query" name:"iOSBadgeAutoIncrement"`
AndroidOpenType string `position:"Query" name:"AndroidOpenType"`
Title string `position:"Query" name:"Title"`
SmsDelaySecs requests.Integer `position:"Query" name:"SmsDelaySecs"`
AndroidRenderStyle requests.Integer `position:"Query" name:"AndroidRenderStyle"`
IOSExtParameters string `position:"Query" name:"iOSExtParameters"`
AndroidNotificationHonorChannel string `position:"Query" name:"AndroidNotificationHonorChannel"`
AndroidXiaomiImageUrl string `position:"Query" name:"AndroidXiaomiImageUrl"`
SmsTemplateName string `position:"Query" name:"SmsTemplateName"`
AndroidPopupBody string `position:"Query" name:"AndroidPopupBody"`
AndroidBigPictureUrl string `position:"Query" name:"AndroidBigPictureUrl"`
IOSSilentNotification requests.Boolean `position:"Query" name:"iOSSilentNotification"`
AndroidNotificationGroup string `position:"Query" name:"AndroidNotificationGroup"`
SendChannels string `position:"Query" name:"SendChannels"`
Target string `position:"Query" name:"Target"`
AndroidBigTitle string `position:"Query" name:"AndroidBigTitle"`
AndroidNotificationChannel string `position:"Query" name:"AndroidNotificationChannel"`
AndroidRemind requests.Boolean `position:"Query" name:"AndroidRemind"`
AndroidActivity string `position:"Query" name:"AndroidActivity"`
SmsSignName string `position:"Query" name:"SmsSignName"`
AndroidNotificationNotifyId requests.Integer `position:"Query" name:"AndroidNotificationNotifyId"`
AppKey requests.Integer `position:"Query" name:"AppKey"`
TargetValue string `position:"Query" name:"TargetValue"`
AndroidXiaoMiNotifyTitle string `position:"Query" name:"AndroidXiaoMiNotifyTitle"`
AndroidXiaoMiActivity string `position:"Query" name:"AndroidXiaoMiActivity"`
}
// PushResponse is the response struct for api Push
type PushResponse struct {
*responses.BaseResponse
MessageId string `json:"MessageId" xml:"MessageId"`
RequestId string `json:"RequestId" xml:"RequestId"`
}
// CreatePushRequest creates a request to invoke Push API
func CreatePushRequest() (request *PushRequest) {
request = &PushRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("Push", "2016-08-01", "Push", "", "")
request.Method = requests.POST
return
}
// CreatePushResponse creates a response to parse from Push response
func CreatePushResponse() (response *PushResponse) {
response = &PushResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}