handler

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanGameHandler

func CleanGameHandler(ctx *gin.Context)

func DeleteGameInfoHandler

func DeleteGameInfoHandler(c *gin.Context)

DeleteGameInfoHandler is the handler for deleting game info @Summary Delete game info by ID @Description Delete game info by ID @Tags game @Produce json @Param Authorization header string true "Authorization: Bearer <api_key>" @Param id path string true "Game ID" @Success 200 {object} DeleteGameInfoResponse @Failure 400 {object} DeleteGameInfoResponse @Failure 500 {object} DeleteGameInfoResponse @Security BearerAuth @Router /game/id/{id} [delete]

func GetAllAuthorsHandler

func GetAllAuthorsHandler(ctx *gin.Context)

GetAllAuthorsHandler returns all authors @Summary Get all authors @Description Get all authors @Tags author @Accept json @Produce json @Success 200 {object} GetAllAuthorsResponse @Failure 500 {object} GetAllAuthorsResponse @Router /author [get]

func GetGameInfoByIDHandler

func GetGameInfoByIDHandler(c *gin.Context)

GetGameInfoByID retrieves game information by ID. @Summary Retrieve game info by ID @Description Retrieves details of a game by game ID @Tags game @Accept json @Produce json @Param id path string true "Game ID" @Success 200 {object} GetGameInfoByIDResponse @Failure 400 {object} GetGameInfoByIDResponse @Failure 500 {object} GetGameInfoByIDResponse @Router /game/id/{id} [get]

func GetGameInfoByPlatformIDHandler

func GetGameInfoByPlatformIDHandler(c *gin.Context)

GetGameInfoByPlatformID retrieves game information by platform and ID. @Summary Retrieve game info by platform ID @Description Retrieves game information based on a platform type and platform ID @Tags game @Accept json @Produce json @Param platform_type path string true "Platform Type" @Param platform_id path int true "Platform ID" @Success 200 {object} GetGameInfoByPlatformIDResponse @Failure 400 {object} GetGameInfoByPlatformIDResponse @Failure 500 {object} GetGameInfoByPlatformIDResponse @Router /game/platform/{platform_type}/{platform_id} [get]

func GetGameInfosByNameHandler

func GetGameInfosByNameHandler(c *gin.Context)

GetGameInfosByName retrieves game information by game name. @Summary Retrieve game info by name @Description Retrieves game information details by game name @Tags game @Accept json @Produce json @Param name path string true "Game Name" @Success 200 {object} GetGameInfosByNameResponse @Failure 400 {object} GetGameInfosByNameResponse @Failure 500 {object} GetGameInfosByNameResponse @Router /game/name/{name} [get]

func GetGameItemByIDHanlder

func GetGameItemByIDHanlder(c *gin.Context)

GetGameItemByID retrieves game download details by ID. @Summary Retrieve game download by ID @Description Retrieves details of a game download by game ID @Tags game @Accept json @Produce json @Param id path string true "Game Download ID" @Success 200 {object} GetGameItemByIDResponse @Failure 400 {object} GetGameItemByIDResponse @Failure 500 {object} GetGameItemByIDResponse @Router /game/raw/id/{id} [get]

func GetGameItemByRawNameHandler

func GetGameItemByRawNameHandler(c *gin.Context)

GetGameItemByRawName retrieves game download details by raw name. @Summary Retrieve game download by raw name @Description Retrieves details of a game download by its raw name @Tags game @Accept json @Produce json @Param name path string true "Game Download Raw Name" @Success 200 {object} GetGameItemByRawNameResponse @Failure 400 {object} GetGameItemByRawNameResponse @Failure 500 {object} GetGameItemByRawNameResponse @Router /game/raw/name/{name} [get]

func GetGameItemsByAuthorHandler

func GetGameItemsByAuthorHandler(ctx *gin.Context)

GetGameItemsByAuthorHandler returns all game downloads by author @Summary Get game downloads by author @Description Get game downloads by author @Tags game @Accept json @Produce json @Param author path string true "Author" @Param page query int false "Page" @Param page_size query int false "Page Size" @Success 200 {object} GetGameItemsByAuthorResponse @Failure 400 {object} GetGameItemsByAuthorResponse @Failure 500 {object} GetGameItemsByAuthorResponse @Router /game/raw/author/{author} [get]

func GetRankingHandler

func GetRankingHandler(c *gin.Context)

