Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type CreateKeyValue201Response
- type CreateKeyValue400Response
- type CreateKeyValue409Response
- type CreateKeyValueJSONBody
- type CreateKeyValueJSONRequestBody
- type CreateKeyValueRequestObject
- type CreateKeyValueResponseObject
- type DeleteKeyValue204Response
- type DeleteKeyValue404Response
- type DeleteKeyValueRequestObject
- type DeleteKeyValueResponseObject
- type InvalidParamFormatError
- type MiddlewareFunc
- type ReadValue200JSONResponse
- type ReadValue404Response
- type ReadValueRequestObject
- type ReadValueResponseObject
- type RequiredHeaderError
- type RequiredParamError
- type ServeMux
- type Server
- func (s Server) CreateKeyValue(ctx context.Context, request CreateKeyValueRequestObject) (CreateKeyValueResponseObject, error)
- func (s Server) DeleteKeyValue(ctx context.Context, request DeleteKeyValueRequestObject) (DeleteKeyValueResponseObject, error)
- func (s Server) ReadValue(ctx context.Context, request ReadValueRequestObject) (ReadValueResponseObject, error)
- func (s Server) Run(ctx context.Context) error
- func (s Server) UpdateValue(ctx context.Context, request UpdateValueRequestObject) (UpdateValueResponseObject, error)
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateKeyValue(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteKeyValue(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ReadValue(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateValue(w http.ResponseWriter, r *http.Request)
- type Service
- type StdHTTPServerOptions
- type StrictHTTPServerOptions
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type UpdateValue204Response
- type UpdateValue400Response
- type UpdateValue404Response
- type UpdateValueJSONBody
- type UpdateValueJSONRequestBody
- type UpdateValueRequestObject
- type UpdateValueResponseObject
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, m ServeMux) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type CreateKeyValue201Response ¶
type CreateKeyValue201Response struct {
}
func (CreateKeyValue201Response) VisitCreateKeyValueResponse ¶
func (response CreateKeyValue201Response) VisitCreateKeyValueResponse(w http.ResponseWriter) error
type CreateKeyValue400Response ¶
type CreateKeyValue400Response struct {
}
func (CreateKeyValue400Response) VisitCreateKeyValueResponse ¶
func (response CreateKeyValue400Response) VisitCreateKeyValueResponse(w http.ResponseWriter) error
type CreateKeyValue409Response ¶
type CreateKeyValue409Response struct {
}
func (CreateKeyValue409Response) VisitCreateKeyValueResponse ¶
func (response CreateKeyValue409Response) VisitCreateKeyValueResponse(w http.ResponseWriter) error
type CreateKeyValueJSONBody ¶
type CreateKeyValueJSONBody struct {
// Value The new value to be associated with the key
Value *string `json:"value,omitempty"`
}
CreateKeyValueJSONBody defines parameters for CreateKeyValue.
type CreateKeyValueJSONRequestBody ¶
type CreateKeyValueJSONRequestBody CreateKeyValueJSONBody
CreateKeyValueJSONRequestBody defines body for CreateKeyValue for application/json ContentType.
type CreateKeyValueRequestObject ¶
type CreateKeyValueRequestObject struct {
Key string `json:"key"`
Body *CreateKeyValueJSONRequestBody
}
type CreateKeyValueResponseObject ¶
type CreateKeyValueResponseObject interface {
VisitCreateKeyValueResponse(w http.ResponseWriter) error
}
type DeleteKeyValue204Response ¶
type DeleteKeyValue204Response struct {
}
func (DeleteKeyValue204Response) VisitDeleteKeyValueResponse ¶
func (response DeleteKeyValue204Response) VisitDeleteKeyValueResponse(w http.ResponseWriter) error
type DeleteKeyValue404Response ¶
type DeleteKeyValue404Response struct {
}
func (DeleteKeyValue404Response) VisitDeleteKeyValueResponse ¶
func (response DeleteKeyValue404Response) VisitDeleteKeyValueResponse(w http.ResponseWriter) error
type DeleteKeyValueRequestObject ¶
type DeleteKeyValueRequestObject struct {
Key string `json:"key"`
}
type DeleteKeyValueResponseObject ¶
type DeleteKeyValueResponseObject interface {
VisitDeleteKeyValueResponse(w http.ResponseWriter) error
}
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ReadValue200JSONResponse ¶
type ReadValue200JSONResponse string
func (ReadValue200JSONResponse) VisitReadValueResponse ¶
func (response ReadValue200JSONResponse) VisitReadValueResponse(w http.ResponseWriter) error
type ReadValue404Response ¶
type ReadValue404Response struct {
}
func (ReadValue404Response) VisitReadValueResponse ¶
func (response ReadValue404Response) VisitReadValueResponse(w http.ResponseWriter) error
type ReadValueRequestObject ¶
type ReadValueRequestObject struct {
Key string `json:"key"`
}
type ReadValueResponseObject ¶
type ReadValueResponseObject interface {
VisitReadValueResponse(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 ServeMux ¶
type ServeMux interface {
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
ServeMux is an abstraction of http.ServeMux.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (Server) CreateKeyValue ¶
func (s Server) CreateKeyValue(ctx context.Context, request CreateKeyValueRequestObject) (CreateKeyValueResponseObject, error)
func (Server) DeleteKeyValue ¶
func (s Server) DeleteKeyValue(ctx context.Context, request DeleteKeyValueRequestObject) (DeleteKeyValueResponseObject, error)
func (Server) ReadValue ¶
func (s Server) ReadValue(ctx context.Context, request ReadValueRequestObject) (ReadValueResponseObject, error)
func (Server) UpdateValue ¶
func (s Server) UpdateValue(ctx context.Context, request UpdateValueRequestObject) (UpdateValueResponseObject, error)
type ServerInterface ¶
type ServerInterface interface {
// Delete key-value pair
// (DELETE /{key})
DeleteKeyValue(w http.ResponseWriter, r *http.Request, key string)
// Read value
// (GET /{key})
ReadValue(w http.ResponseWriter, r *http.Request, key string)
// Create key-value pair
// (POST /{key})
CreateKeyValue(w http.ResponseWriter, r *http.Request, key string)
// Update value
// (PUT /{key})
UpdateValue(w http.ResponseWriter, r *http.Request, key string)
}
ServerInterface represents all server handlers.
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) CreateKeyValue ¶
func (siw *ServerInterfaceWrapper) CreateKeyValue(w http.ResponseWriter, r *http.Request)
CreateKeyValue operation middleware
func (*ServerInterfaceWrapper) DeleteKeyValue ¶
func (siw *ServerInterfaceWrapper) DeleteKeyValue(w http.ResponseWriter, r *http.Request)
DeleteKeyValue operation middleware
func (*ServerInterfaceWrapper) ReadValue ¶
func (siw *ServerInterfaceWrapper) ReadValue(w http.ResponseWriter, r *http.Request)
ReadValue operation middleware
func (*ServerInterfaceWrapper) UpdateValue ¶
func (siw *ServerInterfaceWrapper) UpdateValue(w http.ResponseWriter, r *http.Request)
UpdateValue operation middleware
type Service ¶
type Service interface {
DeleteKeyValue(ctx context.Context, key string) error
ReadValue(ctx context.Context, key string) (string, error)
CreateKeyValue(ctx context.Context, key, value string) error
UpdateValue(ctx context.Context, key, value string) error
}
interface for the service used by the API Server
type StdHTTPServerOptions ¶
type StdHTTPServerOptions struct {
BaseURL string
BaseRouter ServeMux
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
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 {
// Delete key-value pair
// (DELETE /{key})
DeleteKeyValue(ctx context.Context, request DeleteKeyValueRequestObject) (DeleteKeyValueResponseObject, error)
// Read value
// (GET /{key})
ReadValue(ctx context.Context, request ReadValueRequestObject) (ReadValueResponseObject, error)
// Create key-value pair
// (POST /{key})
CreateKeyValue(ctx context.Context, request CreateKeyValueRequestObject) (CreateKeyValueResponseObject, error)
// Update value
// (PUT /{key})
UpdateValue(ctx context.Context, request UpdateValueRequestObject) (UpdateValueResponseObject, 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 UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpdateValue204Response ¶
type UpdateValue204Response struct {
}
func (UpdateValue204Response) VisitUpdateValueResponse ¶
func (response UpdateValue204Response) VisitUpdateValueResponse(w http.ResponseWriter) error
type UpdateValue400Response ¶
type UpdateValue400Response struct {
}
func (UpdateValue400Response) VisitUpdateValueResponse ¶
func (response UpdateValue400Response) VisitUpdateValueResponse(w http.ResponseWriter) error
type UpdateValue404Response ¶
type UpdateValue404Response struct {
}
func (UpdateValue404Response) VisitUpdateValueResponse ¶
func (response UpdateValue404Response) VisitUpdateValueResponse(w http.ResponseWriter) error
type UpdateValueJSONBody ¶
type UpdateValueJSONBody struct {
// Value The new value to be associated with the key
Value *string `json:"value,omitempty"`
}
UpdateValueJSONBody defines parameters for UpdateValue.
type UpdateValueJSONRequestBody ¶
type UpdateValueJSONRequestBody UpdateValueJSONBody
UpdateValueJSONRequestBody defines body for UpdateValue for application/json ContentType.
type UpdateValueRequestObject ¶
type UpdateValueRequestObject struct {
Key string `json:"key"`
Body *UpdateValueJSONRequestBody
}
type UpdateValueResponseObject ¶
type UpdateValueResponseObject interface {
VisitUpdateValueResponse(w http.ResponseWriter) error
}