sms

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(*Message) error

Handler handles messages

type Message

type Message struct {
	Sender string `schema:"From"`

	// TODO: enforce phone number
	Recipient string `schema:"To"`

	// TODO: enforce limit
	Content string `schema:"Body"`
}

Message is a phone message

func (*Message) Response

func (m *Message) Response(content string) *Message

Response returns a response to the message

func (*Message) String

func (m *Message) String() string

type ShortMessageService

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

ShortMessageService is a service for sending and receiving short messages

func New

func New(sid, token string, handler Handler) *ShortMessageService

New returns a new short service message

func (*ShortMessageService) Send

func (sms *ShortMessageService) Send(msg *Message)

Send sends a message

func (*ShortMessageService) ServeHTTP

func (sms *ShortMessageService) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ShortMessageService) Stop

func (*ShortMessageService) Stop() error

Stop stops the ShortMessageService

Jump to

Keyboard shortcuts

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