]> git.basschouten.com Git - openhab-addons.git/blob
aeb0b18aee693b3997df95c7ae59e076f81d853b
[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.nest.internal.sdm.config;
14
15 import java.util.stream.Stream;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * The {@link SDMAccountConfiguration} contains the configuration parameter values for the SDM and Pub/Sub APIs.
21  *
22  * @author Brian Higginbotham - Initial contribution
23  * @author Wouter Born - Initial contribution
24  */
25 @NonNullByDefault
26 public class SDMAccountConfiguration {
27
28     public static final String PUBSUB_AUTHORIZATION_CODE = "pubsubAuthorizationCode";
29     public String pubsubAuthorizationCode = "";
30
31     public static final String PUBSUB_CLIENT_ID = "pubsubClientId";
32     public String pubsubClientId = "";
33
34     public static final String PUBSUB_CLIENT_SECRET = "pubsubClientSecret";
35     public String pubsubClientSecret = "";
36
37     public static final String PUBSUB_PROJECT_ID = "pubsubProjectId";
38     public String pubsubProjectId = "";
39
40     public static final String PUBSUB_SUBSCRIPTION_ID = "pubsubSubscriptionId";
41     public String pubsubSubscriptionId = "";
42
43     public static final String SDM_AUTHORIZATION_CODE = "sdmAuthorizationCode";
44     public String sdmAuthorizationCode = "";
45
46     public static final String SDM_CLIENT_ID = "sdmClientId";
47     public String sdmClientId = "";
48
49     public static final String SDM_CLIENT_SECRET = "sdmClientSecret";
50     public String sdmClientSecret = "";
51
52     public static final String SDM_PRODUCT_ID = "sdmProductId";
53     public String sdmProjectId = "";
54
55     public boolean usePubSub() {
56         return Stream.of(pubsubProjectId, pubsubSubscriptionId, pubsubClientId, pubsubClientSecret)
57                 .noneMatch(String::isBlank);
58     }
59 }