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.
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 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 New(h TaskHandler) (http.Handler, error)
- func WithHandler(th TaskHandler) httpserver.Opt
- type API
- func (a *API) CreateTask(w http.ResponseWriter, r *http.Request)
- func (a *API) DeleteTask(w http.ResponseWriter, r *http.Request, taskID uint64)
- func (a *API) ListTasks(w http.ResponseWriter, r *http.Request, params ListTasksParams)
- func (a *API) UpdateTask(w http.ResponseWriter, r *http.Request, taskID uint64)
- type CreateTaskJSONRequestBody
- type Error
- type ErrorResponse
- type InvalidParamFormatError
- type ListTasksParams
- type MiddlewareFunc
- type RequiredHeaderError
- type RequiredParamError
- type ServeMux
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateTask(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteTask(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListTasks(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateTask(w http.ResponseWriter, r *http.Request)
- type Status
- type StdHTTPServerOptions
- type Task
- type TaskData
- type TaskHandler
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type UpdateTaskJSONRequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
func WithHandler ¶
func WithHandler(th TaskHandler) httpserver.Opt
WithHandler returns an httpserver.Opt that sets the API handler.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) CreateTask ¶
func (a *API) CreateTask(w http.ResponseWriter, r *http.Request)
func (*API) DeleteTask ¶
func (*API) ListTasks ¶
func (a *API) ListTasks(w http.ResponseWriter, r *http.Request, params ListTasksParams)
func (*API) UpdateTask ¶
type CreateTaskJSONRequestBody ¶
type CreateTaskJSONRequestBody = TaskData
CreateTaskJSONRequestBody defines body for CreateTask for application/json ContentType.
type ErrorResponse ¶
type ErrorResponse struct { // Details Error details Details string `json:"details"` }
ErrorResponse defines model for errorResponse.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListTasksParams ¶
type ListTasksParams struct { // Status Filters the tasks by their status Status *Status `form:"status,omitempty" json:"status,omitempty"` }
ListTasksParams defines parameters for ListTasks.
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 ServerInterface ¶
type ServerInterface interface { // List the available tasks // (GET /api/v1/tasks) ListTasks(w http.ResponseWriter, r *http.Request, params ListTasksParams) // Create a task // (POST /api/v1/tasks) CreateTask(w http.ResponseWriter, r *http.Request) // Delete task by id // (DELETE /api/v1/tasks/{taskID}) DeleteTask(w http.ResponseWriter, r *http.Request, taskID uint64) // Update the task // (PUT /api/v1/tasks/{taskID}) UpdateTask(w http.ResponseWriter, r *http.Request, taskID uint64) }
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) CreateTask ¶
func (siw *ServerInterfaceWrapper) CreateTask(w http.ResponseWriter, r *http.Request)
CreateTask operation middleware
func (*ServerInterfaceWrapper) DeleteTask ¶
func (siw *ServerInterfaceWrapper) DeleteTask(w http.ResponseWriter, r *http.Request)
DeleteTask operation middleware
func (*ServerInterfaceWrapper) ListTasks ¶
func (siw *ServerInterfaceWrapper) ListTasks(w http.ResponseWriter, r *http.Request)
ListTasks operation middleware
func (*ServerInterfaceWrapper) UpdateTask ¶
func (siw *ServerInterfaceWrapper) UpdateTask(w http.ResponseWriter, r *http.Request)
UpdateTask operation middleware
type StdHTTPServerOptions ¶
type StdHTTPServerOptions struct { BaseURL string BaseRouter ServeMux Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type Task ¶
type Task struct { // CreatedAt The task creation date CreatedAt time.Time `json:"createdAt"` // Description The task description Description *string `json:"description,omitempty"` // Id The task identifier Id uint64 `json:"id"` // Status The task status Status Status `json:"status"` // Title The task title Title string `json:"title"` }
Task defines model for Task.
type TaskData ¶
type TaskData struct { // Description The task description Description *string `json:"description,omitempty"` // Status The task status Status Status `json:"status"` // Title The task title Title string `json:"title"` }
TaskData defines model for TaskData.
type TaskHandler ¶
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 UpdateTaskJSONRequestBody ¶
type UpdateTaskJSONRequestBody = TaskData
UpdateTaskJSONRequestBody defines body for UpdateTask for application/json ContentType.