blob: daa68a8a4b9b6d27638b507093b398dd947ab631 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package apiv2
import (
"net/http"
"github.com/labstack/echo/v4"
)
func (a *API) getListHandler(c echo.Context) error {
echos, err := a.idec.GetEchos()
if err != nil {
return err
}
return c.JSON(http.StatusOK, echos)
}
func (a *API) getEchoHandler(c echo.Context) error {
q := new(getEchosRequest)
if err := c.Bind(q); err != nil {
return err
}
echos, err := a.idec.GetEchosByIDs(q.EchoIDs, q.Offset, q.Limit)
if err != nil {
return err
}
return c.JSON(http.StatusOK, echos)
}
type getEchosRequest struct {
EchoIDs []string `query:"e"`
Offset int `query:"offset"`
Limit int `query:"limit"`
}
|