apns

package
v0.0.0-...-fd5dff8 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceEndpointFormat = "https://%s/3/device/%s"

	ProductionEndpoint = "api.push.apple.com"
	SandboxEndpoint    = "api.sandbox.push.apple.com"
)

Variables

This section is empty.

Functions

func GenerateJWTFromKey

func GenerateJWTFromKey(key *ecdsa.PrivateKey, keyId string, teamId string, issuedAt time.Time, expiresAfter time.Duration) (string, error)

func GenerateJWTFromKeyFile

func GenerateJWTFromKeyFile(keyFile string, keyId string, teamId string, issuedAt time.Time, expiresAfter time.Duration) (string, error)

func LoadCertificateFromFile

func LoadCertificateFromFile(filePath string, password string) (tls.Certificate, error)

func LoadKeyFromFile

func LoadKeyFromFile(filePath string) (*ecdsa.PrivateKey, error)

Types

type Client

type Client interface {
	ConfigureCertificateAuth(cert tls.Certificate)
	ConfigureEndpoint(endpoint string)
	ConfigureTokenAuth(token string)
	EnableLogging(writer io.Writer)
	Send(deviceToken string, headers Headers, content []byte) (*SendResult, error)
}

func NewClient

func NewClient() Client

type Headers

type Headers map[string]string

type NotificationBuilder

type NotificationBuilder struct {
	AppId string
	// contains filtered or unexported fields
}

func NewNotificationBuilder

func NewNotificationBuilder(appId string) *NotificationBuilder

func (*NotificationBuilder) Build

func (b *NotificationBuilder) Build() (Headers, []byte, error)

func (*NotificationBuilder) BuildContent

func (b *NotificationBuilder) BuildContent() ([]byte, error)

func (*NotificationBuilder) BuildHeaders

func (b *NotificationBuilder) BuildHeaders() (Headers, error)

func (*NotificationBuilder) Merge

func (b *NotificationBuilder) Merge(data map[string]interface{}) *NotificationBuilder

func (*NotificationBuilder) SetAlertText

func (b *NotificationBuilder) SetAlertText(text string) *NotificationBuilder

func (*NotificationBuilder) SetBadgeCount

func (b *NotificationBuilder) SetBadgeCount(count int) *NotificationBuilder

func (*NotificationBuilder) SetContentAvailable

func (b *NotificationBuilder) SetContentAvailable(value bool) *NotificationBuilder

func (*NotificationBuilder) SetSoundName

func (b *NotificationBuilder) SetSoundName(name string) *NotificationBuilder

type SendResult

type SendResult struct {
	StatusCode int
	// contains filtered or unexported fields
}

func (*SendResult) ErrorReason

func (r *SendResult) ErrorReason() string

func (*SendResult) Id

func (r *SendResult) Id() string

func (*SendResult) Success

func (r *SendResult) Success() bool

Jump to

Keyboard shortcuts

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