summaryrefslogtreecommitdiffstats
path: root/lib/apiv1/apiv1.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-08-26 11:29:56 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-08-26 11:29:56 +0200
commit5e120c466686880c5bf6b94043dd01edc261fef9 (patch)
tree9d3071f226bd0b234540bd20bdab0c77d3bca164 /lib/apiv1/apiv1.go
parente113bbc75f88457d29f11823af0ff902e7c2ac8b (diff)
parent0367a6f9f2f868d785f197a052840ec621a681a6 (diff)
Merge remote-tracking branch 'origin/wip'
Diffstat (limited to 'lib/apiv1/apiv1.go')
-rw-r--r--lib/apiv1/apiv1.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/apiv1/apiv1.go b/lib/apiv1/apiv1.go
index 7fa69e9..262f513 100644
--- a/lib/apiv1/apiv1.go
+++ b/lib/apiv1/apiv1.go
@@ -16,19 +16,19 @@ type APIService struct {
apiRouter *gin.RouterGroup
sessions *session.Sessions
cfg *xdsconfig.Config
- mfolder *model.Folder
+ mfolders *model.Folders
sdks *crosssdk.SDKs
log *logrus.Logger
}
// New creates a new instance of API service
-func New(r *gin.Engine, sess *session.Sessions, cfg *xdsconfig.Config, mfolder *model.Folder, sdks *crosssdk.SDKs) *APIService {
+func New(r *gin.Engine, sess *session.Sessions, cfg *xdsconfig.Config, mfolders *model.Folders, sdks *crosssdk.SDKs) *APIService {
s := &APIService{
router: r,
sessions: sess,
apiRouter: r.Group("/api/v1"),
cfg: cfg,
- mfolder: mfolder,
+ mfolders: mfolders,
sdks: sdks,
log: cfg.Log,
}
@@ -42,6 +42,7 @@ func New(r *gin.Engine, sess *session.Sessions, cfg *xdsconfig.Config, mfolder *
s.apiRouter.GET("/folders", s.getFolders)
s.apiRouter.GET("/folder/:id", s.getFolder)
s.apiRouter.POST("/folder", s.addFolder)
+ s.apiRouter.POST("/folder/sync/:id", s.syncFolder)
s.apiRouter.DELETE("/folder/:id", s.delFolder)
s.apiRouter.GET("/sdks", s.getSdks)
@@ -52,6 +53,11 @@ func New(r *gin.Engine, sess *session.Sessions, cfg *xdsconfig.Config, mfolder *
s.apiRouter.POST("/exec", s.execCmd)
s.apiRouter.POST("/exec/:id", s.execCmd)
+ s.apiRouter.POST("/signal", s.execSignalCmd)
+
+ s.apiRouter.GET("/events", s.eventsList)
+ s.apiRouter.POST("/events/register", s.eventsRegister)
+ s.apiRouter.POST("/events/unregister", s.eventsUnRegister)
return s
}