msg

package
v0.0.0-...-adebd87 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartSendingMessages

func StartSendingMessages(ctx context.Context, mc chan Request, m Messenger)

StartSendingMessages starts background worker that sends short messages.

Types

type Birdman

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

Birdman or simply aviculturist. Knows how to deal with MessageBird.com API. Wraps original MessageBird client in order to avoid coupling with vendor specific structs in packages that will consume this functionality.

func NewMsgBirdClient

func NewMsgBirdClient(token string, mc chan Request) *Birdman

NewMsgBirdClient creates instance of Birdman

func (*Birdman) Lookup

func (c *Birdman) Lookup(msisdn string) (string, error)

Lookup is used to get detailes about MSISDN. We need only country code.

func (*Birdman) RequestSMS

func (c *Birdman) RequestSMS(sender, recipient, text string)

RequestSMS adds SMS request to the channel, it will be send sometime in the future.

func (*Birdman) SendText

func (c *Birdman) SendText(sender, recipient, text string) error

SendText sends SMS from sender to a recipient with provided text.

type Messenger

type Messenger interface {
	SendText(sender, msisdn, text string) error
}

Messenger is used to send text messages.

type Request

type Request struct {
	Sender    string
	Recipient string
	Text      string
}

Request stores SMS details that will be used in NewMessage.

Jump to

Keyboard shortcuts

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