api

package
v0.0.0-...-8a5ee96 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormatJSON is the format constant for a JSON output
	FormatJSON = "json"
	// FormatJSONP is the format constant for a JSONP output
	FormatJSONP = "jsonp"
	// FormatXML is the format constant for a XML output
	FormatXML = "xml"
)

Variables

View Source
var (
	// ErrInvalidCallback is thrown when the request is missing the callback queryparam
	ErrInvalidCallback = echo.NewHTTPError(http.StatusBadRequest, "Invalid callback query param provided")
	// ErrUnsupportedFormat is thrown when the requestor has defined an unsupported response format
	ErrUnsupportedFormat = echo.NewHTTPError(http.StatusBadRequest, "Unsupported format")
)
View Source
var ErrVerificationFailure = echo.NewHTTPError(http.StatusInternalServerError, "Failed to perform email verification lookup")

ErrVerificationFailure is thrown when there is error while validating an email

Functions

func DefaultEncoder

func DefaultEncoder(c echo.Context, code int, res interface{}) error

DefaultEncoder is an encoder that reads the format from the passed echo context and writes the status code and response based on that format

Types

type Encoder

type Encoder func(c echo.Context, code int, res interface{}) error

Encoder is a function type that encodes a response given a context, a status code and a response

type Health

type Health struct {
	Status string `json:"status"`
}

Health is a healthcheck response body

type Service

type Service struct {
	Logger   *logrus.Entry
	Encode   Encoder
	Timeout  time.Duration
	Verifier *verifier.Verifier
}

Service contains all dependencies for the Trumail API

func NewService

func NewService(l *logrus.Logger, timeout int, v *verifier.Verifier) *Service

NewService generates a new, fully populated Trumail reference

func (*Service) Health

func (s *Service) Health(c echo.Context) error

Health returns a Health check response indicating the health state of the service

func (*Service) Lookup

func (s *Service) Lookup(c echo.Context) error

Lookup performs a single email verification and returns a fully populated lookup or an error

Jump to

Keyboard shortcuts

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