Documentation
¶
Index ¶
- Constants
- Variables
- func GetGeTuiToken(appID string, appKey string, masterSecret string) (string, error)
- func MakeReqBody(param interface{}) ([]byte, error)
- func SendPost(url string, authToken string, bodyByte []byte) (string, error)
- func Signature(appKey string, masterSecret string) (string, string)
- type Alert
- type Apns
- type AppCondition
- type Condition
- type GtFeedBack
- type Link
- type Message
- type Notification
- type Notify
- type NotyPopload
- type PushAppParam
- type PushAppResult
- type PushInfo
- type PushListParam
- type PushListResult
- type PushResult
- type PushResultParam
- type PushSingleParam
- type PushSingleResult
- type SaveListBodyParam
- type SaveListBodyResult
- type SignParam
- type SignResult
- type Transmission
Constants ¶
View Source
const (
API_URL = "https://restapi.getui.com/v1/"
)
View Source
const PHONE_TYPE = "phonetype"
手机类型
View Source
const REGION = "region"
地区
View Source
const TAG = "tag"
自定义tag
Variables ¶
View Source
var MsgType = &messageType{
"notification",
"link",
"notypopload",
"transmission",
}
消息类型
Functions ¶
func GetGeTuiToken ¶
Types ¶
type Apns ¶
type Apns struct {
Alert *Alert `json:"alert"` //
AutoBadge string `json:"autoBadge,omitempty"` //用于计算icon上显示的数字,还可以实现显示数字的自动增减,如“+1”、 “-1”、 “1” 等,计算结果将覆盖badge
Sound string `json:"sound,omitempty"` //通知铃声文件名,无声设置为“com.gexin.ios.silence”
ContentAvailable int `json:"content-available"` //推送直接带有透传数据
Category string `json:"category,omitempty"` //在客户端通知栏触发特定的action和button显示
}
push_info.Apns
type AppCondition ¶
type Condition ¶
type Condition []AppCondition
type GtFeedBack ¶
type Link ¶
type Link struct {
Url string `json:"url,omitempty"` // 打开网址 可选
DurationBegin string `json:"duration_begin,omitempty"` // 设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss 可选
DurationEnd string `json:"duration_end,omitempty"` //设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss 可选
Style interface{} `json:"style,omitempty"` // 通知栏消息布局样式(0 系统样式 1 个推样式) 默认为0 可选
}
开通知打开网页模板
type Message ¶
type Message struct {
AppKey string `json:"appkey"` // 注册应用时生成的appkey
IsOffline bool `json:"is_offline,omitempty"` // 是否离线推送 可选 默认true
OfflineExpireTime int `json:"offline_expire_time,omitempty"` // 消息离线存储有效期,单位:ms 默认24小时
PushNetWorkType int `json:"push_network_type,omitempty"` // 选择推送消息使用网络类型,0:不限制,1:wifi 默认0
MsgType string `json:"msgtype"` // 消息应用类型,可选项:notification、link、notypopload、transmission。选了MsgType,那么必须有对应的模板,否则失败
}
type Notification ¶
type Notification struct {
TransmissionType bool `json:"transmission_type,omitempty"` //收到消息是否立即启动应用,true为立即启动,false则广播等待启动,默认是否 可选
TransmissionContent string `json:"transmission_content,omitempty"` //透传内容 可选
DurationBegin string `json:"duration_begin,omitempty"` //设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss 可选
DurationEnd string `json:"duration_end,omitempty"` //设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss 可选
Style interface{} `json:"style"` //通知栏消息布局样式(0 系统样式 1 个推样式) 默认为0 可选
}
点开通知打开应用模板 在通知栏显示一条含图标、标题等的通知,用户点击后,会激活您的应用 http://docs.getui.com/getui/server/rest/template/?id=doc-title-0
type Notify ¶
type Notify struct {
Title string `json:"title"`
Content string `json:"content"`
Intent string `json:"intent"`
Type string `json:"type"`
}
多厂商推送透传消息带通知
type NotyPopload ¶
type NotyPopload struct {
NotyIcon string `json:"notyicon"` //通知栏图标
NotyTitle string `json:"notytitle"` // 通知标题
NotyContent string `json:"notycontent"` // 通知内容
// LogoUrl string `json:"logourl,omitempty"` // 通知的网络图标地址 可选
PopTitle string `json:"poptitle"` // 弹出框标题
PopContent string `json:"popcontent"` //弹出框内容
PopImage string `json:"popimage"` //弹出框图标
PopButton1 string `json:"PopButton1"` //弹出框左边按钮名称
PopButton2 string `json:"PopButton2"` //弹出框左边按钮名称
LoadUrl string `json:"loadurl"` // 下载文件地址
LoadIcon string `json:"loadicon,omitempty"` // 下载图标 可选
LoadTitle string `json:"loadtitle,omitempty"` // 下载标题 可选
IsAutoinstall bool `json:"is_autoinstall,omitempty"` // 是否自动安装,默认值false 可选
IsActived bool `json:"is_actived,omitempty"` //安装完成后是否自动启动应用程序,默认值false 可选
AndroidMark string `json:"androidmark,omitempty"` //安卓标识 可选
SymbianMark string `json:"symbianmark,omitempty"` //塞班标识 可选
IphoneMark string `json:"iphonemark,omitempty"` //苹果标志 可选
DurationBegin string `json:"duration_begin,omitempty"` // 设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss 可选
DurationEnd string `json:"duration_end,omitempty"` //设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss 可选
NotifyStyle int `json:"notify_style,omitempty"` // 通知栏消息布局样式(0 系统样式 1 个推样式) 默认为0 可选
Style interface{} `json:"style,omitempty"` //通知栏消息布局样式(0 系统样式 1 个推样式) 默认为0 可选
}
点击通知弹窗下载模板
type PushAppParam ¶
type PushAppParam struct {
Message *Message `json:"message"`
Notification *Notification `json:"notification"`
Link *Link `json:"link,omitempty"`
Notypopload *NotyPopload `json:"notypopload,omitempty"`
Transmission *Transmission `json:"transmission,omitempty"`
PushInfo *PushInfo `json:"push_info,omitempty"`
Condition *Condition `json:"condition,omitempty"`
RequestId string `json:"requestid"` //请求唯一标识
Speed int64 `json:"speed,omitempty"` //推送速度控制。设置群推接口的推送速度,单位为条/秒,例如填写100,则为100条/秒。仅对指定应用群推接口有效。
TaskName string `json:"task_name,omitempty"` //任务别名
DurationBegin string `json:"duration_begin,omitempty"` //设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss
DurationEnd string `json:"duration_end,omitempty"` //设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss
}
type PushAppResult ¶
type PushAppResult struct {
Result string `json:"result"`
Taskid string `json:"taskid"`
Desc string `json:"desc"`
}
func PushApp ¶
func PushApp(appId string, authToken string, param *PushAppParam) (*PushAppResult, error)
全推,http://docs.getui.com/getui/server/rest/push/#doc-title-2
type PushListParam ¶
type PushListResult ¶
type PushListResult struct {
Result string `json:"result"`
Taskid string `json:"taskid"`
Desc string `json:"desc"`
CidDetails map[string]string `json:"cid_details"`
AliasDetails map[string]string `json:"alias_details"`
}
func PushList ¶
func PushList(appId string, authToken string, param *PushListParam) (*PushListResult, error)
群推
type PushResult ¶
type PushResult struct {
Result string `json:"result"`
Data []struct {
Taskid string `json:"taskId"`
MsgTotal int `json:"msgTotal"`
MsgProcess int `json:"msgProcess"`
ClickNum int `json:"clickNum"`
PushNum int `json:"pushNum"`
APN string `json:"APN,omitempty"`
GT string `json:"GT"`
} `json:"data"`
}
func GetPushResult ¶
func GetPushResult(appId string, authToken string, param *PushResultParam) (*PushResult, error)
获取推送结果接口
type PushResultParam ¶
type PushResultParam struct {
Taskidlist []string `json:"taskIdList"` //查询的任务结果列表
}
type PushSingleParam ¶
type PushSingleParam struct {
Message *Message `json:"message"`
Notification *Notification `json:"notification,omitempty"`
Link *Link `json:"link,omitempty"`
Notypopload *NotyPopload `json:"notypopload,omitempty"`
Transmission *Transmission `json:"transmission,omitempty"`
PushInfo *PushInfo `json:"push_info,omitempty"`
Cid string `json:"cid,omitempty"`
Alias string `json:"alias,omitempty"`
RequestId string `json:"requestid"`
}
type PushSingleResult ¶
type PushSingleResult struct {
Result string `json:"result"` //ok 鉴权成功
TaskId string `json:"taskid"` //任务标识号
Desc string `json:"desc"` //错误信息描述
Status string `json:"status"` //推送结果successed_offline 离线下发successed_online 在线下发successed_ignore 非活跃用户不下发
}
func PushSingle ¶
func PushSingle(appId string, authToken string, param *PushSingleParam) (*PushSingleResult, error)
单推
type SaveListBodyParam ¶
type SaveListBodyParam struct {
Message *Message `json:"message"` //消息内容
Notification *Notification `json:"notification,omitempty"` //通知模板
Link *Link `json:"link,omitempty"`
Notypopload *NotyPopload `json:"notypopload,omitempty"`
Transmission *Transmission `json:"transmission,omitempty"` //透传模板
PushInfo *PushInfo `json:"push_info,omitempty"` //json串,当手机为ios,并且为离线的时候;或者简化推送的时候,使用该参数
TaskName string `json:"task_name,omitempty"` // 任务名称 可以给多个任务指定相同的task_name,后面用task_name查询推送结果能得到多个任务的结果 可选
}
消息应用模板 notification、link、notypopload、transmission 四种类型选其一该属性与message下面的msgtype一致
type SaveListBodyResult ¶
type SaveListBodyResult struct {
Result string `json:"result"`
TaskId string `json:"taskid"` // 任务标识号
Desc string `json:"desc"` // 错误信息描述
}
func SaveListBody ¶
func SaveListBody(appId string, authToken string, param *SaveListBodyParam) (*SaveListBodyResult, error)
保存消息共同体,获取推送taskid
type SignResult ¶
token
type Transmission ¶
type Transmission struct {
TransmissionType bool `json:"transmission_type"` // 收到消息是否立即启动应用,true为立即启动,false则广播等待启动,默认是否 可选
TransmissionContent string `json:"transmission_content"` //透传内容
DurationBegin string `json:"duration_begin,omitempty"` // 设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss 可选
DurationEnd string `json:"duration_end,omitempty"` //设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss 可选
Notify *Notify `json:"notify,omitempty"` //多厂商推送透传消息带通知
}
透传消息模板 透传消息是指消息传递到客户端只有消息内容,展现的形式由客户端自行定义。客户端可自定义通知的展现形式,可以自定义通知到达后的动作,或者不做任何展现。IOS推送也使用该模板 http://docs.getui.com/getui/server/rest/template/?id=doc-title-3
Click to show internal directories.
Click to hide internal directories.