Documentation
¶
Index ¶
- func BeginAuthHandler(_ *users.Repository) gin.HandlerFunc
- func CallbackHandler(userRepo *users.Repository) gin.HandlerFunc
- func GetCurrentUserHandler(userRepo *users.Repository) gin.HandlerFunc
- func LogoutHandler() gin.HandlerFunc
- func RegisterRoutes(router *gin.RouterGroup, userRepo *users.Repository)
- func UpdateProfileHandler(userRepo *users.Repository) gin.HandlerFunc
- type AuthResponse
- type MessageResponse
- type UpdateProfileRequest
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeginAuthHandler ¶
func BeginAuthHandler(_ *users.Repository) gin.HandlerFunc
BeginAuthHandler godoc @Summary Start OAuth authentication @Description Begin OAuth authentication flow with specified provider (google, github, apple) @Tags auth @Param provider path string true "OAuth provider" Enums(google, github, apple) @Param redirect_url query string false "URL to redirect to after authentication" @Success 302 {string} string "Redirect to OAuth provider" @Failure 400 {object} errors.ErrorResponse @Router /api/v1/auth/{provider} [get]
func CallbackHandler ¶
func CallbackHandler(userRepo *users.Repository) gin.HandlerFunc
CallbackHandler godoc @Summary OAuth callback @Description OAuth provider callback. Redirects to original URL with token, or returns JSON if no redirect URL @Tags auth @Produce json @Param provider path string true "OAuth provider" Enums(google, github, apple) @Success 302 {string} string "Redirect to original URL with token" @Success 200 {object} AuthResponse @Failure 400 {object} errors.ErrorResponse @Failure 500 {object} errors.ErrorResponse @Router /api/v1/auth/{provider}/callback [get]
func GetCurrentUserHandler ¶
func GetCurrentUserHandler(userRepo *users.Repository) gin.HandlerFunc
GetCurrentUserHandler godoc @Summary Get current user @Description Get authenticated user's profile @Tags auth @Produce json @Success 200 {object} UserResponse @Failure 401 {object} errors.ErrorResponse @Failure 404 {object} errors.ErrorResponse @Router /api/v1/auth/me [get] @Security BearerAuth
func LogoutHandler ¶
func LogoutHandler() gin.HandlerFunc
LogoutHandler godoc @Summary Logout @Description Clear authentication session @Tags auth @Produce json @Success 200 {object} MessageResponse @Router /api/v1/auth/logout [post]
func RegisterRoutes ¶
func RegisterRoutes(router *gin.RouterGroup, userRepo *users.Repository)
func UpdateProfileHandler ¶
func UpdateProfileHandler(userRepo *users.Repository) gin.HandlerFunc
UpdateProfileHandler godoc @Summary Update user profile @Description Update authenticated user's name and avatar @Tags auth @Accept json @Produce json @Param request body UpdateProfileRequest true "Profile update" @Success 200 {object} UserResponse @Failure 400 {object} errors.ErrorResponse @Failure 401 {object} errors.ErrorResponse @Failure 500 {object} errors.ErrorResponse @Router /api/v1/auth/me [put] @Security BearerAuth
Types ¶
type AuthResponse ¶
AuthResponse returned after successful OAuth callback
type MessageResponse ¶
type MessageResponse struct {
Message string `json:"message"`
}
MessageResponse for simple success messages
type UpdateProfileRequest ¶
type UpdateProfileRequest struct {
Name string `json:"name" binding:"required,max=100"`
AvatarURL string `json:"avatar_url" binding:"max=500"`
}
UpdateProfileRequest for updating user profile
type UserResponse ¶
UserResponse wraps user data