Documentation ¶
Overview ¶
Package oapi 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 BadRequest
- type CreatePostJSONRequestBody
- type CreateUserJSONRequestBody
- type InvalidParamFormatError
- type MiddlewareFunc
- type Post
- type PostBody
- type PostInput
- type RequiredHeaderError
- type RequiredParamError
- type ResourceNotFound
- type ServeMux
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreatePost(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeletePost(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetPost(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListPosts(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListUsers(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdatePost(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)
- type StdHTTPServerOptions
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type UpdatePostJSONRequestBody
- type UpdateUserJSONRequestBody
- type User
- type UserBody
- type UserInput
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 CreatePostJSONRequestBody ¶
type CreatePostJSONRequestBody = PostInput
CreatePostJSONRequestBody defines body for CreatePost for application/json ContentType.
type CreateUserJSONRequestBody ¶
type CreateUserJSONRequestBody = UserInput
CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type Post ¶
type Post struct { // Content Post content Content string `json:"content"` Id *int64 `json:"id,omitempty"` // Title Short headline of your post Title string `json:"title"` UserId int64 `json:"user_id"` }
Post defines model for Post.
type PostInput ¶
type PostInput struct { // Content Post content Content string `json:"content"` // Title Short headline of your post Title string `json:"title"` UserId int64 `json:"user_id"` }
PostInput defines model for PostInput.
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 ResourceNotFound ¶
type ResourceNotFound = string
ResourceNotFound defines model for ResourceNotFound.
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 ServerInterface ¶
type ServerInterface interface { // (GET /posts) ListPosts(w http.ResponseWriter, r *http.Request) // (POST /posts) CreatePost(w http.ResponseWriter, r *http.Request) // (DELETE /posts/{id}) DeletePost(w http.ResponseWriter, r *http.Request, id int64) // (GET /posts/{id}) GetPost(w http.ResponseWriter, r *http.Request, id int64) // (PUT /posts/{id}) UpdatePost(w http.ResponseWriter, r *http.Request, id int64) // (GET /users) ListUsers(w http.ResponseWriter, r *http.Request) // (POST /users) CreateUser(w http.ResponseWriter, r *http.Request) // (DELETE /users/{id}) DeleteUser(w http.ResponseWriter, r *http.Request, id int64) // (GET /users/{id}) GetUser(w http.ResponseWriter, r *http.Request, id int64) // (PUT /users/{id}) UpdateUser(w http.ResponseWriter, r *http.Request, id int64) }
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) CreatePost ¶
func (siw *ServerInterfaceWrapper) CreatePost(w http.ResponseWriter, r *http.Request)
CreatePost operation middleware
func (*ServerInterfaceWrapper) CreateUser ¶
func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)
CreateUser operation middleware
func (*ServerInterfaceWrapper) DeletePost ¶
func (siw *ServerInterfaceWrapper) DeletePost(w http.ResponseWriter, r *http.Request)
DeletePost operation middleware
func (*ServerInterfaceWrapper) DeleteUser ¶
func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)
DeleteUser operation middleware
func (*ServerInterfaceWrapper) GetPost ¶
func (siw *ServerInterfaceWrapper) GetPost(w http.ResponseWriter, r *http.Request)
GetPost operation middleware
func (*ServerInterfaceWrapper) GetUser ¶
func (siw *ServerInterfaceWrapper) GetUser(w http.ResponseWriter, r *http.Request)
GetUser operation middleware
func (*ServerInterfaceWrapper) ListPosts ¶
func (siw *ServerInterfaceWrapper) ListPosts(w http.ResponseWriter, r *http.Request)
ListPosts operation middleware
func (*ServerInterfaceWrapper) ListUsers ¶
func (siw *ServerInterfaceWrapper) ListUsers(w http.ResponseWriter, r *http.Request)
ListUsers operation middleware
func (*ServerInterfaceWrapper) UpdatePost ¶
func (siw *ServerInterfaceWrapper) UpdatePost(w http.ResponseWriter, r *http.Request)
UpdatePost operation middleware
func (*ServerInterfaceWrapper) UpdateUser ¶
func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)
UpdateUser operation middleware
type StdHTTPServerOptions ¶
type StdHTTPServerOptions struct { BaseURL string BaseRouter ServeMux Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
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 UpdatePostJSONRequestBody ¶
type UpdatePostJSONRequestBody = PostInput
UpdatePostJSONRequestBody defines body for UpdatePost for application/json ContentType.
type UpdateUserJSONRequestBody ¶
type UpdateUserJSONRequestBody = UserInput
UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.