sns

package
v0.0.0-...-c0eba6c Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

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

	MessageBodyLimit = 2000
)

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) Publish

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

Publish notification for arn(topic or endpoint)

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 NewApp

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

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
}

func NewEndpoint

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

func (*SNSEndpoint) GetARN

func (e *SNSEndpoint) GetARN() string

return Endpoint ARN

func (*SNSEndpoint) Publish

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

Publish notification to the endpoint

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