xiaomi_channel

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Extra

type Extra struct {
	NotifyEffect string `json:"extra.notify_effect"` // 预定义通知栏消息的点击行为
	IntentUri    string `json:"extra.intent_uri"`
}

type PushClient

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

func (*PushClient) GetAccessToken

func (p *PushClient) GetAccessToken(ctx context.Context) (interface{}, error)

func (*PushClient) PushNotice

func (p *PushClient) PushNotice(ctx context.Context, pushRequest *setting.PushMessageRequest) (interface{}, error)

type PushMessageRequest

type PushMessageRequest struct {
	Payload               string `json:"payload"`                 // 消息的内容。(注意:需要对payload字符串做urlencode处理)
	RestrictedPackageName string `json:"restricted_package_name"` // App的包名
	PassThrough           int    `json:"pass_through"`            // 0 表示通知栏消息,1 表示透传消息
	Title                 string `json:"title"`                   // 通知栏展示的通知的标题
	Description           string `json:"description"`             // 通知栏展示的通知的描述
	RegistrationId        string `json:"registration_id"`         // 根据registration_id,发送消息到指定设备上
	Extra                 *Extra `json:"extra"`
}

type PushMessageResponse

type PushMessageResponse struct {
	Result      string            `json:"result"`      // "ok" 表示成功
	Description string            `json:"description"` // 对发送消息失败原因的解释
	Data        map[string]string `json:"data"`        // 本身就是一个json字符串(其中id字段的值就是消息的Id)
	Code        int               `json:"code"`        // 0表示成功,非0表示失败
	Info        string            `json:"info"`        // 详细信息
	Reason      string            `json:"reason"`      // 错误原因
}

PushMessageResponse 小米

{
 "code": 0,
 "data": {
   "id": "sdm00940562225761669wO"
 },
 "description": "成功",
 "info": "Received push messages for 1 REGID",
 "reason": "",
 "result": "ok",
 "success": true
}

Jump to

Keyboard shortcuts

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