Documentation
¶
Overview ¶
Package server provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func Start(port int, frontendFS fs.FS, configPath string) error
- type ChiServerOptions
- type GetConfig200JSONResponse
- type GetConfig500Response
- type GetConfigRequestObject
- type GetConfigResponseObject
- type InvalidParamFormatError
- type MiddlewareFunc
- type PutConfig200Response
- type PutConfig400Response
- type PutConfig500Response
- type PutConfigJSONRequestBody
- type PutConfigRequestObject
- type PutConfigResponseObject
- type RequiredHeaderError
- type RequiredParamError
- type Server
- type ServerInterface
- type ServerInterfaceWrapper
- type StrictHTTPServerOptions
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- type UnmarshalingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type GetConfig200JSONResponse ¶
type GetConfig200JSONResponse externalRef0.Config
func (GetConfig200JSONResponse) VisitGetConfigResponse ¶
func (response GetConfig200JSONResponse) VisitGetConfigResponse(w http.ResponseWriter) error
type GetConfig500Response ¶
type GetConfig500Response struct {
}
func (GetConfig500Response) VisitGetConfigResponse ¶
func (response GetConfig500Response) VisitGetConfigResponse(w http.ResponseWriter) error
type GetConfigRequestObject ¶
type GetConfigRequestObject struct {
}
type GetConfigResponseObject ¶
type GetConfigResponseObject interface {
VisitGetConfigResponse(w http.ResponseWriter) error
}
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type PutConfig200Response ¶
type PutConfig200Response struct {
}
func (PutConfig200Response) VisitPutConfigResponse ¶
func (response PutConfig200Response) VisitPutConfigResponse(w http.ResponseWriter) error
type PutConfig400Response ¶
type PutConfig400Response struct {
}
func (PutConfig400Response) VisitPutConfigResponse ¶
func (response PutConfig400Response) VisitPutConfigResponse(w http.ResponseWriter) error
type PutConfig500Response ¶
type PutConfig500Response struct {
}
func (PutConfig500Response) VisitPutConfigResponse ¶
func (response PutConfig500Response) VisitPutConfigResponse(w http.ResponseWriter) error
type PutConfigJSONRequestBody ¶
type PutConfigJSONRequestBody = externalRef0.Config
PutConfigJSONRequestBody defines body for PutConfig for application/json ContentType.
type PutConfigRequestObject ¶
type PutConfigRequestObject struct {
Body *PutConfigJSONRequestBody
}
type PutConfigResponseObject ¶
type PutConfigResponseObject interface {
VisitPutConfigResponse(w http.ResponseWriter) error
}
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (Server) GetConfig ¶
func (s Server) GetConfig(_ context.Context, _ GetConfigRequestObject) (GetConfigResponseObject, error)
func (Server) PutConfig ¶
func (s Server) PutConfig(_ context.Context, request PutConfigRequestObject) (PutConfigResponseObject, error)
type ServerInterface ¶
type ServerInterface interface {
// Get current configuration
// (GET /config)
GetConfig(w http.ResponseWriter, r *http.Request)
// Update configuration
// (PUT /config)
PutConfig(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
func NewServer ¶
func NewServer(configPath string) ServerInterface
func NewStrictHandler ¶
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface
func NewStrictHandlerWithOptions ¶
func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetConfig ¶
func (siw *ServerInterfaceWrapper) GetConfig(w http.ResponseWriter, r *http.Request)
GetConfig operation middleware
func (*ServerInterfaceWrapper) PutConfig ¶
func (siw *ServerInterfaceWrapper) PutConfig(w http.ResponseWriter, r *http.Request)
PutConfig operation middleware
type StrictHTTPServerOptions ¶
type StrictHTTPServerOptions struct {
RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type StrictHandlerFunc ¶
type StrictHandlerFunc = strictnethttp.StrictHTTPHandlerFunc
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc = strictnethttp.StrictHTTPMiddlewareFunc
type StrictServerInterface ¶
type StrictServerInterface interface {
// Get current configuration
// (GET /config)
GetConfig(ctx context.Context, request GetConfigRequestObject) (GetConfigResponseObject, error)
// Update configuration
// (PUT /config)
PutConfig(ctx context.Context, request PutConfigRequestObject) (PutConfigResponseObject, error)
}
StrictServerInterface represents all server handlers.
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) GetConfig ¶
func (_ Unimplemented) GetConfig(w http.ResponseWriter, r *http.Request)
Get current configuration (GET /config)
func (Unimplemented) PutConfig ¶
func (_ Unimplemented) PutConfig(w http.ResponseWriter, r *http.Request)
Update configuration (PUT /config)
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error