Documentation ¶
Index ¶
- func GetRouter(deps RouterDependencies) http.Handler
- func JSON(w http.ResponseWriter, obj interface{})
- type AuthRequestPart
- type HTTPHandler
- type HTTPHandlerContainer
- func ReqBuyProduct(db *gorm.DB, marketInstance *market.Market) HTTPHandlerContainer
- func ReqEnter(db *gorm.DB) HTTPHandlerContainer
- func ReqReduceCredits(db *gorm.DB) HTTPHandlerContainer
- func ReqReduceTries(db *gorm.DB) HTTPHandlerContainer
- func ReqSavePlayerProgress(vkWorker *notification.VkWorker, db *gorm.DB) HTTPHandlerContainer
- func ReqUsersProgress(db *gorm.DB) HTTPHandlerContainer
- type Middleware
- type RouterDependencies
- type VkPayForContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRouter ¶
func GetRouter(deps RouterDependencies) http.Handler
GetRouter return http.Handler for tests and core
func JSON ¶
func JSON(w http.ResponseWriter, obj interface{})
JSON is helper to serve json http response
Types ¶
type AuthRequestPart ¶
type AuthRequestPart struct { AuthKey string `json:"authKey"` // some hash ExtID int64 `json:"extId,string"` // id on platform SysID string `json:"sysId"` // "VK" SessionKey string `json:"sessionKey"` // OK only }
AuthRequestPart can be used to validate request
type HTTPHandler ¶
type HTTPHandler struct { URL string HTTPHandler http.HandlerFunc }
HTTPHandler struct to hold URL to handle and http.HandlerFunc only for game handlers
type HTTPHandlerContainer ¶
type HTTPHandlerContainer struct { dig.Out HTTPHandler HTTPHandler `group:"server"` }
HTTPHandlerContainer provider for container
func ReqBuyProduct ¶
func ReqBuyProduct(db *gorm.DB, marketInstance *market.Market) HTTPHandlerContainer
ReqBuyProduct buy product
func ReqEnter ¶
func ReqEnter(db *gorm.DB) HTTPHandlerContainer
ReqEnter first request from client. Return user info and user progress
func ReqReduceCredits ¶
func ReqReduceCredits(db *gorm.DB) HTTPHandlerContainer
ReqReduceCredits reduce user credits. Get amount from request
func ReqReduceTries ¶
func ReqReduceTries(db *gorm.DB) HTTPHandlerContainer
ReqReduceTries reduce user tries by one
func ReqSavePlayerProgress ¶
func ReqSavePlayerProgress( vkWorker *notification.VkWorker, db *gorm.DB, ) HTTPHandlerContainer
ReqSavePlayerProgress save player progress
func ReqUsersProgress ¶
func ReqUsersProgress(db *gorm.DB) HTTPHandlerContainer
ReqUsersProgress return progres of received users
type Middleware ¶
Middleware for http router to authorize user
func AuthorizationMiddleware ¶
func AuthorizationMiddleware(db *gorm.DB) Middleware
AuthorizationMiddleware check signature and load user
type RouterDependencies ¶
type RouterDependencies struct { dig.In HandlerSecure []HTTPHandler `group:"server"` Newrelic newrelic.Application AuthorizationMiddleware Middleware NewrelicMiddleware mynewrelic.Middleware VkWorker *notification.VkWorker VkPayHandler http.HandlerFunc Test bool Version string }
RouterDependencies for uber-go/dig
type VkPayForContainer ¶
type VkPayForContainer struct { dig.Out HTTPHandler http.HandlerFunc }
VkPayForContainer for uber-go/dig