wns

package module
v0.0.0-...-75372ea Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2017 License: MIT Imports: 5 Imported by: 0

README

go-wns

Simple Go package for working with Windows Push Notification Services (WNS).

Example

client := wns.Client{}
client.Init("{Package Security Identifier}", "{Client Secret}")
notification := wns.NewToast().SetTemplate("ToastText02").
  AddText("1", "Title").
  AddText("2", "Text")

success, err := client.Send("{Channel URL}", notification)
if err != nil {
  log.Println(err.Code, err.Message)
}

You can find more templates here.

Documentation

Index

Constants

View Source
const (
	TypeToast = "toast"
	TypeTile  = "tile"
	TypeBadge = "badge"
)

Variables

This section is empty.

Functions

func GetXml

func GetXml(notification interface{}) (string, error)

func NewBadge

func NewBadge() *badge

func NewTile

func NewTile() *baseNotification

func NewToast

func NewToast() *baseNotification

Types

type Client

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

func (*Client) Init

func (c *Client) Init(clientId string, clientSecret string)

func (*Client) Send

func (c *Client) Send(channelUri string, notification NotificationInterface) (success bool, error *ClientError)

type ClientError

type ClientError struct {
	Code    int
	Message string
}

func (*ClientError) Error

func (e *ClientError) Error() string

type NotificationInterface

type NotificationInterface interface {
	GetWnsType() string
	GetXml() (string, error)
}

Jump to

Keyboard shortcuts

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