Add swaggo annotations to all handlers and regenerate full Swagger docs
- Added @Summary/@Router/@Param/@Success/@Security annotations to all API handlers - Regenerated docs/swagger.json, docs/swagger.yaml, docs/docs.go with full endpoint definitions - Fixed generated docs.go to remove unsupported LeftDelim/RightDelim fields
This commit is contained in:
@@ -99,6 +99,19 @@ func (h *Handler) requireMessageAccess(w http.ResponseWriter, r *http.Request, m
|
||||
return userID, channelID, serverID, true
|
||||
}
|
||||
|
||||
// @Summary Add a reaction
|
||||
// @Description Add a reaction to a message
|
||||
// @Tags reactions
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security SessionAuth
|
||||
// @Param messageID path string true "Message ID"
|
||||
// @Param body body addReactionRequest true "Reaction data"
|
||||
// @Success 201 {object} reactionResponse
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Failure 403 {object} map[string]string
|
||||
// @Router /messages/{messageID}/reactions [post]
|
||||
func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
||||
messageID := chi.URLParam(r, "messageID")
|
||||
userID, channelID, _, ok := h.requireMessageAccess(w, r, messageID)
|
||||
@@ -146,6 +159,17 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
||||
json.NewEncoder(w).Encode(reaction)
|
||||
}
|
||||
|
||||
// @Summary Remove a reaction
|
||||
// @Description Remove a reaction from a message
|
||||
// @Tags reactions
|
||||
// @Security SessionAuth
|
||||
// @Param messageID path string true "Message ID"
|
||||
// @Param emoji path string true "Emoji to remove"
|
||||
// @Success 204
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Failure 403 {object} map[string]string
|
||||
// @Failure 404 {object} map[string]string
|
||||
// @Router /messages/{messageID}/reactions/{emoji} [delete]
|
||||
func (h *Handler) Remove(w http.ResponseWriter, r *http.Request) {
|
||||
messageID := chi.URLParam(r, "messageID")
|
||||
emoji := chi.URLParam(r, "emoji")
|
||||
@@ -185,6 +209,16 @@ func (h *Handler) Remove(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// @Summary List reactions
|
||||
// @Description List reactions on a message grouped by emoji
|
||||
// @Tags reactions
|
||||
// @Produce json
|
||||
// @Security SessionAuth
|
||||
// @Param messageID path string true "Message ID"
|
||||
// @Success 200 {array} emojiGroup
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Failure 403 {object} map[string]string
|
||||
// @Router /messages/{messageID}/reactions [get]
|
||||
func (h *Handler) List(w http.ResponseWriter, r *http.Request) {
|
||||
messageID := chi.URLParam(r, "messageID")
|
||||
if _, _, _, ok := h.requireMessageAccess(w, r, messageID); !ok {
|
||||
|
||||
Reference in New Issue
Block a user