neko/internal/api/room/handler.go

46 lines
808 B
Go
Raw Normal View History

2020-10-31 06:16:21 +13:00
package room
import (
"github.com/go-chi/chi"
"demodesk/neko/internal/types"
)
type RoomHandler struct {
sessions types.SessionManager
remote types.RemoteManager
broadcast types.BroadcastManager
websocket types.WebSocketHandler
}
func New(
sessions types.SessionManager,
remote types.RemoteManager,
broadcast types.BroadcastManager,
websocket types.WebSocketHandler,
) *RoomHandler {
// Init
return &RoomHandler{
sessions: sessions,
remote: remote,
broadcast: broadcast,
websocket: websocket,
}
}
func (h *RoomHandler) Router() *chi.Mux {
r := chi.NewRouter()
2020-10-31 09:28:07 +13:00
r.Route("/screen", func(r chi.Router) {
r.Get("/", h.ScreenConfiguration)
r.Post("/", h.ScreenConfigurationChange)
2020-10-31 06:16:21 +13:00
2020-10-31 09:28:07 +13:00
r.Get("/configurations", h.ScreenConfigurationsList)
2020-10-31 06:16:21 +13:00
})
// TODO
return r
}