astisparkpost

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 8 Imported by: 0

README

// TODO

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Key = flag.String("sparkpost-key", "", "the SparkPost key")
)

Flags

Functions

This section is empty.

Types

type Address

type Address struct {
	Email    string `json:"email,omitempty"`
	HeaderTo string `json:"header_to,omitempty"`
	Name     string `json:"name,omitempty"`
}

type Attachment

type Attachment struct {
	Data string `json:"data,omitempty"`
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

type Client

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

Client represents the client

func New

func New(c Configuration) *Client

New creates a new client

func (*Client) CreateTransmission

func (c *Client) CreateTransmission(t Transmission) (r TransmissionResults, err error)

CreateLink creates a link

type Configuration

type Configuration struct {
	Key    string `toml:"key"`
	Sender astikit.HTTPSenderOptions
}

Configuration represents the lib's configuration

func FlagConfig

func FlagConfig() Configuration

FlagConfig generates a Configuration based on flags

type Error

type Error struct {
	Code        string `json:"code"`
	Description string `json:"description"`
	Message     string `json:"message"`
}

type ErrorPayload

type ErrorPayload struct {
	Errors []Error `json:"errors"`
}

type Headers

type Headers map[string]string

type InlineContent

type InlineContent struct {
	Attachments  []Attachment  `json:"attachments,omitempty"`
	From         *Address      `json:"from,omitempty"`
	Headers      *Headers      `json:"headers,omitempty"`
	HTML         string        `json:"html,omitempty"`
	InlineImages []InlineImage `json:"inline_images,omitempty"`
	ReplyTo      string        `json:"reply_to,omitempty"`
	Subject      string        `json:"subject,omitempty"`
	Text         string        `json:"text,omitempty"`
}

type InlineImage

type InlineImage struct {
	Data string `json:"data,omitempty"`
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

type Metadata

type Metadata map[string]string

type Recipient

type Recipient struct {
	Address          *Address          `json:"address,omitempty"`
	Metadata         *Metadata         `json:"metadata,omitempty"`
	ReturnPath       string            `json:"return_path,omitempty"`
	SubstitutionData *SubstitutionData `json:"substitution_data,omitempty"`
	Tags             []string          `json:"tags,omitempty"`
}

type SubstitutionData

type SubstitutionData map[string]string

type Transmission

type Transmission struct {
	CampaignID       string               `json:"campaign_id,omitempty"`
	Content          *InlineContent       `json:"content,omitempty"`
	Description      string               `json:"description,omitempty"`
	Metadata         *Metadata            `json:"metadata,omitempty"`
	Options          *TransmissionOptions `json:"options,omitempty"`
	Recipients       []Recipient          `json:"recipients,omitempty"`
	ReturnPath       string               `json:"return_path,omitempty"`
	SubstitutionData *SubstitutionData    `json:"substitution_data,omitempty"`
}

type TransmissionOptions

type TransmissionOptions struct {
	Sandbox bool `json:"sandbox,omitempty"`
}

type TransmissionResults

type TransmissionResults struct {
	ID                      string `json:"id"`
	TotalAcceptedRecipients int    `json:"total_accepted_recipients"`
	TotalRejectedRecipients int    `json:"total_rejected_recipients"`
}

Jump to

Keyboard shortcuts

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