push

package
v0.0.0-...-a88cfdc Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CanNotGetClientFromConfig              = errors.New("can not get client from config")
	CanNotGetPushClient                    = errors.New("can not get push client")
	ConvertToSpecificPlatformClientFailed  = errors.New("convert to specific platform client failed")
	ConvertToSpecificPlatformMessageFailed = errors.New("convert to specific platform message failed")
	SendMessageResponseNotOk               = errors.New("request send message to platform push service reply http status code not ok")
)
View Source
var (
	GlobalApplePushClient    = NewApplePushClient()
	GlobalFirebasePushClient = NewFirebasePushClient()
)

Functions

func InitApplePush

func InitApplePush(ctx context.Context, appConfig *config.AppConfig)

func InitFirebasePush

func InitFirebasePush(ctx context.Context, appConfig *config.AppConfig)

func NewApplePushClientItem

func NewApplePushClientItem(ctx context.Context, appConfig *config.AppConfig, bundleID string) (*apns2.Client, error)

func NewFirebasePushClientItem

func NewFirebasePushClientItem(ctx context.Context, appConfig *config.AppConfig, packageName string) (*messaging.Client, error)

Types

type ApplePushClient

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

func NewApplePushClient

func NewApplePushClient() *ApplePushClient

func (*ApplePushClient) GetClientByAppID

func (a *ApplePushClient) GetClientByAppID(ctx context.Context, appID string) (interface{}, bool)

func (*ApplePushClient) Push

func (a *ApplePushClient) Push(ctx context.Context, message *models.PushMessage) (interface{}, error)

type FirebasePushClient

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

func NewFirebasePushClient

func NewFirebasePushClient() *FirebasePushClient

func (*FirebasePushClient) GetClientByAppID

func (f *FirebasePushClient) GetClientByAppID(ctx context.Context, appID string) (interface{}, bool)

func (*FirebasePushClient) Push

func (f *FirebasePushClient) Push(ctx context.Context, message *models.PushMessage) (interface{}, error)

type MessageFirebaseItem

type MessageFirebaseItem struct {
	Title    string            `json:"title,omitempty"`
	Body     string            `json:"body,omitempty"`
	ImageURL string            `json:"image,omitempty"`
	Data     map[string]string `json:"data,omitempty"`
}

type Pusher

type Pusher interface {
	GetClientByAppID(ctx context.Context, appId string) (interface{}, bool)
	Push(ctx context.Context, message *models.PushMessage) (interface{}, error)
}

type WrappedError

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

func NewWrappedError

func NewWrappedError(msg string, err error) *WrappedError

func (*WrappedError) Error

func (w *WrappedError) Error() string

func (*WrappedError) Unwrap

func (w *WrappedError) Unwrap() error

Jump to

Keyboard shortcuts

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