huawei

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HUAWEI_ERROR_CODE_SUCCESS          = "80000000" //成功
	HUAWEI_ERROR_CODE_OAUTH            = "80200001" //Oauth认证错误, 请求HTTP头中Authorization参数里面的Access Token鉴权失败,请检查。
	HUAWEI_ERROR_CODE_TOKEN_EXPIRE     = "80200003" //Oauth Token过期, 请求HTTP头中Authorization参数里面的Access Token已过期,请重新申请后重试。
	HUAWEI_ERROR_CODE_MESSAGE_BODY     = "80100003" //消息结构体错误, 消息结构体参数携带错误,请按照此文档中请求参数部分进行检查。
	HUAWEI_ERROR_CODE_OVERFLOW         = "80300008" //消息体大小超过系统设置的默认值(4K) 请求消息体超默认值,请减小消息体后重试。
	HUAWEI_ERROR_CODE_PERMISSION       = "80300002" //APP被禁止发送当前应用无权限发送该消息,请检查应用权限。
	HUAWEI_ERROR_CODE_INVALID_TOKEN    = "80300007" //无效的Token消息请求携带的Push Token无效,请检查。
	HUAWEI_ERROR_CODE_INTERNAL_SERVICE = "500"      //内部服务器错误(与华为无关)
)

Variables

View Source
var (
	HUAWEI_HTTP_METHOD_POST = "POST"
	HUAWEI_TOKEN_TYPE       = "Bearer" //默认token类型
)
View Source
var (
	HUAWEI_AUTH_V2_URL = "https://oauth-login.cloud.huawei.com/oauth2/v2/token"

	//完整URL "https://push-api.cloud.huawei.com/v1/[appid]/messages:send"
	HUAWEI_PUSH_API_URL = "https://push-api.cloud.huawei.com/v1"
)

Functions

This section is empty.

Types

type Audience

type Audience struct {
	RegId []string //接收者的设备注册id/token
}

type HuaWei

type HuaWei struct {
	// contains filtered or unexported fields
}

func (*HuaWei) Debug

func (h *HuaWei) Debug(enable bool)

enable or disable debug output

func (*HuaWei) PushNotification

func (h *HuaWei) PushNotification(msg *push.Notification) (MsgID string, err error)

type Message

type Message struct {
	Audience  Audience    //消息接收者
	Title     string      //标题
	Content   string      //内容
	Extra     interface{} //自定义数据结构
	ReceiptID string      //消息回执ID
	Badge     int         //角标数量
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL