]> git.basschouten.com Git - openhab-addons.git/commitdiff
[freeboxos] Keep enum in API response record DTO (play media) (#17282)
authorlolodomo <lg.hc@free.fr>
Sun, 18 Aug 2024 11:24:42 +0000 (13:24 +0200)
committerGitHub <noreply@github.com>
Sun, 18 Aug 2024 11:24:42 +0000 (13:24 +0200)
Partial revert of #17244

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/api/rest/MediaReceiverManager.java

index 5141e46743387b6040407bb870588c3e43c8a44c..da52a34537ff2e20fb45c2833186676e5fcee690 100644 (file)
@@ -22,6 +22,8 @@ import org.openhab.binding.freeboxos.internal.api.FreeboxException;
 import org.openhab.binding.freeboxos.internal.api.Response;
 import org.openhab.binding.freeboxos.internal.api.rest.MediaReceiverManager.Receiver;
 
+import com.google.gson.annotations.SerializedName;
+
 /**
  * The {@link MediaReceiverManager} is the Java class used to handle api requests related to air media receivers
  *
@@ -41,24 +43,27 @@ public class MediaReceiverManager extends ListableRest<Receiver, MediaReceiverMa
     }
 
     public enum Action {
+        @SerializedName("start")
         START,
+        @SerializedName("stop")
         STOP,
         UNKNOWN
     }
 
     public enum MediaType {
+        @SerializedName("video")
         VIDEO,
+        @SerializedName("photo")
         PHOTO,
+        @SerializedName("audio")
         AUDIO,
+        @SerializedName("screen")
         SCREEN,
         UNKNOWN
     }
 
-    private static record Request(String password, String action, String mediaType, @Nullable String media,
+    private static record Request(String password, Action action, MediaType mediaType, @Nullable String media,
             int position) {
-        Request(String password, Action action, MediaType mediaType, @Nullable String media, int position) {
-            this(password, action.name().toLowerCase(), mediaType.name().toLowerCase(), media, position);
-        }
     }
 
     public MediaReceiverManager(FreeboxOsSession session, UriBuilder uriBuilder) throws FreeboxException {