Documentation ¶
Overview ¶
Package api provides an API router and controller Registry to route controller api's.
Index ¶
- func APICallback(c *gin.Context)
- func GetControllerInterface(key string) interface{}
- func ProcessRequest(controller string, action string, data []byte, ...)
- func RegisterController(controller interface{})
- func RegisterControllerByKey(key string, controller interface{})
- func SocketAPICallback(conn *app.WebSocketConnection, c *gin.Context, messageType int, id string, ...)
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APICallback ¶
APICallback provides the routing to controller methods. Implementation example----------- ginServer.Router.GET("/apiGET", appAPI.APICallback) ginServer.Router.POST("/api", appAPI.APICallback) ---------------------------------
func GetControllerInterface ¶
func GetControllerInterface(key string) interface{}
GetControllerInterface will return the interface of the controller.
func ProcessRequest ¶
func ProcessRequest(controller string, action string, data []byte, results func(y interface{}, e ErrorResponse, httpStatus int))
ProcessRequest will process a controller requeest.
func RegisterController ¶
func RegisterController(controller interface{})
RegisterController registers a controller object to be registered by the name of the object.
func RegisterControllerByKey ¶
func RegisterControllerByKey(key string, controller interface{})
RegisterControllerByKey registers a controller object to be registered by a custom key.
func SocketAPICallback ¶
func SocketAPICallback(conn *app.WebSocketConnection, c *gin.Context, messageType int, id string, data []byte)
SocketAPICallback provides the routing to controller methods for web socket calls. Implementation example----------- app.RegisterWebSocketDataCallback(api.SocketAPICallback) ---------------------------------
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error *errorObj `json:"error"`
}
ErrorResponse is the default error response object.