models

package
v0.0.0-...-56a2adc Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLimitMessagesReached = errors.New("ERR_LIMIT_REACHED")
	ErrServerError          = errors.New("ERR_INTERNAL_ERROR")
	ErrInvalidDomain        = errors.New("ERR_INVALID_DOMAIN")
	ErrInvalidAPIKey        = errors.New("ERR_INVALID_APIKEY")
	ErrInvalidMessage       = errors.New("ERR_INVALID_MESSAGE")
	ErrUnknownProvider      = errors.New("ERR_UNKNOWN_PROVIDER")
	ErrInvalidProviders     = errors.New("ERR_INVALID_PROVIDERS")
	ErrInvalidPublicAPIKey  = errors.New("ERR_INVALID_PUBAPIKEY")
	ErrLimitDailyMessages   = errors.New("ERR_DAILY_LIMIT_APIKEY")
	ErrAllLimitsReached     = errors.New("ERR_ALL_LIMITS_REACHED")
	ErrInvalidSender        = errors.New("ERR_INVALID_SENDER")
	ErrInvalidContent       = errors.New("ERR_INVALID_CONTENT")
	ErrInvalidTemplate      = errors.New("ERR_INVALID_TEMPLATE")
	ErrInvalidAttachment    = errors.New("ERR_INVALID_ATTACHMENT")
	ErrInvalidRecipients    = errors.New("ERR_INVALID_RECIPIENTS")
)

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Type     string `json:"type,omitempty"`
	Content  string `json:"content,omitempty"`
	Filename string `json:"filename,omitempty"`
	Filepath string `json:"filepath,omitempty"`
}

Attachment struct provide basic attachment information

func NewAttachment

func NewAttachment() *Attachment

NewAttachment creates a new attachment struct

func (*Attachment) SetContent

func (a *Attachment) SetContent(content string)

SetContent set a information about attachment

func (*Attachment) SetFilename

func (a *Attachment) SetFilename(filename string)

SetFilename set a name for attachment

func (*Attachment) SetFilepath

func (a *Attachment) SetFilepath(filepath string)

SetFilepath set the attachment location path

func (*Attachment) SetType

func (a *Attachment) SetType(typeA string)

SetType set attachment type

type Content

type Content struct {
	Type  string `json:"type,omitempty"`
	Value string `json:"value,omitempty"`
}

Content struct provide basic content information

func NewContent

func NewContent() *Content

NewContent creates a new content struct

func (*Content) SetType

func (c *Content) SetType(typec string)

SetType set content type

func (*Content) SetValue

func (c *Content) SetValue(value string)

SetValue set the body content

type Email

type Email struct {
	ID          int64         `json:"id,omitempty"`
	Sender      *Sender       `json:"sender,omitempty"`
	Subject     *string       `json:"subject,omitempty"`
	Content     []*Content    `json:"content,omitempty"`
	Attachments []*Attachment `json:"attachments,omitempty"`
	Recipients  *Recipients   `json:"recipients,omitempty"`
	Template    *Template     `json:"template,omitempty"`
	CreatedAt   time.Time     `json:"created_at,omitempty"`
	SendedAt    time.Time     `json:"sended_at,omitempty"`
}

EEmail struct provide plain email information

type Provider

type Provider interface {
	// contains filtered or unexported methods
}

interface provider

type Recipients

type Recipients struct {
	To  []string `json:"to,omitempty"`
	CC  []string `json:"cc,omitempty"`
	BCC []string `json:"bcc,omitempty"`
}

Content struct provide all recipients email information

func NewRecipients

func NewRecipients() *Recipients

NewRecipients creates a new recipients struct with empty list

func (*Recipients) AddBCCs

func (r *Recipients) AddBCCs(bcc ...string)

AddTos struct Add a email list of BCC recipients

func (*Recipients) AddCCs

func (r *Recipients) AddCCs(cc ...string)

AddTos struct Add a email list of CC recipients

func (*Recipients) AddTos

func (r *Recipients) AddTos(to ...string)

AddTos struct Add a email list of common recipients

type Sender

type Sender struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

Sender struct provide basic sender information

func NewSender

func NewSender() *Sender

NewSender creates a new sender struct

func (*Sender) SetEmail

func (s *Sender) SetEmail(email string)

SetEmail set sender email address

func (*Sender) SetName

func (s *Sender) SetName(name string)

SetName set sender name

type Template

type Template struct {
	ID   int64  `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

func NewTemplate

func NewTemplate() *Template

NewTemplate creates a new sender struct

func (*Template) SetID

func (t *Template) SetID(id int64)

SetID set sender id

func (*Template) SetName

func (t *Template) SetName(name string)

SetName set sender name

Jump to

Keyboard shortcuts

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