sns

package
v0.0.0-...-474e430 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppTypeAPNS        = "apns"
	AppTypeAPNSSandbox = "apns_sandbox"
	AppTypeGCM         = "gcm"

	MessageBodyLimit = 2000

	ProtocolApplication = "application"
)

Variables

This section is empty.

Functions

func String

func String(v string) *string

Types

type AmazonSNS

type AmazonSNS struct {
	Client *SDK.SNS
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *AmazonSNS

Create new AmazonSQS struct

func (*AmazonSNS) BulkPublish

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

Publish 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 (*AmazonSNS) BulkPublishByDevice

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

Publish notification for many endpoints (supports single device only)

func (*AmazonSNS) CreateTopic

func (svc *AmazonSNS) CreateTopic(name string) (*SNSTopic, error)

Create SNS Topic and return `TopicARN`

func (*AmazonSNS) GetApp

func (svc *AmazonSNS) GetApp(typ string) (*SNSApp, error)

Get SNSApp struct

func (*AmazonSNS) GetAppAPNS

func (svc *AmazonSNS) GetAppAPNS() (*SNSApp, error)

Get SNSApp struct of Apple Push Notification Service for iOS

func (*AmazonSNS) GetAppGCM

func (svc *AmazonSNS) GetAppGCM() (*SNSApp, error)

Get SNSApp struct for Google Cloud Messaging for Android

func (*AmazonSNS) GetEndpoint

func (svc *AmazonSNS) GetEndpoint(arn string) (*SNSEndpoint, error)

GetEndpoint

func (*AmazonSNS) NewApp

func (svc *AmazonSNS) NewApp(arn, pf string) *SNSApp

func (*AmazonSNS) NewApplicationEndpoint

func (svc *AmazonSNS) NewApplicationEndpoint(arn string) *SNSEndpoint

func (*AmazonSNS) NewEndpoint

func (svc *AmazonSNS) NewEndpoint(arn, protocol string) *SNSEndpoint

func (*AmazonSNS) NewTopic

func (svc *AmazonSNS) NewTopic(arn, name string) *SNSTopic

func (*AmazonSNS) Publish

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

Publish notification for arn(topic or endpoint)

func (*AmazonSNS) PublishAPNSByToken

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

PublishAPNSByToken sends push message for iOS device by device token

func (*AmazonSNS) PublishByToken

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

PublishByToken sends push message by device token

func (*AmazonSNS) PublishGCMByToken

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

PublishGCMByToken sends push message for Android device by device token

func (*AmazonSNS) RegisterEndpoint

func (svc *AmazonSNS) RegisterEndpoint(device, token string) (*SNSEndpoint, error)

Register endpoint(device) to application

type SNSApp

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

func (*SNSApp) CreateEndpoint

func (a *SNSApp) CreateEndpoint(token string) (*SNSEndpoint, error)

Create Endpoint(add device) and return `EndpointARN`

type SNSEndpoint

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

SNSEndpoint is struct for endpoint(device / )

func (*SNSEndpoint) Enable

func (e *SNSEndpoint) Enable() bool

Enable returns endpoint Enable

func (*SNSEndpoint) GetARN

func (e *SNSEndpoint) GetARN() string

GetARN returns endpoint ARN

func (*SNSEndpoint) GetToken

func (e *SNSEndpoint) GetToken() string

GetToken returns endpoint Token

func (*SNSEndpoint) Publish

func (e *SNSEndpoint) Publish(msg string, badge int) error

Publish sends push notification to the endpoint

func (*SNSEndpoint) SetToken

func (e *SNSEndpoint) SetToken(token string)

SetToken set endpoint Token

func (*SNSEndpoint) UpdateToken

func (e *SNSEndpoint) UpdateToken() error

UpdateToken updates endpoint attributes

func (*SNSEndpoint) UpdateTokenAsDisable

func (e *SNSEndpoint) UpdateTokenAsDisable() error

UpdateTokenAsEnable updates token and enabled as false

func (*SNSEndpoint) UpdateTokenAsEnable

func (e *SNSEndpoint) UpdateTokenAsEnable() error

UpdateTokenAsEnable updates token and enabled as true

type SNSTopic

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

func NewTopic

func NewTopic(arn, name string, svc *AmazonSNS) *SNSTopic

func (*SNSTopic) Delete

func (t *SNSTopic) Delete() error

Delete topic

func (*SNSTopic) Publish

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

Publish notification to the topic

func (*SNSTopic) Subscribe

func (t *SNSTopic) Subscribe(endpoint *SNSEndpoint) (string, error)

Subscribe

Jump to

Keyboard shortcuts

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