Categorygithub.com/cossim/go-meizu-push-sdk
modulepackage
0.0.0-20240308111828-f4255aaae3ac
Repository: https://github.com/cossim/go-meizu-push-sdk.git
Documentation: pkg.go.dev

# README

go-meizu-push-sdk

GoDoc Reference Build Status Coverage Status Go Report Card License

Installation

   go get github.com/MEIZUPUSH/go-meizu-push-sdk

订阅相关接口

  • API 列表
    func ChangeAllSwitch(appId string, pushId string, subSwitch bool, appKey string) PushResponse
    func ChangeRegisterSwitch(appId string, pushId string, msgType string, subSwitch bool, appKey string) PushResponse
    func GetRegisterSwitch(appId string, pushId string, appKey string) PushResponse
    func GetSubAlias(appId string, pushId string, appKey string) PushResponse
    func GetSubTags(appId string, pushId string, appKey string) PushResponse
    func Register(appId string, appKey string, deviceId string) PushResponse
    func ResolvePushResponse(res *httpclient.Response, err error) PushResponse
    func SubscribeAlias(appId string, pushId string, alias string, appKey string) PushResponse
    func SubscribeTags(appId string, pushId string, tags string, appKey string) PushResponse
    func UnSubAllTags(appId string, pushId string, appKey string) PushResponse
    func UnSubscribeAlias(appId string, pushId string, appKey string) PushResponse
    func UnSubscribeTags(appId string, pushId string, tags string, appKey string) PushResponse

NOTE: 以test单元测试的方法说明其中一种api的使用方式

  • 获取订阅开关状态
func TestGetRegisterSwitch(t *testing.T) {
	message := GetRegisterSwitch(APP_ID,PUSH_ID,APP_KEY)
	fmt.Println("current message "+message.message)
	if(message.code != 200){
		t.Error("Status Code not 200")
	}
}

推送相关接口

  • API 列表
    func PushNotificationMessageByPushId(appId string, pushIds string, messageJson string, appKey string) PushResponse
    func PushThroughMessageByPushId(appId string, pushIds string, messageJson string, appKey string) PushResponse

NOTE: 以test单元测试的方法说明其中一种api的使用方式

  • 推送透传消息
func TestPushThroughMessageByPushId(t *testing.T) {
	messageJson := `{"test_throught_message": "message"}`
	message := PushThroughMessageByPushId(APP_ID,PUSH_ID,buildThroughMessage(messageJson),APP_KEY)

	fmt.Println("TestPushThroughMessageByPushId ",message.message)

	if message.code != 200 {
		t.Error("Status Code not 200")
	}
}    
  • 推送通知栏消息
func TestPushNotificationMessageByPushId(t *testing.T) {
    //使用通知栏构建工具方法快速构建通知栏json
	json := BuildNotificationMessage().
		noticeBarType(2).
		noticeTitle("标题go").
		noticeContent("测试内容").toJson()
	message := PushNotificationMessageByPushId(APP_ID,PUSH_ID,json,APP_KEY)

	fmt.Println("TestPushNotificationMessageByPushId ",message.message)

	if message.code != 200 {
		t.Error("Status Code not 200")
	}

}

NOTE: 详情请参考meizu-push-godoc

# Functions

No description provided by the author
修改所有开关状态.
修改订阅开关状态.
md5 sign.
获取订阅开关状态.
获取订阅别名.
获取订阅标签.
获取任务推送统计.
别名推送接口(通知栏消息).
pushId推送接口(通知栏消息).
No description provided by the author
别名推送接口(透传消息.
* * 通过PushId推送透传消息 */.
android 客户端订阅接口.
resolve push response.
别名订阅.
标签订阅.
取消订阅所有标签.
取消别名订阅.
取消标签订阅.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
服务端SDK调用API的应用的私钥Secret Key为 appSecret.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

"advanceInfo": { "suspend":是否通知栏悬浮窗显示 (1 显示 0 不显示) 【int 非必填,默认1】 "clearNoticeBar":是否可清除通知栏 (1 可以 0 不可以) 【int 非必填,默认1】 "fixDisplay":是否定时展示 (1 是 0 否) 【int 非必填,默认0】 "fixStartDisplayTime": 定时展示开始时间(yyyy-MM-dd HH:mm:ss) 【str 非必填】 "fixEndDisplayTime ": 定时展示结束时间(yyyy-MM-dd HH:mm:ss) 【str 非必填】 "notificationType": { "vibrate": 震动 (0关闭 1 开启) , 【int 非必填,默认1】 "lights": 闪光 (0关闭 1 开启), 【int 非必填,默认1】 "sound": 声音 (0关闭 1 开启), 【int 非必填,默认1】 } }.
"clickTypeInfo": { "clickType": 点击动作 (0,"打开应用"),(1,"打开应用页面"),(2,"打开URI页面"),(3, "应用客户端自定义")【int 非必填,默认为0】 "url": URI页面地址, 【string clickType为打开URI页面时,必填, 长度限制1000字节】 "parameters":参数 【JSON格式】【非必填】 "activity":应用页面地址 【string clickType为打开应用页面时,必填, 长度限制1000字节】 "customAttribute":应用客户端自定义【string clickType为应用客户端自定义时,必填, 输入长度为1000字节以内】 }.
"noticeBarInfo": { "noticeBarType": 通知栏样式(0, "标准"),(2, "安卓原生")【int 非必填,值为0】 "title": 推送标题, 【string 必填,字数限制1~32字符】 "content": 推送内容, 【string 必填,字数限制1~100字符】}.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
"pushTimeInfo": { "offLine": 是否进离线消息(0 否 1 是[validTime]) 【int 非必填,默认值为1】 "validTime": 有效时长 (1到72 小时内的正整数) 【int offLine值为1时,必填,默认24】 }.
No description provided by the author
No description provided by the author
这里所有的字段都是头字母大写.