routes

package
v0.0.0-...-98ece37 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoints

type Endpoints struct {
	Config *db.Config
}

Endpoints is the marker interface for defining routes

func NewEndpoints

func NewEndpoints(dbc *db.Config) *Endpoints

NewEndpoints gives handle to REST Endpoints dbType could be one of "pg","mysql","sqlite".Defaults to "sqlite"

func (*Endpoints) AddFruit

func (e *Endpoints) AddFruit(c echo.Context) error

AddFruit godoc @Summary Add a fruit to Database @Description Adds a new Fruit to the Database @Tags fruit @Accept json @Produce json @Param message body db.Fruit true "Fruit object" @Success 200 {object} db.Fruit @Failure 404 {object} utils.HTTPError @Router /fruits/add [post]

func (*Endpoints) DeleteAll

func (e *Endpoints) DeleteAll(c echo.Context) error

DeleteAll godoc @Summary Delete all fruit from Database @Description Delete all fruit from Database @Tags fruit @Success 204 @Failure 404 {object} utils.HTTPError @Router /fruits/ [delete]

func (*Endpoints) DeleteFruit

func (e *Endpoints) DeleteFruit(c echo.Context) error

DeleteFruit godoc @Summary Delete a fruit from Database @Description Deletes a Fruit to the Database @Tags fruit @Param id path int true "Fruit ID" @Success 204 @Failure 404 {object} utils.HTTPError @Router /fruits/{id} [delete]

func (*Endpoints) GetFruitsByName

func (e *Endpoints) GetFruitsByName(c echo.Context) error

GetFruitsByName godoc @Summary Gets fruits by name @Description Gets list of fruits by name @Tags fruit @Produce json @Param name path string true "Full or partial name of the fruit" @Success 200 {object} db.Fruits @Failure 404 {object} utils.HTTPError @Router /fruits/search/{name} [get]

func (*Endpoints) GetFruitsBySeason

func (e *Endpoints) GetFruitsBySeason(c echo.Context) error

GetFruitsBySeason godoc @Summary Gets fruits by season @Description Gets a list of fruits by season @Tags fruit @Produce json @Param season path string true "Full or partial name of the season" @Success 200 {object} db.Fruits @Failure 404 {object} utils.HTTPError @Router /fruits/season/{season} [get]

func (*Endpoints) ListFruits

func (e *Endpoints) ListFruits(c echo.Context) error

ListFruits godoc @Summary Gets all fruits @Description Gets a list all available fruits from the database @Tags fruit @Produce json @Success 200 {object} db.Fruits @Failure 404 {object} utils.HTTPError @Router /fruits/ [get]

func (*Endpoints) Live

func (e *Endpoints) Live(c echo.Context) error

Live godoc @Summary Checks the API liveness @Description Checks the API liveness, can be used with Kubernetes Probes @Tags health @Produce json @Success 200 {object} string @Router /health/live/ [get]

func (*Endpoints) Ready

func (e *Endpoints) Ready(c echo.Context) error

Ready godoc @Summary Checks the API readiness @Description Checks the API readiness, can be used with Kubernetes Probes @Tags health @Produce json @Success 200 {object} string @Router /health/ready/ [get]

Jump to

Keyboard shortcuts

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