GetRanking retrieves game rankings. @Summary Retrieve rankings @Description Retrieves rankings based on a specified type @Tags ranking @Accept json @Produce json @Param type path string true "Ranking Type(top, week-top, best-of-the-year, most-played)" @Success 200 {object} GetRankingResponse @Failure 400 {object} GetRankingResponse @Failure 500 {object} GetRankingResponse @Router /ranking/{type} [get]

func GetUnorganizedGameItemsHandler

func GetUnorganizedGameItemsHandler(c *gin.Context)

GetUnorganizedGameItems retrieves a list of unorganized game downloads. @Summary List unorganized game downloads @Description Retrieves game downloads that have not been organized @Tags game @Accept json @Produce json @Param num query int false "Number of game downloads to retrieve" @Success 200 {object} GetUnorganizedGameItemsResponse @Failure 400 {object} GetUnorganizedGameItemsResponse @Failure 500 {object} GetUnorganizedGameItemsResponse @Router /game/raw/unorganized [get]

func HealthCheckHandler

func HealthCheckHandler(c *gin.Context)

HealthCheckHandler performs a health check of the service. @Summary Health Check @Description Performs a server health check and returns detailed server status including the current time, uptime, and configuration settings such as AutoCrawl. @Tags health @Accept json @Produce json @Success 200 {object} HealthCheckResponse @Failure 500 {string} HealthCheckResponse @Router /healthcheck [get]

func OrganizeGameItemHandler

func OrganizeGameItemHandler(c *gin.Context)

OrganizeGameItem organizes a specific game download. @Summary Organize a game download @Description Organizes a game download based on platform and game ID @Tags game @Accept json @Produce json @Param Authorization header string true "Authorization: Bearer <api_key>" @Param body body OrganizeGameItemRequest true "Organize Game Download Request" @Success 200 {object} OrganizeGameItemResponse @Failure 400 {object} OrganizeGameItemResponse @Failure 401 {object} OrganizeGameItemResponse @Failure 500 {object} OrganizeGameItemResponse @Security BearerAuth @Router /game/raw/organize [post]

func SearchGamesHandler

func SearchGamesHandler(c *gin.Context)

SearchGames searches for games based on a keyword. @Summary Search games @Description Searches for games based on the provided keyword @Tags game @Accept json @Produce json @Param keyword query string true "Search keyword" @Param page query int false "Page number" @Param page_size query int false "Number of items per page" @Success 200 {object} SearchGamesResponse @Failure 400 {object} SearchGamesResponse @Failure 500 {object} SearchGamesResponse @Router /game/search [get]

func UpdateGameInfoHandler

func UpdateGameInfoHandler(c *gin.Context)

UpdateGameInfoHandler updates game information. @Summary Update game info @Description Updates details of a game @Tags game @Accept json @Produce json @Param Authorization header string true "Authorization: Bearer <api_key>" @Param body body handler.UpdateGameInfoRequest true "Update Game Info Request" @Success 200 {object} handler.UpdateGameInfoResponse @Failure 400 {object} handler.UpdateGameInfoResponse @Failure 401 {object} handler.UpdateGameInfoResponse @Failure 500 {object} handler.UpdateGameInfoResponse @Router /game/update [post]

Types

type DeleteGameInfoRequest

type DeleteGameInfoRequest struct {
	ID string `uri:"id" binding:"required"`
}

type DeleteGameInfoResponse

