handlers

package
v0.0.0-...-9401fe5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutocompleteHandler

type AutocompleteHandler struct {
	Logger *log.Logger
	Cache  *cache.Cache
	Config *config.AppConfig
	Client *client.Client
}

func NewAutocompleteHandler

func NewAutocompleteHandler(cfg *config.AppConfig, client *client.Client) *AutocompleteHandler

func (*AutocompleteHandler) AutocompleteGET

func (h *AutocompleteHandler) AutocompleteGET(c *gin.Context)

AutocompleteGET handles /autocomplete requests for champion names. Accepts "champion" or "q" query param to support both champion form and unified search. When the query contains "#", it returns a player search suggestion instead.

type ChampionHandler

type ChampionHandler struct {
	Logger *log.Logger
	Cache  *cache.Cache
	Client *client.Client
	Config *config.AppConfig
}

func NewChampionHandler

func NewChampionHandler(cfg *config.AppConfig, client *client.Client) *ChampionHandler

func (*ChampionHandler) ChampionGET

func (h *ChampionHandler) ChampionGET(c *gin.Context)

ChampionGET handles /champion requests with content negotiation. HTMX requests get a fragment (with modal/detail/compact variants). Full page requests get the champion search page with results pre-populated.

type LiveGameHandler

type LiveGameHandler struct {
	Logger *log.Logger
	Client *client.Client
	Config *config.AppConfig
}

LiveGameHandler handles live game search requests.

func NewLiveGameHandler

func NewLiveGameHandler(cfg *config.AppConfig, apiClient *client.Client) *LiveGameHandler

NewLiveGameHandler creates a LiveGameHandler.

func (*LiveGameHandler) LiveGameGET

func (h *LiveGameHandler) LiveGameGET(c *gin.Context)

LiveGameGET handles GET /livegame requests.

func (*LiveGameHandler) PlayerLiveGameGET

func (h *LiveGameHandler) PlayerLiveGameGET(c *gin.Context)

PlayerLiveGameGET handles GET /player/livegame?puuid=...&riotID=... Returns a LiveGameStatus fragment for embedding in the player page. Designed to be loaded via HTMX (hx-trigger="load" then "every 30s").

type MatchHandler

type MatchHandler struct {
	Logger *log.Logger
	Client *client.Client
	Config *config.AppConfig
}

MatchHandler handles match detail requests.

func NewMatchHandler

func NewMatchHandler(cfg *config.AppConfig, apiClient *client.Client) *MatchHandler

NewMatchHandler constructs a MatchHandler.

func (*MatchHandler) MatchGET

func (h *MatchHandler) MatchGET(c *gin.Context)

MatchGET handles GET /match?id=...&puuid=... requests.

func (*MatchHandler) MatchPlayerGET

func (h *MatchHandler) MatchPlayerGET(c *gin.Context)

MatchPlayerGET handles GET /match/player?id=...&puuid=... — renders a detailed stats modal for one player.

type PageHandler

type PageHandler struct {
	Logger          *log.Logger
	ChampionHandler *ChampionHandler
	PlayerHandler   *PlayerHandler
}

PageHandler handles rendering of standalone lookup pages.

func NewPageHandler

func NewPageHandler(cfg *config.AppConfig, ch *ChampionHandler, ph *PlayerHandler) *PageHandler

NewPageHandler constructs a PageHandler.

func (*PageHandler) HomePageGET

func (p *PageHandler) HomePageGET(c *gin.Context)

HomePageGET renders the landing home page.

func (*PageHandler) SearchGET

func (p *PageHandler) SearchGET(c *gin.Context)

SearchGET routes a unified search query to the appropriate handler. For HTMX requests, it proxies directly to the champion or player handler so the result renders inline on the homepage. For plain HTTP requests, it redirects to the appropriate page.

type PlayerHandler

type PlayerHandler struct {
	Logger *log.Logger
	Client *client.Client
	Config *config.AppConfig
}

PlayerHandler handles player lookup requests.

func NewPlayerHandler

func NewPlayerHandler(cfg *config.AppConfig, apiClient *client.Client) *PlayerHandler

NewPlayerHandler constructs a PlayerHandler.

func (*PlayerHandler) PlayerGET

func (h *PlayerHandler) PlayerGET(c *gin.Context)

PlayerGET handles /player requests with content negotiation. HTMX requests get a PlayerComponent fragment. Full page requests get the player search page with results pre-populated.

func (*PlayerHandler) PlayerMatchesGET

func (h *PlayerHandler) PlayerMatchesGET(c *gin.Context)

PlayerMatchesGET handles paginated match history requests via HTMX. Returns the next page of match items plus a new "Load More" button.

Jump to

Keyboard shortcuts

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