Skip to content

Commit

Permalink
add channel
Browse files Browse the repository at this point in the history
Signed-off-by: Yuanmao Zhu <yuanmao@ualberta.ca>
  • Loading branch information
zhuyuanmao committed Aug 9, 2024
1 parent c1c8377 commit 27524ca
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
29 changes: 29 additions & 0 deletions src/agent/sdk-agent/internal/routers/channel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package routers

import (
"net/http"

"github.com/gin-gonic/gin"
)

func GetChannel(c *gin.Context) {
id := c.Query("channel_id")
if id == "" {
channels := []string{"Channel 1", "Channel 2", "Channel 3"}
c.JSON(http.StatusOK, gin.H{
"channels": channels,
})
return
}
c.JSON(http.StatusOK, gin.H{
"message": "Channel ID: " + id,
})
}

func CreateChannel(c *gin.Context) {
c.IndentedJSON(http.StatusOK, nil)
}

func UpdateChannel(c *gin.Context) {
c.IndentedJSON(http.StatusOK, nil)
}
11 changes: 0 additions & 11 deletions src/agent/sdk-agent/internal/routers/networks.go

This file was deleted.

5 changes: 3 additions & 2 deletions src/agent/sdk-agent/internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ func NewServer() server {

func (s *server) Start() {
grouter := gin.Default()
grouter.GET("/networks", routers.GetNetworks)

grouter.GET("/channels", routers.GetChannel)
grouter.PUT("/channels", routers.UpdateChannel)
grouter.POST("/channels", routers.CreateChannel)
grouter.Run("localhost:8080")
}

0 comments on commit 27524ca

Please sign in to comment.