33 lines
560 B
Go
33 lines
560 B
Go
|
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
|
||
|
}
|