v1

package
v0.0.0-...-4c6bba2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminHandler

func AdminHandler() gin.HandlerFunc

AdminHandler handles admin action It should be called after JWTHandler is called

func ChangeSettings

func ChangeSettings(c *gin.Context)

ChangeSettings returns the result of change profile @Description change user attributes including private one @Tags entry @Summary change user attributes @Accept json @Produce json @Param Authorization header string true "with the bearer started" @Param resname path string true "changing resource name" Enums(custom_name, use_cname) @Param value body string true "changing resource value" @Success 200 {object} entry "changed user attributes" @Failure 400 {object} errInfo "invalid parameter" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /settings/{resname} [post]

func Connect

func Connect(c *gin.Context)

Connect returns result of rail connection @Description result of rail node connection @Tags connectResponse @Summary connect @Accept json @Produce json @Param x body number true "x coordinate" @Param y body number true "y coordinate" @Param scale body number true "width,height(100%)=2^scale" @Param from body integer true "from rail node id" @Param to body integer true "to rail node id" @Success 200 {object} connectResponse "connect rail node" @Failure 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /rail_nodes/connect [post]

func Depart

func Depart(c *gin.Context)

Depart returns result of rail node creation @Description result of rail node creation @Tags deptResponse @Summary depart @Accept json @Produce json @Param x body number true "x coordinate" @Param y body number true "y coordinate" @Param scale body number true "width,height(100%)=2^scale" @Success 200 {object} deptResponse "created rail node" @Failure 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /rail_nodes [post]

func Extend

func Extend(c *gin.Context)

Extend returns result of rail node extension @Description result of rail node extension @Tags extendResponse @Summary extend @Accept json @Produce json @Param x body number true "x coordinate" @Param y body number true "y coordinate" @Param scale body number true "width,height(100%)=2^scale" @Param rnid body integer true "tail rail node id" @Success 200 {object} extendResponse "extend rail node" @Failure 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /rail_nodes/extend [post]

func GameMap

func GameMap(c *gin.Context)

GameMap returns all data of gamemap @Description entities are delegate object @Tags entities.DelegateMap @Summary get all entities in specified area @Accept json @Produce json @Param cx query number true "x coordinate" @Param cy query number true "y coordinate" @Param scale query number true "width,height(100%)=2^scale" @Param delegate query number true "width,height(grid)=2^delegate" @Success 200 {object} entities.DelegateMap "map centered (x,y) with grid in (width,height)" @Failure 400 {array} string "reasons of error when cx, cy and scale are out of area" @Router /gamemap [get]

func GameStatus

func GameStatus(c *gin.Context)

GameStatus returns game status @Description game status @Tags gameStatus @Summary game status @Produce json @Success 200 {object} gameStatus "game status" @Router /game [get]

func GitHub

func GitHub(c *gin.Context)

GitHub redirects github sign in page

func GitHubCallback

func GitHubCallback(c *gin.Context)

GitHubCallback registers user info @Description try register github info @Summary try register github info @Param state query string true "state" @Param code query string true "code" @Failure 503 {string} string "no OAuth token"

func Google

func Google(c *gin.Context)

Google redirects google sign in page

func GoogleCallback

func GoogleCallback(c *gin.Context)

GoogleCallback registers user info @Param state query string true "state" @Param code query string true "code" @Failure 503 {string} string "no OAuth token"

func InitController

func InitController(c *config.Config, a *auth.Auther)

InitController loads config

func JWTHandler

func JWTHandler() gin.HandlerFunc

JWTHandler handles user action with jwt key It should be called after MaintenanceHandler is called

func Login

func Login(c *gin.Context)

Login returns result of password login @Description try login using loginid/password paramter @Tags jwtInfo @Summary try login to RushHour server @Accept json @Produce json @Param id body string true "email address" @Param password body string true "password" @Success 200 {object} jwtInfo "json web token containing user attributes" @Failure 400 {object} errInfo "reasons of error when login fail" @Failure 503 {object} errInfo "under maintenance (apply only normal, except admin)" @Router /login [post]

