]> git.basschouten.com Git - openhab-addons.git/blob
49436df4ed7e9399b5d9369fb37884508f1c3099
[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.livisismarthome.internal.client.api.entity.error;
14
15 import java.util.List;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * Error response object from the LIVISI SmartHome api.
21  *
22  * @author Oliver Kuhl - Initial contribution
23  */
24 public class ErrorResponseDTO {
25
26     // General errors
27     public static final int ERR_UNKNOWN = 1000;
28     public static final int ERR_SERVICE_UNAVAILABLE = 1001;
29     public static final int ERR_SERVICE_TIMEOUT = 1002;
30     public static final int ERR_INTERNAL_API_ERROR = 1003;
31     public static final int ERR_INVALID_SHC_OPERATION = 1004;
32     public static final int ERR_MISSING_ARGUMENT_OR_WRONG_VALUE = 1005;
33     public static final int ERR_SERVICE_TOO_BUSY = 1006;
34
35     // Authentication and authorization errors
36     public static final int ERR_UNKNOWN_AUTHENTICATION_ERROR = 2000;
37     public static final int ERR_ACCESS_NOT_ALLOWED = 2001;
38     public static final int ERR_INVALID_TOKEN_REQUEST = 2002;
39     public static final int ERR_INVALID_CLIENT_CREDENTIALS = 2003;
40     public static final int ERR_INVALID_TOKEN_SIGNATURE = 2004;
41     public static final int ERR_SESSION_INITIALIZATION_FAILED = 2005;
42     public static final int ERR_SESSION_EXISTS = 2006;
43     public static final int ERR_TOKEN_EXPIRED = 2007;
44     public static final int ERR_LOGIN_FROM_DIFFERENT_CLIENT = 2008;
45     public static final int ERR_INVALID_USER_CREDENTIALS = 2009;
46     public static final int ERR_REMOTE_ACCESS_NOT_ALLOWED = 2010;
47     public static final int ERR_INSUFFICIENT_PERMISSIONS = 2011;
48     public static final int ERR_SESSION_NOT_FOUND = 2012;
49     public static final int ERR_ACCOUNT_TEMPORARY_LOCKED = 2013;
50
51     // Entities
52     public static final int ERR_ENTITY_DOES_NOT_EXIST = 3000;
53     public static final int ERR_INVALID_REQUEST_CONTENT = 3001;
54     public static final int ERR_NO_CHANGE_PERFORMED = 3002;
55     public static final int ERR_ENTITY_ALREADY_EXISTS = 3003;
56     public static final int ERR_INVALID_INTERACTION = 3004;
57
58     // Products
59     public static final int ERR_PREMIUM_SERVICE_CANNOT_BE_ENABLED_DIRECTLY = 3500;
60     public static final int ERR_CANNOT_REMOVE_A_PRODUCT_THAT_WAS_PAID = 3501;
61
62     // Actions
63     public static final int ERR_INVALID_ACTION_TRIGGERED = 4000;
64     public static final int ERR_INVALID_PARAMETER = 4001;
65     public static final int ERR_TRIGGER_ACTION_NOT_ALLOWED = 4002;
66     public static final int ERR_UNSUPPORTED_ACTION_TYPE = 4003;
67
68     // Configuration
69     public static final int ERR_ERROR_UPDATING_CONFIG = 5000;
70     public static final int ERR_CONFIG_LOCKED_BY_OTHER_PROCESS = 5001;
71     public static final int ERR_COMMUNICATION_WITH_SHC_FAILED = 5002;
72     public static final int ERR_LATEST_TERMS_AND_CONDITIONS_NOT_ACCEPTED_BY_USER = 5003;
73     public static final int ERR_ONE_SHC_ALREADY_REGISTERED = 5004;
74     public static final int ERR_USER_HAS_NO_REGISTERED_SHC = 5005;
75     public static final int ERR_CONTROLLER_OFFLINE = 5006;
76     public static final int ERR_REGISTRATION_FAILURE = 5009;
77
78     // Smart codes
79     public static final int ERR_SMARTCODE_REQUEST_NOT_ALLOWED = 6000;
80     public static final int ERR_SMARTCODE_CANNOT_BE_REDEEMED = 6001;
81     public static final int ERR_RESTRICTED_ACCESS = 6002;
82
83     @SerializedName("errorcode")
84     private int code;
85     @SerializedName("description")
86     private String description;
87     @SerializedName("messages")
88     private List<String> messages;
89
90     /**
91      * @return the error code
92      */
93     public int getCode() {
94         return code;
95     }
96
97     /**
98      * @param code the error code to set
99      */
100     public void setCode(int code) {
101         this.code = code;
102     }
103
104     /**
105      * @return the description
106      */
107     public String getDescription() {
108         return description;
109     }
110
111     /**
112      * @param description the description to set
113      */
114     public void setDescription(String description) {
115         this.description = description;
116     }
117
118     /**
119      * @return the messages
120      */
121     public List<String> getMessages() {
122         return messages;
123     }
124
125     /**
126      * @param messages the messages to set
127      */
128     public void setMessages(List<String> messages) {
129         this.messages = messages;
130     }
131
132     @Override
133     public String toString() {
134         String stringRepresentation = "ErrorResponse [code=" + code + ", description=" + description;
135         if (messages != null) {
136             stringRepresentation += ", messages=" + messages.toString();
137         }
138         stringRepresentation += "]";
139         return stringRepresentation;
140     }
141 }