Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.
Index ¶
- Constants
- Variables
- func GetSwagger() (swagger *openapi3.T, err error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type ClientError
- type Config
- type EchoRouter
- type GetBadgeDynamicParams
- type GetBadgePredefinedPredefinedNameParams
- type GetBadgePredefinedPredefinedNameParams_Params
- func (a GetBadgePredefinedPredefinedNameParams_Params) Get(fieldName string) (value interface{}, found bool)
- func (a GetBadgePredefinedPredefinedNameParams_Params) MarshalJSON() ([]byte, error)
- func (a *GetBadgePredefinedPredefinedNameParams_Params) Set(fieldName string, value interface{})
- func (a *GetBadgePredefinedPredefinedNameParams_Params) UnmarshalJSON(b []byte) error
- type GetBadgeStaticParams
- type PingResponse
- type PingResponseStatus
- type ServerInterface
- type ServerInterfaceWrapper
- func (w *ServerInterfaceWrapper) GetBadgeDynamic(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetBadgePredefined(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetBadgePredefinedPredefinedName(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetBadgeStatic(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetOpenapiYaml(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetPing(ctx echo.Context) error
Constants ¶
const DynamicBadgeResponseName = "r"
Variables ¶
var (
ErrPredefinedBadgeNotFound = errors.New("Predefined badge name not found")
)
var OpenAPISpec []byte
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 PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type ClientError ¶
error object for client errors
type Config ¶
type Config struct { BadgeService badges.BadgeService HTTPClient *resty.Client PredefinedBadges *badgeconfig.Config }
Config provides the up-front configuration necessary to launch an API.
type EchoRouter ¶
type EchoRouter interface { CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route }
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type GetBadgeDynamicParams ¶
type GetBadgeDynamicParams struct { // URL of the server to fetch dynamic data from. Target string `form:"target" json:"target"` // Pongo2 format string to display for fo the badge label Label *string `form:"label,omitempty" json:"label,omitempty"` // Pongo2 format string to display for fo the badge message Message *string `form:"message,omitempty" json:"message,omitempty"` // Pongo2 format string to select a badge color by Color *string `form:"color,omitempty" json:"color,omitempty"` }
GetBadgeDynamicParams defines parameters for GetBadgeDynamic.
type GetBadgePredefinedPredefinedNameParams ¶
type GetBadgePredefinedPredefinedNameParams struct { // Predefined badges may define custom parameters to control templating. Params *GetBadgePredefinedPredefinedNameParams_Params `form:"params,omitempty" json:"params,omitempty"` }
GetBadgePredefinedPredefinedNameParams defines parameters for GetBadgePredefinedPredefinedName.
type GetBadgePredefinedPredefinedNameParams_Params ¶
type GetBadgePredefinedPredefinedNameParams_Params struct {
AdditionalProperties map[string]interface{} `json:"-"`
}
GetBadgePredefinedPredefinedNameParams_Params defines parameters for GetBadgePredefinedPredefinedName.
func (GetBadgePredefinedPredefinedNameParams_Params) Get ¶
func (a GetBadgePredefinedPredefinedNameParams_Params) Get(fieldName string) (value interface{}, found bool)
Getter for additional properties for GetBadgePredefinedPredefinedNameParams_Params. Returns the specified element and whether it was found
func (GetBadgePredefinedPredefinedNameParams_Params) MarshalJSON ¶
func (a GetBadgePredefinedPredefinedNameParams_Params) MarshalJSON() ([]byte, error)
Override default JSON handling for GetBadgePredefinedPredefinedNameParams_Params to handle AdditionalProperties
func (*GetBadgePredefinedPredefinedNameParams_Params) Set ¶
func (a *GetBadgePredefinedPredefinedNameParams_Params) Set(fieldName string, value interface{})
Setter for additional properties for GetBadgePredefinedPredefinedNameParams_Params
func (*GetBadgePredefinedPredefinedNameParams_Params) UnmarshalJSON ¶
func (a *GetBadgePredefinedPredefinedNameParams_Params) UnmarshalJSON(b []byte) error
Override default JSON handling for GetBadgePredefinedPredefinedNameParams_Params to handle AdditionalProperties
type GetBadgeStaticParams ¶
type GetBadgeStaticParams struct { // Pongo2 format string to display for fo the badge label Label *string `form:"label,omitempty" json:"label,omitempty"` // Pongo2 format string to display for fo the badge message Message *string `form:"message,omitempty" json:"message,omitempty"` // Pongo2 format string to select a badge color by Color *string `form:"color,omitempty" json:"color,omitempty"` }
GetBadgeStaticParams defines parameters for GetBadgeStatic.
type PingResponse ¶
type PingResponse struct { RespondedAt *time.Time `json:"responded_at,omitempty"` Status *PingResponseStatus `json:"status,omitempty"` Version *string `json:"version,omitempty"` }
API availability response endpoint
type PingResponseStatus ¶
type PingResponseStatus string
PingResponseStatus defines model for PingResponse.Status.
const (
Ok PingResponseStatus = "ok"
)
Defines values for PingResponseStatus.
type ServerInterface ¶
type ServerInterface interface { // (GET /badge/dynamic) GetBadgeDynamic(ctx echo.Context, params GetBadgeDynamicParams) error // (GET /badge/predefined) GetBadgePredefined(ctx echo.Context) error // (GET /badge/predefined/{predefined_name}/) GetBadgePredefinedPredefinedName(ctx echo.Context, predefinedName string, params GetBadgePredefinedPredefinedNameParams) error // (GET /badge/static) GetBadgeStatic(ctx echo.Context, params GetBadgeStaticParams) error // (GET /openapi.yaml) GetOpenapiYaml(ctx echo.Context) error // (GET /ping) GetPing(ctx echo.Context) error }
ServerInterface represents all server handlers.
func NewAPI ¶
func NewAPI(apiConfig *Config) (ServerInterface, string)
NewAPI returns the API server instance and the version prefix.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) GetBadgeDynamic ¶
func (w *ServerInterfaceWrapper) GetBadgeDynamic(ctx echo.Context) error
GetBadgeDynamic converts echo context to params.
func (*ServerInterfaceWrapper) GetBadgePredefined ¶
func (w *ServerInterfaceWrapper) GetBadgePredefined(ctx echo.Context) error
GetBadgePredefined converts echo context to params.
func (*ServerInterfaceWrapper) GetBadgePredefinedPredefinedName ¶
func (w *ServerInterfaceWrapper) GetBadgePredefinedPredefinedName(ctx echo.Context) error
GetBadgePredefinedPredefinedName converts echo context to params.
func (*ServerInterfaceWrapper) GetBadgeStatic ¶
func (w *ServerInterfaceWrapper) GetBadgeStatic(ctx echo.Context) error
GetBadgeStatic converts echo context to params.
func (*ServerInterfaceWrapper) GetOpenapiYaml ¶
func (w *ServerInterfaceWrapper) GetOpenapiYaml(ctx echo.Context) error
GetOpenapiYaml converts echo context to params.
func (*ServerInterfaceWrapper) GetPing ¶
func (w *ServerInterfaceWrapper) GetPing(ctx echo.Context) error
GetPing converts echo context to params.