Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 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 NewWeatherService(config WeatherServiceConfig) *weatherService
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type ChiServerOptions
- type Coordinate
- type ErrorMessage
- type GetWeather200JSONResponse
- type GetWeather400JSONResponse
- type GetWeatherParams
- type GetWeatherRequestObject
- type GetWeatherResponseObject
- type InvalidParamFormatError
- type MiddlewareFunc
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- type StrictHTTPServerOptions
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type Temperature
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- type UnmarshalingParamError
- type WeatherServiceConfig
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
func NewWeatherService ¶
func NewWeatherService(config WeatherServiceConfig) *weatherService
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type ErrorMessage ¶
type ErrorMessage struct {
Error string `json:"error"`
}
ErrorMessage defines model for ErrorMessage.
type GetWeather200JSONResponse ¶
type GetWeather200JSONResponse struct { TemperatureSummary Temperature `json:"temperature_summary"` WeatherCondition string `json:"weather_condition"` }
func (GetWeather200JSONResponse) VisitGetWeatherResponse ¶
func (response GetWeather200JSONResponse) VisitGetWeatherResponse(w http.ResponseWriter) error
type GetWeather400JSONResponse ¶
type GetWeather400JSONResponse ErrorMessage
func (GetWeather400JSONResponse) VisitGetWeatherResponse ¶
func (response GetWeather400JSONResponse) VisitGetWeatherResponse(w http.ResponseWriter) error
type GetWeatherParams ¶
type GetWeatherParams struct { Lat *Coordinate `form:"lat,omitempty" json:"lat,omitempty"` Lon *Coordinate `form:"lon,omitempty" json:"lon,omitempty"` }
GetWeatherParams defines parameters for GetWeather.
type GetWeatherRequestObject ¶
type GetWeatherRequestObject struct {
Params GetWeatherParams
}
type GetWeatherResponseObject ¶
type GetWeatherResponseObject interface {
VisitGetWeatherResponse(w http.ResponseWriter) error
}
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 { // (GET /weather) GetWeather(w http.ResponseWriter, r *http.Request, params GetWeatherParams) }
ServerInterface represents all server handlers.
func NewStrictHandler ¶
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface
func NewStrictHandlerWithOptions ¶
func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface
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) GetWeather ¶
func (siw *ServerInterfaceWrapper) GetWeather(w http.ResponseWriter, r *http.Request)
GetWeather operation middleware
type StrictHTTPServerOptions ¶
type StrictHTTPServerOptions struct { RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type StrictHandlerFunc ¶
type StrictHandlerFunc = strictnethttp.StrictHTTPHandlerFunc
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc = strictnethttp.StrictHTTPMiddlewareFunc
type StrictServerInterface ¶
type StrictServerInterface interface { // (GET /weather) GetWeather(ctx context.Context, request GetWeatherRequestObject) (GetWeatherResponseObject, error) }
StrictServerInterface represents all server handlers.
type Temperature ¶
type Temperature string
Temperature defines model for Temperature.
const ( COLD Temperature = "COLD" HOT Temperature = "HOT" MODERATE Temperature = "MODERATE" )
Defines values for Temperature.
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) GetWeather ¶
func (_ Unimplemented) GetWeather(w http.ResponseWriter, r *http.Request, params GetWeatherParams)
(GET /weather)
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type WeatherServiceConfig ¶
type WeatherServiceConfig struct { WeatherUtil weather.WeatherUtil // Anything below specified ColdTemp will be summarized as "COLD" ColdTemp int // Anything above HotTemp will be summarized as "HOT" (this must be greater than ColdTemp ) HotTemp int }