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.7.1 DO NOT EDIT.
Index ¶
- Constants
- func GetSpec() (swagger *openapi3.T, err error)
- func GetSpecJSON() ([]byte, error)
- func GetSwagger() (*openapi3.T, error)deprecated
- 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 ChiServerOptions
- type CreateWidgetJSONRequestBody
- type CreateWidgetParams
- type FieldError
- type IdempotencyKey
- type InvalidParamFormatError
- type Limit
- type ListWidgetsParams
- type MiddlewareFunc
- type Offset
- type Pagination
- type Problem
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateWidget(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteWidget(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetWidget(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListWidgets(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateWidget(w http.ResponseWriter, r *http.Request)
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) CreateWidget(w http.ResponseWriter, r *http.Request, params CreateWidgetParams)
- func (_ Unimplemented) DeleteWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
- func (_ Unimplemented) GetWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
- func (_ Unimplemented) ListWidgets(w http.ResponseWriter, r *http.Request, params ListWidgetsParams)
- func (_ Unimplemented) UpdateWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
- type UnmarshalingParamError
- type UpdateWidgetJSONRequestBody
- type Widget
- type WidgetID
- type WidgetInput
- type WidgetList
- type WidgetStatus
Constants ¶
const (
BearerAuthScopes bearerAuthContextKey = "bearerAuth.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func GetSpec ¶
GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.
func GetSpecJSON ¶
GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.
func GetSwagger
deprecated
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
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type CreateWidgetJSONRequestBody ¶
type CreateWidgetJSONRequestBody = WidgetInput
CreateWidgetJSONRequestBody defines body for CreateWidget for application/json ContentType.
type CreateWidgetParams ¶
type CreateWidgetParams struct {
// IdempotencyKey Opaque key that makes a create request safe to retry.
IdempotencyKey *IdempotencyKey `json:"Idempotency-Key,omitempty"`
}
CreateWidgetParams defines parameters for CreateWidget.
type FieldError ¶
FieldError defines model for FieldError.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListWidgetsParams ¶
type ListWidgetsParams struct {
// Limit Maximum number of items to return.
Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"`
// Offset Number of items to skip.
Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"`
}
ListWidgetsParams defines parameters for ListWidgets.
type Pagination ¶
type Pagination struct {
Limit int32 `json:"limit"`
Offset int32 `json:"offset"`
Total int64 `json:"total"`
}
Pagination defines model for Pagination.
type Problem ¶
type Problem struct {
Detail *string `json:"detail,omitempty"`
// Errors Field-level validation failures.
Errors *[]FieldError `json:"errors,omitempty"`
Instance *string `json:"instance,omitempty"`
Status int32 `json:"status"`
Title string `json:"title"`
// TraceId Correlates this response with a distributed trace.
TraceId *string `json:"traceId,omitempty"`
Type string `json:"type"`
}
Problem Problem details as defined by RFC 9457.
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 {
// List widgets
// (GET /v1/widgets)
ListWidgets(w http.ResponseWriter, r *http.Request, params ListWidgetsParams)
// Create a widget
// (POST /v1/widgets)
CreateWidget(w http.ResponseWriter, r *http.Request, params CreateWidgetParams)
// Delete a widget
// (DELETE /v1/widgets/{id})
DeleteWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
// Get a widget by ID
// (GET /v1/widgets/{id})
GetWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
// Replace a widget
// (PUT /v1/widgets/{id})
UpdateWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
}
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) CreateWidget ¶
func (siw *ServerInterfaceWrapper) CreateWidget(w http.ResponseWriter, r *http.Request)
CreateWidget operation middleware
func (*ServerInterfaceWrapper) DeleteWidget ¶
func (siw *ServerInterfaceWrapper) DeleteWidget(w http.ResponseWriter, r *http.Request)
DeleteWidget operation middleware
func (*ServerInterfaceWrapper) GetWidget ¶
func (siw *ServerInterfaceWrapper) GetWidget(w http.ResponseWriter, r *http.Request)
GetWidget operation middleware
func (*ServerInterfaceWrapper) ListWidgets ¶
func (siw *ServerInterfaceWrapper) ListWidgets(w http.ResponseWriter, r *http.Request)
ListWidgets operation middleware
func (*ServerInterfaceWrapper) UpdateWidget ¶
func (siw *ServerInterfaceWrapper) UpdateWidget(w http.ResponseWriter, r *http.Request)
UpdateWidget 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 Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) CreateWidget ¶
func (_ Unimplemented) CreateWidget(w http.ResponseWriter, r *http.Request, params CreateWidgetParams)
Create a widget (POST /v1/widgets)
func (Unimplemented) DeleteWidget ¶
func (_ Unimplemented) DeleteWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
Delete a widget (DELETE /v1/widgets/{id})
func (Unimplemented) GetWidget ¶
func (_ Unimplemented) GetWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
Get a widget by ID (GET /v1/widgets/{id})
func (Unimplemented) ListWidgets ¶
func (_ Unimplemented) ListWidgets(w http.ResponseWriter, r *http.Request, params ListWidgetsParams)
List widgets (GET /v1/widgets)
func (Unimplemented) UpdateWidget ¶
func (_ Unimplemented) UpdateWidget(w http.ResponseWriter, r *http.Request, id WidgetID)
Replace a widget (PUT /v1/widgets/{id})
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpdateWidgetJSONRequestBody ¶
type UpdateWidgetJSONRequestBody = WidgetInput
UpdateWidgetJSONRequestBody defines body for UpdateWidget for application/json ContentType.
type Widget ¶
type Widget struct {
CreatedAt time.Time `json:"createdAt"`
Description string `json:"description"`
Id openapi_types.UUID `json:"id"`
Name string `json:"name"`
Status WidgetStatus `json:"status"`
UpdatedAt time.Time `json:"updatedAt"`
}
Widget defines model for Widget.
type WidgetInput ¶
type WidgetInput struct {
Description *string `json:"description,omitempty"`
Name string `json:"name"`
Status *WidgetStatus `json:"status,omitempty"`
}
WidgetInput defines model for WidgetInput.
type WidgetList ¶
type WidgetList struct {
Items []Widget `json:"items"`
Pagination Pagination `json:"pagination"`
}
WidgetList defines model for WidgetList.
type WidgetStatus ¶
type WidgetStatus string
WidgetStatus defines model for WidgetStatus.
const ( Active WidgetStatus = "active" Archived WidgetStatus = "archived" )
Defines values for WidgetStatus.
func (WidgetStatus) Valid ¶
func (e WidgetStatus) Valid() bool
Valid indicates whether the value is a known member of the WidgetStatus enum.