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:
2026-06-28 19:16:42 -04:00
parent 1b7778930c
commit 72ca99b58d
14 changed files with 9581 additions and 4 deletions
+48
View File
@@ -82,6 +82,20 @@ func writeErr(w http.ResponseWriter, status int, msg string) {
// ---- handlers ----
// @Summary Create a webhook
// @Description Create a new webhook for a channel
// @Tags webhooks
// @Accept json
// @Produce json
// @Security SessionAuth
// @Param channelID path string true "Channel ID"
// @Param body body createWebhookRequest true "Webhook data"
// @Success 201 {object} webhookWithToken
// @Failure 400 {object} map[string]string
// @Failure 401 {object} map[string]string
// @Failure 403 {object} map[string]string
// @Failure 404 {object} map[string]string
// @Router /channels/{channelID}/webhooks [post]
// Create creates a new webhook for a channel.
func (h *Handler) Create(w http.ResponseWriter, r *http.Request) {
userID, ok := middleware.UserIDFromContext(r.Context())
@@ -148,6 +162,17 @@ func (h *Handler) Create(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusCreated, wh)
}
// @Summary List webhooks
// @Description List webhooks for a channel
// @Tags webhooks
// @Produce json
// @Security SessionAuth
// @Param channelID path string true "Channel ID"
// @Success 200 {array} webhookResponse
// @Failure 401 {object} map[string]string
// @Failure 403 {object} map[string]string
// @Failure 404 {object} map[string]string
// @Router /channels/{channelID}/webhooks [get]
// List returns all webhooks for a channel.
func (h *Handler) List(w http.ResponseWriter, r *http.Request) {
userID, ok := middleware.UserIDFromContext(r.Context())
@@ -211,6 +236,16 @@ func (h *Handler) List(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, webhooks)
}
// @Summary Delete a webhook
// @Description Delete a webhook
// @Tags webhooks
// @Security SessionAuth
// @Param webhookID path string true "Webhook ID"
// @Success 204
// @Failure 401 {object} map[string]string
// @Failure 403 {object} map[string]string
// @Failure 404 {object} map[string]string
// @Router /webhooks/{webhookID} [delete]
// Delete removes a webhook.
func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
userID, ok := middleware.UserIDFromContext(r.Context())
@@ -247,6 +282,19 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
}
// @Summary Execute a webhook
// @Description Execute a webhook to send a message (no auth required)
// @Tags webhooks
// @Accept json
// @Produce json
// @Param webhookID path string true "Webhook ID"
// @Param token path string true "Webhook token"
// @Param body body executeWebhookRequest true "Message data"
// @Success 201 {object} map[string]interface{}
// @Failure 400 {object} map[string]string
// @Failure 401 {object} map[string]string
// @Failure 404 {object} map[string]string
// @Router /webhooks/{webhookID}/{token} [post]
// Execute sends a message to a channel via webhook (no auth required).
func (h *Handler) Execute(w http.ResponseWriter, r *http.Request) {
webhookID := chi.URLParam(r, "webhookID")