From 7724f16e7c56405ddcc16a83c7807586481cf41a Mon Sep 17 00:00:00 2001 From: lsiepel Date: Fri, 3 Nov 2023 22:05:31 +0100 Subject: [PATCH] gson fields alias (#15829) Signed-off-by: Leo Siepel --- .../api/dto/MessageRecognizerLoopRecordBegin.java | 5 ++++- .../internal/api/dto/MessageRecognizerLoopRecordEnd.java | 5 ++++- .../internal/api/dto/MessageRecognizerLoopUtterance.java | 7 +++++-- .../binding/mycroft/internal/api/dto/MessageSpeak.java | 8 ++++++-- .../mycroft/internal/api/dto/MessageVolumeDecrease.java | 5 ++++- .../mycroft/internal/api/dto/MessageVolumeIncrease.java | 5 ++++- .../mycroft/internal/api/dto/MessageVolumeMute.java | 5 ++++- .../mycroft/internal/api/dto/MessageVolumeUnmute.java | 5 ++++- 8 files changed, 35 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordBegin.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordBegin.java index 44386f267..a1cadc4dd 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordBegin.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordBegin.java @@ -14,6 +14,8 @@ package org.openhab.binding.mycroft.internal.api.dto; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message informs the bus clients that Mycroft * is actively listening and trying to do STT. @@ -29,7 +31,8 @@ public class MessageRecognizerLoopRecordBegin extends BaseMessage { } public static class Context { - public String client_name = ""; + @SerializedName("client_name") + public String clientName = ""; public String source = ""; public String destination = ""; } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordEnd.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordEnd.java index c6998b8da..3da0b2aef 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordEnd.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopRecordEnd.java @@ -14,6 +14,8 @@ package org.openhab.binding.mycroft.internal.api.dto; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message informs the bus clients that Mycroft * finished listening to the mic. @@ -29,7 +31,8 @@ public class MessageRecognizerLoopRecordEnd extends BaseMessage { } public static class Context { - public String client_name = ""; + @SerializedName("client_name") + public String clientName = ""; public String source = ""; public String destination = ""; } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopUtterance.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopUtterance.java index b6d6ab493..243e7c59f 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopUtterance.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageRecognizerLoopUtterance.java @@ -17,6 +17,8 @@ import java.util.List; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message is sent to the skills * module to trigger an intent from a text. @@ -36,7 +38,7 @@ public class MessageRecognizerLoopUtterance extends BaseMessage { public MessageRecognizerLoopUtterance(String utterance) { this(); this.data.utterances.add(utterance); - this.context.client_name = "java_api"; + this.context.clientName = "java_api"; this.context.source = "audio"; this.context.destination.add("skills"); } @@ -46,7 +48,8 @@ public class MessageRecognizerLoopUtterance extends BaseMessage { } public static class Context { - public String client_name = ""; + @SerializedName("client_name") + public String clientName = ""; public String source = ""; public List destination = new ArrayList<>(); } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageSpeak.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageSpeak.java index b2ceb9bcf..c6335ccf5 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageSpeak.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageSpeak.java @@ -17,6 +17,8 @@ import java.util.List; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message is sent to the Mycroft audio module * to trigger a TTS action. @@ -41,11 +43,13 @@ public class MessageSpeak extends BaseMessage { public static class Data { public String utterance = ""; - public String expect_response = ""; + @SerializedName("expect_response") + public String expectResponse = ""; }; public static class Context { - public String client_name = ""; + @SerializedName("client_name") + public String clientName = ""; public List source = new ArrayList<>(); public String destination = ""; } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeDecrease.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeDecrease.java index 2f1e2c894..e46fedb1b 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeDecrease.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeDecrease.java @@ -14,6 +14,8 @@ package org.openhab.binding.mycroft.internal.api.dto; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message asks Mycroft to decrease the volume by 10% * @@ -28,6 +30,7 @@ public class MessageVolumeDecrease extends BaseMessage { } public static class Data { - public Boolean play_sound = true; + @SerializedName("play_sound") + public Boolean playSound = true; } } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeIncrease.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeIncrease.java index bd95c180c..5b38d7852 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeIncrease.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeIncrease.java @@ -14,6 +14,8 @@ package org.openhab.binding.mycroft.internal.api.dto; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message asks Mycroft to increase the volume by 10% * @@ -28,6 +30,7 @@ public class MessageVolumeIncrease extends BaseMessage { } public static class Data { - public Boolean play_sound = true; + @SerializedName("play_sound") + public Boolean playSound = true; } } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeMute.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeMute.java index 4c2ab434a..7013f8534 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeMute.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeMute.java @@ -14,6 +14,8 @@ package org.openhab.binding.mycroft.internal.api.dto; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message asks Mycroft to mute the volume * @@ -28,6 +30,7 @@ public class MessageVolumeMute extends BaseMessage { } public static class Data { - public Boolean speak_message = false; + @SerializedName("speak_messsage") + public Boolean speakMesssage = false; } } diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeUnmute.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeUnmute.java index 91602e872..7334cc6c9 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeUnmute.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/api/dto/MessageVolumeUnmute.java @@ -14,6 +14,8 @@ package org.openhab.binding.mycroft.internal.api.dto; import org.openhab.binding.mycroft.internal.api.MessageType; +import com.google.gson.annotations.SerializedName; + /** * This message asks Mycroft to unmute the volume * @@ -28,6 +30,7 @@ public class MessageVolumeUnmute extends BaseMessage { } public static class Data { - public Boolean speak_message = false; + @SerializedName("speak_messsage") + public Boolean speakMessage = false; } }