]> git.basschouten.com Git - openhab-addons.git/blob
861b4a11b7a4bdb79fba92596b6cfeed88808f29
[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.sleepiq.internal.api;
14
15 import java.net.URI;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * This class represents configuration parameters for using {@link SleepIQ}.
21  *
22  * @author Gregory Moyer - Initial contribution
23  */
24 @NonNullByDefault
25 public class Configuration {
26     private String username = "";
27     private String password = "";
28
29     private URI baseUri = URI.create("https://api.sleepiq.sleepnumber.com");
30
31     private boolean logging = false;
32
33     /**
34      * Get the username on the account.
35      *
36      * @return the username
37      */
38     public String getUsername() {
39         return username;
40     }
41
42     /**
43      * Set the username on the account. This should be the username used to
44      * register with SleepIQ.
45      *
46      * @param username
47      *            the value to set
48      */
49     public void setUsername(String username) {
50         this.username = username;
51     }
52
53     /**
54      * Set the username on the account. This should be the username used to
55      * register with SleepIQ.
56      *
57      * @param username
58      *            the value to set
59      * @return this configuration instance
60      */
61     public Configuration withUsername(String username) {
62         setUsername(username);
63         return this;
64     }
65
66     /**
67      * Get the password on the account.
68      *
69      * @return the password
70      */
71     public String getPassword() {
72         return password;
73     }
74
75     /**
76      * Set the password on the account. This should be the password used to
77      * register with SleepIQ.
78      *
79      * @param password
80      *            the value to set
81      */
82     public void setPassword(String password) {
83         this.password = password;
84     }
85
86     /**
87      * Set the password on the account. This should be the password used to
88      * register with SleepIQ.
89      *
90      * @param password
91      *            the value to set
92      * @return this configuration instance
93      */
94     public Configuration withPassword(String password) {
95         setPassword(password);
96         return this;
97     }
98
99     /**
100      * Get the base URI of the SleepIQ cloud service.
101      *
102      * @return the base URI
103      */
104     public URI getBaseUri() {
105         return baseUri;
106     }
107
108     /**
109      * Set the base URI of the SleepIQ cloud service. It is unlikely that this
110      * will need to be changed from its default value.
111      *
112      * @param baseUri
113      *            the value to set
114      */
115     public void setBaseUri(URI baseUri) {
116         this.baseUri = baseUri;
117     }
118
119     /**
120      * Set the base URI of the SleepIQ cloud service. It is unlikely that this
121      * will need to be changed from its default value.
122      *
123      * @param baseUri
124      *            the value to set
125      * @return this configuration instance
126      */
127     public Configuration withBaseUri(URI baseUri) {
128         setBaseUri(baseUri);
129         return this;
130     }
131
132     /**
133      * Get the logging flag.
134      *
135      * @return the logging flag
136      */
137     public boolean isLogging() {
138         return logging;
139     }
140
141     /**
142      * Set the logging flag. When this is set to <code>true</code>, all requests
143      * and responses will be logged at the {@link Level#INFO} level. <b>This
144      * includes usernames and passwords!</b>
145      *
146      * @param logging
147      *            the value to set
148      */
149     public void setLogging(boolean logging) {
150         this.logging = logging;
151     }
152
153     /**
154      * Set the logging flag. When this is set to <code>true</code>, all requests
155      * and responses will be logged at the {@link Level#INFO} level. <b>This
156      * includes usernames and passwords!</b>
157      *
158      * @param logging
159      *            the value to set
160      * @return this configuration instance
161      */
162     public Configuration withLogging(boolean logging) {
163         setLogging(logging);
164         return this;
165     }
166 }