apns

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 26 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakePushEndpoint

func MakePushEndpoint(svc Service) endpoint.Endpoint

func MarshalPushInfo

func MarshalPushInfo(p *PushInfo) ([]byte, error)

func NewPushService

func NewPushService(provider PushCertificateProvider) (*push.Service, error)

func RegisterHTTPHandlers

func RegisterHTTPHandlers(r *mux.Router, e Endpoints, options ...httptransport.ServerOption)

func UnmarshalPushInfo

func UnmarshalPushInfo(data []byte, p *PushInfo) error

Types

type Endpoints

type Endpoints struct {
	PushEndpoint endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service, outer endpoint.Middleware, others ...endpoint.Middleware) Endpoints

type Middleware

type Middleware func(Service) Service

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

type Option

type Option func(*PushService)

func WithPushService

func WithPushService(svc *push.Service) Option

type PushCertificateProvider

type PushCertificateProvider interface {
	PushCertificate() (*tls.Certificate, error)
}

type PushInfo

type PushInfo struct {
	UDID      string `db:"udid"`
	PushMagic string `db:"push_magic"`
	Token     string `db:"token"`
	MDMTopic  string `db:"mdm_topic"`
}

type PushOption added in v1.6.0

type PushOption func(*pushOpts)

PushOption adds optional parameters to the Push method.

func WithExpiration added in v1.6.0

func WithExpiration(t time.Time) PushOption

WithExpiration sets the expiration of the APNS message. Apple will retry delivery until this time. The default behavior only tries once.

type PushService

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

func New

func New(db Store, provider PushCertificateProvider, sub pubsub.Subscriber, opts ...Option) (*PushService, error)

func (*PushService) Push

func (svc *PushService) Push(ctx context.Context, deviceUDID string, opts ...PushOption) (string, error)

type Service

type Service interface {
	Push(ctx context.Context, udid string, opts ...PushOption) (string, error)
}

type Store

type Store interface {
	PushInfo(ctx context.Context, udid string) (*PushInfo, error)
}

type Worker added in v1.3.1

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

func NewWorker added in v1.3.1

func NewWorker(db WorkerStore, subscriber pubsub.Subscriber, logger log.Logger) *Worker

func (*Worker) Run added in v1.3.1

func (w *Worker) Run(ctx context.Context) error

type WorkerStore added in v1.3.1

type WorkerStore interface {
	Save(context.Context, *PushInfo) error
}

Directories

Path Synopsis
internal
pushproto
Package pushproto is a generated protocol buffer package.
Package pushproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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