From 9343e85b8f3f3aafcab9e72e517406dd4fff3563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 30 Oct 2020 21:28:07 +0100 Subject: [PATCH] resolution -> screen configuration. --- internal/api/room/handler.go | 8 ++++---- internal/api/room/{resolution.go => screen.go} | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) rename internal/api/room/{resolution.go => screen.go} (64%) diff --git a/internal/api/room/handler.go b/internal/api/room/handler.go index 2ec948a6..b03e9760 100644 --- a/internal/api/room/handler.go +++ b/internal/api/room/handler.go @@ -32,11 +32,11 @@ func New( func (h *RoomHandler) Router() *chi.Mux { r := chi.NewRouter() - r.Route("/resolution", func(r chi.Router) { - r.Get("/", h.ResolutionGet) - r.Post("/", h.ResolutionChange) + r.Route("/screen", func(r chi.Router) { + r.Get("/", h.ScreenConfiguration) + r.Post("/", h.ScreenConfigurationChange) - r.Get("/list", h.ResolutionList) + r.Get("/configurations", h.ScreenConfigurationsList) }) // TODO diff --git a/internal/api/room/resolution.go b/internal/api/room/screen.go similarity index 64% rename from internal/api/room/resolution.go rename to internal/api/room/screen.go index 50330d5e..d3e9d54e 100644 --- a/internal/api/room/resolution.go +++ b/internal/api/room/screen.go @@ -8,17 +8,17 @@ import ( "demodesk/neko/internal/api/utils" ) -type ResolutionStruct struct { +type ScreenConfiguration struct { Width int `json:"width"` Height int `json:"height"` Rate int `json:"rate"` } -func (a *ResolutionStruct) Bind(r *http.Request) error { +func (a *ScreenConfiguration) Bind(r *http.Request) error { return nil } -func (h *RoomHandler) ResolutionGet(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) ScreenConfiguration(w http.ResponseWriter, r *http.Request) { size := h.remote.GetScreenSize() if size == nil { @@ -26,15 +26,15 @@ func (h *RoomHandler) ResolutionGet(w http.ResponseWriter, r *http.Request) { return } - render.JSON(w, r, ResolutionStruct{ + render.JSON(w, r, ScreenConfiguration{ Width: size.Width, Height: size.Height, Rate: int(size.Rate), }) } -func (h *RoomHandler) ResolutionChange(w http.ResponseWriter, r *http.Request) { - data := &ResolutionStruct{} +func (h *RoomHandler) ScreenConfigurationChange(w http.ResponseWriter, r *http.Request) { + data := &ScreenConfiguration{} if err := render.Bind(r, data); err != nil { render.Render(w, r, utils.ErrInvalidRequest(err)) return @@ -50,6 +50,6 @@ func (h *RoomHandler) ResolutionChange(w http.ResponseWriter, r *http.Request) { render.JSON(w, r, data) } -func (h *RoomHandler) ResolutionList(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) ScreenConfigurationsList(w http.ResponseWriter, r *http.Request) { render.Render(w, r, utils.ErrMessage(500, "Not implmented.")) }