]> git.basschouten.com Git - openhab-addons.git/blob
9bbae05dc630cdb8def016b75276db7f77db1970
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * The {@link JsonRegisterAppRequest} encapsulate the GSON data of register application request
22  *
23  * @author Michael Geramb - Initial contribution
24  */
25 @NonNullByDefault
26 public class JsonRegisterAppRequest {
27
28     public JsonRegisterAppRequest(String serial, @Nullable String accessToken, String frc,
29             JsonWebSiteCookie[] webSiteCookies) {
30         registrationData.deviceSerial = serial;
31         authData.accessToken = accessToken;
32         userContextMap.frc = frc;
33         cookies.webSiteCookies = webSiteCookies;
34     }
35
36     @SerializedName("requested_extensions")
37     public String[] requestedExtensions = { "device_info", "customer_info" };
38
39     public Cookies cookies = new Cookies();
40     @SerializedName("registration_data")
41     public RegistrationData registrationData = new RegistrationData();
42     @SerializedName("auth_data")
43     public AuthData authData = new AuthData();
44     @SerializedName("user_context_map")
45     public UserContextMap userContextMap = new UserContextMap();
46     @SerializedName("requested_token_type")
47     public String[] requestedTokenType = { "bearer", "mac_dms", "website_cookies" };
48
49     public static class Cookies {
50         @SerializedName("website_cookies")
51         public @Nullable JsonWebSiteCookie @Nullable [] webSiteCookies;
52         public @Nullable String domain = ".amazon.com";
53     }
54
55     public static class RegistrationData {
56         public String domain = "Device";
57         @SerializedName("app_version")
58         public String appVersion = "2.2.223830.0";
59         @SerializedName("device_type")
60         public String deviceType = "A2IVLV5VM2W81";
61         @SerializedName("device_name")
62         public String deviceName = "%FIRST_NAME%'s%DUPE_STRATEGY_1ST%openHAB Alexa Binding";
63         @SerializedName("os_version")
64         public String osVersion = "11.4.1";
65         @SerializedName("device_serial")
66         public @Nullable String deviceSerial;
67         @SerializedName("device_model")
68         public String deviceModel = "iPhone";
69         @SerializedName("app_name")
70         public String appName = "openHAB Alexa Binding";
71         @SerializedName("software_version")
72         public String softwareVersion = "1";
73     }
74
75     public static class AuthData {
76         @SerializedName("access_token")
77         public @Nullable String accessToken;
78     }
79
80     public static class UserContextMap {
81         public String frc = "";
82     }
83 }