hermes

package module
v0.0.0-...-9c6dc8e Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 7 Imported by: 0

README

Hermes

codecov Go Report Card

The Greek Messenger God

And a set of communication tools that I want to be able to reuse in my Go code.

liable to be worthless, use at your own risk.

credit egonelbre/gophers

credit https://github.com/egonelbre/gophers

To Do:

  • finish send method for Email struct
  • add GH CI/CD since TravisCI credit expired

Documentation

Index

Constants

View Source
const (
	SendInBlue = iota
	SendGrid
	MailGun
)

constant uint values for the choices of platform

Variables

View Source
var EnvVarNames = map[uint]map[string]string{
	SendGrid: {
		"key":    "SENDGRID_API_KEY",
		"sender": "SENDGRID_SENDER",
	},
	SendInBlue: {
		"key":    "SENDINBLUE_API_KEY",
		"sender": "SENDINBLUE_SENDER",
	},
	MailGun: {
		"key":     "MAILGUN_API_KEY",
		"baseurl": "MAILGUN_BASE_URL",
	},
}

EnvVarNames stores the set of required .env keys required

by each platform when sending

Functions

This section is empty.

Types

type Email

type Email struct {
	ToName      string
	ToAddr      string
	TextBody    string
	Subject     string
	ReplyToName string
	ReplyToAddr string
	HTMLBody    string
	FromName    string
	FromAddr    string
	// contains filtered or unexported fields
}

Email defineds a data structure for a single message from one to one person independent of platform

func NewTransactional

func NewTransactional() (Email, error)

NewTransactional looks at the environment and returns a sendable email or an error

func NewTransactionalWithEnv

func NewTransactionalWithEnv(creds map[string]string, platform uint) Email

NewTransactionalWithEnv can be called with the environment variables rather than parsing them with os.GetEnv

func (*Email) Send

func (e *Email) Send() (err error)

Send a platform ambiguous email structure :D

type Sendable

type Sendable interface {
	Send() error
}

Sendable interface enforces structure across sub-libraries

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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