notification

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2017 License: BSD-3-Clause Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmailAlreadySent = NewError(1000, "email already sent")
)

Errors that are related to the Notification Service.

View Source
var (
	// ErrorRegistry is a map of error codes to errors.
	// It is usually used in gopherpit.com/gopherpit/pkg/client.Client.
	ErrorRegistry = apiClient.NewMapErrorRegistry(nil)
)

Functions

This section is empty.

Types

type Email

type Email struct {
	From      string   `json:"from"`
	To        []string `json:"to"`
	CC        []string `json:"cc"`
	BCC       []string `json:"bcc"`
	ReplyTo   string   `json:"reply-to"`
	Subject   string   `json:"subject"`
	Body      string   `json:"body"`
	HTML      string   `json:"html"`
	CheckSent bool     `json:"check-sent"`
}

Email represents an e-mail message.

type Error

type Error struct {
	// Message is a text that describes an error.
	Message string `json:"message"`
	// Code is a number that identifies error.
	// It allows error identification when serialization is involved.
	Code int `json:"code"`
}

Error is a structure that holds error message and code.

func NewError

func NewError(code int, message string) (err *Error)

NewError creates an instance of Error and adds it to ErrorRegistry. If error code already exists in ErrorRegistry, it panics.

func (*Error) Error

func (e *Error) Error() string

Error returns error message.

type Service

type Service interface {
	// SendEmail sends an e-mail message and returns it's ID.
	SendEmail(email Email) (id string, err error)
	// IsEmailOptedOut returns true or false if e-mail address
	// is marked not to send any e-mail messages to.
	IsEmailOptedOut(email string) (yes bool, err error)
	// OptOutEmail marks an e-mail address not to send any e-mail messages to.
	OptOutEmail(email string) (err error)
	// RemoveOptedOutEmail removes an opt-out mark previosulu set by
	// OptOutEmail.
	RemoveOptedOutEmail(email string) (err error)
}

Service defines functions that Notification Service must implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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