huawei

package
v0.0.0-...-820a931 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

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

func (c *Client) PushWithContext(ctx context.Context, notification *Notification) (bool, error)

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"`
}

Jump to

Keyboard shortcuts

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