Documentation
¶
Index ¶
- Constants
- func AuthKeyFromBytes(bytes []byte) (*ecdsa.PrivateKey, error)
- func AuthKeyFromFile(filename string) (*ecdsa.PrivateKey, error)
- func BuildPayload(aps *APS, custom map[string]interface{}) map[string]interface{}
- func GenerateBearer(key *ecdsa.PrivateKey, keyId, teamId string, issuedAt int64) (string, error)
- type APS
- type Alert
- type Client
- type Notification
- func (n *Notification) BuildRequest() (*http.Request, error)
- func (n *Notification) BuildRequestWithContext(ctx context.Context) (*http.Request, error)
- func (n *Notification) MarshalJSON() ([]byte, error)
- func (n *Notification) Path() string
- func (n *Notification) SetHeaders(h http.Header)
- func (n *Notification) URL() string
- type Response
- type Sound
- type Token
Constants ¶
View Source
const ( HostDevelopment = "https://api.sandbox.push.apple.com" HostDevelopmentPort2197 = "https://api.sandbox.push.apple.com:2197" HostProduction = "https://api.push.apple.com" HostProductionPort2197 = "https://api.push.apple.com:2197" )
View Source
const ( PushTypeAlert = "alert" PushTypeBackground = "background" PushTypeVoIP = "voip" PushTypeComplication = "complication" PushTypeFileprovider = "fileprovider" PushTypeMDM = "mdm" )
View Source
const ( PriorityLow = 5 PriorityHigh = 10 )
View Source
const SoundDefault = "default"
View Source
const StatusSent = http.StatusOK
Variables ¶
This section is empty.
Functions ¶
func AuthKeyFromBytes ¶
func AuthKeyFromBytes(bytes []byte) (*ecdsa.PrivateKey, error)
func AuthKeyFromFile ¶
func AuthKeyFromFile(filename string) (*ecdsa.PrivateKey, error)
func BuildPayload ¶
func GenerateBearer ¶
Types ¶
type APS ¶
type APS struct { Alert interface{} `json:"alert,omitempty"` Badge interface{} `json:"badge,omitempty"` Sound interface{} `json:"sound,omitempty"` ThreadID string `json:"thread-id,omitempty"` Category string `json:"category,omitempty"` ContentAvailable int `json:"content-available,omitempty"` MutableContent int `json:"mutable-content,omitempty"` TargetContentID string `json:"target-content-id,omitempty"` URLArgs []string `json:"url-args,omitempty"` }
type Alert ¶
type Alert struct { Title string `json:"title,omitempty"` Subtitle string `json:"subtitle,omitempty"` Body string `json:"body,omitempty"` LaunchImage string `json:"launch-image,omitempty"` TitleLocKey string `json:"title-loc-key,omitempty"` TitleLocArgs []string `json:"title-loc-args,omitempty"` SubtitleLocKey string `json:"subtitle-loc-key,omitempty"` SubtitleLocArgs []string `json:"subtitle-loc-args,omitempty"` LocKey string `json:"loc-key,omitempty"` LocArgs []string `json:"loc-args,omitempty"` Action string `json:"action,omitempty"` ActionLocKey string `json:"action-loc-key,omitempty"` SummaryArg string `json:"summary-arg,omitempty"` SummaryArgCount int `json:"summary-arg-count,omitempty"` }
type Client ¶
func (*Client) PushWithContext ¶
type Notification ¶
type Notification struct { DeviceToken string Host string ID string // header: apns-id Topic string // header: apns-topic PushType string // header: apns-push-type Expiration string // header: apns-expiration Priority int // header: apns-priority CollapseID string // header: apns-collapse-id Payload interface{} }
func (*Notification) BuildRequest ¶
func (n *Notification) BuildRequest() (*http.Request, error)
func (*Notification) BuildRequestWithContext ¶
func (*Notification) MarshalJSON ¶
func (n *Notification) MarshalJSON() ([]byte, error)
func (*Notification) Path ¶
func (n *Notification) Path() string
func (*Notification) SetHeaders ¶
func (n *Notification) SetHeaders(h http.Header)
func (*Notification) URL ¶
func (n *Notification) URL() string
type Response ¶
Click to show internal directories.
Click to hide internal directories.