summaryrefslogtreecommitdiff
path: root/pkg/apiv2/message.go
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-10-29 01:21:05 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-10-29 01:21:05 +0300
commitfd4e0c3112d69061d495dfcf79f6ef62e3c6d5e6 (patch)
treefa55d6e879e3c6d85601d5c2486837f323ffd81d /pkg/apiv2/message.go
parentb26bd10926447ed59cbf263aef087bb7c04f35eb (diff)
Начальный веб клиентHEADmaster
Diffstat (limited to 'pkg/apiv2/message.go')
-rw-r--r--pkg/apiv2/message.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/apiv2/message.go b/pkg/apiv2/message.go
new file mode 100644
index 0000000..7b06fde
--- /dev/null
+++ b/pkg/apiv2/message.go
@@ -0,0 +1,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"`
+}