-
-
Notifications
You must be signed in to change notification settings - Fork 182
/
routes.go
49 lines (36 loc) · 1.21 KB
/
routes.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
package api
import (
"github.com/gin-gonic/gin"
)
var streamingMiddleWare = StreamingHeaderMiddleware()
func registerRoutes(router *gin.RouterGroup) {
router.GET("/list", List)
device := router.Group("/device/:udid")
device.Use(DeviceMiddleware())
simpleDeviceRoutes(device)
appRoutes(device)
}
func simpleDeviceRoutes(device *gin.RouterGroup) {
device.POST("/activate", Activate)
device.GET("/conditions", GetSupportedConditions)
device.PUT("/enable-condition", EnableDeviceCondition)
device.POST("/disable-condition", DisableDeviceCondition)
device.GET("/image", GetImages)
device.PUT("/image", InstallImage)
device.GET("/notifications", streamingMiddleWare, Notifications)
device.GET("/info", Info)
device.GET("/listen", streamingMiddleWare, Listen)
device.POST("/pair", PairDevice)
device.GET("/profiles", GetProfiles)
device.POST("/resetlocation", ResetLocation)
device.GET("/screenshot", Screenshot)
device.PUT("/setlocation", SetLocation)
device.GET("/syslog", streamingMiddleWare, Syslog)
}
func appRoutes(group *gin.RouterGroup) {
router := group.Group("/apps")
router.Use(LimitNumClientsUDID())
router.GET("/", ListApps)
router.POST("/launch", LaunchApp)
router.POST("/kill", KillApp)
}