2 * Copyright 2017 Gregory Moyer
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openhab.binding.sleepiq.api;
19 import java.util.logging.Level;
22 * This class represents configuration parameters for using {@link SleepIQ}.
24 * @author Gregory Moyer
26 public class Configuration
28 private String username;
29 private String password;
31 private URI baseUri = URI.create("https://api.sleepiq.sleepnumber.com/rest");
33 private boolean logging = false;
36 * Get the username on the account.
38 * @return the username
40 public String getUsername()
46 * Set the username on the account. This should be the username used to
47 * register with SleepIQ.
52 public void setUsername(String username)
54 this.username = username;
58 * Set the username on the account. This should be the username used to
59 * register with SleepIQ.
63 * @return this configuration instance
65 public Configuration withUsername(String username)
67 setUsername(username);
72 * Get the password on the account.
74 * @return the password
76 public String getPassword()
82 * Set the password on the account. This should be the password used to
83 * register with SleepIQ.
88 public void setPassword(String password)
90 this.password = password;
94 * Set the password on the account. This should be the password used to
95 * register with SleepIQ.
99 * @return this configuration instance
101 public Configuration withPassword(String password)
103 setPassword(password);
108 * Get the base URI of the SleepIQ cloud service.
110 * @return the base URI
112 public URI getBaseUri()
118 * Set the base URI of the SleepIQ cloud service. It is unlikely that this
119 * will need to be changed from its default value.
124 public void setBaseUri(URI baseUri)
126 this.baseUri = baseUri;
130 * Set the base URI of the SleepIQ cloud service. It is unlikely that this
131 * will need to be changed from its default value.
135 * @return this configuration instance
137 public Configuration withBaseUri(URI baseUri)
144 * Get the logging flag.
146 * @return the logging flag
148 public boolean isLogging()
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>
161 public void setLogging(boolean logging)
163 this.logging = logging;
167 * Set the logging flag. When this is set to <code>true</code>, all requests
168 * and responses will be logged at the {@link Level#INFO} level. <b>This
169 * includes usernames and passwords!</b>
173 * @return this configuration instance
175 public Configuration withLogging(boolean logging)