server

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 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)

BaseAPIHandler handles the base API route.

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		Fetch categories
@Description	get categories with optional filters

@Tags			api
@Accept			json
@Produce		json

@Param			random	query		bool	false	"If exists or true, returns `limit` random records."
@Param			id		query		int64	false	"If exists, returns the record with the given id."
@Param			limit	query		int64	false	"Limit the number of records returned."	Default(10)

@Success		200		{array}		models.Category
@Failure		500		{object}	utils.HTTPError
@Router			/category [get]

func ClueHandler added in v0.0.9

func ClueHandler(c *gin.Context)

ClueHandler godoc

@Summary		Fetch Clues
@Description	get clues with optional filters

@Tags			api
@Accept			json
@Produce		json

@Param			random		query		bool	false	"If exists or true, returns `limit` random records."
@Param			id			query		int64	false	"If exists, returns the record with the given id."
@Param			game		query		integer	false	"Filter by Game ID"
@Param			category	query		integer	false	"Filter by Category ID"
@Param			limit		query		int64	false	"Limit the number of records returned"	Default(10)

@Success		200			{array}		models.Clue
@Failure		500			{object}	utils.HTTPError
@Router			/clue [get]

func GameHandler added in v0.0.9

func GameHandler(c *gin.Context)

GameHandler godoc

@Summary		Fetch Games
@Description	get games with optional filters

@Tags			api
@Accept			json
@Produce		json

@Param			random	query		bool	false	"If exists or true, returns `limit` random records."
@Param			id		query		int64	false	"If exists, returns the record with the given id."
@Param			limit	query		int64	false	"Limit the number of records returned."	Default(10)

@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
}

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