Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version (devel) DO NOT EDIT.
Index ¶
- Variables
- func ErrUnprocessableEntity(err error) render.Renderer
- 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 ChiServerOptions
- type ErrResponse
- type Error
- type Event
- type GetValuesByMeterIdParams
- type IngestEventsJSONRequestBody
- type InvalidParamFormatError
- type Meter
- type MeterValue
- type MiddlewareFunc
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetMeters(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMetersById(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetValuesByMeterId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) IngestEvents(w http.ResponseWriter, r *http.Request)
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshallingParamError
- type WindowSize
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = &ErrResponse{StatusCode: 404, StatusText: http.StatusText(404)}
Functions ¶
func ErrUnprocessableEntity ¶
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 ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error StatusCode int `json:"statusCode"` // http response status code StatusText string `json:"status"` // user-level status message AppCode int64 `json:"code,omitempty"` // application-specific error code Message string `json:"message,omitempty"` // application-level error message, for debugging }
ErrResponse renderer type for handling all sorts of errors. In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.
func ErrBadRequest ¶
func ErrBadRequest(err error) *ErrResponse
func ErrInternalServerError ¶
func ErrInternalServerError(err error) *ErrResponse
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
type GetValuesByMeterIdParams ¶
type GetValuesByMeterIdParams struct { Subject *string `form:"subject,omitempty" json:"subject,omitempty"` // From Start date-time in RFC 3339 format. // Must be aligned with the window size. // Inclusive. From *time.Time `form:"from,omitempty" json:"from,omitempty"` // To End date-time in RFC 3339 format. // Must be aligned with the window size. // Inclusive. To *time.Time `form:"to,omitempty" json:"to,omitempty"` // WindowSize If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. WindowSize *WindowSize `form:"windowSize,omitempty" json:"windowSize,omitempty"` }
GetValuesByMeterIdParams defines parameters for GetValuesByMeterId.
type IngestEventsJSONRequestBody ¶
type IngestEventsJSONRequestBody = Event
IngestEventsJSONRequestBody defines body for IngestEvents for application/cloudevents+json ContentType.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() 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 ServerInterface ¶
type ServerInterface interface { // (POST /api/v1alpha1/events) IngestEvents(w http.ResponseWriter, r *http.Request) // (GET /api/v1alpha1/meters) GetMeters(w http.ResponseWriter, r *http.Request) // (GET /api/v1alpha1/meters/{meterId}) GetMetersById(w http.ResponseWriter, r *http.Request, meterId string) // (GET /api/v1alpha1/meters/{meterId}/values) GetValuesByMeterId(w http.ResponseWriter, r *http.Request, meterId string, params GetValuesByMeterIdParams) }
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) GetMeters ¶
func (siw *ServerInterfaceWrapper) GetMeters(w http.ResponseWriter, r *http.Request)
GetMeters operation middleware
func (*ServerInterfaceWrapper) GetMetersById ¶
func (siw *ServerInterfaceWrapper) GetMetersById(w http.ResponseWriter, r *http.Request)
GetMetersById operation middleware
func (*ServerInterfaceWrapper) GetValuesByMeterId ¶
func (siw *ServerInterfaceWrapper) GetValuesByMeterId(w http.ResponseWriter, r *http.Request)
GetValuesByMeterId operation middleware
func (*ServerInterfaceWrapper) IngestEvents ¶
func (siw *ServerInterfaceWrapper) IngestEvents(w http.ResponseWriter, r *http.Request)
IngestEvents 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 UnmarshallingParamError ¶
func (*UnmarshallingParamError) Error ¶
func (e *UnmarshallingParamError) Error() string
func (*UnmarshallingParamError) Unwrap ¶
func (e *UnmarshallingParamError) Unwrap() error