email

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TemplateNotFoundErr is returned by MailTemplates if the
	// requested template cannot be found
	TemplateNotFoundErr = errors.Errorf("email template not found")
)

Functions

func PrepareMapProducedEmail

func PrepareMapProducedEmail(templates *MailTemplates, to string, kmlFile []byte, params MapProducedParameters) (*mailer.EmailJob, error)

PrepareMapProducedEmail creates an MapProducedEmail and returns a mailer.EmailJob for the email with the KML attachment.

func PrepareSpottedInFlightEmail

func PrepareSpottedInFlightEmail(templates *MailTemplates, to string, params SpottedInFlightParameters) (*mailer.EmailJob, error)

PrepareSpottedInFlightEmail creates an SpottedInFlight and returns a mailer.EmailJob for the email

func PrepareTakeoffComplete

func PrepareTakeoffComplete(templates *MailTemplates, to string, params TakeoffCompleteParams) (*mailer.EmailJob, error)

PrepareTakeoffComplete creates an TakeoffComplete and returns a mailer.EmailJob for the email

func PrepareTakeoffFromAirport

func PrepareTakeoffFromAirport(templates *MailTemplates, to string, params TakeoffParams) (*mailer.EmailJob, error)

PrepareTakeoffFromAirport creates an TakeoffFromAirport and returns a mailer.EmailJob for the email

func PrepareTakeoffUnknownAirport

func PrepareTakeoffUnknownAirport(templates *MailTemplates, to string, params TakeoffUnknownAirportParams) (*mailer.EmailJob, error)

PrepareTakeoffUnknownAirport creates an TakeoffUnknownAirport and returns a mailer.EmailJob for the email

Types

type Email

type Email string

Email - data type used to identify an email template

const (
	// MapProducedEmail - the template's name
	MapProducedEmail Email = "map_produced.tpl"
	// SpottedInFlight - the template's name
	SpottedInFlight Email = "spotted_in_flight.tpl"
	// TakeoffUnknownAirport - the template's name
	TakeoffUnknownAirport Email = "takeoff_unknown_airport.tpl"
	// TakeoffFromAirport - the template's name
	TakeoffFromAirport Email = "takeoff_from_airport.tpl"
	// TakeoffComplete - the template's name
	TakeoffComplete Email = "takeoff_complete.tpl"
)

func GetTemplates

func GetTemplates() []Email

GetTemplates returns a list of all known templates

func (Email) String

func (e Email) String() string

String - implements Stringer. Returns the template name.

type Location

type Location struct {
	// Latitude - decimal latitude
	Latitude float64
	// Longitude - decimal longitude
	Longitude float64
	// Altitude - height in ft
	// todo: Units
	Altitude int64
}

Location - a structure containing an aircraft's location

type MailTemplates

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

MailTemplates - map of Emails to parsed template

func LoadMailTemplates

func LoadMailTemplates(templates ...Email) (*MailTemplates, error)

LoadMailTemplates takes a list of Emails, loads and parses the template, initializing MapTemplates, or an error if one occurred.

func (*MailTemplates) Get

func (t *MailTemplates) Get(email Email) (*template.Template, error)

Get returns the template for Email if known, or an TemplateNotFoundErr if the Email is not known.

type MapProducedParameters

type MapProducedParameters struct {
	Project       string
	Icao          string
	CallSign      string
	StartTime     time.Time
	EndTime       time.Time
	DurationFmt   string
	StartTimeFmt  string
	StartLocation Location
	EndTimeFmt    string
	EndLocation   Location
	MapUpdated    bool
}

MapProducedParameters contains parameters for the MapProducedParameters template.

type SpottedInFlightParameters

type SpottedInFlightParameters struct {
	Project       string
	Icao          string
	CallSign      string
	StartTime     time.Time
	StartTimeFmt  string
	StartLocation Location
}

SpottedInFlightParameters contains parameters for the SpottedInFlight template.

type TakeoffCompleteParams

type TakeoffCompleteParams struct {
	Project       string
	Icao          string
	CallSign      string
	AirportName   string
	StartTimeFmt  string
	StartLocation Location
}

TakeoffCompleteParams contains parameters for the TakeoffCompleteParams template.

type TakeoffParams

type TakeoffParams struct {
	Project       string
	Icao          string
	CallSign      string
	AirportName   string
	StartTimeFmt  string
	StartLocation Location
}

TakeoffParams contains parameters for the TakeoffParams template.

type TakeoffUnknownAirportParams

type TakeoffUnknownAirportParams struct {
	Project       string
	Icao          string
	CallSign      string
	StartTimeFmt  string
	StartLocation Location
}

TakeoffUnknownAirportParams contains parameters for the TakeoffUnknownAirportParams template.

Jump to

Keyboard shortcuts

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