]> git.basschouten.com Git - openhab-addons.git/blob
34624bb452669f28ab122b08c85ae69c114ccd16
[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.vesync.internal.dto.responses;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * The {@link VeSyncResponse} is a Java class used as a DTO to hold the Vesync's API's common response data.
19  *
20  * @author David Goodyear - Initial contribution
21  */
22 public class VeSyncResponse {
23
24     @SerializedName("traceId")
25     public String traceId;
26
27     @SerializedName("code")
28     public String code;
29
30     @SerializedName("msg")
31     public String msg;
32
33     public String getMsg() {
34         return msg;
35     }
36
37     public String getTraceId() {
38         return traceId;
39     }
40
41     public String getCode() {
42         return code;
43     }
44
45     public boolean isMsgSuccess() {
46         return (msg != null) ? "request success".equals(msg) : false;
47     }
48
49     public boolean isMsgDeviceOffline() {
50         return (msg != null) ? "device offline".equals(msg) : false;
51     }
52
53     @Override
54     public String toString() {
55         return "VesyncResponse [traceId=\"" + traceId + "\", msg=\"" + msg + "\", code=\"" + code + "\"]";
56     }
57 }