Documentation ¶
Overview ¶
Package huawei can be used to send notifications via the Huawei Push Kit APIs. https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/https-send-api-0000001050986197
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndroidStructure ¶
type AndroidStructure struct { Data string `json:"data"` Notification NotificationStructure `json:"notification"` }
type ClickStructure ¶
type ClickStructure struct {
Type int `json:"type"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client can be used to send notifications via the Huawei Push Kit APIs.
func NewClient ¶
func NewClient(conf config.Notifications) (*Client, error)
NewClient create a client for sending notifications.
func (*Client) PushWithContext ¶
PushWithContext send the notification to Push Kit. It returns a bool that indicates true if the client is no longer registered (app has been uninstalled), and an error.
type Notification ¶
type Notification struct {
Message NotificationMessage `json:"message"`
}
Notification is the payload to send to Push Kit for sending a notification. Cf https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/https-send-api-0000001050986197#section13271045101216
func NewNotification ¶
func NewNotification(title, body, token string, data map[string]interface{}) *Notification
type NotificationMessage ¶
type NotificationMessage struct { Android AndroidStructure `json:"android"` Token []string `json:"token"` }
type NotificationStructure ¶
type NotificationStructure struct { Title string `json:"title"` Body string `json:"body"` ClickAction ClickStructure `json:"click_action"` }