api

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package api provides primitives to interact the openapi HTTP API.

Code generated by github.com/jerejones/oapi-codegen DO NOT EDIT.

Package api provides primitives to interact the openapi HTTP API.

Code generated by github.com/jerejones/oapi-codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (*openapi3.Swagger, error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file.

func RegisterHandlers

func RegisterHandlers(router interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

Types

type AddPetJSONRequestBody

type AddPetJSONRequestBody addPetJSONBody

AddPetRequestBody defines body for AddPet for application/json ContentType.

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type FindPetsParams

type FindPetsParams struct {

	// tags to filter by
	Tags *[]string `json:"tags,omitempty"`

	// maximum number of results to return
	Limit *int32 `json:"limit,omitempty"`
}

FindPetsParams defines parameters for FindPets.

type NewPet

type NewPet struct {
	Name string  `json:"name"`
	Tag  *string `json:"tag,omitempty"`
}

NewPet defines model for NewPet.

type Pet

type Pet struct {
	// Embedded struct due to allOf(#/components/schemas/NewPet)
	NewPet
	// Embedded fields due to inline allOf schema
	Id int64 `json:"id"`
}

Pet defines model for Pet.

type PetStore

type PetStore struct {
	Pets   map[int64]Pet
	NextId int64
	Lock   sync.Mutex
}

func NewPetStore

func NewPetStore() *PetStore

func (*PetStore) AddPet

func (p *PetStore) AddPet(ctx echo.Context) error

func (*PetStore) DeletePet

func (p *PetStore) DeletePet(ctx echo.Context, id int64) error

func (*PetStore) FindPetById

func (p *PetStore) FindPetById(ctx echo.Context, petId int64) error

func (*PetStore) FindPets

func (p *PetStore) FindPets(ctx echo.Context, params FindPetsParams) error

Here, we implement all of the handlers in the ServerInterface

type ServerInterface

type ServerInterface interface {
	// (GET /pets)
	FindPets(ctx echo.Context, params FindPetsParams) error
	// (POST /pets)
	AddPet(ctx echo.Context) error
	// (DELETE /pets/{id})
	DeletePet(ctx echo.Context, id int64) error
	// (GET /pets/{id})
	FindPetById(ctx echo.Context, id int64) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) AddPet

func (w *ServerInterfaceWrapper) AddPet(ctx echo.Context) error

AddPet converts echo context to params.

func (*ServerInterfaceWrapper) DeletePet

func (w *ServerInterfaceWrapper) DeletePet(ctx echo.Context) error

DeletePet converts echo context to params.

func (*ServerInterfaceWrapper) FindPetById

func (w *ServerInterfaceWrapper) FindPetById(ctx echo.Context) error

FindPetById converts echo context to params.

func (*ServerInterfaceWrapper) FindPets

func (w *ServerInterfaceWrapper) FindPets(ctx echo.Context) error

FindPets converts echo context to params.

Jump to

Keyboard shortcuts

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