application

package
v0.0.0-...-988bea4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

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

type Middleware func(next http.Handler) http.Handler

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

func VkPay

func VkPay(db *gorm.DB, marketInstance *market.Market) VkPayForContainer

VkPay acept and validate payment request from vk

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL