summaryrefslogtreecommitdiff
path: root/pkg/apiv2/api.go
blob: 8fbd759cfef13235c0b59082c550e9d7a577a058 (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
package apiv2

import (
	"github.com/labstack/echo/v4"
	"gitrepo.ru/neonxp/idecnode/pkg/config"
	"gitrepo.ru/neonxp/idecnode/pkg/idec"
)

type API struct {
	config *config.Config
	idec   *idec.IDEC
}

func New(i *idec.IDEC, cfg *config.Config) *API {
	return &API{
		config: cfg,
		idec:   i,
	}
}

func (a *API) Register(e *echo.Echo) {
	func(g *echo.Group) {
		g.GET("/list", a.getListHandler)
		g.GET("/e", a.getEchoHandler)
		g.GET("/m", a.getMessagesHandler)
	}(e.Group("/api"))
}