type DeleteGameInfoResponse struct {
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

type GetAllAuthorsResponse

type GetAllAuthorsResponse struct {
	Status  string   `json:"status"`
	Message string   `json:"message,omitempty"`
	Authors []string `json:"authors,omitempty"`
}

type GetGameInfoByIDRequest

type GetGameInfoByIDRequest struct {
	ID string `uri:"id" binding:"required"`
}

type GetGameInfoByIDResponse

type GetGameInfoByIDResponse struct {
	Status   string          `json:"status"`
	Message  string          `json:"message,omitempty"`
	GameInfo *model.GameInfo `json:"game_info,omitempty"`
}

type GetGameInfoByPlatformIDRequest

type GetGameInfoByPlatformIDRequest struct {
	PlatformType string `uri:"platform_type" binding:"required"`
	PlatformID   int    `uri:"platform_id" binding:"required"`
}

type GetGameInfoByPlatformIDResponse

type GetGameInfoByPlatformIDResponse struct {
	Status   string          `json:"status"`
	Message  string          `json:"message,omitempty"`
	GameInfo *model.GameInfo `json:"game_info,omitempty"`
}

type GetGameInfosByNameRequest

type GetGameInfosByNameRequest struct {
	Name string `uri:"name" binding:"required"`
}

type GetGameInfosByNameResponse

type GetGameInfosByNameResponse struct {
	Status    string            `json:"status"`
	Message   string            `json:"message,omitempty"`
	GameInfos []*model.GameInfo `json:"game_infos,omitempty"`
}

type GetGameItemByIDRequest

type GetGameItemByIDRequest struct {
	ID string `uri:"id" binding:"required"`
}

type GetGameItemByIDResponse

type GetGameItemByIDResponse struct {
	Status  string          `json:"status"`
	Message string          `json:"message,omitempty"`
	Game    *model.GameItem `json:"game,omitempty"`
}

type GetGameItemByRawNameRequest

type GetGameItemByRawNameRequest struct {
	Name string `uri:"name" binding:"required"`
}

type GetGameItemByRawNameResponse

type GetGameItemByRawNameResponse struct {
	Status   string            `json:"status"`
	Message  string            `json:"message,omitempty"`
	GameItem []*model.GameItem `json:"game_downloads,omitempty"`
}

type GetGameItemsByAuthorRequest

type GetGameItemsByAuthorRequest struct {
	Author   string `uri:"author" binding:"required"`
	Page     int    `form:"page" json:"page"`
	PageSize int    `form:"page_size" json:"page_size"`
}

type GetGameItemsByAuthorResponse

type GetGameItemsByAuthorResponse struct {
	Status    string            `json:"status"`
	Message   string            `json:"message,omitempty"`
	TotalPage int               `json:"total_page"`
	GameItems []*model.GameItem `json:"game_downloads,omitempty"`
}

type GetRankingResponse

type GetRankingResponse struct {
	Status  string            `json:"status"`
	Message string            `json:"message,omitempty"`
	Games   []*model.GameInfo `json:"games"`
}

type GetUnorganizedGameItemsRequest

type GetUnorganizedGameItemsRequest struct {
	Num int `json:"num" form:"num"`
}

type GetUnorganizedGameItemsResponse

type GetUnorganizedGameItemsResponse struct {
	Status    string            `json:"status"`
	Message   string            `json:"message,omitempty"`
	Size      int               `json:"size,omitempty"`
	GameItems []*model.GameItem `json:"game_downloads,omitempty"`
}

type HealthCheckResponse

type HealthCheckResponse struct {
	Version            string `json:"version"`
	Status             string `json:"status"`
	Message            string `json:"message,omitempty"`
	Date               string `json:"date"`
	Uptime             string `json:"uptime"`
	Alloc              string `json:"alloc"`
	AutoCrawl          bool   `json:"auto_crawl"`
	GameItem           int64  `json:"game_download,omitempty"`
	GameInfo           int64  `json:"game_info,omitempty"`
	Unorganized        int64  `json:"unorganized,omitempty"`
	RedisAvaliable     bool   `json:"redis_avaliable"`
	OnlineFixAvaliable bool   `json:"online_fix_avaliable"`
	MegaAvaliable      bool   `json:"mega_avaliable"`
}

type OrganizeGameItemRequest

type OrganizeGameItemRequest struct {
	Platform   string `form:"platform" json:"platform" binding:"required"`
	GameID     string `form:"game_id" json:"game_id" binding:"required"`
	PlatformID int    `form:"platform_id" json:"platform_id" binding:"required"`
}

type OrganizeGameItemResponse

type OrganizeGameItemResponse struct {
	Status   string          `json:"status"`
	Message  string          `json:"message,omitempty"`
	GameInfo *model.GameInfo `json:"game_info,omitempty"`
}

type SearchGamesRequest

type SearchGamesRequest struct {
	Keyword  string `form:"keyword" json:"keyword" binding:"required,min=4,max=64"`
	Page     int    `form:"page" json:"page"`
	PageSize int    `form:"page_size" json:"page_size"`
}

type SearchGamesResponse

type SearchGamesResponse struct {
	Status    string            `json:"status"`
	Message   string            `json:"message,omitempty"`
	TotalPage int               `json:"total_page,omitempty"`
	GameInfos []*model.GameInfo `json:"game_infos,omitempty"`
}

type UpdateGameInfoRequest

type UpdateGameInfoRequest struct {
	GameID     string `json:"game_id" binding:"required"`
	Platform   string `json:"platform" binding:"required"`
	PlatformID int    `json:"platform_id" binding:"required"`
}

type UpdateGameInfoResponse

type UpdateGameInfoResponse struct {
	Status   string          `json:"status"`
	Message  string          `json:"message"`
	GameInfo *model.GameInfo `json:"game_info,omitempty"`
}

Jump to

Keyboard shortcuts

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