api

package
v0.0.0-...-200412a Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest = errors.New("Invalid request")
)
View Source
var (
	ErrUnauthorized = errors.New("Unauthorized")
)

Functions

func MakeAddressGetEndpoint

func MakeAddressGetEndpoint(s Service) endpoint.Endpoint

func MakeAddressPostEndpoint

func MakeAddressPostEndpoint(s Service) endpoint.Endpoint

func MakeCardGetEndpoint

func MakeCardGetEndpoint(s Service) endpoint.Endpoint

func MakeCardPostEndpoint

func MakeCardPostEndpoint(s Service) endpoint.Endpoint

func MakeDeleteEndpoint

func MakeDeleteEndpoint(s Service) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(e Endpoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router

func MakeHealthEndpoint

func MakeHealthEndpoint(s Service) endpoint.Endpoint

func MakeLoginEndpoint

func MakeLoginEndpoint(s Service) endpoint.Endpoint

func MakeRegisterEndpoint

func MakeRegisterEndpoint(s Service) endpoint.Endpoint

func MakeUserGetEndpoint

func MakeUserGetEndpoint(s Service) endpoint.Endpoint

func MakeUserPostEndpoint

func MakeUserPostEndpoint(s Service) endpoint.Endpoint

Types

type EmbedStruct

type EmbedStruct struct {
	Embed interface{} `json:"_embedded"`
}

type Endpoints

type Endpoints struct {
	LoginEndpoint       endpoint.Endpoint
	RegisterEndpoint    endpoint.Endpoint
	UserGetEndpoint     endpoint.Endpoint
	UserPostEndpoint    endpoint.Endpoint
	AddressGetEndpoint  endpoint.Endpoint
	AddressPostEndpoint endpoint.Endpoint
	CardGetEndpoint     endpoint.Endpoint
	CardPostEndpoint    endpoint.Endpoint
	DeleteEndpoint      endpoint.Endpoint
	HealthEndpoint      endpoint.Endpoint
}

func MakeEndpoints

func MakeEndpoints(s Service, tracer stdopentracing.Tracer) Endpoints

type GetRequest

type GetRequest struct {
	ID   string
	Attr string
}

type Health

type Health struct {
	Service string `json:"service"`
	Status  string `json:"status"`
	Time    string `json:"time"`
}

type Middleware

type Middleware func(Service) Service

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

type Service

type Service interface {
	Login(username, password string) (users.User, error)
	Register(username, password, email, first, last string) (string, error)
	GetUsers(id string) ([]users.User, error)
	PostUser(u users.User) (string, error)
	GetAddresses(id string) ([]users.Address, error)
	PostAddress(a users.Address, userid string) (string, error)
	GetCards(id string) ([]users.Card, error)
	PostCard(c users.Card, userid string) (string, error)
	Delete(entity, id string) error
	Health() []Health
}

func NewFixedService

func NewFixedService() Service

func NewInstrumentingService

func NewInstrumentingService(requestCount metrics.Counter, requestLatency metrics.Histogram, s Service) Service

Jump to

Keyboard shortcuts

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