Documentation
¶
Overview ¶
Package web provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.12.2 DO NOT EDIT.
Index ¶
- Constants
- func ConfigureHTTPServers(lifecycle fx.Lifecycle, shutdowner fx.Shutdowner, k *koanf.Koanf) (*echo.Echo, error)
- 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 Channel
- type ChannelCreation
- type ChannelCreationRequest
- type ChannelSubscription
- type ChannelSubscriptionRequest
- type ChattyService
- type EchoRouter
- type ErrorMessage
- type HTTPServerConfig
- type LoginRequest
- type LoginSchema
- type N200SuccessChannelSubscribe
- type N200SuccessGetChannels
- type N200SuccessGetUsers
- type N200SuccessLogin
- type N200SuccessWsConnection
- type N200SuccessWsToken
- type N201SuccessChannelCreation
- type N201SuccessSignUp
- type N400BadRequest
- type N401UnauthorizedError
- type N500InternalServerError
- type PublicPostChannelsJSONRequestBody
- type PublicPostChannelsSubscribeJSONRequestBody
- type PublicPostSignupJSONRequestBody
- type PublicPostTokenJSONRequestBody
- type ServerInterface
- type ServerInterfaceWrapper
- func (w *ServerInterfaceWrapper) PublicGetChannels(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicGetUsers(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicGetWs(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicGetWsToken(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicPostChannels(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicPostChannelsSubscribe(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicPostSignup(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) PublicPostToken(ctx echo.Context) error
- type SignUpRequest
- type SignUpSchema
- type SuccessChannelCreation
- type SuccessChannelSubscription
- type SuccessGetChannels
- type SuccessGetUsers
- type SuccessLoginSchema
- type SuccessSignupSchema
- type SuccessWsConnectionSchema
- type SystemHTTPServerConfig
- type UnauthorizedSchema
- type User
- type WebHandler
- func (wh *WebHandler) PublicGetChannels(ctx echo.Context) error
- func (wh *WebHandler) PublicGetUsers(ctx echo.Context) error
- func (wh *WebHandler) PublicGetWs(ctx echo.Context) error
- func (wh *WebHandler) PublicGetWsToken(ctx echo.Context) error
- func (wh *WebHandler) PublicPostChannels(ctx echo.Context) error
- func (wh *WebHandler) PublicPostChannelsSubscribe(ctx echo.Context, id string) error
- func (wh *WebHandler) PublicPostSignup(ctx echo.Context) error
- func (wh *WebHandler) PublicPostToken(ctx echo.Context) error
Constants ¶
const (
JwtAuthScopes = "jwtAuth.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigureHTTPServers ¶
func ConfigureHTTPServers(lifecycle fx.Lifecycle, shutdowner fx.Shutdowner, k *koanf.Koanf) (*echo.Echo, error)
ConfigureHTTPServers creates an HTTP server with standard middleware and a system HTTP server with health and metrics endpoints returns the echo engine for serving API
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 Channel ¶
type Channel struct {
Id string `json:"id"`
Members []string `json:"members"`
Name string `json:"name"`
OwnerId string `json:"ownerId"`
Visibility string `json:"visibility"`
}
Channel defines model for Channel.
type ChannelCreation ¶
ChannelCreation defines model for ChannelCreation.
type ChannelCreationRequest ¶
type ChannelCreationRequest = ChannelCreation
ChannelCreationRequest defines model for ChannelCreationRequest.
type ChannelSubscription ¶
type ChannelSubscription = map[string]interface{}
ChannelSubscription defines model for ChannelSubscription.
type ChannelSubscriptionRequest ¶
type ChannelSubscriptionRequest = ChannelSubscription
ChannelSubscriptionRequest defines model for ChannelSubscriptionRequest.
type ChattyService ¶
type ChattyService interface {
Signup(username string, password string) (string, string, error)
Login(username string, password string) (string, error)
GetUsers() ([]*inmemory.UserBean, error)
CreateChannel(name string, visibility string, owner string) (*inmemory.ChannelBean, error)
SubscribeChannel(username string, channelName string) error
GetChannels() ([]*inmemory.ChannelBean, error)
HandleConnection(ctx echo.Context) error
GetConnectionToken(ctx echo.Context, userId string) (string, error)
}
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 ErrorMessage ¶
ErrorMessage defines model for ErrorMessage.
type HTTPServerConfig ¶
type HTTPServerConfig struct {
Address string `json:"address"`
SystemHTTPServerConfig *SystemHTTPServerConfig `json:"system,omitempty"`
ReadTimeout time.Duration `json:"readTimeout"`
WriteTimeout time.Duration `json:"writeTimeout"`
IdleTimeout time.Duration `json:"idleTimeout"`
}
HTTPServerConfig provides configuration for HTTP Server
func ReadHTTPServerConfig ¶
func ReadHTTPServerConfig(k *koanf.Koanf) (*HTTPServerConfig, error)
ReadHTTPServerConfig reads HTTP server configuration
type LoginSchema ¶
LoginSchema defines model for LoginSchema.
type N200SuccessChannelSubscribe ¶
type N200SuccessChannelSubscribe = SuccessChannelSubscription
N200SuccessChannelSubscribe defines model for 200SuccessChannelSubscribe.
type N200SuccessGetChannels ¶
type N200SuccessGetChannels = SuccessGetChannels
N200SuccessGetChannels defines model for 200SuccessGetChannels.
type N200SuccessGetUsers ¶
type N200SuccessGetUsers = SuccessGetUsers
N200SuccessGetUsers defines model for 200SuccessGetUsers.
type N200SuccessLogin ¶
type N200SuccessLogin = SuccessLoginSchema
N200SuccessLogin defines model for 200SuccessLogin.
type N200SuccessWsConnection ¶
type N200SuccessWsConnection = SuccessWsConnectionSchema
N200SuccessWsConnection defines model for 200SuccessWsConnection.
type N200SuccessWsToken ¶
type N200SuccessWsToken = SuccessLoginSchema
N200SuccessWsToken defines model for 200SuccessWsToken.
type N201SuccessChannelCreation ¶
type N201SuccessChannelCreation = SuccessChannelCreation
N201SuccessChannelCreation defines model for 201SuccessChannelCreation.
type N201SuccessSignUp ¶
type N201SuccessSignUp = SuccessSignupSchema
N201SuccessSignUp defines model for 201SuccessSignUp.
type N400BadRequest ¶
type N400BadRequest = ErrorMessage
N400BadRequest defines model for 400BadRequest.
type N401UnauthorizedError ¶
type N401UnauthorizedError = UnauthorizedSchema
N401UnauthorizedError defines model for 401UnauthorizedError.
type N500InternalServerError ¶
type N500InternalServerError = ErrorMessage
N500InternalServerError defines model for 500InternalServerError.
type PublicPostChannelsJSONRequestBody ¶
type PublicPostChannelsJSONRequestBody = ChannelCreation
PublicPostChannelsJSONRequestBody defines body for PublicPostChannels for application/json ContentType.
type PublicPostChannelsSubscribeJSONRequestBody ¶
type PublicPostChannelsSubscribeJSONRequestBody = ChannelSubscription
PublicPostChannelsSubscribeJSONRequestBody defines body for PublicPostChannelsSubscribe for application/json ContentType.
type PublicPostSignupJSONRequestBody ¶
type PublicPostSignupJSONRequestBody = SignUpSchema
PublicPostSignupJSONRequestBody defines body for PublicPostSignup for application/json ContentType.
type PublicPostTokenJSONRequestBody ¶
type PublicPostTokenJSONRequestBody = LoginSchema
PublicPostTokenJSONRequestBody defines body for PublicPostToken for application/json ContentType.
type ServerInterface ¶
type ServerInterface interface {
// Returns a list of channels
// (GET /v1/chatty/channels)
PublicGetChannels(ctx echo.Context) error
// Creates a new channel
// (POST /v1/chatty/channels)
PublicPostChannels(ctx echo.Context) error
// Subscribe to a channel
// (POST /v1/chatty/channels/{id}/subscribe)
PublicPostChannelsSubscribe(ctx echo.Context, id string) error
// Registers a new user
// (POST /v1/chatty/signup)
PublicPostSignup(ctx echo.Context) error
// Returns a token
// (POST /v1/chatty/token)
PublicPostToken(ctx echo.Context) error
// Returns a list of users
// (GET /v1/chatty/users)
PublicGetUsers(ctx echo.Context) error
// Connects to Chatty to send and receive messages
// (GET /v1/chatty/ws)
PublicGetWs(ctx echo.Context) error
// Returns a token for authentication with the Webscoket endpoint
// (GET /v1/chatty/ws/token)
PublicGetWsToken(ctx echo.Context) error
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) PublicGetChannels ¶
func (w *ServerInterfaceWrapper) PublicGetChannels(ctx echo.Context) error
PublicGetChannels converts echo context to params.
func (*ServerInterfaceWrapper) PublicGetUsers ¶
func (w *ServerInterfaceWrapper) PublicGetUsers(ctx echo.Context) error
PublicGetUsers converts echo context to params.
func (*ServerInterfaceWrapper) PublicGetWs ¶
func (w *ServerInterfaceWrapper) PublicGetWs(ctx echo.Context) error
PublicGetWs converts echo context to params.
func (*ServerInterfaceWrapper) PublicGetWsToken ¶
func (w *ServerInterfaceWrapper) PublicGetWsToken(ctx echo.Context) error
PublicGetWsToken converts echo context to params.
func (*ServerInterfaceWrapper) PublicPostChannels ¶
func (w *ServerInterfaceWrapper) PublicPostChannels(ctx echo.Context) error
PublicPostChannels converts echo context to params.
func (*ServerInterfaceWrapper) PublicPostChannelsSubscribe ¶
func (w *ServerInterfaceWrapper) PublicPostChannelsSubscribe(ctx echo.Context) error
PublicPostChannelsSubscribe converts echo context to params.
func (*ServerInterfaceWrapper) PublicPostSignup ¶
func (w *ServerInterfaceWrapper) PublicPostSignup(ctx echo.Context) error
PublicPostSignup converts echo context to params.
func (*ServerInterfaceWrapper) PublicPostToken ¶
func (w *ServerInterfaceWrapper) PublicPostToken(ctx echo.Context) error
PublicPostToken converts echo context to params.
type SignUpRequest ¶
type SignUpRequest = SignUpSchema
SignUpRequest defines model for SignUpRequest.
type SuccessChannelCreation ¶
type SuccessChannelCreation struct {
Id string `json:"id"`
Name string `json:"name"`
OwnerId string `json:"ownerId"`
}
SuccessChannelCreation defines model for SuccessChannelCreation.
type SuccessChannelSubscription ¶
SuccessChannelSubscription defines model for SuccessChannelSubscription.
type SuccessGetChannels ¶
type SuccessGetChannels struct {
Channels []Channel `json:"channels"`
}
SuccessGetChannels defines model for SuccessGetChannels.
type SuccessGetUsers ¶
type SuccessGetUsers struct {
Users []User `json:"users"`
}
SuccessGetUsers defines model for SuccessGetUsers.
type SuccessLoginSchema ¶
type SuccessLoginSchema struct {
Token string `json:"token"`
}
SuccessLoginSchema defines model for SuccessLoginSchema.
type SuccessSignupSchema ¶
type SuccessSignupSchema struct {
Id string `json:"id"`
Ok *bool `json:"ok,omitempty"`
Username string `json:"username"`
}
SuccessSignupSchema defines model for SuccessSignupSchema.
type SuccessWsConnectionSchema ¶
SuccessWsConnectionSchema defines model for SuccessWsConnectionSchema.
type SystemHTTPServerConfig ¶
type SystemHTTPServerConfig struct {
Address string `json:"address"`
}
SystemHTTPServerConfig provides configuration for the system HTTP server
type UnauthorizedSchema ¶
type UnauthorizedSchema struct {
}
UnauthorizedSchema defines model for UnauthorizedSchema.
type WebHandler ¶
type WebHandler struct {
// contains filtered or unexported fields
}
func NewWebHandler ¶
func NewWebHandler(service ChattyService) *WebHandler
func (*WebHandler) PublicGetChannels ¶
func (wh *WebHandler) PublicGetChannels(ctx echo.Context) error
func (*WebHandler) PublicGetUsers ¶
func (wh *WebHandler) PublicGetUsers(ctx echo.Context) error
func (*WebHandler) PublicGetWs ¶
func (wh *WebHandler) PublicGetWs(ctx echo.Context) error
func (*WebHandler) PublicGetWsToken ¶
func (wh *WebHandler) PublicGetWsToken(ctx echo.Context) error
func (*WebHandler) PublicPostChannels ¶
func (wh *WebHandler) PublicPostChannels(ctx echo.Context) error
func (*WebHandler) PublicPostChannelsSubscribe ¶
func (wh *WebHandler) PublicPostChannelsSubscribe(ctx echo.Context, id string) error
func (*WebHandler) PublicPostSignup ¶
func (wh *WebHandler) PublicPostSignup(ctx echo.Context) error
func (*WebHandler) PublicPostToken ¶
func (wh *WebHandler) PublicPostToken(ctx echo.Context) error