handlers

package
v0.0.0-...-70a9c39 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyHandlers

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

func NewAPIKeyHandlers

func NewAPIKeyHandlers(services *services.Services, logger *zap.Logger, config *config.Config) *APIKeyHandlers

func (*APIKeyHandlers) HandleRequestAPIKey

func (h *APIKeyHandlers) HandleRequestAPIKey(c *fiber.Ctx) error

@id HandleRequestAPIKey @Summary Request a new API key @Tags API Key @Accept json @Produce json @Param request body services.APIKeyRequest true "Request a new API key" @Success 200 {object} services.APIKeyResponse @Failure 400 {object} fiber.Error @Router /api/keys/request [post]

func (*APIKeyHandlers) HandleVerifyAPIKey

func (h *APIKeyHandlers) HandleVerifyAPIKey(c *fiber.Ctx) error

type Handlers

type Handlers struct {
	Web    *WebHandlers
	APIKey *APIKeyHandlers
	Paste  *PasteHandlers
	URL    *URLHandlers
	// contains filtered or unexported fields
}

Handlers holds all handler instances

func NewHandlers

func NewHandlers(db *gorm.DB, logger *zap.Logger, config *config.Config, services *services.Services) *Handlers

NewHandlers creates a new Handlers instance with all handler dependencies

type PasteHandlers

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

func NewPasteHandlers

func NewPasteHandlers(services *services.Services, logger *zap.Logger, config *config.Config) *PasteHandlers

func (*PasteHandlers) HandleDeletePaste

func (h *PasteHandlers) HandleDeletePaste(c *fiber.Ctx) error

HandleDeletePaste deletes a paste (requires API key ownership)

func (*PasteHandlers) HandleDeleteWithKey

func (h *PasteHandlers) HandleDeleteWithKey(c *fiber.Ctx) error

HandleDeleteWithKey deletes a paste using its deletion key

func (*PasteHandlers) HandleDownload

func (h *PasteHandlers) HandleDownload(c *fiber.Ctx) error

HandleDownload serves the content as a downloadable file

func (*PasteHandlers) HandleGetPasteImage

func (h *PasteHandlers) HandleGetPasteImage(c *fiber.Ctx) error

HandleGetPasteImage returns an image of the paste suitable for Open Graph

func (*PasteHandlers) HandleListPastes

func (h *PasteHandlers) HandleListPastes(c *fiber.Ctx) error

HandleListPastes returns a paginated list of pastes for the API key

func (*PasteHandlers) HandlePreview

func (h *PasteHandlers) HandlePreview(c *fiber.Ctx) error

HandlePreview renders a markdown preview

func (*PasteHandlers) HandleRawView

func (h *PasteHandlers) HandleRawView(c *fiber.Ctx) error

HandleRawView serves the raw content of a paste

func (*PasteHandlers) HandleUpdateExpiration

func (h *PasteHandlers) HandleUpdateExpiration(c *fiber.Ctx) error

HandleUpdateExpiration updates a paste's expiration time

func (*PasteHandlers) HandleUpload

func (h *PasteHandlers) HandleUpload(c *fiber.Ctx) error

@id HandleUpload @Summary Upload a new paste @Tags Paste @Accept multipart/form-data @Produce json @Param file formData file true "File to upload" @Success 200 {object} services.PasteResponse @Failure 400 {object} fiber.Error

func (*PasteHandlers) HandleView

func (h *PasteHandlers) HandleView(c *fiber.Ctx) error

HandleView serves the content with syntax highlighting if applicable

type URLHandlers

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

func NewURLHandlers

func NewURLHandlers(services *services.Services, logger *zap.Logger, config *config.Config) *URLHandlers

func (*URLHandlers) HandleDeleteURL

func (h *URLHandlers) HandleDeleteURL(c *fiber.Ctx) error

HandleDeleteURL deletes a URL (requires API key ownership)

func (*URLHandlers) HandleListURLs

func (h *URLHandlers) HandleListURLs(c *fiber.Ctx) error

HandleListURLs returns a paginated list of URLs for the API key

func (*URLHandlers) HandleRedirect

func (h *URLHandlers) HandleRedirect(c *fiber.Ctx) error

HandleRedirect redirects to the target URL

func (*URLHandlers) HandleURLShorten

func (h *URLHandlers) HandleURLShorten(c *fiber.Ctx) error

HandleURLShorten creates a new shortened URL

func (*URLHandlers) HandleURLStats

func (h *URLHandlers) HandleURLStats(c *fiber.Ctx) error

HandleURLStats returns statistics for a shortened URL

func (*URLHandlers) HandleUpdateURLExpiration

func (h *URLHandlers) HandleUpdateURLExpiration(c *fiber.Ctx) error

HandleUpdateURLExpiration updates a URL's expiration time

type WebHandlers

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

func NewWebHandlers

func NewWebHandlers(services *services.Services, logger *zap.Logger, config *config.Config) *WebHandlers

func (*WebHandlers) HandleDocs

func (h *WebHandlers) HandleDocs(c *fiber.Ctx) error

HandleDocs serves the API documentation page

func (*WebHandlers) HandleIndex

func (h *WebHandlers) HandleIndex(c *fiber.Ctx) error

HandleIndex serves the main web interface page

func (*WebHandlers) HandleStats

func (h *WebHandlers) HandleStats(c *fiber.Ctx) error

HandleStats serves the statistics page

func (*WebHandlers) HandleSubmit

func (h *WebHandlers) HandleSubmit(c *fiber.Ctx) error

HandleSubmit serves the paste submission page

Jump to

Keyboard shortcuts

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