api

package
v2.0.0-...-76fd7a6 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	List   = Verb("list")
	Get    = Verb("get")
	Delete = Verb("delete")
	Create = Verb("create")
	Update = Verb("update")
)

Functions

func CheckCSRF

func CheckCSRF(apiOp *types.APIRequest) error

func ValidateAction

func ValidateAction(request *types.APIRequest) (*types.Action, error)

Types

type Defaults

type Defaults struct {
	ListHandler   types.RequestHandler
	CreateHandler types.RequestHandler
	DeleteHandler types.RequestHandler
	UpdateHandler types.RequestHandler
	Store         types.Store
	ErrorHandler  types.ErrorHandler
}

type RequestHandler

type RequestHandler interface {
	http.Handler

	GetSchemas() *types.Schemas
	Handle(apiOp *types.APIRequest)
}

type ResponseWriter

type ResponseWriter interface {
	Write(apiOp *types.APIRequest, code int, obj interface{})
}

type Server

type Server struct {
	ResponseWriters  map[string]ResponseWriter
	Schemas          *types.Schemas
	QueryFilter      types.QueryFilter
	Defaults         Defaults
	DefaultNamespace string
	AccessControl    types.AccessControl
	Parser           parse.Parser
	URLParser        parse.URLParser
}

func DefaultAPIServer

func DefaultAPIServer() *Server

func (*Server) AddSchemas

func (s *Server) AddSchemas(schemas *types.Schemas) error

func (*Server) CustomAPIUIResponseWriter

func (s *Server) CustomAPIUIResponseWriter(cssURL, jsURL, version writer.StringGetter)

func (*Server) GetSchemas

func (s *Server) GetSchemas() *types.Schemas

func (*Server) Handle

func (s *Server) Handle(apiOp *types.APIRequest)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Verb

type Verb string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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