Documentation
¶
Index ¶
- Constants
- Variables
- func GetToken(client_id string, client_secret string) string
- func PushSend(client_id string, client_secret string, param *PushSendParam) (*PushSendResult, error, *BizErr)
- type Action
- type BizErr
- type Body
- type Ext
- type Hps
- type Message
- type Msg
- type Param
- type PushSendParam
- type PushSendResult
- type TokenResultStruct
- type Vers
Constants ¶
View Source
const ( TOKEN_URL = "https://login.cloud.huawei.com/oauth2/v2/token" PUSH_URL = "https://api.push.hicloud.com/pushsend.do" )
View Source
const ( NSP_STATUS_6 = 6 NSP_STATUS_102 = 102 NSP_STATUS_105 = 105 NSP_STATUS_111 = 111 NSP_STATUS_112 = 112 NSP_STATUS_113 = 113 NSP_STATUS_114 = 114 NSP_STATUS_199 = 199 NSP_STATUS_403 = 403 )
Variables ¶
View Source
var NSP_STATUS_MSG = map[int]string{ NSP_STATUS_6: "session过期", NSP_STATUS_102: "无效的SESSION_KEY", NSP_STATUS_105: "参数错误", NSP_STATUS_111: "系统、服务处理忙", NSP_STATUS_112: "找不到对应服务", NSP_STATUS_113: "请求服务失败", NSP_STATUS_114: "服务不可达、无路由", NSP_STATUS_199: "未知错误", NSP_STATUS_403: "无权限", }
Functions ¶
func PushSend ¶
func PushSend(client_id string, client_secret string, param *PushSendParam) (*PushSendResult, error, *BizErr)
Types ¶
type Action ¶
type Action struct { Type int `json:"type,omitempty"` //1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3 打开APP:默认值,打开App的首页。注意:富媒体消息开放API不支持。 Param Param `json:"param,omitempty"` }
消息点击动作
type Ext ¶
type Ext struct { BadgeAddNum string `json:"badgeAddNum,omitempty"` //设置应用角标数值,取值范围1-99。 BadgeClass string `json:"badgeClass,omitempty"` //桌面图标对应的应用入口Activity类。 BiTag string `json:"biTag,omitempty"` //设置消息标签,如果带了这个标签,会在回执中推送给CP用于检测某种类型消息的到达率和状态。 Customize []string `json:"customize,omitempty"` //用于触发onEvent点击事件,扩展样例:[{"season":"Spring"},{"weather":"raining"}] 。说明:这个字段类型必须是JSON Array,里面是key-value的一组扩展信息。 }
扩展信息,含BI消息统计,特定展示风格,消息折叠
type Msg ¶
type Msg struct { Type int `json:"type"` //1, 透传异步消息; 3, 系统通知栏异步消息。注意:2和4以后为保留后续扩展使用 Body Body `json:"body"` Action Action `json:"action,omitempty"` }
PUSH消息定义。包括:消息类型type、消息内容body、消息动作action
type Param ¶
type Param struct { Intent string `json:"intent,omitempty"` //Action的type为1的时候表示自定义行为。 Url string `json:"url,omitempty"` //Action的type为2的时候表示打开URL地址 AppPkgName string `json:"appPkgName"` //需要拉起的应用包名,必须和注册推送的包名一致。 }
关于消息点击动作的参数
type PushSendParam ¶
type PushSendParam struct { DeviceToken string `json:"device_token"` //JSON数值字符串,单次最多只是100个。 Payload string `json:"payload"` //描述投递消息的JSON结构体,描述PUSH消息的:类型、内容、显示、点击动作、报表统计和扩展信息 NspCtx string `json:"nsp_ctx"` }
请求参数
type PushSendResult ¶
type TokenResultStruct ¶
Click to show internal directories.
Click to hide internal directories.