func MaintenanceHandler

func MaintenanceHandler() gin.HandlerFunc

MaintenanceHandler blocks user access under maintenance

func ModelHandler

func ModelHandler() gin.HandlerFunc

ModelHandler handles model and error controling It causes panic when neither result keyOk or keyErr is set It should be called after JWTHandeler and AdminHandler are called

func Players

func Players(c *gin.Context)

Players returns list of player @Description list of player @Tags []entities.Player @Summary list of player @Accept json @Produce json @Success 200 {array} entities.Player "list of player" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /players [get]

func PurgeUserData

func PurgeUserData(c *gin.Context)

PurgeUserData deletes all user data @Description result of purging @Tags gameStatus @Summary start game @Produce json @Success 200 {object} gameStatus "game status" @Failure 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Router /admin/game/purge [post]

func Register

func Register(c *gin.Context)

Register returns result of password sign up @Description try register with loginid/password @Tags jwtInfo @Summary try register to RushHour server @Accept json @Produce json @Param id body string true "email address" @Param password body string true "password" @Param name body string false "display name" @Param hue body integer true "player's rail line symbol color (HSV model)" @Success 200 {object} jwtInfo "json web token containing user attributes" @Failure 400 {object} errInfo "reasons of error when register" @Failure 503 {object} errInfo "under maintenance" @Router /register [post]

func RemoveRailNode

func RemoveRailNode(c *gin.Context)

RemoveRailNode returns result of rail deletion @Description result of rail node deletion @Tags removeRailNodeResponse @Summary remove rail node @Accept json @Produce json @Param rnid body integer true "rail node id" @Success 200 {object} removeRailNodeResponse "connect rail node" @Success 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /rail_nodes [delete]

func Settings

func Settings(c *gin.Context)

Settings returns the list of customizable attributes @Description list up user attributes including private one @Tags services.AccountSettings @Summary get user attributes @Accept json @Produce json @Param Authorization header string true "with the bearer started" @Success 200 {object} services.AccountSettings "user attributes" @Failure 400 {object} errInfo "under maintenance" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /settings [get]

func SignOut

func SignOut(c *gin.Context)

SignOut deletes cached OAuth token. @Description deletes OAuth token @Summary execute user sign out @Accept json @Produce json @Success 200 {object} string "sign out successfully" @Failure 401 {object} errInfo "invalid jwt" @Failure 503 {object} errInfo "under maintenance" @Router /signout [get]

func StartGame

func StartGame(c *gin.Context)

StartGame returns result of game starting @Description result of game starting @Tags gameStatus @Summary start game @Produce json @Success 200 {object} gameStatus "game status" @Failure 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Router /admin/game/start [post]

func StopGame

func StopGame(c *gin.Context)

StopGame returns result of game stopping @Description result of game stopping @Tags gameStatus @Summary stop game @Produce json @Success 200 {object} gameStatus "game status" @Failure 400 {object} errInfo "reason of fail" @Failure 401 {object} errInfo "invalid jwt" @Router /admin/game/stop [post]

func Twitter

func Twitter(c *gin.Context)

Twitter redirects twitter sign in page

func TwitterCallback

func TwitterCallback(c *gin.Context)

TwitterCallback registers user info @Param oauth_verifier query string true "access token" @Failure 503 {string} string "session expire" @Failure 503 {string} string "no OAuth token"

Types

type DefaultValidator

type DefaultValidator struct {
	// contains filtered or unexported fields
}

DefaultValidator enables custom validation

func (*DefaultValidator) Engine

func (v *DefaultValidator) Engine() interface{}

Engine is implementation of binding.StructValidator

func (*DefaultValidator) ValidateStruct

func (v *DefaultValidator) ValidateStruct(obj interface{}) error

ValidateStruct is implementation of binding.StructValidator

Jump to

Keyboard shortcuts

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