Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWTExtractor ¶
type URLHandler ¶
type URLHandler struct {
// contains filtered or unexported fields
}
func NewURLHandler ¶
func NewURLHandler(urlService URLService, jwtExtractor JWTExtractor) *URLHandler
NewURLHandler creates a new URLHandler with the provided URLService
func (*URLHandler) CreateShortURL ¶
func (h *URLHandler) CreateShortURL(c echo.Context) error
POST /api/user/url original_url, custom_code, duration -> short_url, expired_at
func (*URLHandler) DeleteShortURL ¶ added in v1.1.0
func (h *URLHandler) DeleteShortURL(c echo.Context) error
DELETE /api/user/url
func (*URLHandler) GetMyURLs ¶
func (h *URLHandler) GetMyURLs(c echo.Context) error
GET /api/user/my_urls
func (*URLHandler) RedirectToOriginalURL ¶
func (h *URLHandler) RedirectToOriginalURL(c echo.Context) error
GET /:short_code (redirect to original_url)
type URLService ¶
type URLService interface {
CreateShortURL(ctx context.Context, req model.CreateShortURLRequest) (*model.CreateShortURLResponse, error)
GetLongURLInfo(ctx context.Context, shortURL string) (string, error)
GetMyURLs(ctx context.Context, req model.GetUserShortURLsRequest, username string) (*model.GetUserShortURLsResponse, error)
DeleteShortURL(ctx context.Context, req model.DeleteUserShortURLRequest, username string) (*model.DeleteUserShortURLResponse, error)
}
URLService defines the interface for URL-related operations
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(userService UserService) *UserHandler
func (*UserHandler) GetEmailCode ¶
func (h *UserHandler) GetEmailCode(c echo.Context) error
POST /api/email_code
func (*UserHandler) ResetPassword ¶
func (h *UserHandler) ResetPassword(c echo.Context) error
PUT /api/reset_password
func (*UserHandler) TestAuth ¶
func (h *UserHandler) TestAuth(c echo.Context) error
GET /api/user/test_auth
func (*UserHandler) UserLogin ¶
func (h *UserHandler) UserLogin(c echo.Context) error
POST /api/login
func (*UserHandler) UserRegister ¶
func (h *UserHandler) UserRegister(c echo.Context) error
POST /api/register
type UserService ¶
type UserService interface {
UserLogin(ctx context.Context, req model.LoginRequest) (*model.LoginResponse, error)
UserRegister(ctx context.Context, req model.RegisterRequest) error
GetEmailCode(ctx context.Context, req model.GetEmailCodeRequest) error
ResetPassword(ctx context.Context, req model.ResetPasswordRequest) error
}
Click to show internal directories.
Click to hide internal directories.