]> git.basschouten.com Git - openhab-addons.git/blob
71230d521a44e4e18fa281842859c89281507e34
[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.netatmo.internal.config;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@link ApiHandlerConfiguration} is responsible for holding configuration
19  * information needed to access Netatmo API and general binding behavior setup
20  *
21  * @author GaĆ«l L'hopital - Initial contribution
22  */
23 @NonNullByDefault
24 public class ApiHandlerConfiguration {
25     public static final String CLIENT_ID = "clientId";
26
27     public String clientId = "";
28     public String clientSecret = "";
29     public String webHookUrl = "";
30     public String webHookPostfix = "";
31     public int reconnectInterval = 300;
32
33     public ConfigurationLevel check(String refreshToken) {
34         if (clientId.isBlank()) {
35             return ConfigurationLevel.EMPTY_CLIENT_ID;
36         } else if (clientSecret.isBlank()) {
37             return ConfigurationLevel.EMPTY_CLIENT_SECRET;
38         } else if (refreshToken.isBlank()) {
39             return ConfigurationLevel.REFRESH_TOKEN_NEEDED;
40         }
41         return ConfigurationLevel.COMPLETED;
42     }
43 }