blob: 7b06fde9c7d496cc59c4eae72719a7435b5e1b00 (
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
|
package apiv2
import (
"net/http"
"github.com/labstack/echo/v4"
)
func (a *API) getMessagesHandler(c echo.Context) error {
q := new(getMessagesRequest)
if err := c.Bind(q); err != nil {
return err
}
msgs, err := a.idec.GetMessagesByEcho(q.Echo, q.Message, q.Offset, q.Limit)
if err != nil {
return err
}
return c.JSON(http.StatusOK, msgs)
}
type getMessagesRequest struct {
Echo string `query:"e"`
Message string `query:"m"`
Offset int `query:"offset"`
Limit int `query:"limit"`
}
|