Documentation ¶
Index ¶
- Constants
- 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 ¶
This section is empty.
Types ¶
type PlatformApplication ¶ added in v1.0.0
type PlatformApplication struct {
// contains filtered or unexported fields
}
PlatformApplication is struct for Platform Application.
func (*PlatformApplication) CreateEndpoint ¶ added in v1.0.0
func (a *PlatformApplication) CreateEndpoint(token string) (*PlatformEndpoint, error)
CreateEndpoint creates Endpoint(add device).
func (*PlatformApplication) CreateEndpointWithUserData ¶ added in v1.0.0
func (a *PlatformApplication) CreateEndpointWithUserData(token, userData string) (*PlatformEndpoint, error)
CreateEndpointWithUserData creates Endpoint(add device) with CustomUserData.
func (*PlatformApplication) SetUserData ¶ added in v1.0.0
func (a *PlatformApplication) SetUserData(userData string)
SetUserData sets CustomUserData.
type PlatformEndpoint ¶ added in v1.0.0
type PlatformEndpoint struct {
// contains filtered or unexported fields
}
PlatformEndpoint is struct for Platform Endpoint.
func (*PlatformEndpoint) Enable ¶ added in v1.0.0
func (e *PlatformEndpoint) Enable() bool
Enable returns info that endpoint is Enable or not.
func (*PlatformEndpoint) GetARN ¶ added in v1.0.0
func (e *PlatformEndpoint) GetARN() (endpointARN string)
GetARN returns endpoint ARN.
func (*PlatformEndpoint) GetToken ¶ added in v1.0.0
func (e *PlatformEndpoint) GetToken() (token string)
GetToken returns endpoint Token.
func (*PlatformEndpoint) Publish ¶ added in v1.0.0
func (e *PlatformEndpoint) Publish(msg string, badge int) error
Publish sends push notification to the endpoint.
func (*PlatformEndpoint) PublishWithOption ¶ added in v1.0.0
func (e *PlatformEndpoint) PublishWithOption(msg string, opt map[string]interface{}) error
PublishWithOption sends push notification to the endpoint with optional params.
func (*PlatformEndpoint) UpdateAsDisable ¶ added in v1.0.0
func (e *PlatformEndpoint) UpdateAsDisable() error
UpdateAsDisable updates as `Enabled` is false.
func (*PlatformEndpoint) UpdateToken ¶ added in v1.0.0
func (e *PlatformEndpoint) UpdateToken(token string) error
UpdateToken updates token and `Enabled` is true.
type Platforms ¶ added in v1.0.0
Platforms contations Platforms Application ARNs.
func (Platforms) GetARNByType ¶ added in v1.0.0
GetARNByType returns ARN for application platform by device type.
type SNS ¶ added in v1.0.0
type SNS struct {
// contains filtered or unexported fields
}
SNS is AWS SNS client and has platform application and topic list.
func (*SNS) BulkPublish ¶ added in v1.0.0
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 ¶ added in v1.0.0
BulkPublishByDevice sends mobile notification to many endpoints. (supports single device only)
func (*SNS) CreateTopic ¶ added in v1.0.0
CreateTopic creates Topic.
func (*SNS) GetEndpoint ¶ added in v1.0.0
func (svc *SNS) GetEndpoint(arn string) (*PlatformEndpoint, error)
GetEndpoint gets *PlatformEndpoint by ARN.
func (*SNS) GetPlatformApplicationApple ¶ added in v1.0.0
func (svc *SNS) GetPlatformApplicationApple() *PlatformApplication
GetPlatformApplicationApple returns *PlatformApplication for iOS APNS.
func (*SNS) GetPlatformApplicationGoogle ¶ added in v1.0.0
func (svc *SNS) GetPlatformApplicationGoogle() *PlatformApplication
GetPlatformApplicationGoogle returns *PlatformApplication for Android GCM.
func (*SNS) Publish ¶ added in v1.0.0
Publish sends mobile notifications to the ARN (topic or endpoint).
func (*SNS) PublishAPNSByToken ¶ added in v1.0.0
PublishAPNSByToken sends push message for iOS device by device token
func (*SNS) PublishByToken ¶ added in v1.0.0
PublishByToken sends push message by device token
func (*SNS) PublishGCMByToken ¶ added in v1.0.0
PublishGCMByToken sends push message for Android device by device token
func (*SNS) RegisterEndpoint ¶ added in v1.0.0
func (svc *SNS) RegisterEndpoint(device, token string) (*PlatformEndpoint, error)
RegisterEndpoint creates endpoint(device) to platform application.
func (*SNS) RegisterEndpointWithUserData ¶ added in v1.0.0
func (svc *SNS) RegisterEndpointWithUserData(device, token, userData string) (*PlatformEndpoint, error)
RegisterEndpointWithUserData creates endpoint(device) and CustomUserData to platform application.
func (*SNS) SetAsProduction ¶ added in v1.0.0
func (svc *SNS) SetAsProduction()
SetAsProduction sets productiom mode flag.