handler

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

AuthHandler handles authentication-related requests.

func NewAuthHandler

func NewAuthHandler(cfg *config.AuthConfig) *AuthHandler

NewAuthHandler creates a new AuthHandler with the given auth configuration.

func (*AuthHandler) HandleToken

func (h *AuthHandler) HandleToken(w http.ResponseWriter, r *http.Request)

HandleToken authenticates via a shared secret and returns a JWT.

type SearchHandler

type SearchHandler struct {
	// contains filtered or unexported fields
}

func NewSearchHandler

func NewSearchHandler(uc *application.SearchUsecase) *SearchHandler

func (*SearchHandler) HandleSearch

func (h *SearchHandler) HandleSearch(w http.ResponseWriter, r *http.Request)

HandleSearch handles GET /api/search?q=&type=keyword|semantic|hybrid&page=1&size=20

type ShortURLHandler

type ShortURLHandler struct {
	// contains filtered or unexported fields
}

ShortURLHandler provides HTTP handlers for short link operations.

func NewShortURLHandler

func NewShortURLHandler(uc *application.URLUsecase) *ShortURLHandler

NewShortURLHandler creates a new ShortURLHandler with the given use case.

func (*ShortURLHandler) HandleCreate

func (h *ShortURLHandler) HandleCreate(w http.ResponseWriter, r *http.Request)

HandleCreate handles POST /api/short-links - create a new short link.

func (*ShortURLHandler) HandleDelete

func (h *ShortURLHandler) HandleDelete(w http.ResponseWriter, r *http.Request)

HandleDelete handles DELETE /api/short-links/:id - clear short code (keep URL record).

func (*ShortURLHandler) HandleList

func (h *ShortURLHandler) HandleList(w http.ResponseWriter, r *http.Request)

HandleList handles GET /api/short-links - list short links with pagination.

func (*ShortURLHandler) HandleRedirect

func (h *ShortURLHandler) HandleRedirect(w http.ResponseWriter, r *http.Request)

HandleRedirect handles GET /s/:code - resolve code and redirect. This is a PUBLIC route (no auth needed).

func (*ShortURLHandler) HandleUpdate added in v0.2.0

func (h *ShortURLHandler) HandleUpdate(w http.ResponseWriter, r *http.Request)

HandleUpdate handles PUT /api/short-links/:id - update a short link's code or long URL.

func (*ShortURLHandler) SetAnalysisUsecase added in v0.2.0

func (h *ShortURLHandler) SetAnalysisUsecase(au *application.AnalysisUsecase)

SetAnalysisUsecase sets the analysis usecase for async LLM processing.

type URLHandler

type URLHandler struct {
	// contains filtered or unexported fields
}

URLHandler provides HTTP handlers for URL CRUD operations.

func NewURLHandler

func NewURLHandler(uc *application.URLUsecase) *URLHandler

NewURLHandler creates a new URLHandler with the given use case.

func (*URLHandler) HandleCreate

func (h *URLHandler) HandleCreate(w http.ResponseWriter, r *http.Request)

HandleCreate handles POST /api/urls - create a new URL.

func (*URLHandler) HandleDelete

func (h *URLHandler) HandleDelete(w http.ResponseWriter, r *http.Request)

HandleDelete handles DELETE /api/urls/:id - soft delete URL.

func (*URLHandler) HandleGet

func (h *URLHandler) HandleGet(w http.ResponseWriter, r *http.Request)

HandleGet handles GET /api/urls/:id - get URL by ID.

func (*URLHandler) HandleList

func (h *URLHandler) HandleList(w http.ResponseWriter, r *http.Request)

HandleList handles GET /api/urls - list URLs with pagination and filtering.

func (*URLHandler) HandleReanalyze added in v0.2.0

func (h *URLHandler) HandleReanalyze(w http.ResponseWriter, r *http.Request)

HandleReanalyze handles POST /api/urls/:id/reanalyze - re-trigger async LLM analysis. Resets the URL status to "pending", clears LLM-generated fields, and enqueues for re-processing.

func (*URLHandler) HandleUpdate

func (h *URLHandler) HandleUpdate(w http.ResponseWriter, r *http.Request)

HandleUpdate handles PUT /api/urls/:id - partial update URL.

func (*URLHandler) HandleVisit

func (h *URLHandler) HandleVisit(w http.ResponseWriter, r *http.Request)

HandleVisit handles POST /api/urls/:id/visit - record a visit.

func (*URLHandler) SetAnalysisUsecase

func (h *URLHandler) SetAnalysisUsecase(au *application.AnalysisUsecase)

SetAnalysisUsecase sets the analysis usecase for async LLM processing.

type WebHandler

type WebHandler struct {
	// contains filtered or unexported fields
}

WebHandler serves the SPA entry point.

func NewWebHandler

func NewWebHandler(templateDir string, version string) *WebHandler

NewWebHandler loads the SPA HTML template once.

func (*WebHandler) HandleSPA added in v0.3.0

func (h *WebHandler) HandleSPA(w http.ResponseWriter, r *http.Request)

HandleSPA serves the SPA entry point for all non-API, non-static routes.

Jump to

Keyboard shortcuts

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