handlers

package
v0.0.0-...-59cac3b Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package handlers provides handler functions for web routes

Package handlers provides handler functions for web routes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountInfo

func AccountInfo(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: /api/v0/my/account

func ApiSelection

func ApiSelection(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api

func ChangeGolemTask

func ChangeGolemTask(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: PUT /api/v0/my/invokers/{symbol}

func GenerateHandlerMiddlewareFunc

func GenerateHandlerMiddlewareFunc(udb rdb.Database, wdb rdb.Database) func(http.Handler) http.Handler

Generates middleware func to pass databases to handlers using context

func GetGolems

func GetGolems(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: GET /api/v0/my/golems

func GetGolemsByArchetype

func GetGolemsByArchetype(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: GET /api/v0/my/golems/{archetype}

func GetLeaderboards

func GetLeaderboards(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0/leaderboards/{board}

func GetRitualInfo

func GetRitualInfo(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: GET /api/v0/my/rituals/{ritual}

func GetUDBAndSaveUserToDB

func GetUDBAndSaveUserToDB(w http.ResponseWriter, r *http.Request, userData schema.User) bool

func GetUdbFromCtx

func GetUdbFromCtx(r *http.Request) (rdb.Database, error)

Attempt to get udb from context, return udb, nil if successful else return rdb.Database{}, nil

func GetValidationFromCtx

func GetValidationFromCtx(r *http.Request) (auth.ValidationPair, error)

Attempt to get validation context

func GetWdbFromCtx

func GetWdbFromCtx(w http.ResponseWriter, r *http.Request) (bool, rdb.Database)

Attempt to get wdb from context

func GolemInfo

func GolemInfo(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: GET /api/v0/my/golems/info/{symbol}

func Homepage

func Homepage(w http.ResponseWriter, r *http.Request)

Handler function for the route: /

func LeaderboardDescriptions

func LeaderboardDescriptions(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0/leaderboards

func ListRituals

func ListRituals(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: GET /api/v0/my/rituals

func LocationsOverview

func LocationsOverview(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0/locations

func NewHarvester

func NewHarvester(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: POST /api/v0/my/rituals/summon-harvester

func NewInvoker

func NewInvoker(w http.ResponseWriter, r *http.Request)

Handler function for the secure route: POST /api/v0/my/rituals/summon-invoker

func SaveUserToDB

func SaveUserToDB(udb rdb.Database, userData schema.User) error

Attempt to save user, returns error or nil if successful

func UsernameClaim

func UsernameClaim(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0/users/{username}/claim

func UsernameInfo

func UsernameInfo(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0/users/{username}

func UsersSummary

func UsersSummary(w http.ResponseWriter, r *http.Request)

- `.../users` users summary (e.g. unique, active - call in last 5 min, etc.) example: ```json

{
  "uniqueUsers": ["Greenitthe", ...],
  "activeUsers": ["Greenitthe", ...],
  "usersWithAchievement": {
    "ratelimited": ["Greenitthe", ...],
    "first_million": ["Greenitthe", ...],
    ...
  }
}

``` Handler function for the route: /api/v0/users

func V0Status

func V0Status(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0

Types

type HandlerResponseKey

type HandlerResponseKey int

ENUM for handler context

const (
	UserDBContext HandlerResponseKey = iota
	WorldDBContext
)

Jump to

Keyboard shortcuts

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