Documentation ¶
Index ¶
- Constants
- func ParseARNFromError(err error) (arn string, ok bool)
- type PlatformApplication
- type PlatformEndpoint
- func (e *PlatformEndpoint) Enable() bool
- func (e *PlatformEndpoint) GetARN() (endpointARN string)
- func (e *PlatformEndpoint) GetToken() (token string)
- func (e *PlatformEndpoint) Publish(msg string, badge int) error
- func (e *PlatformEndpoint) PublishWithOption(msg string, opt map[string]interface{}) error
- func (e *PlatformEndpoint) UpdateAsDisable() error
- func (e *PlatformEndpoint) UpdateToken(token string) error
- type Platforms
- type SNS
- func (svc *SNS) BulkPublish(tokens map[string][]string, msg string) error
- func (svc *SNS) BulkPublishByDevice(device string, tokens []string, msg string) error
- func (svc *SNS) CreateTopic(name string) (*Topic, error)
- func (svc *SNS) Errorf(format string, v ...interface{})
- func (svc *SNS) GetEndpoint(arn string) (*PlatformEndpoint, error)
- func (svc *SNS) GetPlatformApplicationApple() *PlatformApplication
- func (svc *SNS) GetPlatformApplicationGoogle() *PlatformApplication
- func (svc *SNS) Infof(format string, v ...interface{})
- func (svc *SNS) Publish(arn string, msg string, options map[string]interface{}) error
- func (svc *SNS) PublishAPNSByToken(token string, msg string, badge int) error
- func (svc *SNS) PublishByToken(device, token string, msg string, badge int) error
- func (svc *SNS) PublishGCMByToken(token string, msg string, badge int) error
- func (svc *SNS) RegisterEndpoint(device, token string) (*PlatformEndpoint, error)
- func (svc *SNS) RegisterEndpointWithUserData(device, token, userData string) (*PlatformEndpoint, error)
- func (svc *SNS) SetAsProduction()
- func (svc *SNS) SetLogger(logger log.Logger)
- type Topic
Constants ¶
const ( AppTypeAPNS = "APNS" AppTypeAPNSSandbox = "APNS_SANDBOX" AppTypeGCM = "GCM" ProtocolApplication = "application" )
Application types
Variables ¶
This section is empty.
Functions ¶
func ParseARNFromError ¶
ParseARNFromError extracts ARN string from error message.
Types ¶
type PlatformApplication ¶
type PlatformApplication struct {
// contains filtered or unexported fields
}
PlatformApplication is struct for Platform Application.
func (*PlatformApplication) CreateEndpoint ¶
func (a *PlatformApplication) CreateEndpoint(token string) (*PlatformEndpoint, error)
CreateEndpoint creates Endpoint(add device).
func (*PlatformApplication) CreateEndpointWithUserData ¶
func (a *PlatformApplication) CreateEndpointWithUserData(token, userData string) (*PlatformEndpoint, error)
CreateEndpointWithUserData creates Endpoint(add device) with CustomUserData.
func (*PlatformApplication) SetUserData ¶
func (a *PlatformApplication) SetUserData(userData string)
SetUserData sets CustomUserData.
type PlatformEndpoint ¶
type PlatformEndpoint struct {
// contains filtered or unexported fields
}
PlatformEndpoint is struct for Platform Endpoint.
func (*PlatformEndpoint) Enable ¶
func (e *PlatformEndpoint) Enable() bool
Enable returns info that endpoint is Enable or not.
func (*PlatformEndpoint) GetARN ¶
func (e *PlatformEndpoint) GetARN() (endpointARN string)
GetARN returns endpoint ARN.
func (*PlatformEndpoint) GetToken ¶
func (e *PlatformEndpoint) GetToken() (token string)
GetToken returns endpoint Token.
func (*PlatformEndpoint) Publish ¶
func (e *PlatformEndpoint) Publish(msg string, badge int) error
Publish sends push notification to the endpoint.
func (*PlatformEndpoint) PublishWithOption ¶
func (e *PlatformEndpoint) PublishWithOption(msg string, opt map[string]interface{}) error
PublishWithOption sends push notification to the endpoint with optional params.
func (*PlatformEndpoint) UpdateAsDisable ¶
func (e *PlatformEndpoint) UpdateAsDisable() error
UpdateAsDisable updates as `Enabled` is false.
func (*PlatformEndpoint) UpdateToken ¶
func (e *PlatformEndpoint) UpdateToken(token string) error
UpdateToken updates token and `Enabled` is true.
type Platforms ¶
Platforms contations Platforms Application ARNs.
func (Platforms) GetARNByType ¶
GetARNByType returns ARN for application platform by device type.
type SNS ¶
type SNS struct {
// contains filtered or unexported fields
}
SNS is AWS SNS client and has platform application and topic list.
func (*SNS) BulkPublish ¶
BulkPublish sends mobile notification for many endpoints. tokens is map of string slices, each key stands for device, like "android"/"ios" ex) tokens := map[string][]string{ "android": []string{"token1", "token2"}, "ios": []string{"token3", "token4"}}
func (*SNS) BulkPublishByDevice ¶
BulkPublishByDevice sends mobile notification to many endpoints. (supports single device only)
func (*SNS) CreateTopic ¶
CreateTopic creates Topic.
func (*SNS) GetEndpoint ¶
func (svc *SNS) GetEndpoint(arn string) (*PlatformEndpoint, error)
GetEndpoint gets *PlatformEndpoint by ARN.
func (*SNS) GetPlatformApplicationApple ¶
func (svc *SNS) GetPlatformApplicationApple() *PlatformApplication
GetPlatformApplicationApple returns *PlatformApplication for iOS APNS.
func (*SNS) GetPlatformApplicationGoogle ¶
func (svc *SNS) GetPlatformApplicationGoogle() *PlatformApplication
GetPlatformApplicationGoogle returns *PlatformApplication for Android GCM.
func (*SNS) PublishAPNSByToken ¶
PublishAPNSByToken sends push message for iOS device by device token
func (*SNS) PublishByToken ¶
PublishByToken sends push message by device token
func (*SNS) PublishGCMByToken ¶
PublishGCMByToken sends push message for Android device by device token
func (*SNS) RegisterEndpoint ¶
func (svc *SNS) RegisterEndpoint(device, token string) (*PlatformEndpoint, error)
RegisterEndpoint creates endpoint(device) to platform application.
func (*SNS) RegisterEndpointWithUserData ¶
func (svc *SNS) RegisterEndpointWithUserData(device, token, userData string) (*PlatformEndpoint, error)
RegisterEndpointWithUserData creates endpoint(device) and CustomUserData to platform application.
func (*SNS) SetAsProduction ¶
func (svc *SNS) SetAsProduction()
SetAsProduction sets productiom mode flag.