sns

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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

type Platforms struct {
	Production bool

	Apple  string
	Google string
}

Platforms contations Platforms Application ARNs.

func (Platforms) GetARNByType added in v1.0.0

func (p Platforms) GetARNByType(typ string) (arn string)

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 New added in v1.0.0

func New(conf config.Config, pf Platforms) (*SNS, error)

New returns initialized *SNS. use ARNs in given Platforms.

func (*SNS) BulkPublish added in v1.0.0

func (svc *SNS) BulkPublish(tokens map[string][]string, msg string) error

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

func (svc *SNS) BulkPublishByDevice(device string, tokens []string, msg string) error

BulkPublishByDevice sends mobile notification to many endpoints. (supports single device only)

func (*SNS) CreateTopic added in v1.0.0

func (svc *SNS) CreateTopic(name string) (*Topic, error)

CreateTopic creates Topic.

func (*SNS) Errorf added in v1.0.0

func (svc *SNS) Errorf(format string, v ...interface{})

Errorf logging error information.

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) Infof added in v1.0.0

func (svc *SNS) Infof(format string, v ...interface{})

Infof logging information.

func (*SNS) Publish added in v1.0.0

func (svc *SNS) Publish(arn string, msg string, options map[string]interface{}) error

Publish sends mobile notifications to the ARN (topic or endpoint).

func (*SNS) PublishAPNSByToken added in v1.0.0

func (svc *SNS) PublishAPNSByToken(token string, msg string, badge int) error

PublishAPNSByToken sends push message for iOS device by device token

func (*SNS) PublishByToken added in v1.0.0

func (svc *SNS) PublishByToken(device, token string, msg string, badge int) error

PublishByToken sends push message by device token

func (*SNS) PublishGCMByToken added in v1.0.0

func (svc *SNS) PublishGCMByToken(token string, msg string, badge int) error

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.

func (*SNS) SetLogger added in v1.0.0

func (svc *SNS) SetLogger(logger log.Logger)

SetLogger sets logger.

type Topic added in v1.0.0

type Topic struct {
	// contains filtered or unexported fields
}

Topic is struct for Topic.

func NewTopic

func NewTopic(svc *SNS, arn, name string) *Topic

NewTopic returns initialized *Topic.

func (*Topic) Delete added in v1.0.0

func (t *Topic) Delete() error

Delete deltes the topic.

func (*Topic) Publish added in v1.0.0

func (t *Topic) Publish(msg string) error

Publish sends notification to the topic.

func (*Topic) Subscribe added in v1.0.0

func (t *Topic) Subscribe(endpointARN, protocol string) (subscriptionARN string, err error)

Subscribe operates `Subscribe` and returns `SubscriptionArn`.

Jump to

Keyboard shortcuts

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