docs: add docs for agents list
ci-agent / build (push) Failing after 22s

This commit is contained in:
d3m0k1d
2026-04-03 23:01:59 +03:00
parent 83427193bc
commit 27e82f80f1
5 changed files with 129 additions and 28 deletions
+13 -23
View File
@@ -1,36 +1,26 @@
package handlers
import (
"net/http"
"github.com/gin-gonic/gin"
"net/http"
)
// AgentsGroup — группа хэндлеров для агентов
type AgentsGroup struct {
*Handlers
}
// List GET /api/v1/agents
type AgentInfo struct {
Token string `json:"token"`
Label string `json:"label"`
Services []string `json:"services"`
}
// @Summary Get connected agents
// @Description Returns a list of all agents currently connected via gRPC streaming
// @Tags agents
// @Produce json
// @Success 200 {array} AgentInfo
// @Router /agents [get]
func (ag *AgentsGroup) List(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "Agents list"})
}
// GetByID GET /api/v1/agents/:id
func (ag *AgentsGroup) GetByID(c *gin.Context) {
id := c.Param("id")
c.JSON(http.StatusOK, gin.H{"id": id})
}
// Create POST /api/v1/agents
func (ag *AgentsGroup) Create(c *gin.Context) {
var body struct {
Name string `json:"name" binding:"required"`
}
if err := c.ShouldBindJSON(&body); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusCreated, gin.H{"name": body.Name})
}