Skip to content
fast go language http client for quick using meizu push open api
Go
Branch: master
Clone or download
Pull request Compare This branch is even with MEIZUPUSH:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
common.go
common_test.go
non-task-push.go
non-task-push_test.go
notification-message.go
notification-message_test.go
pushapi.go
pushapi_test.go
pushstatics.go
registerservice.go
registerservice_test.go
task-push.go
through-message.go
through-message_test.go

README.md

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

You can’t perform that action at this time.