From fd4e0c3112d69061d495dfcf79f6ef62e3c6d5e6 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Tue, 29 Oct 2024 01:21:05 +0300 Subject: Начальный веб клиент MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/apiv1/list.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pkg/apiv1/list.go (limited to 'pkg/apiv1/list.go') diff --git a/pkg/apiv1/list.go b/pkg/apiv1/list.go new file mode 100644 index 0000000..1e5dafc --- /dev/null +++ b/pkg/apiv1/list.go @@ -0,0 +1,32 @@ +package apiv1 + +import ( + "fmt" + "strings" + + "github.com/labstack/echo/v4" +) + +func (a *API) getListHandler(c echo.Context) error { + echos, err := a.idec.GetEchos() + if err != nil { + return echo.ErrInternalServerError + } + + for _, e := range echos { + fmt.Fprintf(c.Response(), "%s:%d:%s\n", e.Name, e.Count, e.Description) + } + + return nil +} + +func (a *API) getBlacklistHandler(c echo.Context) error { + list, err := a.idec.GetBlacklist() + if err != nil { + return echo.ErrInternalServerError + } + + fmt.Fprint(c.Response(), strings.Join(list, "\n")) + + return nil +} -- cgit v1.2.3