server

package
v0.0.0-...-4f695cd Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *config.Config) *http.Server

Types

type AuthManager

type AuthManager interface {
	BlockUser(ctx context.Context, userID string) (*management.UpdateUserResponseContent, error)
	UnblockUser(ctx context.Context, userID string) error
}

AuthManager defines the interface for user management operations with Auth0

type BlockUserDTO

type BlockUserDTO struct {
	Reason *string `json:"reason" validate:"omitzero,min=1,max=255"`
}

type BlockUserParams

type BlockUserParams struct {
	DeleteUserURLsParams
	BlockUserDTO
}

type CreateShortUrlDTO

type CreateShortUrlDTO struct {
	ShortCode string `json:"shortCode" validate:"omitempty,min=5,max=16,shortcode"`
	URL       string `json:"url" validate:"required,http_url"`
}

type DeleteShortUrlParams

type DeleteShortUrlParams struct {
	GetLongUrlParams
}

type DeleteURLParams

type DeleteURLParams struct {
	GetLongUrlParams
}

type DeleteUserURLsParams

type DeleteUserURLsParams struct {
	UserID string `param:"userId" validate:"required,min=1,max=50"`
}

type DeleteUserURLsResponse

type DeleteUserURLsResponse struct {
	Deleted int `json:"deleted"`
}

type GetLongUrlParams

type GetLongUrlParams struct {
	Code string `param:"code" validate:"required,max=16"`
}

type GetLongUrlResponse

type GetLongUrlResponse struct {
	LongUrl string `json:"longUrl"`
}

type HTTPError

type HTTPError struct {
	Message string `json:"message" example:"error message"`
}

HTTPError represents an HTTP error response for swagger documentation

type HTTPValidationError

type HTTPValidationError struct {
	HTTPError
	Errors appvalidator.ValidationError `json:"errors" example:"{\"field\":\"field error message\"}"`
}

HTTPValidationError represents an HTTP error (400) response for swagger documentation

type HealthResponse

type HealthResponse struct {
	Status      string `json:"status" example:"ok"`
	Environment string `json:"environment" example:"production"`
}

type PaginatedURLs

type PaginatedURLs struct {
	Items      []repository.Url `json:"items"`
	Pagination Pagination       `json:"pagination"`
}

type PaginatedUserBlocks

type PaginatedUserBlocks struct {
	Items      []repository.UserBlock `json:"items"`
	Pagination Pagination             `json:"pagination"`
}

type PaginatedUserURLs

type PaginatedUserURLs struct {
	Items      []URLResponse `json:"items"`
	Pagination Pagination    `json:"pagination"`
}

type Pagination

type Pagination struct {
	Page        int  `json:"page"`
	PageSize    int  `json:"pageSize"`
	TotalItems  int  `json:"totalItems"`
	TotalPages  int  `json:"totalPages"`
	HasNext     bool `json:"hasNext"`
	HasPrevious bool `json:"hasPrevious"`
}

type PaginationFilters

type PaginationFilters struct {
	Page     int32 `query:"page" validate:"min=1,max=10000"`
	PageSize int32 `query:"pageSize" validate:"min=1,max=100"`
}

type Server

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

func (*Server) RegisterRoutes

func (s *Server) RegisterRoutes(logger *slog.Logger) http.Handler

@securityDefinitions.apikey BearerAuth @in header @name Authorization @description Type "Bearer" followed by a space and JWT token

type URLResponse

type URLResponse struct {
	ID        string    `json:"id"`
	LongUrl   string    `json:"longUrl"`
	CreatedAt time.Time `json:"createdAt"`
	IsCustom  bool      `json:"isCustom"`
}

type URLsFilters

type URLsFilters struct {
	PaginationFilters
	IsCustom *bool   `query:"isCustom" validate:"omitzero,boolean"`
	UserID   *string `query:"userId" validate:"omitzero,min=1,max=50"`
}

type UserBlocksFilters

type UserBlocksFilters struct {
	PaginationFilters
}

Jump to

Keyboard shortcuts

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