]> git.basschouten.com Git - openhab-addons.git/blob
f32628e0734aac54caffd8b37ffcbc2082f45953
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.amazonechocontrol.internal.jsons;
14
15 import java.util.List;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 import com.google.gson.annotations.SerializedName;
21
22 /**
23  * The {@link JsonRegisterAppRequest} encapsulate the GSON data of register application request
24  *
25  * @author Michael Geramb - Initial contribution
26  */
27 @NonNullByDefault
28 public class JsonRegisterAppRequest {
29
30     public JsonRegisterAppRequest(String serial, @Nullable String accessToken, String frc,
31             List<JsonWebSiteCookie> webSiteCookies) {
32         registrationData.deviceSerial = serial;
33         authData.accessToken = accessToken;
34         userContextMap.frc = frc;
35         cookies.webSiteCookies = webSiteCookies;
36     }
37
38     @SerializedName("requested_extensions")
39     public String[] requestedExtensions = { "device_info", "customer_info" };
40
41     public Cookies cookies = new Cookies();
42     @SerializedName("registration_data")
43     public RegistrationData registrationData = new RegistrationData();
44     @SerializedName("auth_data")
45     public AuthData authData = new AuthData();
46     @SerializedName("user_context_map")
47     public UserContextMap userContextMap = new UserContextMap();
48     @SerializedName("requested_token_type")
49     public String[] requestedTokenType = { "bearer", "mac_dms", "website_cookies" };
50
51     public static class Cookies {
52         @SerializedName("website_cookies")
53         public List<JsonWebSiteCookie> webSiteCookies = List.of();
54         public @Nullable String domain = ".amazon.com";
55     }
56
57     public static class RegistrationData {
58         public String domain = "Device";
59         @SerializedName("app_version")
60         public String appVersion = "2.2.223830.0";
61         @SerializedName("device_type")
62         public String deviceType = "A2IVLV5VM2W81";
63         @SerializedName("device_name")
64         public String deviceName = "%FIRST_NAME%'s%DUPE_STRATEGY_1ST%openHAB Alexa Binding";
65         @SerializedName("os_version")
66         public String osVersion = "11.4.1";
67         @SerializedName("device_serial")
68         public @Nullable String deviceSerial;
69         @SerializedName("device_model")
70         public String deviceModel = "iPhone";
71         @SerializedName("app_name")
72         public String appName = "openHAB Alexa Binding";
73         @SerializedName("software_version")
74         public String softwareVersion = "1";
75     }
76
77     public static class AuthData {
78         @SerializedName("access_token")
79         public @Nullable String accessToken;
80     }
81
82     public static class UserContextMap {
83         public String frc = "";
84     }
85 }