Documentation
¶
Index ¶
- type APNSAlert
- type APNSNotification
- type APNSPayload
- type FCMNotification
- type FCMPayload
- type Message
- type Service
- func (s *Service) CreateAPNSApplication(name string, cert string, key string, sandbox bool) (string, error)
- func (s *Service) CreateApplication(name string, platform string, attr map[string]*string) (string, error)
- func (s *Service) CreateFCMApplication(name string, key string) (string, error)
- func (s *Service) DeleteApplication(appArn string) error
- func (s *Service) DeregisterDevice(endpointArn string) error
- func (s *Service) RegisterDevice(appArn, deviceToken string) (string, error)
- func (s *Service) SendToAndroid(target string, payload FCMPayload) (string, error)
- func (s *Service) SendToDevice(target string, msg Message) (string, error)
- func (s *Service) SendToIOS(target string, payload APNSPayload) (string, error)
- func (s *Service) SendToTopic(topic string, msg Message) (string, error)
- func (s *Service) UpdateAPNSApplication(arn string, cert string, key string, sandbox bool) (string, error)
- func (s *Service) UpdateApplication(appArn string, attr map[string]*string) error
- func (s *Service) UpdateFCMApplication(arn string, key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APNSAlert ¶
type APNSAlert struct {
Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
Body string `json:"body,omitempty"`
}
APNSAlert represents the APNS alert object
type APNSNotification ¶
type APNSNotification struct {
Alert *APNSAlert `json:"alert,omitempty"`
Sound string `json:"sound,omitempty"`
Badge *int `json:"badge,omitempty"`
ContentAvailable int `json:"content-available,omitempty"`
Category *string `json:"category,omitempty"`
MutableContent *int `json:"mutable-content,omitempty"`
}
APNSNotification represents the user-visible of the notification for APNS platform
type APNSPayload ¶
type APNSPayload struct {
Data map[string]interface{}
Notification *APNSNotification
HighPriority bool
}
APNSPayload represents the APNS message payload
func (APNSPayload) MarshalJSON ¶
func (ap APNSPayload) MarshalJSON() ([]byte, error)
MarshalJSON modifies json marshal output for APNSPayload
type FCMNotification ¶
type FCMNotification struct {
Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
Body string `json:"body,omitempty"`
Sound string `json:"sound,omitempty"`
Badge *int `json:"badge,omitempty"`
}
FCMNotification represents the user-visible of the notification for FCM platform
type FCMPayload ¶
type FCMPayload struct {
Data map[string]interface{}
Notification *FCMNotification
HighPriority bool
}
FCMPayload represents the FCM message payload
func (FCMPayload) MarshalJSON ¶
func (fp FCMPayload) MarshalJSON() ([]byte, error)
MarshalJSON modifies json marshal output for FCMPayload
type Message ¶
type Message struct {
APNS *APNSPayload
APNSSandbox *APNSPayload
FCM *FCMPayload
}
Message represents the message structure for SNS message
func (Message) MarshalJSON ¶
MarshalJSON modifies json marshal output for Message
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents the snsutil service
func (*Service) CreateAPNSApplication ¶
func (s *Service) CreateAPNSApplication(name string, cert string, key string, sandbox bool) (string, error)
CreateAPNSApplication creates new Apple APNS platform application on SNS service
func (*Service) CreateApplication ¶
func (s *Service) CreateApplication(name string, platform string, attr map[string]*string) (string, error)
CreateApplication creates new platform application on SNS service
func (*Service) CreateFCMApplication ¶
CreateFCMApplication creates new FCM platform application on SNS service
func (*Service) DeleteApplication ¶
DeleteApplication deletes the platform application from SNS service
func (*Service) DeregisterDevice ¶
DeregisterDevice remove a device from SNS application
func (*Service) RegisterDevice ¶
RegisterDevice registers a device with SNS application
func (*Service) SendToAndroid ¶
func (s *Service) SendToAndroid(target string, payload FCMPayload) (string, error)
SendToAndroid sends push notification to an Android device using FCM platform
func (*Service) SendToDevice ¶
SendToDevice sends push notification to a device. The "msg" should contains correct payload for FCM or APNS plarform, depends on the "target" OS
func (*Service) SendToIOS ¶
func (s *Service) SendToIOS(target string, payload APNSPayload) (string, error)
SendToIOS sends push notification to an IOS device using APNS platform
func (*Service) SendToTopic ¶
SendToTopic sends push notification to a topic. The "msg" should contains payload for both FCM and APNS plarforms
func (*Service) UpdateAPNSApplication ¶
func (s *Service) UpdateAPNSApplication(arn string, cert string, key string, sandbox bool) (string, error)
UpdateAPNSApplication updates Apple APNS platform application attributes
func (*Service) UpdateApplication ¶
UpdateApplication updates the platform application attributes