]> git.basschouten.com Git - openhab-addons.git/blob
2b04b49347faf32b144151852bee5ca249d0caa4
[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.io.hueemulation.internal.dto.response;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * Hue API response base type
20  *
21  * @author David Graeff - Initial contribution
22  */
23 @NonNullByDefault
24 public class HueResponse {
25     public static final int UNAUTHORIZED = 1;
26     public static final int INVALID_JSON = 2;
27     public static final int NOT_AVAILABLE = 3;
28     public static final int METHOD_NOT_ALLOWED = 4;
29     public static final int ARGUMENTS_INVALID = 7;
30     public static final int SENSOR_NOT_CLIP_SENSOR = 8;
31     public static final int LINK_BUTTON_NOT_PRESSED = 101;
32     public static final int INTERNAL_ERROR = 901;
33
34     public static final int RULE_ENGINE_FULL = 601; // The Rule Engine has reached its maximum capacity of 100 rules.
35     public static final int CONDITION_ERROR = 607; // Rule conditions contain errors or operator combination is not
36                                                    // allowed
37     public static final int ACTION_ERROR = 608; // Rule actions contain errors or multiple actions with the same
38                                                 // resource address.
39     public static final int TOO_MANY_ITEMS = 11; // Too many items in the list (too many conditions or too many actions)
40
41     public final @Nullable HueErrorMessage error;
42     public final @Nullable HueSuccessResponse success;
43
44     public HueResponse(HueErrorMessage error) {
45         this.error = error;
46         this.success = null;
47     }
48
49     public HueResponse(HueSuccessResponse success) {
50         this.error = null;
51         this.success = success;
52     }
53
54     public static class HueErrorMessage {
55         public final String address;
56         public final String description;
57         public final int type;
58
59         public HueErrorMessage(int type, String address, String description) {
60             this.type = type;
61             this.address = address;
62             this.description = description;
63         }
64     }
65 }