apn

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadDeviceToken = errors.New("bad device token")
)

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Title    string `json:"title"`
	Subtitle string `json:"subtitle"`
	Body     string `json:"body"`
}

type Client

type Client interface {
	Do(req *http.Request) (*http.Response, error)
}

type Config

type Config struct {
	BaseURL     *url.URL
	Topic       string
	TeamId      string
	KeyId       string
	KeyData     []byte
	MaxTokenAge time.Duration
}

type Notification

type Notification struct {
	Alert Alert  `json:"alert"`
	Badge int    `json:"badge"`
	Sound string `json:"sound"`
}

type Service

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

func NewService

func NewService(cfg Config, client Client) (*Service, error)

func (*Service) SendNotification

func (s *Service) SendNotification(ctx context.Context, device []byte, n Notification) error

Jump to

Keyboard shortcuts

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