handler

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 8 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 HTTP requests.

func NewAuthHandler

func NewAuthHandler(service domain.AuthService) *AuthHandler

NewAuthHandler creates a new AuthHandler with the given service and logger.

func (*AuthHandler) RefreshToken

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

RefreshToken handles POST /v1/auth/token/refresh

func (*AuthHandler) RequestOTP

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

RequestOTP handles POST /v1/auth/otp/request

func (*AuthHandler) VerifyOTP

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

VerifyOTP handles POST /v1/auth/otp/verify

type InviteUserRequest added in v1.1.0

type InviteUserRequest struct {
	Email string      `json:"email" validate:"required,email"`
	Role  domain.Role `json:"role"  validate:"required,oneof=owner member"`
}

InviteUserRequest defines the payload for inviting a user.

type RequestOTPRequest

type RequestOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
}

RequestOTPRequest defines the payload for requesting an OTP.

type TenantHandler added in v1.1.0

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

TenantHandler handles tenant-related HTTP requests.

func NewTenantHandler added in v1.1.0

func NewTenantHandler(service domain.TenantService) *TenantHandler

NewTenantHandler creates a new TenantHandler.

func (*TenantHandler) GetMe added in v1.1.0

func (h *TenantHandler) GetMe(w http.ResponseWriter, r *http.Request)

GetMe handles GET /v1/tenants/me

func (*TenantHandler) InviteUser added in v1.1.0

func (h *TenantHandler) InviteUser(w http.ResponseWriter, r *http.Request)

InviteUser handles POST /v1/tenants/me/invite

func (*TenantHandler) UpdateMe added in v1.1.0

func (h *TenantHandler) UpdateMe(w http.ResponseWriter, r *http.Request)

UpdateMe handles PATCH /v1/tenants/me

type TokenResponse

type TokenResponse struct {
	// ExpiresAt is the timestamp when the access token expires.
	ExpiresAt time.Time `json:"expires_at"`
	// AccessToken is the PASETO access token.
	//
	//nolint:gosec
	AccessToken string `json:"access_token"`
	// RefreshToken is the PASETO refresh token.
	//
	//nolint:gosec
	RefreshToken string `json:"refresh_token"`
}

TokenResponse defines the successful authentication response.

type UpdateTenantRequest added in v1.1.0

type UpdateTenantRequest struct {
	Name *string `json:"name" validate:"omitempty,min=2,max=100"`
}

UpdateTenantRequest defines the payload for updating a tenant.

type VerifyOTPRequest

type VerifyOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
	Code  string `json:"code"  validate:"required,len=6"`
}

VerifyOTPRequest defines the payload for verifying an OTP.

Jump to

Keyboard shortcuts

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