Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Login ¶
func (h *Handler) Login(w http.ResponseWriter, r *http.Request)
Login @Summary Вход пользователя @Description Эндпоинт для аутентификации пользователя с указанием имени пользователя и пароля @ID auth-login @Tags Auth @Accept json @Produce json @Param request body models.UserCredentials true "Учетные данные пользователя для входа" example({"username": "user123", "password": "securepassword"}) @Success 200 {object} map[string]string "Успешный вход пользователя" @Failure 400 {object} common.ErrorResponse "Bad Request: Invalid input" @Failure 401 {object} common.ErrorResponse "Unauthorized: Invalid credentials" @Failure 500 {object} common.ErrorResponse "Internal Server Error"
@Example 200 Success {
"message": "Login successful"
}
@Example 400 Bad Request {
"Message": "Invalid input"
}
@Example 401 Unauthorized {
"Message": "Invalid credentials"
}
@Example 500 Internal Server Error {
"Message": "Internal Server Error"
}
@Router /api/auth/login [post]
func (*Handler) Logout ¶
func (h *Handler) Logout(w http.ResponseWriter, r *http.Request)
Logout @Summary Выход пользователя @Description Эндпоинт для выхода пользователя и уничтожения его сессии @ID auth-logout @Tags Auth @Accept json @Produce json @Success 200 {object} map[string]string "Успешный выход пользователя" @Failure 500 {object} common.ErrorResponse "Internal Server Error: Failed to logout"
@Example 200 Success {
"message": "Logout successful"
}
@Example 500 Internal Server Error {
"Message": "Failed to log out"
}
@Router /api/auth/logout [post]
func (*Handler) Register ¶
func (h *Handler) Register(w http.ResponseWriter, r *http.Request)
Register @Summary Регистрация нового пользователя @Description Эндпоинт для регистрации нового пользователя с указанием имени пользователя и пароля @ID auth-register @Tags Auth @Accept json @Produce json @Param request body models.UserCredentials true "Учетные данные пользователя для регистрации" example({"username": "user123", "password": "securepassword"}) @Success 201 {object} string "Пользователь успешно зарегистрирован" @Failure 400 {object} common.ErrorResponse "Bad Request: Invalid input" @Failure 500 {object} common.ErrorResponse "Internal Server Error: Failed to register"
@Example 201 Success {
"message": "User registered"
}
@Example 400 Bad Request {
"Message": "Invalid input"
}
@Example 500 Internal Server Error {
"Message": "Failed to register"
}
@Router /api/auth/register [post]