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