Skip to content

Commit

Permalink
add docs and change path to /wda/session/
Browse files Browse the repository at this point in the history
  • Loading branch information
aluedeke committed Oct 10, 2024
1 parent 6f087dc commit 882049a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions restapi/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func simpleDeviceRoutes(device *gin.RouterGroup) {
device.PUT("/setlocation", SetLocation)
device.GET("/syslog", streamingMiddleWare, Syslog)

device.POST("/wda", CreateWdaSession)
device.GET("/wda/:sessionId", ReadWdaSession)
device.DELETE("/wda/:sessionId", DeleteWdaSession)
device.POST("/wda/session", CreateWdaSession)
device.GET("/wda/session/:sessionId", ReadWdaSession)
device.DELETE("/wda/session/:sessionId", DeleteWdaSession)
}

func appRoutes(group *gin.RouterGroup) {
Expand Down
25 changes: 25 additions & 0 deletions restapi/api/wda.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ func (session *WdaSession) Write(p []byte) (n int, err error) {

var globalSessions = sync.Map{}

// @Summary Create a new WDA session
// @Description Create a new WebDriverAgent session for the specified device
// @Tags WebDriverAgent
// @Accept json
// @Produce json
// @Param config body WdaConfig true "WebDriverAgent Configuration"
// @Success 200 {object} WdaSession
// @Failure 400 {object} GenericResponse
// @Router /wda/session [post]
func CreateWdaSession(c *gin.Context) {
device := c.MustGet(IOS_KEY).(ios.DeviceEntry)
log.
Expand Down Expand Up @@ -99,6 +108,14 @@ func CreateWdaSession(c *gin.Context) {
c.JSON(http.StatusOK, session)
}

// @Summary Get a WebDriverAgent session
// @Description Get a WebDriverAgent session by sessionId
// @Tags WebDriverAgent
// @Produce json
// @Param sessionId path string true "Session ID"
// @Success 200 {object} WdaSession
// @Failure 400 {object} GenericResponse
// @Router /wda/session/{sessionId} [get]
func ReadWdaSession(c *gin.Context) {
device := c.MustGet(IOS_KEY).(ios.DeviceEntry)

Expand All @@ -122,6 +139,14 @@ func ReadWdaSession(c *gin.Context) {
c.JSON(http.StatusOK, session)
}

// @Summary Delete a WebDriverAgent session
// @Description Delete a WebDriverAgent session by sessionId
// @Tags WebDriverAgent
// @Produce json
// @Param sessionId path string true "Session ID"
// @Success 200 {object} WdaSession
// @Failure 400 {object} GenericResponse
// @Router /wda/session/{sessionId} [delete]
func DeleteWdaSession(c *gin.Context) {
device := c.MustGet(IOS_KEY).(ios.DeviceEntry)

Expand Down

0 comments on commit 882049a

Please sign in to comment.