diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/pom.xml b/bundles/org.smarthomej.binding.amazonechocontrol/pom.xml index eb739c8010..0207183f1f 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/pom.xml +++ b/bundles/org.smarthomej.binding.amazonechocontrol/pom.xml @@ -33,6 +33,24 @@ 2.2.600 compile + + org.eclipse.jdt + org.eclipse.jdt.annotation + 2.2.600 + compile + + + org.eclipse.jdt + org.eclipse.jdt.annotation + 2.2.600 + compile + + + org.eclipse.jdt + org.eclipse.jdt.annotation + 2.2.600 + compile + diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/AccountServlet.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/AccountServlet.java index 7069573f86..902f9d5bcc 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/AccountServlet.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/AccountServlet.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -56,8 +57,6 @@ import org.smarthomej.binding.amazonechocontrol.internal.handler.AccountHandler; import org.smarthomej.binding.amazonechocontrol.internal.util.HttpRequestBuilder; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; /** @@ -80,19 +79,16 @@ public class AccountServlet extends HttpServlet { private static final String PROXY_URI_PART = "/PROXY/"; private final Logger logger = LoggerFactory.getLogger(AccountServlet.class); - private final HttpService httpService; private final String servletUrl; private final AccountHandler accountHandler; private final String id; - private final Gson gson; private @Nullable Connection connectionToInitialize; - public AccountServlet(HttpService httpService, String id, AccountHandler accountHandler, Gson gson) { + public AccountServlet(HttpService httpService, String id, AccountHandler accountHandler) { this.httpService = httpService; this.accountHandler = accountHandler; this.id = id; - this.gson = gson; try { servletUrl = "/" + BINDING_ID + "/" + URLEncoder.encode(id, StandardCharsets.UTF_8); @@ -164,11 +160,12 @@ private void doVerb(String verb, HttpServletRequest req, HttpServletResponse res + uri.substring(PROXY_URI_PART.length()); Object postData = null; + boolean isJson = false; if ("POST".equals(verb) || "PUT".equals(verb)) { - postData = gson.fromJson(req.getReader(), JsonObject.class); + postData = req.getReader().lines().collect(Collectors.joining()); } - this.handleProxyRequest(connection, resp, verb, getUrl, null, postData, connection.getAmazonSite()); + this.handleProxyRequest(connection, resp, verb, getUrl, null, postData, true, connection.getAmazonSite()); return; } @@ -220,7 +217,7 @@ private void doVerb(String verb, HttpServletRequest req, HttpServletResponse res } String referer = "https://www." + site; String postData = postDataBuilder.toString(); - handleProxyRequest(connection, resp, "POST", postUrl, referer, postData, site); + handleProxyRequest(connection, resp, "POST", postUrl, referer, postData, false, site); } @Override @@ -243,7 +240,7 @@ protected void doGet(@NonNullByDefault({}) HttpServletRequest req, @NonNullByDef String getUrl = "https://www." + connection.getAmazonSite() + "/" + uri.substring(FORWARD_URI_PART.length()); - this.handleProxyRequest(connection, resp, "GET", getUrl, null, null, connection.getAmazonSite()); + this.handleProxyRequest(connection, resp, "GET", getUrl, null, null, false, connection.getAmazonSite()); return; } @@ -258,7 +255,7 @@ protected void doGet(@NonNullByDefault({}) HttpServletRequest req, @NonNullByDef String getUrl = "https://alexa." + connection.getAmazonSite() + "/" + uri.substring(PROXY_URI_PART.length()); - this.handleProxyRequest(connection, resp, "GET", getUrl, null, null, connection.getAmazonSite()); + this.handleProxyRequest(connection, resp, "GET", getUrl, null, null, false, connection.getAmazonSite()); return; } @@ -578,7 +575,7 @@ private void renderBluetoothMacChannel(Connection connection, DeviceTO device, S } private void handleProxyRequest(Connection connection, HttpServletResponse resp, String verb, String url, - @Nullable String referer, @Nullable Object postData, String site) throws IOException { + @Nullable String referer, @Nullable Object postData, boolean isJson, String site) throws IOException { try { Map headers = new HashMap<>(); if (referer != null) { @@ -586,8 +583,8 @@ private void handleProxyRequest(Connection connection, HttpServletResponse resp, } HttpRequestBuilder.HttpResponse response = connection.getRequestBuilder() - .builder(HttpMethod.fromString(verb), url).withContent(postData).withJson(true).withHeaders(headers) - .retry(false).redirect(false).syncSend(); + .builder(HttpMethod.fromString(verb), url).withContent(postData).withJson(isJson) + .withHeaders(headers).retry(false).redirect(false).syncSend(); if (response.statusCode() == HttpStatus.FOUND_302) { String location = response.headers().get("location"); if (location.contains("/ap/maplanding")) { diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/connection/Connection.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/connection/Connection.java index eba1088160..e9f4130ac2 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/connection/Connection.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/connection/Connection.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.net.CookieManager; +import java.net.CookieStore; import java.net.HttpCookie; import java.net.URI; import java.net.URLEncoder; @@ -61,51 +62,49 @@ import org.slf4j.LoggerFactory; import org.smarthomej.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants; import org.smarthomej.binding.amazonechocontrol.internal.ConnectionException; -import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmModelTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceNotificationStateTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DoNotDisturbDeviceStatusTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.EnabledFeedsTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.EqualizerTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.FeedTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.EnabledFeedTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonAnnouncementTarget; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonAutomation; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonAutomation.Payload; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonExchangeTokenResponse; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonExchangeTokenResponse.Cookie; +import org.smarthomej.binding.amazonechocontrol.internal.dto.request.ExchangeTokenTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonMediaState; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonNetworkDetails; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonNotificationRequest; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlaySearchPhraseOperationPayload; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayValidationResult; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlaylists; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonStartRoutineRequest; +import org.smarthomej.binding.amazonechocontrol.internal.dto.request.StartRoutineTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationSoundTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationStateTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.request.AnnouncementTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.request.RegisterAppRequestTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.request.WebSiteCookieTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.AscendingAlarmModelResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.AuthTokenResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.AuthenticationTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStateResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BootstrapResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.CustomerHistoryRecordResponseTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.request.AuthRegisterTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.AscendingAlarmModelsTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.AuthRegisterTokensTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.AuthTokenTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStatesTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BootstrapAuthenticationTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BootstrapTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.CookieTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.CustomerHistoryRecordTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.DeviceListResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.DeviceNotificationStateResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.DoNotDisturbDeviceStatusResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.EndpointResponseTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.CustomerHistoryRecordsTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.DeviceListTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.DeviceNotificationStatesTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.DoNotDisturbDeviceStatusesTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.EndpointTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.MusicProviderTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.NotificationListResponseTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.NotificationSoundResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.RegisterAppResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.TokensTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.UsersMeResponseTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.WakeWordResponseTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.UsersMeTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.WakeWordTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.WakeWordsTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.smarthome.JsonSmartHomeDevice; import org.smarthomej.binding.amazonechocontrol.internal.dto.smarthome.JsonSmartHomeGroups.SmartHomeGroup; import org.smarthomej.binding.amazonechocontrol.internal.dto.smarthome.SmartHomeBaseDevice; @@ -227,8 +226,8 @@ public boolean tryRestoreLogin(@Nullable String data, @Nullable String overloade String retailDomain = loginData.getRetailDomain(); String retailDomainTLD = retailDomain.substring(retailDomain.lastIndexOf(".")); if (!loginData.getRetailUrl().endsWith(retailDomainTLD)) { - EndpointResponseTO endpoints = requestBuilder.get("https://alexa.amazon.com/api/endpoints") - .syncSend(EndpointResponseTO.class); + EndpointTO endpoints = requestBuilder.get("https://alexa.amazon.com/api/endpoints") + .syncSend(EndpointTO.class); this.loginData.setRetailDomain(endpoints.retailDomain); this.loginData.setWebsiteApiUrl(endpoints.websiteApiUrl); this.loginData.setRetailUrl(endpoints.retailUrl); @@ -247,9 +246,9 @@ public boolean tryRestoreLogin(@Nullable String data, @Nullable String overloade private boolean tryGetBootstrap() { try { - BootstrapResponseTO result = requestBuilder.get(getAlexaServer() + "/api/bootstrap").retry(false) - .redirect(false).syncSend(BootstrapResponseTO.class); - AuthenticationTO authentication = result.authentication; + BootstrapTO result = requestBuilder.get(getAlexaServer() + "/api/bootstrap").retry(false).redirect(false) + .syncSend(BootstrapTO.class); + BootstrapAuthenticationTO authentication = result.authentication; if (authentication != null && authentication.authenticated) { this.customerName = authentication.customerName; this.loginData.setAccountCustomerId(authentication.customerId); @@ -261,30 +260,43 @@ private boolean tryGetBootstrap() { return false; } - private WebSiteCookieTO mapWebSiteCookie(HttpCookie cookie) { - WebSiteCookieTO webSiteCookie = new WebSiteCookieTO(); - webSiteCookie.name = cookie.getName(); - webSiteCookie.value = cookie.getValue(); - return webSiteCookie; + private CookieTO mapCookie(HttpCookie httpCookie) { + CookieTO cookie = new CookieTO(); + cookie.name = httpCookie.getName(); + cookie.value = httpCookie.getValue(); + cookie.secure = String.valueOf(httpCookie.getSecure()); + cookie.httpOnly = String.valueOf(httpCookie.isHttpOnly()); + return cookie; + } + + private HttpCookie mapCookie(CookieTO cookie, String domain) { + HttpCookie httpCookie = new HttpCookie(cookie.name, cookie.value); + httpCookie.setPath(cookie.path); + httpCookie.setDomain(domain); + String secure = cookie.secure; + if (secure != null) { + httpCookie.setSecure(Boolean.getBoolean(secure)); + } + return httpCookie; } public boolean registerConnectionAsApp(String accessToken) { try { - List webSiteCookies = cookieManager.getCookieStore() - .get(URI.create("https://www.amazon.com")).stream().map(this::mapWebSiteCookie).toList(); + List webSiteCookies = cookieManager.getCookieStore().get(URI.create("https://www.amazon.com")) + .stream().map(this::mapCookie).toList(); - RegisterAppRequestTO registerAppRequest = new RegisterAppRequestTO(); + AuthRegisterTO registerAppRequest = new AuthRegisterTO(); registerAppRequest.registrationData.deviceSerial = loginData.getSerial(); registerAppRequest.authData.accessToken = accessToken; registerAppRequest.userContextMap = Map.of("frc", loginData.getFrc()); registerAppRequest.cookies.webSiteCookies = webSiteCookies; - RegisterAppResponseTO registerAppResponse = requestBuilder.post("https://api.amazon.com/auth/register") - .withContent(registerAppRequest) + org.smarthomej.binding.amazonechocontrol.internal.dto.response.AuthRegisterTO registerAppResponse = requestBuilder + .post("https://api.amazon.com/auth/register").withContent(registerAppRequest) .withHeaders(Map.of("x-amzn-identity-auth-domain", "api.amazon.com")) - .syncSend(RegisterAppResponseTO.class); + .syncSend(org.smarthomej.binding.amazonechocontrol.internal.dto.response.AuthRegisterTO.class); - TokensTO tokens = registerAppResponse.response.success.tokens; + AuthRegisterTokensTO tokens = registerAppResponse.response.success.tokens; String refreshToken = tokens.bearer.refreshToken; this.loginData.setRefreshToken(refreshToken); @@ -296,15 +308,13 @@ public boolean registerConnectionAsApp(String accessToken) { exchangeToken(getAmazonSite()); // Check which is the owner domain - UsersMeResponseTO usersMeResponse = requestBuilder - .get("https://alexa.amazon.com/api/users/me?platform=ios&version=" - + AmazonEchoControlBindingConstants.API_VERSION) - .syncSend(UsersMeResponseTO.class); + UsersMeTO usersMeResponse = requestBuilder.get("https://alexa.amazon.com/api/users/me?platform=ios&version=" + + AmazonEchoControlBindingConstants.API_VERSION).syncSend(UsersMeTO.class); // Switch to owner domain exchangeToken(usersMeResponse.marketPlaceDomainName); - EndpointResponseTO endpoints = requestBuilder.get("https://alexa.amazon.com/api/endpoints") - .syncSend(EndpointResponseTO.class); + EndpointTO endpoints = requestBuilder.get("https://alexa.amazon.com/api/endpoints") + .syncSend(EndpointTO.class); this.loginData.setRetailDomain(endpoints.retailDomain); this.loginData.setWebsiteApiUrl(endpoints.websiteApiUrl); this.loginData.setRetailUrl(endpoints.retailUrl); @@ -352,28 +362,13 @@ private void exchangeToken(String cookieDomain) throws ConnectionException { String url = "https://www." + getAmazonSite() + "/ap/exchangetoken"; - String exchangeTokenJson = requestBuilder.post(url).withContent(exchangePostData).withHeader("Cookie", "") - .syncSend(String.class); - JsonExchangeTokenResponse exchangeTokenResponse = Objects - .requireNonNull(gson.fromJson(exchangeTokenJson, JsonExchangeTokenResponse.class)); - - Map cookiesMap = exchangeTokenResponse.response.tokens.cookies; - for (Map.Entry entry : cookiesMap.entrySet()) { - String domain = entry.getKey(); - Cookie[] cookies = entry.getValue(); - for (Cookie cookie : cookies) { - if (cookie != null) { - HttpCookie httpCookie = new HttpCookie(cookie.name, cookie.value); - httpCookie.setPath(cookie.path); - httpCookie.setDomain(domain); - Boolean secure = cookie.secure; - if (secure != null) { - httpCookie.setSecure(secure); - } - cookieManager.getCookieStore().add(null, httpCookie); - } - } - } + ExchangeTokenTO exchangeToken = requestBuilder.post(url).withContent(exchangePostData) + .withHeader("Cookie", "").syncSend(ExchangeTokenTO.class); + + CookieStore cookieStore = cookieManager.getCookieStore(); + exchangeToken.response.tokens.cookies.forEach((domain, cookies) -> + cookies.stream().map(cookie -> mapCookie(cookie, domain)).forEach(httpCookie -> cookieStore.add(null, httpCookie))); + if (!verifyLogin()) { throw new ConnectionException("Verify login failed after token exchange"); } @@ -415,8 +410,8 @@ public boolean checkRenewSession() throws ConnectionException { + "&di.os.version=" + AmazonEchoControlBindingConstants.DI_OS_VERSION // + "¤t_version=6.12.4"; - AuthTokenResponseTO tokenResponse = requestBuilder.post("https://api.amazon.com/auth/token") - .withContent(renewTokenPostData).syncSend(AuthTokenResponseTO.class); + AuthTokenTO tokenResponse = requestBuilder.post("https://api.amazon.com/auth/token") + .withContent(renewTokenPostData).syncSend(AuthTokenTO.class); if (tokenResponse == null) { return false; @@ -540,7 +535,7 @@ public void logout() { public List getWakeWords() { try { return requestBuilder.get(getAlexaServer() + "/api/wake-word?cached=true") - .syncSend(WakeWordResponseTO.class).wakeWords; + .syncSend(WakeWordsTO.class).wakeWords; } catch (ConnectionException e) { logger.info("Getting wake words failed", e); } @@ -586,8 +581,8 @@ private void searchSmartHomeDevicesRecursive(@Nullable Object jsonNode, List getDeviceList() throws ConnectionException { - DeviceListResponseTO devices = requestBuilder.get(getAlexaServer() + "/api/devices-v2/device?cached=false") - .syncSend(DeviceListResponseTO.class); + DeviceListTO devices = requestBuilder.get(getAlexaServer() + "/api/devices-v2/device?cached=false") + .syncSend(DeviceListTO.class); // @Nullable because of a limitation of the null-checker, we filter null-serialNumbers before Set<@Nullable String> serialNumbers = ConcurrentHashMap.newKeySet(); return devices.devices.stream().filter(d -> d.serialNumber != null && serialNumbers.add(d.serialNumber)) @@ -652,9 +647,9 @@ public Map getSmartHomeDeviceStatesJson(Set getActivities(long startTime, long endTime) try { String url = "https://www." + getAmazonSite() + "/alexa-privacy/apd/rvh/customer-history-records?startTime=" + startTime + "&endTime=" + endTime + "&maxRecordSize=1"; - CustomerHistoryRecordResponseTO customerHistoryRecords = requestBuilder.get(url) - .syncSend(CustomerHistoryRecordResponseTO.class); - if (customerHistoryRecords == null) { - return List.of(); - } + CustomerHistoryRecordsTO customerHistoryRecords = requestBuilder.get(url) + .syncSend(CustomerHistoryRecordsTO.class); return customerHistoryRecords.customerHistoryRecords.stream().sorted(Comparator.comparing(r -> r.timestamp)) .toList(); } catch (ConnectionException e) { @@ -679,13 +671,13 @@ public List getActivities(long startTime, long endTime) return List.of(); } - public BluetoothStateResponseTO getBluetoothConnectionStates() { + public BluetoothStatesTO getBluetoothConnectionStates() { try { String url = getAlexaServer() + "/api/bluetooth?cached=true"; - return requestBuilder.get(url).syncSend(BluetoothStateResponseTO.class); + return requestBuilder.get(url).syncSend(BluetoothStatesTO.class); } catch (ConnectionException e) { logger.debug("Failed to get bluetooth state: {}", e.getMessage()); - return new BluetoothStateResponseTO(); + return new BluetoothStatesTO(); } } @@ -773,7 +765,7 @@ public void setNotificationVolume(DeviceTO device, int volume) throws Connection public void setAscendingAlarm(DeviceTO device, boolean ascendingAlarm) throws ConnectionException { String url = getAlexaServer() + "/api/ascending-alarm/" + device.serialNumber; - AscendingAlarmTO command = new AscendingAlarmTO(); + AscendingAlarmModelTO command = new AscendingAlarmModelTO(); command.ascendingAlarmEnabled = ascendingAlarm; command.deviceSerialNumber = device.serialNumber; command.deviceType = device.deviceType; @@ -792,17 +784,17 @@ public void setDoNotDisturb(DeviceTO device, boolean doNotDisturb) throws Connec public List getDeviceNotificationStates() { try { return requestBuilder.get(getAlexaServer() + "/api/device-notification-state") - .syncSend(DeviceNotificationStateResponseTO.class).deviceNotificationStates; + .syncSend(DeviceNotificationStatesTO.class).deviceNotificationStates; } catch (ConnectionException e) { logger.info("Error getting device notification states", e); } return List.of(); } - public List getAscendingAlarms() { + public List getAscendingAlarms() { try { return requestBuilder.get(getAlexaServer() + "/api/ascending-alarm") - .syncSend(AscendingAlarmModelResponseTO.class).ascendingAlarmModelList; + .syncSend(AscendingAlarmModelsTO.class).ascendingAlarmModelList; } catch (ConnectionException e) { logger.info("Error getting ascending alarm states", e); } @@ -812,7 +804,7 @@ public List getAscendingAlarms() { public List getDoNotDisturbs() { try { return requestBuilder.get(getAlexaServer() + "/api/dnd/device-status-list") - .syncSend(DoNotDisturbDeviceStatusResponseTO.class).doNotDisturbDeviceStatusList; + .syncSend(DoNotDisturbDeviceStatusesTO.class).doNotDisturbDeviceStatusList; } catch (ConnectionException e) { logger.info("Error getting do not disturb status list", e); } @@ -1224,7 +1216,7 @@ private void queuedExecuteSequenceNode(QueueObject queueObject) { sequenceJson.addProperty("@type", "com.amazon.alexa.behaviors.model.Sequence"); sequenceJson.add("startNode", nodeToExecute); - JsonStartRoutineRequest request = new JsonStartRoutineRequest(); + StartRoutineTO request = new StartRoutineTO(); request.sequenceJson = gson.toJson(sequenceJson); String text = executionNodeObject.text; @@ -1390,7 +1382,7 @@ public void startRoutine(DeviceTO device, String utterance) throws ConnectionExc if (found != null) { String sequenceJson = gson.toJson(found.sequence); - JsonStartRoutineRequest request = new JsonStartRoutineRequest(); + StartRoutineTO request = new StartRoutineTO(); request.behaviorId = found.automationId; // replace tokens @@ -1429,7 +1421,7 @@ public List getRoutines() throws ConnectionException { return Arrays.asList(result); } - public List getEnabledFlashBriefings() { + public List getEnabledFlashBriefings() { try { return requestBuilder.get(getAlexaServer() + "/api/content-skills/enabled-feeds") .syncSend(EnabledFeedsTO.class).enabledFeeds; @@ -1439,7 +1431,7 @@ public List getEnabledFlashBriefings() { return List.of(); } - public void setEnabledFlashBriefings(List enabledFlashBriefing) throws ConnectionException { + public void setEnabledFlashBriefings(List enabledFlashBriefing) throws ConnectionException { EnabledFeedsTO enabled = new EnabledFeedsTO(); enabled.enabledFeeds = enabledFlashBriefing; requestBuilder.post(getAlexaServer() + "/api/content-skills/enabled-feeds").withContent(enabled).retry(false) @@ -1554,7 +1546,7 @@ public void playMusicVoiceCommand(DeviceTO device, String providerId, String voi startNodeJson.add("operationPayload", gson.toJsonTree(payload)); sequenceJson.add("startNode", startNodeJson); - JsonStartRoutineRequest startRoutineRequest = new JsonStartRoutineRequest(); + StartRoutineTO startRoutineRequest = new StartRoutineTO(); startRoutineRequest.sequenceJson = sequenceJson.toString(); startRoutineRequest.status = null; diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/AscendingAlarmTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/AscendingAlarmModelTO.java similarity index 80% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/AscendingAlarmTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/AscendingAlarmModelTO.java index bf9e0f378a..de85cbdb5e 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/AscendingAlarmTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/AscendingAlarmModelTO.java @@ -16,11 +16,11 @@ import org.smarthomej.binding.amazonechocontrol.internal.util.SerializeNull; /** - * The {@link AscendingAlarmTO} encapsulates the ascending alarm status of a device + * The {@link AscendingAlarmModelTO} encapsulates the ascending alarm status of a device * * @author Jan N. Klug - Initial contribution */ -public class AscendingAlarmTO { +public class AscendingAlarmModelTO { public boolean ascendingAlarmEnabled; public String deviceSerialNumber; public String deviceType; @@ -29,7 +29,7 @@ public class AscendingAlarmTO { @Override public @NonNull String toString() { - return "AscendingAlarmTO{ascendingAlarmEnabled=" + ascendingAlarmEnabled + ", deviceSerialNumber='" + return "AscendingAlarmModelTO{ascendingAlarmEnabled=" + ascendingAlarmEnabled + ", deviceSerialNumber='" + deviceSerialNumber + "', deviceType='" + deviceType + "', deviceAccountId=" + deviceAccountId + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/WebSiteCookieTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/CookieTO.java similarity index 52% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/WebSiteCookieTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/CookieTO.java index 67541bf731..ee5330da00 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/WebSiteCookieTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/CookieTO.java @@ -1,5 +1,4 @@ /** - * Copyright (c) 2010-2021 Contributors to the openHAB project * Copyright (c) 2021-2023 Contributors to the SmartHome/J project * * See the NOTICE file(s) distributed with this work for additional @@ -11,25 +10,34 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.smarthomej.binding.amazonechocontrol.internal.dto.request; +package org.smarthomej.binding.amazonechocontrol.internal.dto; import org.eclipse.jdt.annotation.NonNull; import com.google.gson.annotations.SerializedName; /** - * The {@link WebSiteCookieTO} encapsulate a website cookie + * The {@link CookieTO} encapsulates a cookie * - * @author Michael Geramb - Initial contribution + * @author Jan N. Klug - Initial contribution */ -public class WebSiteCookieTO { +public class CookieTO { + @SerializedName("Path") + public String path; + @SerializedName("Secure") + public String secure; @SerializedName("Value") public String value; + @SerializedName("Expires") + public String expires; + @SerializedName("HttpOnly") + public String httpOnly; @SerializedName("Name") public String name; @Override public @NonNull String toString() { - return "WebSiteCookieTO{value='" + value + "', name='" + name + "'}"; + return "CookieTO{path='" + path + "', secure=" + secure + ", value='" + value + "', expires='" + expires + + "', httpOnly=" + httpOnly + ", name='" + name + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/FeedTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedTO.java similarity index 78% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/FeedTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedTO.java index 2a02aa4eac..839f24a5bd 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/FeedTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedTO.java @@ -15,11 +15,11 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link FeedTO} encapsulate a single feed + * The {@link EnabledFeedTO} encapsulate a single feed * * @author Jan N. Klug - Initial contribution */ -public class FeedTO { +public class EnabledFeedTO { public Object feedId; public String name; public String skillId; @@ -27,7 +27,7 @@ public class FeedTO { @Override public @NonNull String toString() { - return "FeedTO{feedId=" + feedId + ", name='" + name + "', skillId='" + skillId + "', imageUrl='" + imageUrl + return "EnabledFeedTO{feedId=" + feedId + ", name='" + name + "', skillId='" + skillId + "', imageUrl='" + imageUrl + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedsTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedsTO.java index 6618f23bcc..1aad2b2d91 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedsTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/EnabledFeedsTO.java @@ -23,7 +23,7 @@ * @author Jan N. Klug - Initial contribution */ public class EnabledFeedsTO { - public List enabledFeeds = List.of(); + public List enabledFeeds = List.of(); @Override public @NonNull String toString() { diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonExchangeTokenResponse.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonExchangeTokenResponse.java deleted file mode 100644 index 178a9522e8..0000000000 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonExchangeTokenResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2010-2021 Contributors to the openHAB project - * Copyright (c) 2021-2023 Contributors to the SmartHome/J project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.smarthomej.binding.amazonechocontrol.internal.dto; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -import com.google.gson.annotations.SerializedName; - -/** - * The {@link JsonExchangeTokenResponse} encapsulate the GSON response data of the token exchange - * - * @author Michael Geramb - Initial contribution - */ -@NonNullByDefault -public class JsonExchangeTokenResponse { - public Response response = new Response(); - - public static class Response { - public Tokens tokens = new Tokens(); - } - - public static class Tokens { - public Map cookies = new HashMap<>(); - } - - public static class Cookie { - @SerializedName("Path") - public @Nullable String path; - @SerializedName("Secure") - public @Nullable Boolean secure; - @SerializedName("Value") - public @Nullable String value; - @SerializedName("Expires") - public @Nullable String expires; - @SerializedName("HttpOnly") - public @Nullable Boolean httpOnly; - @SerializedName("Name") - public @Nullable String name; - } -} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlayerState.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlayerState.java deleted file mode 100644 index 6c7cbdac89..0000000000 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlayerState.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2010-2021 Contributors to the openHAB project - * Copyright (c) 2021-2023 Contributors to the SmartHome/J project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.smarthomej.binding.amazonechocontrol.internal.dto; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * The {@link JsonPlayerState} encapsulate the GSON data of the player state - * - * @author Michael Geramb - Initial contribution - */ -@NonNullByDefault -public class JsonPlayerState { - public @Nullable PlayerInfo playerInfo; - - public static class PlayerInfo { - public @Nullable String state; - public @Nullable InfoText infoText; - public @Nullable InfoText miniInfoText; - public @Nullable Provider provider; - public @Nullable Volume volume; - public @Nullable MainArt mainArt; - - public @Nullable String queueId; - public @Nullable String mediaId; - - public @Nullable Progress progress; - - public static class InfoText { - public boolean multiLineMode; - public @Nullable String subText1; - public @Nullable String subText2; - public @Nullable String title; - } - - public static class Provider { - public @Nullable String providerDisplayName; - public @Nullable String providerName; - } - - public static class Volume { - public boolean muted; - public int volume; - } - - public static class MainArt { - public @Nullable String altText; - public @Nullable String artType; - public @Nullable String contentType; - public @Nullable String url; - } - - public static class Progress { - public @Nullable Boolean allowScrubbing; - public @Nullable Object locationInfo; - public @Nullable Long mediaLength; - public @Nullable Long mediaProgress; - public @Nullable Boolean showTiming; - public @Nullable Boolean visible; - } - } -} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlaylists.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlaylists.java index 8f5f79a11d..dda6523da1 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlaylists.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonPlaylists.java @@ -17,9 +17,10 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateTO; /** - * The {@link JsonPlayerState} encapsulate the GSON data of playlist query + * The {@link PlayerStateTO} encapsulate the GSON data of playlist query * * @author Michael Geramb - Initial contribution */ diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonStartRoutineRequest.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonStartRoutineRequest.java deleted file mode 100644 index e20bb92d44..0000000000 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/JsonStartRoutineRequest.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2010-2021 Contributors to the openHAB project - * Copyright (c) 2021-2023 Contributors to the SmartHome/J project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.smarthomej.binding.amazonechocontrol.internal.dto; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * The {@link JsonStartRoutineRequest} encapsulate the GSON for starting a routine - * - * @author Michael Geramb - Initial contribution - */ -@NonNullByDefault -public class JsonStartRoutineRequest { - public @Nullable String behaviorId = "PREVIEW"; - public @Nullable String sequenceJson; - public @Nullable String status = "ENABLED"; -} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthDataTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterAuthTO.java similarity index 79% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthDataTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterAuthTO.java index 8a5ad0f03b..1aa43aa834 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthDataTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterAuthTO.java @@ -18,16 +18,16 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link AuthDataTO} encapsulates the auth information of an app registration request + * The {@link AuthRegisterAuthTO} encapsulates the auth information of an app registration request * * @author Jan N. Klug - Initial contribution */ -public class AuthDataTO { +public class AuthRegisterAuthTO { @SerializedName("access_token") public @Nullable String accessToken; @Override public @NonNull String toString() { - return "AuthDataTO{accessToken='" + accessToken + "'}"; + return "AuthRegisterAuthTO{accessToken='" + accessToken + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/CookiesTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterCookiesTO.java similarity index 68% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/CookiesTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterCookiesTO.java index ceb72427b7..acdcdcd224 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/CookiesTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterCookiesTO.java @@ -15,21 +15,22 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNull; +import org.smarthomej.binding.amazonechocontrol.internal.dto.CookieTO; import com.google.gson.annotations.SerializedName; /** - * The {@link CookiesTO} encapsulates the cookie information for a given domain + * The {@link AuthRegisterCookiesTO} encapsulates the cookie information for a given domain * * @author Jan N. Klug - Initial contribution */ -public class CookiesTO { +public class AuthRegisterCookiesTO { @SerializedName("website_cookies") - public List webSiteCookies = List.of(); + public List webSiteCookies = List.of(); public String domain = ".amazon.com"; @Override public @NonNull String toString() { - return "CookiesTO{webSiteCookies=" + webSiteCookies + ", domain='" + domain + "'}"; + return "AuthRegisterCookiesTO{webSiteCookies=" + webSiteCookies + ", domain='" + domain + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/RegistrationDataTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterRegistrationTO.java similarity index 87% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/RegistrationDataTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterRegistrationTO.java index d7697cf1fb..416bf6d974 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/RegistrationDataTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterRegistrationTO.java @@ -21,11 +21,11 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link RegistrationDataTO} encapsulates the registration data for an app registration request + * The {@link AuthRegisterRegistrationTO} encapsulates the registration data for an app registration request * * @author Jan N. Klug - Initial contribution */ -public class RegistrationDataTO { +public class AuthRegisterRegistrationTO { public String domain = "Device"; @SerializedName("app_version") public String appVersion = API_VERSION; @@ -46,7 +46,7 @@ public class RegistrationDataTO { @Override public @NonNull String toString() { - return "RegistrationDataTO{domain='" + domain + "', appVersion='" + appVersion + "', deviceType='" + deviceType + return "AuthRegisterRegistrationTO{domain='" + domain + "', appVersion='" + appVersion + "', deviceType='" + deviceType + "', deviceName='" + deviceName + "', osVersion='" + osVersion + "', deviceSerial='" + deviceSerial + "', deviceModel='" + deviceModel + "', appName='" + appName + "', softwareVersion='" + softwareVersion + "'}"; diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/RegisterAppRequestTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterTO.java similarity index 75% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/RegisterAppRequestTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterTO.java index af1fc659d0..26d009e06b 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/RegisterAppRequestTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/AuthRegisterTO.java @@ -20,18 +20,18 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link RegisterAppRequestTO} encapsulate the app registration request + * The {@link AuthRegisterTO} encapsulate the app registration request * * @author Jan N. Klug - Initial contribution */ -public class RegisterAppRequestTO { +public class AuthRegisterTO { @SerializedName("requested_extensions") public List requestedExtensions = List.of("device_info", "customer_info"); - public CookiesTO cookies = new CookiesTO(); + public AuthRegisterCookiesTO cookies = new AuthRegisterCookiesTO(); @SerializedName("registration_data") - public RegistrationDataTO registrationData = new RegistrationDataTO(); + public AuthRegisterRegistrationTO registrationData = new AuthRegisterRegistrationTO(); @SerializedName("auth_data") - public AuthDataTO authData = new AuthDataTO(); + public AuthRegisterAuthTO authData = new AuthRegisterAuthTO(); @SerializedName("user_context_map") public Map userContextMap = Map.of(); @SerializedName("requested_token_type") @@ -39,7 +39,7 @@ public class RegisterAppRequestTO { @Override public @NonNull String toString() { - return "RegisterAppRequestTO{requestedExtensions=" + requestedExtensions + ", cookies=" + cookies + return "AuthRegisterTO{requestedExtensions=" + requestedExtensions + ", cookies=" + cookies + ", registrationData=" + registrationData + ", authData=" + authData + ", userContextMap=" + userContextMap + ", requestedTokenType=" + requestedTokenType + "}"; } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenResponseTO.java new file mode 100644 index 0000000000..f89e2b3191 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenResponseTO.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.request; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link ExchangeTokenResponseTO} encapsulates the response of an exchange token request + * + * @author Jan N. Klug - Initial contribution + */ +public class ExchangeTokenResponseTO { + public ExchangeTokenTokensTO tokens = new ExchangeTokenTokensTO(); + + @Override + public @NonNull String toString() { + return "ExchangeTokenResponseTO{tokens=" + tokens + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenTO.java new file mode 100644 index 0000000000..6f354c6b97 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenTO.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.request; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link ExchangeTokenTO} encapsulates an exchange token request + * + * @author Jan N. Klug - Initial contribution + */ +public class ExchangeTokenTO { + public ExchangeTokenResponseTO response = new ExchangeTokenResponseTO(); + + @Override + public @NonNull String toString() { + return "ExchangeTokenTO{response=" + response + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenTokensTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenTokensTO.java new file mode 100644 index 0000000000..505b0660d8 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/ExchangeTokenTokensTO.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.request; + +import org.eclipse.jdt.annotation.NonNull; +import org.smarthomej.binding.amazonechocontrol.internal.dto.CookieTO; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * The {@link ExchangeTokenTokensTO} encapsulates the token section of an exchange token request + * + * @author Jan N. Klug - Initial contribution + */ +public class ExchangeTokenTokensTO { + public Map> cookies = new HashMap<>(); + + @Override + public @NonNull String toString() { + return "ExchangeTokenTokensTO{cookies=" + cookies + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/StartRoutineTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/StartRoutineTO.java new file mode 100644 index 0000000000..50586ae8ab --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/request/StartRoutineTO.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.request; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link StartRoutineTO} encapsulate the request to start a routine + * + * @author Jan N. Klug - Initial contribution + */ +public class StartRoutineTO { + public String behaviorId = "PREVIEW"; + public String sequenceJson; + public String status = "ENABLED"; + + @Override + public @NonNull String toString() { + return "StartRoutineTO{behaviorId='" + behaviorId + "', sequenceJson='" + sequenceJson + "', status='" + status + "'}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AscendingAlarmModelResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AscendingAlarmModelsTO.java similarity index 69% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AscendingAlarmModelResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AscendingAlarmModelsTO.java index 9d5efd6d89..b5227735cf 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AscendingAlarmModelResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AscendingAlarmModelsTO.java @@ -16,18 +16,18 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNull; -import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmModelTO; /** - * The {@link AscendingAlarmModelResponseTO} encapsulates the response of the /api/ascending-alarm + * The {@link AscendingAlarmModelsTO} encapsulates the response of the /api/ascending-alarm * * @author Jan N. Klug - Initial contribution */ -public class AscendingAlarmModelResponseTO { - public List ascendingAlarmModelList = List.of(); +public class AscendingAlarmModelsTO { + public List ascendingAlarmModelList = List.of(); @Override public @NonNull String toString() { - return "AscendingAlarmModelResponseTO{ascendingAlarmModelList=" + ascendingAlarmModelList + "}"; + return "AscendingAlarmModelsTO{ascendingAlarmModelList=" + ascendingAlarmModelList + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BearerTokenTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterBearerTokenTO.java similarity index 75% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BearerTokenTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterBearerTokenTO.java index b30da69eb8..39bdae6923 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BearerTokenTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterBearerTokenTO.java @@ -17,11 +17,11 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link BearerTokenTO} encapsulates the bearer token information + * The {@link AuthRegisterBearerTokenTO} encapsulates the bearer token information * * @author Jan N. Klug - Initial contribution */ -public class BearerTokenTO { +public class AuthRegisterBearerTokenTO { @SerializedName("access_token") public String accessToken; @@ -33,7 +33,7 @@ public class BearerTokenTO { @Override public @NonNull String toString() { - return "BearerTO{accessToken='" + accessToken + "', refreshToken='" + refreshToken + "', expiresIn='" - + expiresIn + "'}"; + return "AuthRegisterBearerTO{accessToken='" + accessToken + "', refreshToken='" + refreshToken + + "', expiresIn='" + expiresIn + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerInfoTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterCustomerInfoTO.java similarity index 72% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerInfoTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterCustomerInfoTO.java index 68256f26c5..95ea265100 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerInfoTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterCustomerInfoTO.java @@ -17,11 +17,11 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link CustomerInfoTO} encapsulates the customer information of a registration response + * The {@link AuthRegisterCustomerInfoTO} encapsulates the customer information of a registration response * * @author Jan N. Klug - Initial contribution */ -public class CustomerInfoTO { +public class AuthRegisterCustomerInfoTO { @SerializedName("account_pool") public String accountPool; @SerializedName("user_id") @@ -34,7 +34,7 @@ public class CustomerInfoTO { @Override public @NonNull String toString() { - return "CustomerInfoTO{accountPool='" + accountPool + "', userId='" + userId + "', homeRegion='" + homeRegion - + "', name='" + name + "', givenName='" + givenName + "'}"; + return "AuthRegisterCustomerInfoTO{accountPool='" + accountPool + "', userId='" + userId + "', homeRegion='" + + homeRegion + "', name='" + name + "', givenName='" + givenName + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceInfoTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterDeviceInfoTO.java similarity index 78% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceInfoTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterDeviceInfoTO.java index c5713cda73..8e1a6ab109 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceInfoTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterDeviceInfoTO.java @@ -17,11 +17,11 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link DeviceInfoTO} encapsulates the device information of an app registration response + * The {@link AuthRegisterDeviceInfoTO} encapsulates the device information of an app registration response * * @author Jan N. Klug - Initial contribution */ -public class DeviceInfoTO { +public class AuthRegisterDeviceInfoTO { @SerializedName("device_name") public String deviceName = "Unknown"; @SerializedName("device_serial_number") @@ -31,7 +31,7 @@ public class DeviceInfoTO { @Override public @NonNull String toString() { - return "DeviceInfoTO{deviceName='" + deviceName + "', deviceSerialNumber='" + deviceSerialNumber + return "AuthRegisterDeviceInfoTO{deviceName='" + deviceName + "', deviceSerialNumber='" + deviceSerialNumber + "', deviceType='" + deviceType + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ExtensionsTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterExtensionsTO.java similarity index 64% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ExtensionsTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterExtensionsTO.java index 60e211330d..e3bae82a10 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ExtensionsTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterExtensionsTO.java @@ -18,21 +18,21 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link ExtensionsTO} encapsulates the extension part of an app registration response + * The {@link AuthRegisterExtensionsTO} encapsulates the extension part of an app registration response * * @author Jan N. Klug - Initial contribution */ -public class ExtensionsTO { +public class AuthRegisterExtensionsTO { @SerializedName("device_info") - public DeviceInfoTO deviceInfo = new DeviceInfoTO(); + public AuthRegisterDeviceInfoTO deviceInfo = new AuthRegisterDeviceInfoTO(); @SerializedName("customer_info") - public CustomerInfoTO customerInfo = new CustomerInfoTO(); + public AuthRegisterCustomerInfoTO customerInfo = new AuthRegisterCustomerInfoTO(); @SerializedName("customer_id") public @Nullable String customerId; @Override public @NonNull String toString() { - return "ExtensionsTO{deviceInfo=" + deviceInfo + ", customerInfo=" + customerInfo + ", customerId='" - + customerId + "'}"; + return "AuthRegisterExtensions" + "TO{deviceInfo=" + deviceInfo + ", customerInfo=" + customerInfo + + ", customerId='" + customerId + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MacDmsTokenTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterMacDmsTokenTO.java similarity index 78% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MacDmsTokenTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterMacDmsTokenTO.java index 5ffbe0cbcd..9b3b3fad21 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MacDmsTokenTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterMacDmsTokenTO.java @@ -17,11 +17,11 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link MacDmsTokenTO} encapsulates MAC dms tokens + * The {@link AuthRegisterMacDmsTokenTO} encapsulates MAC dms tokens * * @author Jan N. Klug - Initial contribution */ -public class MacDmsTokenTO { +public class AuthRegisterMacDmsTokenTO { @SerializedName("device_private_key") public String devicePrivateKey; @@ -30,6 +30,6 @@ public class MacDmsTokenTO { @Override public @NonNull String toString() { - return "MacDmsTokenTO{devicePrivateKey='" + devicePrivateKey + "', adpToken='" + adpToken + "'}"; + return "AuthRegisterMacDmsTokenTO{devicePrivateKey='" + devicePrivateKey + "', adpToken='" + adpToken + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterResponseTO.java new file mode 100644 index 0000000000..7595b88c4b --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterResponseTO.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link AuthRegisterResponseTO} encapsulates the internal response section of an app registration response + * + * @author Jan N. Klug - Initial contribution + */ +public class AuthRegisterResponseTO { + public AuthRegisterSuccessTO success = new AuthRegisterSuccessTO(); + + @Override + public @NonNull String toString() { + return "AuthRegisterResponseTO{success=" + success + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/SuccessTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterSuccessTO.java similarity index 63% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/SuccessTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterSuccessTO.java index 8deae5d5b7..6962cbf6fb 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/SuccessTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterSuccessTO.java @@ -17,18 +17,19 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link SuccessTO} encapsulates the success section of an app registration response + * The {@link AuthRegisterSuccessTO} encapsulates the success section of an app registration response * * @author Jan N. Klug - Initial contribution */ -public class SuccessTO { - public ExtensionsTO extensions = new ExtensionsTO(); - public TokensTO tokens = new TokensTO(); +public class AuthRegisterSuccessTO { + public AuthRegisterExtensionsTO extensions = new AuthRegisterExtensionsTO(); + public AuthRegisterTokensTO tokens = new AuthRegisterTokensTO(); @SerializedName("customer_id") public String customerId; @Override public @NonNull String toString() { - return "SuccessTO{extensions=" + extensions + ", tokens=" + tokens + ", customerId='" + customerId + "'}"; + return "AuthRegisterSuccessTO{extensions=" + extensions + ", tokens=" + tokens + ", customerId='" + customerId + + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/RegisterAppResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterTO.java similarity index 73% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/RegisterAppResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterTO.java index d72e9362ac..6fb4b54b98 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/RegisterAppResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterTO.java @@ -17,17 +17,17 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link RegisterAppResponseTO} encapsulate an app registration response + * The {@link AuthRegisterTO} encapsulate an app registration response * * @author Jan N. Klug - Initial contribution */ -public class RegisterAppResponseTO { +public class AuthRegisterTO { @SerializedName("request_id") public String requestId; - public ResponseTO response = new ResponseTO(); + public AuthRegisterResponseTO response = new AuthRegisterResponseTO(); @Override public @NonNull String toString() { - return "RegisterAppResponseTO{requestId='" + requestId + "', response=" + response + "}"; + return "AuthRegister{requestId='" + requestId + "', response=" + response + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/TokensTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterTokensTO.java similarity index 56% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/TokensTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterTokensTO.java index f198cfdfbb..a49bc0d3a1 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/TokensTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthRegisterTokensTO.java @@ -12,25 +12,28 @@ */ package org.smarthomej.binding.amazonechocontrol.internal.dto.response; +import java.util.List; + import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; import com.google.gson.annotations.SerializedName; +import org.smarthomej.binding.amazonechocontrol.internal.dto.CookieTO; /** - * The {@link TokensTO} encapsulates all tokens for a connection registration response + * The {@link AuthRegisterTokensTO} encapsulates all tokens for a connection registration response * * @author Jan N. Klug - Initial contribution */ -public class TokensTO { +public class AuthRegisterTokensTO { @SerializedName("website_cookies") - public @Nullable Object websiteCookies; + public List websiteCookies = List.of(); @SerializedName("mac_dms") - public MacDmsTokenTO macDms = new MacDmsTokenTO(); - public BearerTokenTO bearer = new BearerTokenTO(); + public AuthRegisterMacDmsTokenTO macDms = new AuthRegisterMacDmsTokenTO(); + public AuthRegisterBearerTokenTO bearer = new AuthRegisterBearerTokenTO(); @Override public @NonNull String toString() { - return "TokensTO{websiteCookies=" + websiteCookies + ", macDms=" + macDms + ", bearer=" + bearer + "}"; + return "AuthRegisterTokensTO{websiteCookies=" + websiteCookies + ", macDms=" + macDms + ", bearer=" + bearer + + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthTokenResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthTokenTO.java similarity index 76% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthTokenResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthTokenTO.java index 3bc037843a..56b06af387 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthTokenResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthTokenTO.java @@ -17,11 +17,11 @@ import com.google.gson.annotations.SerializedName; /** - * The {@link AuthTokenResponseTO} encapsulates the response of a request to /auth/token + * The {@link AuthTokenTO} encapsulates the response of a request to /auth/token * * @author Jan N. Klug - Initial contribution */ -public class AuthTokenResponseTO { +public class AuthTokenTO { @SerializedName("access_token") public String accessToken; @SerializedName("token_type") @@ -31,7 +31,7 @@ public class AuthTokenResponseTO { @Override public @NonNull String toString() { - return "AuthTokenResponseTO{accessToken='" + accessToken + "', tokenType='" + tokenType + "', expiresIn=" - + expiresIn + "}"; + return "AuthTokenTO{accessToken='" + accessToken + "', tokenType='" + tokenType + "', expiresIn=" + expiresIn + + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BluetoothStateResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BluetoothStatesTO.java similarity index 77% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BluetoothStateResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BluetoothStatesTO.java index 4d7211a2c2..77167c9206 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BluetoothStateResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BluetoothStatesTO.java @@ -17,15 +17,15 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link BluetoothStateResponseTO} encapsulate the response of /api/bluetooth + * The {@link BluetoothStatesTO} encapsulate the response of /api/bluetooth * * @author Jan N. Klug - Initial contribution */ -public class BluetoothStateResponseTO { +public class BluetoothStatesTO { public List bluetoothStates = List.of(); @Override public @NonNull String toString() { - return "BluetoothStateResponseTO{bluetoothStates=" + bluetoothStates + "}"; + return "BluetoothStatesTO{bluetoothStates=" + bluetoothStates + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthenticationTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapAuthenticationTO.java similarity index 75% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthenticationTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapAuthenticationTO.java index 02c2b1d231..0a4f2e4d97 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/AuthenticationTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapAuthenticationTO.java @@ -15,20 +15,20 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link AuthenticationTO} encapsulates the authentication information of a bootstrap response + * The {@link BootstrapAuthenticationTO} encapsulates the authentication information of a bootstrap response * * @author Jan N. Klug - Initial contribution */ -public class AuthenticationTO { +public class BootstrapAuthenticationTO { public boolean authenticated; - public Boolean canAccessPrimeMusicContent; + public boolean canAccessPrimeMusicContent; public String customerEmail; public String customerId; public String customerName; @Override public @NonNull String toString() { - return "AuthenticationTO{authenticated=" + authenticated + ", canAccessPrimeMusicContent=" + return "BootstrapAuthenticationTO{authenticated=" + authenticated + ", canAccessPrimeMusicContent=" + canAccessPrimeMusicContent + ", customerEmail='" + customerEmail + "', customerId='" + customerId + "', customerName='" + customerName + "'}"; } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapTO.java similarity index 73% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapTO.java index 2d6f6ee477..4cba1f9a9c 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapTO.java @@ -15,15 +15,15 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link ResponseTO} encapsulates the internal response section of an app registration response + * The {@link BootstrapTO} encapsulate the response of a boostrap request * * @author Jan N. Klug - Initial contribution */ -public class ResponseTO { - public SuccessTO success = new SuccessTO(); +public class BootstrapTO { + public BootstrapAuthenticationTO authentication; @Override public @NonNull String toString() { - return "ResponseTO{success=" + success + "}"; + return "BootstrapTO{authentication=" + authentication + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordTO.java index c5a35cd0af..18703a5f25 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordTO.java @@ -14,8 +14,10 @@ import java.util.List; +import org.eclipse.jdt.annotation.NonNull; + /** - * The {@link CustomerHistoryRecordTO} is + * The {@link CustomerHistoryRecordTO} encapsulates * * @author Jan N. Klug - Initial contribution */ @@ -25,12 +27,21 @@ public class CustomerHistoryRecordTO { public long timestamp; public String customerId; public Object device; - public Boolean isBinaryFeedbackProvided; - public Boolean isFeedbackPositive; + public boolean isBinaryFeedbackProvided; + public boolean isFeedbackPositive; public String utteranceType; public String domain; public String intent; public String skillName; - public List voiceHistoryRecordItems = List.of(); + public List voiceHistoryRecordItems = List.of(); public List personsInfo = List.of(); + + @Override + public @NonNull String toString() { + return "CustomerHistoryRecordTO{recordKey='" + recordKey + "', recordType='" + recordType + "', timestamp=" + + timestamp + ", customerId='" + customerId + "', device=" + device + ", isBinaryFeedbackProvided=" + + isBinaryFeedbackProvided + ", isFeedbackPositive=" + isFeedbackPositive + ", utteranceType='" + + utteranceType + "', domain='" + domain + "', intent='" + intent + "', skillName='" + skillName + + "', voiceHistoryRecordItems=" + voiceHistoryRecordItems + ", personsInfo=" + personsInfo + "}"; + } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/VoiceHistoryRecordItemTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordVoiceTO.java similarity index 80% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/VoiceHistoryRecordItemTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordVoiceTO.java index 9540704a8c..28d686fb4d 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/VoiceHistoryRecordItemTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordVoiceTO.java @@ -17,11 +17,11 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link VoiceHistoryRecordItemTO} encapsulates a voice history record of a customer history + * The {@link CustomerHistoryRecordVoiceTO} encapsulates a voice history record of a customer history * * @author Jan N. Klug - Initial contribution */ -public class VoiceHistoryRecordItemTO { +public class CustomerHistoryRecordVoiceTO { public String recordItemKey; public String recordItemType; public String utteranceId; @@ -32,7 +32,7 @@ public class VoiceHistoryRecordItemTO { @Override public @NonNull String toString() { - return "VoiceHistoryRecordItemTO{recordItemKey='" + recordItemKey + "', recordItemType='" + recordItemType + return "CustomerHistoryRecordVoiceTO{recordItemKey='" + recordItemKey + "', recordItemType='" + recordItemType + "', utteranceId='" + utteranceId + "', timestamp=" + timestamp + ", transcriptText='" + transcriptText + "', agentVisualName='" + agentVisualName + "', personsInfo=" + personsInfo + "}"; } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordsTO.java similarity index 73% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordsTO.java index e8b47468e2..89ee2e9c8d 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/CustomerHistoryRecordsTO.java @@ -17,15 +17,15 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link CustomerHistoryRecordResponseTO} encapsulate the response for customer history record requests + * The {@link CustomerHistoryRecordsTO} encapsulate the response for customer history record requests * * @author Jan N. Klug - Initial contribution */ -public class CustomerHistoryRecordResponseTO { +public class CustomerHistoryRecordsTO { public List customerHistoryRecords = List.of(); @Override public @NonNull String toString() { - return "CustomerHistoryRecordResponseTO{customerHistoryRecords=" + customerHistoryRecords + "}"; + return "CustomerHistoryRecordsTO{customerHistoryRecords=" + customerHistoryRecords + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceListResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceListTO.java similarity index 80% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceListResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceListTO.java index 735f3eb5a1..f915312581 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceListResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceListTO.java @@ -18,15 +18,15 @@ import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceTO; /** - * The {@link DeviceListResponseTO} encapsulate the response of /api/devices-v2 + * The {@link DeviceListTO} encapsulate the response of /api/devices-v2 * * @author Jan N. Klug - Initial contribution */ -public class DeviceListResponseTO { +public class DeviceListTO { public List devices = List.of(); @Override public @NonNull String toString() { - return "DeviceListResponseTO{devices=" + devices + "}"; + return "DeviceListTO{devices=" + devices + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceNotificationStateResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceNotificationStatesTO.java similarity index 77% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceNotificationStateResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceNotificationStatesTO.java index affee995e7..fbf8067749 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceNotificationStateResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DeviceNotificationStatesTO.java @@ -20,16 +20,16 @@ import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceNotificationStateTO; /** - * The {@link DeviceNotificationStateResponseTO} encapsulate the response of the /api/device-notification-state + * The {@link DeviceNotificationStatesTO} encapsulate the response of the /api/device-notification-state * * @author Jan N. Klug - Initial contribution */ @NonNullByDefault -public class DeviceNotificationStateResponseTO { +public class DeviceNotificationStatesTO { public List deviceNotificationStates = List.of(); @Override public @NonNull String toString() { - return "DeviceNotificationStateResponseTO{deviceNotificationStates=" + deviceNotificationStates + "}"; + return "DeviceNotificationStatesTO{deviceNotificationStates=" + deviceNotificationStates + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DoNotDisturbDeviceStatusResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DoNotDisturbDeviceStatusesTO.java similarity index 76% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DoNotDisturbDeviceStatusResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DoNotDisturbDeviceStatusesTO.java index 9208a9c50a..96ba844140 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DoNotDisturbDeviceStatusResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/DoNotDisturbDeviceStatusesTO.java @@ -19,15 +19,15 @@ import org.smarthomej.binding.amazonechocontrol.internal.dto.DoNotDisturbDeviceStatusTO; /** - * The {@link DoNotDisturbDeviceStatusResponseTO} encapsulate the response of /api/dnd/device-status-list + * The {@link DoNotDisturbDeviceStatusesTO} encapsulate the response of /api/dnd/device-status-list * * @author Jan N. Klug - Initial contribution */ -public class DoNotDisturbDeviceStatusResponseTO { +public class DoNotDisturbDeviceStatusesTO { public List doNotDisturbDeviceStatusList = List.of(); @Override public @NonNull String toString() { - return "DoNotDisturbDeviceStatusResponseTO{doNotDisturbDeviceStatusList=" + doNotDisturbDeviceStatusList + "}"; + return "DoNotDisturbDeviceStatusesTO{doNotDisturbDeviceStatusList=" + doNotDisturbDeviceStatusList + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/EndpointResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/EndpointTO.java similarity index 58% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/EndpointResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/EndpointTO.java index 47c0b9f76e..01dd74eac9 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/EndpointResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/EndpointTO.java @@ -12,12 +12,14 @@ */ package org.smarthomej.binding.amazonechocontrol.internal.dto.response; +import org.eclipse.jdt.annotation.NonNull; + /** - * The {@link DoNotDisturbDeviceStatusResponseTO} encapsulate the response of /api/endpoints + * The {@link DoNotDisturbDeviceStatusesTO} encapsulate the response of /api/endpoints * * @author Jan N. Klug - Initial contribution */ -public class EndpointResponseTO { +public class EndpointTO { public String alexaApiUrl; public String awsRegion; public String retailDomain; @@ -25,4 +27,11 @@ public class EndpointResponseTO { public String skillsStoreUrl; public String websiteApiUrl; public String websiteUrl; + + @Override + public @NonNull String toString() { + return "EndpointTO{alexaApiUrl='" + alexaApiUrl + "', awsRegion='" + awsRegion + "', retailDomain='" + + retailDomain + "', retailUrl='" + retailUrl + "', skillsStoreUrl='" + skillsStoreUrl + + "', websiteApiUrl='" + websiteApiUrl + "', websiteUrl='" + websiteUrl + "'}"; + } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ProviderDataTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderDataTO.java similarity index 77% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ProviderDataTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderDataTO.java index bcf6e100ae..4f86bef774 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/ProviderDataTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderDataTO.java @@ -15,17 +15,17 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link ProviderDataTO} encapsulates music provider metadata + * The {@link MusicProviderDataTO} encapsulates music provider metadata * * @author Jan N. Klug - Initial contribution */ -public class ProviderDataTO { +public class MusicProviderDataTO { public boolean isDefaultMusicProvider; public boolean isDefaultStationProvider; @Override public @NonNull String toString() { - return "ProviderDataTO{isDefaultMusicProvider=" + isDefaultMusicProvider + ", isDefaultStationProvider=" + return "MusicProviderDataTO{isDefaultMusicProvider=" + isDefaultMusicProvider + ", isDefaultStationProvider=" + isDefaultStationProvider + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderTO.java index 7f804480e1..535bb49ef3 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/MusicProviderTO.java @@ -30,7 +30,7 @@ public class MusicProviderTO { public List supportedOperations = List.of(); public String availability; public String icon; - public ProviderDataTO providerData = new ProviderDataTO(); + public MusicProviderDataTO providerData = new MusicProviderDataTO(); @Override public @NonNull String toString() { diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateInfoTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateInfoTO.java new file mode 100644 index 0000000000..4a0477a262 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateInfoTO.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link PlayerStateInfoTO} encapsulates the information about a player + * + * @author Jan N. Klug - Initial contribution + */ +public class PlayerStateInfoTO { + public String queueId; + public String mediaId; + public String state; + public PlayerStateInfoTextTO infoText = new PlayerStateInfoTextTO(); + public PlayerStateInfoTextTO miniInfoText = new PlayerStateInfoTextTO(); + public PlayerStateProviderTO provider = new PlayerStateProviderTO(); + public PlayerStateVolumeTO volume = new PlayerStateVolumeTO(); + public PlayerStateMainArtTO mainArt = new PlayerStateMainArtTO(); + public PlayerStateProgressTO progress = new PlayerStateProgressTO(); + + @Override + public @NonNull String toString() { + return "PlayerStateInfoTO{queueId='" + queueId + "', mediaId='" + mediaId + "', state='" + state + + "', infoText=" + infoText + ", miniInfoText=" + miniInfoText + ", provider=" + provider + ", volume=" + + volume + ", mainArt=" + mainArt + ", progress=" + progress + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateInfoTextTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateInfoTextTO.java new file mode 100644 index 0000000000..0e258c4b65 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateInfoTextTO.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link PlayerStateInfoTextTO} encapsulates the info text section of a player info + * + * @author Jan N. Klug - Initial contribution + */ +public class PlayerStateInfoTextTO { + public boolean multiLineMode; + public String subText1; + public String subText2; + public String title; + + @Override + public @NonNull String toString() { + return "PlayerStateInfoTextTO{multiLineMode=" + multiLineMode + ", subText1='" + subText1 + "', subText2='" + + subText2 + "', title='" + title + "'}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateMainArtTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateMainArtTO.java new file mode 100644 index 0000000000..284371396d --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateMainArtTO.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link PlayerStateMainArtTO} encapsulates the art section of a player info + * + * @author Jan N. Klug - Initial contribution + */ +public class PlayerStateMainArtTO { + public String altText; + public String artType; + public String contentType; + public String url; + + @Override + public @NonNull String toString() { + return "PlayerStateMainArtTO{altText='" + altText + "', artType='" + artType + "', contentType='" + contentType + + "', url='" + url + "'}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateProgressTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateProgressTO.java new file mode 100644 index 0000000000..223feed219 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateProgressTO.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link PlayerStateProgressTO} encapsulates the progress section of a player info + * + * @author Jan N. Klug - Initial contribution + */ +public class PlayerStateProgressTO { + public boolean allowScrubbing; + public Object locationInfo; + public long mediaLength; + public long mediaProgress; + public boolean showTiming; + public boolean visible; + + @Override + public @NonNull String toString() { + return "PlayerStateProgressTO{allowScrubbing=" + allowScrubbing + ", locationInfo=" + locationInfo + + ", mediaLength=" + mediaLength + ", mediaProgress=" + mediaProgress + ", showTiming=" + showTiming + + ", visible=" + visible + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateProviderTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateProviderTO.java new file mode 100644 index 0000000000..6fd4bdeea3 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateProviderTO.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link PlayerStateProviderTO} encapsulates the provider section of a player info + * + * @author Jan N. Klug - Initial contribution + */ +public class PlayerStateProviderTO { + public String providerDisplayName; + public String providerName; + + @Override + public @NonNull String toString() { + return "PlayerStateProviderTO{providerDisplayName='" + providerDisplayName + "', providerName='" + providerName + + "'}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateTO.java similarity index 71% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateTO.java index 8c7b60ff70..6ef8d41f85 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/BootstrapResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateTO.java @@ -15,15 +15,15 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link BootstrapResponseTO} encapsulate the response of a boostrap request + * The {@link PlayerStateTO} encapsulate the response of a request to /api/np/player * * @author Jan N. Klug - Initial contribution */ -public class BootstrapResponseTO { - public AuthenticationTO authentication; +public class PlayerStateTO { + public PlayerStateInfoTO playerInfo = new PlayerStateInfoTO(); @Override public @NonNull String toString() { - return "BootstrapResponseTO{authentication=" + authentication + "}"; + return "PlayerStateTO{playerInfo=" + playerInfo + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateVolumeTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateVolumeTO.java new file mode 100644 index 0000000000..11c6e84ba4 --- /dev/null +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/PlayerStateVolumeTO.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2021-2023 Contributors to the SmartHome/J project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.smarthomej.binding.amazonechocontrol.internal.dto.response; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * The {@link PlayerStateVolumeTO} encapsulates the volume part of a player info + * + * @author Jan N. Klug - Initial contribution + */ +public class PlayerStateVolumeTO { + public boolean muted; + public int volume; + + @Override + public @NonNull String toString() { + return "PlayerStateVolumeTO{muted=" + muted + ", volume=" + volume + "}"; + } +} diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/UsersMeResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/UsersMeTO.java similarity index 86% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/UsersMeResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/UsersMeTO.java index 426e5c0f0a..25ba96e3a0 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/UsersMeResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/UsersMeTO.java @@ -18,11 +18,11 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link UsersMeResponseTO} encapsulate the response of /api/users/me + * The {@link UsersMeTO} encapsulate the response of /api/users/me * * @author Michael Geramb - Initial contribution */ -public class UsersMeResponseTO { +public class UsersMeTO { public String countryOfResidence; public String effectiveMarketPlaceId; public String email; @@ -37,10 +37,10 @@ public class UsersMeResponseTO { @Override public @NonNull String toString() { - return "UsersMeResponseTO{countryOfResidence='" + countryOfResidence + "', effectiveMarketPlaceId='" + return "UsersMeTO{countryOfResidence='" + countryOfResidence + "', effectiveMarketPlaceId='" + effectiveMarketPlaceId + "', email='" + email + "', eulaAcceptance=" + eulaAcceptance + ", features=" + features + ", fullName='" + fullName + "'" + ", hasActiveDopplers=" + hasActiveDopplers + ", id='" + id + "', marketPlaceDomainName='" + marketPlaceDomainName + "', marketPlaceId='" + marketPlaceId - + "', marketPlaceLocale='" + marketPlaceLocale + "'" + "}"; + + "', marketPlaceLocale='" + marketPlaceLocale + "'}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/WakeWordResponseTO.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/WakeWordsTO.java similarity index 78% rename from bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/WakeWordResponseTO.java rename to bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/WakeWordsTO.java index ba5b31de9a..64ab3be28f 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/WakeWordResponseTO.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/dto/response/WakeWordsTO.java @@ -17,15 +17,15 @@ import org.eclipse.jdt.annotation.NonNull; /** - * The {@link WakeWordResponseTO} encapsulate the response of a request to /api/wake-word + * The {@link WakeWordsTO} encapsulate the response of a request to /api/wake-word * * @author Michael Geramb - Initial contribution */ -public class WakeWordResponseTO { +public class WakeWordsTO { public List wakeWords = List.of(); @Override public @NonNull String toString() { - return "WakeWordResponseTO{wakeWords=" + wakeWords + "}"; + return "WakeWords{wakeWords=" + wakeWords + "}"; } } diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/AccountHandler.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/AccountHandler.java index 5d4350a904..ec510f4aaf 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/AccountHandler.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/AccountHandler.java @@ -63,11 +63,11 @@ import org.smarthomej.binding.amazonechocontrol.internal.connection.Connection; import org.smarthomej.binding.amazonechocontrol.internal.discovery.AmazonEchoDiscovery; import org.smarthomej.binding.amazonechocontrol.internal.discovery.SmartHomeDevicesDiscovery; -import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmModelTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceNotificationStateTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DoNotDisturbDeviceStatusTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.FeedTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.EnabledFeedTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlaylists; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationSoundTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationTO; @@ -75,8 +75,8 @@ import org.smarthomej.binding.amazonechocontrol.internal.dto.push.PushDeviceTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.push.PushDopplerIdTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.push.PushNotificationChangeTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStateResponseTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStateTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStatesTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.CustomerHistoryRecordTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.MusicProviderTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.WakeWordTO; @@ -156,7 +156,7 @@ public void initialize() { if (accountServlet == null) { try { - accountServlet = new AccountServlet(httpService, this.getThing().getUID().getId(), this, gson); + accountServlet = new AccountServlet(httpService, this.getThing().getUID().getId(), this); } catch (IllegalStateException e) { logger.warn("Failed to create account servlet", e); } @@ -494,9 +494,9 @@ private void refreshData() { updateFlashBriefingHandlers(); List deviceNotificationStates = List.of(); - List ascendingAlarmModels = List.of(); + List ascendingAlarmModels = List.of(); List doNotDisturbDeviceStatuses = List.of(); - BluetoothStateResponseTO states = null; + BluetoothStatesTO states = null; List musicProviders = null; if (currentConnection.isLoggedIn()) { // update notification states @@ -548,7 +548,7 @@ private void refreshData() { } DeviceNotificationStateTO deviceNotificationState = null; - AscendingAlarmTO ascendingAlarmModel = null; + AscendingAlarmModelTO ascendingAlarmModel = null; DoNotDisturbDeviceStatusTO doNotDisturbDeviceStatus = null; if (device != null) { final String serialNumber = device.serialNumber; @@ -639,7 +639,7 @@ public List updateDeviceList() { public void setEnabledFlashBriefingsJson(String flashBriefingJson) { Connection currentConnection = connection; - FeedTO[] feeds = gson.fromJson(flashBriefingJson, FeedTO[].class); + EnabledFeedTO[] feeds = gson.fromJson(flashBriefingJson, EnabledFeedTO[].class); if (currentConnection != null && feeds != null) { try { currentConnection.setEnabledFlashBriefings(Arrays.asList(feeds)); @@ -687,12 +687,12 @@ public String getEnabledFlashBriefingsJson() { private void updateFlashBriefingProfiles(Connection currentConnection) { // Make a copy and remove changeable parts - List forSerializer = currentConnection.getEnabledFlashBriefings().stream().map(this::copyFeed).toList(); + List forSerializer = currentConnection.getEnabledFlashBriefings().stream().map(this::copyFeed).toList(); this.currentFlashBriefingJson = gson.toJson(forSerializer); } - private FeedTO copyFeed(FeedTO feed) { - FeedTO newFeed = new FeedTO(); + private EnabledFeedTO copyFeed(EnabledFeedTO feed) { + EnabledFeedTO newFeed = new EnabledFeedTO(); newFeed.feedId = feed.feedId; newFeed.skillId = feed.skillId; return newFeed; diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/EchoHandler.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/EchoHandler.java index b875f0ec2d..8b7375da16 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/EchoHandler.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/handler/EchoHandler.java @@ -66,7 +66,7 @@ import org.smarthomej.binding.amazonechocontrol.internal.channelhandler.ChannelHandler; import org.smarthomej.binding.amazonechocontrol.internal.channelhandler.ChannelHandlerAnnouncement; import org.smarthomej.binding.amazonechocontrol.internal.connection.Connection; -import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.AscendingAlarmModelTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.BluetoothPairedDeviceTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceNotificationStateTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.DeviceTO; @@ -74,13 +74,6 @@ import org.smarthomej.binding.amazonechocontrol.internal.dto.EqualizerTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonMediaState; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonMediaState.QueueEntry; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState.PlayerInfo; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState.PlayerInfo.InfoText; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState.PlayerInfo.MainArt; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState.PlayerInfo.Progress; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState.PlayerInfo.Provider; -import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlayerState.PlayerInfo.Volume; import org.smarthomej.binding.amazonechocontrol.internal.dto.JsonPlaylists; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationSoundTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.NotificationTO; @@ -88,11 +81,18 @@ import org.smarthomej.binding.amazonechocontrol.internal.dto.push.PushVolumeChangeTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.request.PlayerSeekMediaTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.request.WHAVolumeLevelTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStateResponseTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStateTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.BluetoothStatesTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.CustomerHistoryRecordTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.CustomerHistoryRecordVoiceTO; import org.smarthomej.binding.amazonechocontrol.internal.dto.response.MusicProviderTO; -import org.smarthomej.binding.amazonechocontrol.internal.dto.response.VoiceHistoryRecordItemTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateInfoTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateInfoTextTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateMainArtTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateProgressTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateProviderTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateTO; +import org.smarthomej.binding.amazonechocontrol.internal.dto.response.PlayerStateVolumeTO; import org.smarthomej.commons.SimpleDynamicCommandDescriptionProvider; import org.smarthomej.commons.SimpleDynamicStateDescriptionProvider; import org.smarthomej.commons.UpdatingBaseThingHandler; @@ -633,7 +633,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { this.disableUpdate = false; BluetoothStateTO state = null; if (bluetoothRefresh) { - BluetoothStateResponseTO bluetoothStateResponseTO = connection.getBluetoothConnectionStates(); + BluetoothStatesTO bluetoothStateResponseTO = connection.getBluetoothConnectionStates(); state = bluetoothStateResponseTO.bluetoothStates.stream() .filter(state1 -> Objects.equals(state1.deviceSerialNumber, device.serialNumber)).findAny() .orElse(null); @@ -852,7 +852,7 @@ private void createBluetoothMACStateDescription(BluetoothStateTO bluetoothState) public void updateState(AccountHandler accountHandler, @Nullable DeviceTO device, @Nullable BluetoothStateTO bluetoothState, @Nullable DeviceNotificationStateTO deviceNotificationState, - @Nullable AscendingAlarmTO ascendingAlarmModel, + @Nullable AscendingAlarmModelTO ascendingAlarmModel, @Nullable DoNotDisturbDeviceStatusTO doNotDisturbDeviceStatus, @Nullable JsonPlaylists playlists, @Nullable List alarmSounds, @Nullable List musicProviders) { try { @@ -899,14 +899,14 @@ public void updateState(AccountHandler accountHandler, @Nullable DeviceTO device updateEqualizerState(); } - PlayerInfo playerInfo = null; - Provider provider = null; - InfoText infoText = null; - MainArt mainArt = null; + PlayerStateInfoTO playerInfo = null; + PlayerStateProviderTO provider = null; + PlayerStateInfoTextTO infoText = null; + PlayerStateMainArtTO mainArt = null; String musicProviderId = null; - Progress progress = null; + PlayerStateProgressTO progress = null; try { - JsonPlayerState playerState = connection.getPlayer(device); + PlayerStateTO playerState = connection.getPlayer(device); playerInfo = playerState.playerInfo; if (playerInfo != null) { infoText = playerInfo.infoText; @@ -1098,7 +1098,7 @@ public void updateState(AccountHandler accountHandler, @Nullable DeviceTO device volume = mediaState.volume; } if (playerInfo != null && volume == null) { - Volume volumnInfo = playerInfo.volume; + PlayerStateVolumeTO volumnInfo = playerInfo.volume; if (volumnInfo != null) { volume = volumnInfo.volume; } @@ -1227,8 +1227,8 @@ public synchronized void handlePushActivity(CustomerHistoryRecordTO customerHist return; } lastCustomerHistoryRecordTimestamp = recordTimestamp; - List voiceHistoryRecordItems = customerHistoryRecord.voiceHistoryRecordItems; - for (VoiceHistoryRecordItemTO voiceHistoryRecordItem : voiceHistoryRecordItems) { + List voiceHistoryRecordItems = customerHistoryRecord.voiceHistoryRecordItems; + for (CustomerHistoryRecordVoiceTO voiceHistoryRecordItem : voiceHistoryRecordItems) { String recordItemType = voiceHistoryRecordItem.recordItemType; if ("CUSTOMER_TRANSCRIPT".equals(recordItemType) || "ASR_REPLACEMENT_TEXT".equals(recordItemType)) { String customerTranscript = voiceHistoryRecordItem.transcriptText;