api

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package api provides API endpoints and controllers.

Index

Constants

This section is empty.

Variables

View Source
var ErrCDCDisabled = etre.Error{
	Type:       "cdc-disabled",
	HTTPStatus: http.StatusNotImplemented,
	Message:    "CDC disabled",
}
View Source
var ErrDb = etre.Error{
	Type:       "db-error",
	HTTPStatus: http.StatusInternalServerError,
	Message:    "unknown database error",
}
View Source
var ErrDuplicateEntity = etre.Error{
	Type:       "duplicate-entity",
	HTTPStatus: http.StatusConflict,
	Message:    "cannot insert or update entity because identifying labels conflict with another entity",
}
View Source
var ErrInternal = etre.Error{
	Type:       "internal-error",
	HTTPStatus: http.StatusInternalServerError,
	Message:    "internal server error",
}
View Source
var ErrInvalidParam = etre.Error{
	Type:       "invalid-param",
	HTTPStatus: http.StatusBadRequest,
	Message:    "missing parameter",
}
View Source
var ErrInvalidQuery = etre.Error{
	Type:       "invalid-query",
	HTTPStatus: http.StatusBadRequest,
	Message:    "invalid query",
}
View Source
var ErrMissingParam = etre.Error{
	Type:       "missing-param",
	HTTPStatus: http.StatusBadRequest,
	Message:    "missing parameter",
}
View Source
var ErrNotFound = etre.Error{
	Type:       "entity-not-found",
	HTTPStatus: http.StatusNotFound,
	Message:    "entity not found",
}

Functions

This section is empty.

Types

type API

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

API provides controllers for endpoints it registers with a router.

func NewAPI

func NewAPI(appCtx app.Context) *API

NewAPI makes a new API.

func (*API) Router

func (api *API) Router() *echo.Echo

func (*API) Run

func (api *API) Run() error

func (*API) ServeHTTP

func (api *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP allows the API to statisfy the http.HandlerFunc interface.

func (*API) Stop

func (api *API) Stop() error

func (*API) Use

func (api *API) Use(middleware ...echo.MiddlewareFunc)

Use adds middleware to the echo web server in the API. See https://echo.labstack.com/middleware for more details.

func (*API) WriteResult

func (api *API) WriteResult(c echo.Context, v interface{}, err error) (int, interface{})

Return an etre.WriteResult for all writes, successful of not. v are the writes, if any, from entity.Store calls, which is why it can be different types. v and err are _not_ mutually exclusive; writes can be partially successful.

Jump to

Keyboard shortcuts

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