mandrill

package module
v0.0.0-...-fcd7799 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: MIT Imports: 3 Imported by: 0

README

go-mandrill

Supported methods

  • /templates/add.json
  • /templates/info.json
  • /templates/update.json
  • /templates/delete.json
  • /rejects/delete.json
  • /messages/send-template.json

Documentation

Index

Constants

View Source
const (
	ErrNameInvalidKey        = "Invalid_Key"
	ErrNameValidationError   = "ValidationError"
	ErrNameGeneralError      = "GeneralError"
	ErrNameInvalidReject     = "Invalid_Reject"
	ErrNameUnknownSubaccount = "Unknown_Subaccount"
	ErrNameInvalidTemplate   = "Invalid_Template"
	ErrNameUnknownTemplate   = "Unknown_Template"
)
View Source
const (
	MessageStatusTypeSent     MessageStatusType = "sent"
	MessageStatusTypeQueued                     = "queued"
	MessageStatusTypeRejected                   = "rejected"
	MessageStatusTypeInvalid                    = "invalid"
)
View Source
const (
	RejectReasonTypeHardBounce    RejectReasonType = "hard-bounce"
	RejectReasonTypeSoftBounce                     = "soft-bounce"
	RejectReasonTypeSpam                           = "spam"
	RejectReasonTypeUnsub                          = "unsub"
	RejectReasonTypeCustom                         = "custom"
	RejectReasonTypeInvalidSender                  = "invalid-sender"
	RejectReasonTypeInvalid                        = "invalid"
	RejectReasonTypeTestModeLimit                  = "test-mode-limit"
	RejectReasonTypeUnsigned                       = "unsigned"
	RejectReasonTypeRule                           = "rule"
)
View Source
const (
	Version = "0.1.0"
)

Variables

View Source
var (
	ToTypeTo  ToType = String("to")
	ToTypeCC         = String("cc")
	ToTypeBCC        = String("bcc")
)

Functions

func Bool

func Bool(v bool) *bool

func Int

func Int(v int) *int

func SliceString

func SliceString(v []string) *[]string

func String

func String(v string) *string

Types

type APIError

type APIError struct {
	Status  string `json:"status"`
	Code    int    `json:"code"`
	Name    string `json:"name"`
	Message string `json:"message"`
}

func (APIError) Error

func (e APIError) Error() string

type Attachment

type Attachment struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Content string `json:"content"`
}

type Client

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

func NewClient

func NewClient(apiKey string) *Client

func (*Client) MessageSendTemplate

func (c *Client) MessageSendTemplate(req *MessageSendTemplateRequest) ([]MessageSendReturn, error)

func (*Client) RejectDelete

func (c *Client) RejectDelete(req *RejectDeleteRequest) (*RejectDeleteResponse, error)

func (*Client) TemplateAdd

func (c *Client) TemplateAdd(req *TemplateAddRequest) (*Template, error)

func (*Client) TemplateDelete

func (c *Client) TemplateDelete(req *TemplateDeleteRequest) (*Template, error)

func (*Client) TemplateInfo

func (c *Client) TemplateInfo(req *TemplateInfoRequest) (*Template, error)

func (*Client) TemplateList

func (c *Client) TemplateList(req *TemplateListRequest) (*[]Template, error)

func (*Client) TemplateUpdate

func (c *Client) TemplateUpdate(req *TemplateUpdateRequest) (*Template, error)

type MergeLanguageType

type MergeLanguageType *string
var (
	MergeLanguageTypeMailchimp  MergeLanguageType = String("mailchimp")
	MergeLanguageTypeHandlebars                   = String("handlebars")
)

type Message

