server

package
v0.0.0-...-02ed8b4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package server provides primitives to interact with the openapi HTTP API.

Code generated by unknown module path version unknown version DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type EchoRouter

type EchoRouter 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
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type PostTodosJSONBody

type PostTodosJSONBody ToDo

PostTodosJSONBody defines parameters for PostTodos.

type PostTodosJSONRequestBody

type PostTodosJSONRequestBody PostTodosJSONBody

PostTodosJSONRequestBody defines body for PostTodos for application/json ContentType.

type PutTodosTodoIdJSONBody

type PutTodosTodoIdJSONBody ToDo

PutTodosTodoIdJSONBody defines parameters for PutTodosTodoId.

type PutTodosTodoIdJSONRequestBody

type PutTodosTodoIdJSONRequestBody PutTodosTodoIdJSONBody

PutTodosTodoIdJSONRequestBody defines body for PutTodosTodoId for application/json ContentType.

type Server

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

func NewServer

func NewServer() (*Server, error)

func (*Server) AllToDos

func (s *Server) AllToDos() []*ToDo

func (*Server) CreateToDo

func (s *Server) CreateToDo(todo *ToDo)

func (*Server) DeleteToDo

func (s *Server) DeleteToDo(todoId int)

func (*Server) DeleteTodosTodoId

func (s *Server) DeleteTodosTodoId(ctx echo.Context, todoId int) error

func (*Server) GetTodos

func (s *Server) GetTodos(ctx echo.Context) error

func (*Server) PostTodos

func (s *Server) PostTodos(ctx echo.Context) error

func (*Server) PutTodosTodoId

func (s *Server) PutTodosTodoId(ctx echo.Context, todoId int) error

func (*Server) Start

func (s *Server) Start(port string) error

func (*Server) UpdateToDo

func (s *Server) UpdateToDo(todo *ToDo)

type ServerInterface

type ServerInterface interface {

	// (GET /todos)
	GetTodos(ctx echo.Context) error

	// (POST /todos)
	PostTodos(ctx echo.Context) error

	// (DELETE /todos/{todoId})
	DeleteTodosTodoId(ctx echo.Context, todoId int) error

	// (PUT /todos/{todoId})
	PutTodosTodoId(ctx echo.Context, todoId int) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) DeleteTodosTodoId

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

DeleteTodosTodoId converts echo context to params.

func (*ServerInterfaceWrapper) GetTodos

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

GetTodos converts echo context to params.

func (*ServerInterfaceWrapper) PostTodos

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

PostTodos converts echo context to params.

func (*ServerInterfaceWrapper) PutTodosTodoId

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

PutTodosTodoId converts echo context to params.

type ToDo

type ToDo struct {
	Done  bool   `json:"done"`
	Id    int    `json:"id"`
	Title string `json:"title"`
}

ToDo defines model for ToDo.

Jump to

Keyboard shortcuts

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