| 1 |
package push |
| 2 |
|
| 3 |
import ( |
| 4 |
"net/http" |
| 5 |
|
| 6 |
"github.com/denverdino/aliyungo/common" |
| 7 |
) |
| 8 |
|
| 9 |
const ( |
| 10 |
PushTargetDevice = "DEVICE" |
| 11 |
PushTargetAccount = "ACCOUNT" |
| 12 |
PushTargetAlias = "ALIAS" |
| 13 |
PushTargetTag = "TAG" |
| 14 |
PushTargetAll = "ALL" |
| 15 |
|
| 16 |
PushDeviceTypeIOS = "iOS" |
| 17 |
PushDeviceTypeAndroid = "ANDROID" |
| 18 |
PushDeviceTypeAll = "ALL" |
| 19 |
|
| 20 |
PushTypeMessage = "MESSAGE" |
| 21 |
PushTypeNotice = "NOTICE" |
| 22 |
|
| 23 |
PushIOSAPNENVProduct = "PRODUCT" |
| 24 |
PushIOSAPNENVDevelopment = "DEV" |
| 25 |
) |
| 26 |
|
| 27 |
推送参数 |
| 28 |
type PushArgs struct { |
| 29 |
数----*/ |
| 30 |
信息 |
| 31 |
AppKey int64 |
| 32 |
标----*/ |
| 33 |
送目标 |
| 34 |
Target string |
| 35 |
值使用逗号分隔,最多支持100个。 |
| 36 |
TargetValue string |
| 37 |
备类型 |
| 38 |
DeviceType string |
| 39 |
置----*/ |
| 40 |
PushType string |
| 41 |
知标题,iOS消息标题 |
| 42 |
Title string |
| 43 |
知内容,iOS消息内容 |
| 44 |
Body string |
| 45 |
知内容] |
| 46 |
Summary string |
| 47 |
于iOS通知任务----*/ |
| 48 |
知声音] |
| 49 |
IOSMusic string `ArgName:"iOSMusic"` |
| 50 |
标右上角角标] |
| 51 |
IOSBadge int `ArgName:"iOSBadge"` |
| 52 |
10+通知显示标题] |
| 53 |
IOSTitle string `ArgName:"iOSTitle"` |
| 54 |
静默通知] |
| 55 |
IOSSilentNotification string `ArgName:"iOSSilentNotification"` |
| 56 |
(iOS 10+)] |
| 57 |
IOSSubtitle string `ArgName:"iOSSubtitle"` |
| 58 |
(iOS 10+)] |
| 59 |
IOSNotificationCategory string `ArgName:"iOSNotificationCategory"` |
| 60 |
扩展处理(iOS 10+)] |
| 61 |
IOSMutableContent string `ArgName:"iOSMutableContent"` |
| 62 |
的扩展属性] |
| 63 |
IOSExtParameters string `ArgName:"iOSExtParameters"` |
| 64 |
境信息] |
| 65 |
IOSApnsEnv string `ArgName:"iOSApnsEnv"` |
| 66 |
在线则这条推送会做为通知] |
| 67 |
IOSRemind bool `ArgName:"iOSRemind"` |
| 68 |
时使用的iOS通知内容] |
| 69 |
IOSRemindBody string `ArgName:"iOSRemindBody"` |
| 70 |
ndroid通知任务----*/ |
| 71 |
知声音] |
| 72 |
AndroidMusic string |
| 73 |
通知后动作] |
| 74 |
AndroidOpenType string |
| 75 |
的提醒方式 |
| 76 |
AndroidNotifyType string |
| 77 |
开的activity] |
| 78 |
AndroidActivity string |
| 79 |
后打开对应的url] |
| 80 |
AndroidOpenUrl string |
| 81 |
通知栏样式] |
| 82 |
AndroidNotificationBarType int |
| 83 |
展示时排列位置的优先级] |
| 84 |
AndroidNotificationBarPriority int |
| 85 |
容 8.0 系统] |
| 86 |
AndroidNotificationChannel string |
| 87 |
知的扩展属性] |
| 88 |
AndroidExtParameters string |
| 89 |
roid辅助弹窗功能----*/ |
| 90 |
备不在线,则这条推送会使用辅助弹窗功能] |
| 91 |
AndroidRemind bool |
| 92 |
击后跳转的Activity] |
| 93 |
AndroidPopupActivity string |
| 94 |
限制:<16字符(中英文都以一个字符计算)] |
| 95 |
AndroidPopupTitle string |
| 96 |
限制:<128字符(中英文都以一个字符计算)] |
| 97 |
AndroidPopupBody string |
| 98 |
制----*/ |
| 99 |
定时发送] |
| 100 |
PushTime string |
| 101 |
/通知是否保存] |
| 102 |
StoreOffline string |
| 103 |
通知的过期时间] |
| 104 |
ExpireTime string |
| 105 |
合----*/ |
| 106 |
短信的模板名 |
| 107 |
SmsTemplateName string |
| 108 |
短信的签名 |
| 109 |
SmsSignName string |
| 110 |
板的变量名值对 |
| 111 |
SmsParams string |
| 112 |
信的延迟时间,秒 |
| 113 |
SmsDelaySecs int |
| 114 |
短信的条件 |
| 115 |
SmsSendPolicy int |
| 116 |
} |
| 117 |
|
| 118 |
type PushResponse struct { |
| 119 |
common.Response |
| 120 |
MessageId string |
| 121 |
} |
| 122 |
|
| 123 |
func (this *Client) Push(args *PushArgs) (*PushResponse, error) { |
| 124 |
resp := PushResponse{} |
| 125 |
return &resp, this.InvokeByAnyMethod(http.MethodPost, Push, "", args, &resp) |
| 126 |
} |