type Message struct {
	HTML                    *string              `json:"html"`
	Text                    *string              `json:"text"`
	Subject                 *string              `json:"subject"`
	FromEmail               *string              `json:"from_email"`
	FromName                *string              `json:"from_name"`
	To                      []To                 `json:"to"`
	Headers                 *map[string]string   `json:"headers"`
	Important               *bool                `json:"important"`
	TrackOpens              *bool                `json:"track_opens"`
	TrackClicks             *bool                `json:"track_clicks"`
	AutoText                *bool                `json:"auto_text"`
	AutoHTML                *bool                `json:"auto_html"`
	InlineCSS               *bool                `json:"inline_css"`
	URLStripQS              *bool                `json:"url_strip_qs"`
	PreserveRecipients      *bool                `json:"preserve_recipients"`
	ViewContentLink         *bool                `json:"view_content_link"`
	BCCAddress              *string              `json:"bcc_address"`
	TrackingDomain          *string              `json:"tracking_domain"`
	SigningDomain           *string              `json:"signing_domain"`
	ReturnPathDomain        *string              `json:"return_path_domain"`
	Merge                   *bool                `json:"merge"`
	MergeLanguage           MergeLanguageType    `json:"merge_language"`
	GlobalMergeVars         *[]Var               `json:"global_merge_vars"`
	MergeVars               *[]RecipientVar      `json:"merge_vars"`
	Tags                    *[]string            `json:"tags"`
	Subaccount              *string              `json:"subaccount"`
	GoogleAnalyticsDomains  *[]string            `json:"google_analytics_domains"`
	GoogleAnalyticsCampaign *string              `json:"google_analytics_campaign"`
	Metadata                *[]string            `json:"metadata"`
	RecipientMetadata       *[]RecipientMetadata `json:"recipient_metadata"`
	Attachments             *[]Attachment        `json:"attachments"`
	Images                  *[]Attachment        `json:"images"`
}

type MessageSendReturn

type MessageSendReturn struct {
	Email        string            `json:"email"`
	Status       MessageStatusType `json:"status"`
	RejectReason RejectReasonType  `json:"reject_reason"`
	ID           string            `json:"_id"`
}

type MessageSendTemplateRequest

type MessageSendTemplateRequest struct {
	TemplateName    string  `json:"template_name"`
	TemplateContent *[]Var  `json:"template_content"`
	Message         Message `json:"message"`
	Async           *bool   `json:"async"`
	IPPool          *string `json:"ip_pool"`
	SendAt          *string `json:"send_at"`
}

type MessageStatusType

type MessageStatusType string

type RecipientMetadata

type RecipientMetadata struct {
	RCPT   string                 `json:"rcpt"`
	Values map[string]interface{} `json:"values"`
}

type RecipientVar

type RecipientVar struct {
	RCPT string `json:"rcpt"`
	Var  []Var  `json:"vars"`
}

type RejectDeleteRequest

type RejectDeleteRequest struct {
	Email      string `json:"email"`
	SubAccount string `json:"subaccount"`
}

type RejectDeleteResponse

type RejectDeleteResponse struct {
	Email      string `json:"email"`
	Deleted    bool   `json:"deleted"`
	SubAccount string `json:"subaccount"`
}

type RejectReasonType

type RejectReasonType string

type Template

type Template struct {
	Slug             string   `json:"slug"`
	Name             string   `json:"name"`
	Labels           []string `json:"labels"`
	Code             string   `json:"code"`
	Subject          string   `json:"subject"`
	FromEmail        string   `json:"from_email"`
	FromName         string   `json:"from_name"`
	Text             string   `json:"text"`
	PublishName      string   `json:"publish_name"`
	PublishCode      string   `json:"publish_code"`
	PublishSubject   string   `json:"publish_subject"`
	PublishFromEmail string   `json:"publish_from_email"`
	PublishFromName  string   `json:"publish_from_name"`
	PublishText      string   `json:"publish_text"`
	PublishedAt      string   `json:"published_at"`
	CreatedAt        string   `json:"created_at"`
	UpdatedAt        string   `json:"updated_at"`
}

type TemplateAddRequest

type TemplateAddRequest struct {
	Name      string    `json:"name"`
	FromEmail *string   `json:"from_email"`
	FromName  *string   `json:"from_name"`
	Subject   *string   `json:"subject"`
	Code      *string   `json:"code"`
	Text      *string   `json:"text"`
	Publish   bool      `json:"publish"`
	Labels    *[]string `json:"labels"`
}

type TemplateDeleteRequest

type TemplateDeleteRequest struct {
	Name string `json:"name"`
}

type TemplateInfoRequest

type TemplateInfoRequest struct {
	Name string `json:"name"`
}

type TemplateListRequest

type TemplateListRequest struct {
	Label *string `json:"label"`
}

type TemplateUpdateRequest

type TemplateUpdateRequest struct {
	Name      string    `json:"name"`
	FromEmail *string   `json:"from_email"`
	FromName  *string   `json:"from_name"`
	Subject   *string   `json:"subject"`
	Code      *string   `json:"code"`
	Text      *string   `json:"text"`
	Publish   bool      `json:"publish"`
	Labels    *[]string `json:"labels"`
}

type To

type To struct {
	Email string  `json:"email"`
	Name  *string `json:"name"`
	Type  ToType  `json:"type"`
}

type ToType

type ToType *string

type Var

type Var struct {
	Name    string      `json:"name"`
	Content interface{} `json:"content"`
}

Jump to

Keyboard shortcuts

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