Documentation ¶
Overview ¶
Package ports provides primitives to interact with the openapi HTTP API.
Code generated by unknown module path version unknown version DO NOT EDIT.
Package ports provides primitives to interact with the openapi HTTP API.
Code generated by unknown module path version unknown version 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)
- type AddUserJSONBody
- type AddUserJSONRequestBody
- type ChiServerOptions
- type Error
- type Http
- type InvalidParamFormatError
- type MiddlewareFunc
- type NewUser
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) AddUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) FindAllUsers(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) FindUserByID(w http.ResponseWriter, r *http.Request)
- type Service
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type User
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 HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type AddUserJSONRequestBody ¶
type AddUserJSONRequestBody AddUserJSONBody
AddUserJSONRequestBody defines body for AddUser for application/json ContentType.
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type Error ¶
type Error struct { // Error code Code int32 `json:"code"` // Error message Message string `json:"message"` }
Error defines model for Error.
type Http ¶
type Http struct {
// contains filtered or unexported fields
}
func (*Http) DeleteUser ¶
func (*Http) FindAllUsers ¶
func (h *Http) FindAllUsers(w http.ResponseWriter, r *http.Request)
func (*Http) FindUserByID ¶
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type NewUser ¶
type NewUser struct { // Name of the user Name string `json:"name"` // Type of the user Tag *string `json:"tag,omitempty"` }
NewUser defines model for NewUser.
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 ServerInterface ¶
type ServerInterface interface { // Returns all users // (GET /api/users) FindAllUsers(w http.ResponseWriter, r *http.Request) // Creates a new user // (POST /api/users) AddUser(w http.ResponseWriter, r *http.Request) // Deletes a user by ID // (DELETE /api/users/{id}) DeleteUser(w http.ResponseWriter, r *http.Request, id openapi_types.UUID) // Returns a user by ID // (GET /api/users/{id}) FindUserByID(w http.ResponseWriter, r *http.Request, id openapi_types.UUID) }
ServerInterface represents all server handlers.
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) AddUser ¶
func (siw *ServerInterfaceWrapper) AddUser(w http.ResponseWriter, r *http.Request)
AddUser operation middleware
func (*ServerInterfaceWrapper) DeleteUser ¶
func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)
DeleteUser operation middleware
func (*ServerInterfaceWrapper) FindAllUsers ¶
func (siw *ServerInterfaceWrapper) FindAllUsers(w http.ResponseWriter, r *http.Request)
FindAllUsers operation middleware
func (*ServerInterfaceWrapper) FindUserByID ¶
func (siw *ServerInterfaceWrapper) FindUserByID(w http.ResponseWriter, r *http.Request)
FindUserByID operation middleware
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 User ¶
type User struct { // Embedded struct due to allOf(#/components/schemas/NewUser) NewUser `yaml:",inline"` // Embedded fields due to inline allOf schema // Unique id of the user Id openapi_types.UUID `json:"id"` }
User defines model for User.