server

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseAPIHandler added in v0.0.9

func BaseAPIHandler(c *gin.Context)

BaseHandler godoc

@Summary		Base api handler
@Description	List available endpoints

@Tags			root
@Accept			*/*
@Produce		json
@Success		200	{array}	string	"list of available endpoints"
@Router			/ [get]

func BaseUIHandler

func BaseUIHandler(c *gin.Context)

BaseUIHandler handles the base UI route.

func CategoryHandler added in v0.0.9

func CategoryHandler(c *gin.Context)

CategoryHandler godoc.

@Summary		Returns a list of categories.
@Description	Returns a list of categories.
@Tags			api
@Accept			json
@Produce		json
@Param			random	query	bool	false	"If exists, returns up to `limit` random records."
@Param			id		query	int64	false	"If exists, returns the record with the given id."
@Param			page	query	int64	false	"Paging offset"
@Param			limit	query	int64	false	"Limit the number of records returned"
@Success		200		{array}	models.Category
@Router			/category [get]

func ClueHandler added in v0.0.9

func ClueHandler(c *gin.Context)

ClueHandler godoc

@Summary		Returns a list of clues
@Description	Returns a list of clues

@Tags			api
@Accept			*/*
@Produce		json
@Param			random		query		bool	false	"Random Clue"
@Param			id			query		integer	false	"Clue ID"
@Param			game		query		integer	false	"Game ID"
@Param			category	query		integer	false	"Category ID"
@Success		200			{array}		models.Clue
@Failure		400			{object}	utils.HTTPError
@Failure		500			{object}	utils.HTTPError
@Router			/clue [get]

func DebugUIHandler

func DebugUIHandler(c *gin.Context)

func GameHandler added in v0.0.9

func GameHandler(c *gin.Context)

GameHandler godoc

@Summary		Returns a list of games
@Description	Returns a list of games

@Tags			api
@Accept			*/*
@Produce		json
@Param			filter	query		Filter	false	"Filter games"
@Success		200		{array}		models.Game
@Failure		500		{object}	utils.HTTPError
@Router			/game [get]

Types

type ClueFilter added in v0.0.9

type ClueFilter struct {
	Filter
	GameID     int64 `form:"game"`
	CategoryID int64 `form:"category"`
}

type Filter added in v0.0.9

type Filter struct {
	Random *bool  `form:"random"`
	ID     *int64 `form:"id"`
	Page   *int64 `form:"page,default=0" binding:"min=0"`
	Limit  *int64 `form:"limit,default=1" binding:"min=1,max=100"`
}

type Server

type Server struct {
	ID     string
	Clock  clock.Clock
	Router *gin.Engine
	JDB    *sqlx.DB
}

Server is the API server.

func NewServer

func NewServer() *Server

NewServer returns a new API server.

type StringResponse

type StringResponse struct {
	Message string `json:"message" example:"some string value"`
}

Jump to

Keyboard shortcuts

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