handler

package
v0.0.0-...-4018547 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(
	flagHandler *FlagHandler,
	authHandler *AuthHandler,
	healthHandler *HealthHandler,
	authMiddleware *middleware.AuthMiddleware,
	sdkAuthMiddleware *middleware.SDKAuthMiddleware,
	projectHandler *ProjectHandler,
	environmentHandler *EnvironmentHandler,
	sdkKeyHandler *SDKKeyHandler) http.Handler

Types

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(authService port.AuthServiceInterface) *AuthHandler

func (*AuthHandler) Login

func (a *AuthHandler) Login(w http.ResponseWriter, r *http.Request)

Login godoc @Summary Login @Description Authenticate user and get token pair @Tags auth @Accept json @Produce json @Param request body loginRequest true "Login data" @Success 200 {object} map[string]any @Failure 400 {object} map[string]string @Failure 401 {object} map[string]string @Failure 500 {object} map[string]string @Router /auth/login [post]

func (*AuthHandler) Logout

func (a *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)

Logout godoc @Summary Logout @Description Invalidate refresh token @Tags auth @Accept json @Param request body logoutRequest true "Refresh token" @Success 204 @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Router /auth/logout [post]

func (*AuthHandler) Refresh

func (a *AuthHandler) Refresh(w http.ResponseWriter, r *http.Request)

Refresh godoc @Summary Refresh access token @Description Get new access token using refresh token @Tags auth @Accept json @Produce json @Param request body refreshRequest true "Refresh token" @Success 200 {object} map[string]any @Failure 400 {object} map[string]string @Failure 401 {object} map[string]string @Failure 500 {object} map[string]string @Router /auth/refresh [post]

func (*AuthHandler) Register

func (a *AuthHandler) Register(w http.ResponseWriter, r *http.Request)

Register godoc @Summary Register new user @Description Creates organization, default project, production and staging environments, and user account @Tags auth @Accept json @Produce json @Param request body registerRequest true "Register data" @Success 201 {object} map[string]any @Failure 400 {object} map[string]string "Validation error" @Failure 409 {object} map[string]string "Email already exists" @Failure 500 {object} map[string]string @Router /auth/register [post]

type EnvironmentHandler

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

func NewEnvironmentHandler

func NewEnvironmentHandler(envService port.EnvironmentServiceInterface) *EnvironmentHandler

func (*EnvironmentHandler) List

type FlagHandler

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

func NewFlagHandler

func NewFlagHandler(flagService port.FlagServiceInterface) *FlagHandler

func (*FlagHandler) Create

func (h *FlagHandler) Create(w http.ResponseWriter, r *http.Request)

Create godoc @Summary Create a feature flag @Description Creates a new feature flag in a project @Tags flags @Accept json @Produce json @Param request body createFlagRequest true "Flag data" @Success 201 {object} map[string]any @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Failure 409 {object} map[string]string @Failure 500 {object} map[string]string @Security BearerAuth @Router /flags [post]

func (*FlagHandler) Delete

func (h *FlagHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete godoc @Summary Delete flag @Description Deletes flag with ID in param @Tags flags @Param id path string true "Flag UUID" @Success 204 @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Security BearerAuth @Router /flags/{id} [delete]

func (*FlagHandler) Evaluate

func (h *FlagHandler) Evaluate(w http.ResponseWriter, r *http.Request)

Evaluate godoc @Summary Get "enabled" of flag @Description Returns a state with current flag ID @Tags flags @Produce json @Param key query string true "Flag key" @Param project_id query string true "Project UUID" @Param environment_id query string true "Environment UUID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Security SDKKeyAuth @Router /flags/evaluate [get]

func (*FlagHandler) GetByID

func (h *FlagHandler) GetByID(w http.ResponseWriter, r *http.Request)

GetByID godoc @Summary Get flag by ID @Description Returns a single feature flag @Tags flags @Produce json @Param id path string true "Flag UUID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Security BearerAuth @Router /flags/{id} [get]

func (*FlagHandler) GetFlagEnvironment

func (h *FlagHandler) GetFlagEnvironment(w http.ResponseWriter, r *http.Request)

func (*FlagHandler) List

func (h *FlagHandler) List(w http.ResponseWriter, r *http.Request)

List godoc @Summary Get a list of flags @Description Show a current list of flags in project @Tags flags @Produce json @Param project_id query string true "Project UUID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Security BearerAuth @Router /flags [get]

func (*FlagHandler) Toggle

func (h *FlagHandler) Toggle(w http.ResponseWriter, r *http.Request)

ToggleEnvironment godoc @Summary Toggle flag in environment @Tags flags @Accept json @Produce json @Param id path string true "Flag UUID" @Param request body toggleFlagRequest true "Toggle data" @Success 200 {object} map[string]any @Security BearerAuth @Router /flags/{id}/toggle [post]

func (*FlagHandler) Update

func (h *FlagHandler) Update(w http.ResponseWriter, r *http.Request)

Update godoc @Summary Update flag @Description Changes past flag fields on new fields @Tags flags @Accept json @Produce json @Param request body updateFlagRequest true "Update data" @Param id path string true "Flag UUID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Security BearerAuth @Router /flags/{id} [put]

type HealthHandler

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

func NewHealthHandler

func NewHealthHandler(db *sqlx.DB, redis *redis.Client) *HealthHandler

func (*HealthHandler) Live

func (h *HealthHandler) Live(w http.ResponseWriter, r *http.Request)

Live godoc @Summary Liveness probe @Description Returns 200 if service is running @Tags health @Produce json @Success 200 {object} map[string]string @Router /health/live [get]

func (*HealthHandler) Ready

func (h *HealthHandler) Ready(w http.ResponseWriter, r *http.Request)

Ready godoc @Summary Readiness probe @Description Returns 200 if service is ready to accept traffic (DB and Redis are up) @Tags health @Produce json @Success 200 {object} map[string]string @Failure 503 {object} map[string]string @Router /health/ready [get]

type ProjectHandler

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

func NewProjectHandler

func NewProjectHandler(projectService port.ProjectServiceInterface) *ProjectHandler

func (*ProjectHandler) List

type SDKKeyHandler

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

func NewSDKKeyHandler

func NewSDKKeyHandler(repo domain.SDKKeyRepository) *SDKKeyHandler

func (*SDKKeyHandler) Create

func (h *SDKKeyHandler) Create(w http.ResponseWriter, r *http.Request)

func (*SDKKeyHandler) Delete

func (h *SDKKeyHandler) Delete(w http.ResponseWriter, r *http.Request)

func (*SDKKeyHandler) List

func (h *SDKKeyHandler) List(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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