2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.freeboxos.internal.api;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.freeboxos.internal.api.rest.LoginManager;
21 * Defines an API result that returns a single object
23 * @author Gaƫl L'hopital - Initial contribution
26 public class Response<ResultType> {
27 public static enum ErrorCode {
33 NOT_ENOUGH_DIFFERENT_CHARS,
37 DENIED_FROM_EXTERNAL_IP,
41 APPS_AUTHORIZATION_DENIED,
42 APPS_AUTHORIZATION_TIMEOUT,
43 PASSWORD_RESET_DENIED,
97 private ErrorCode errorCode = ErrorCode.NONE;
98 private LoginManager.Permission missingRight = LoginManager.Permission.NONE;
99 private String msg = "";
100 private List<ResultType> result = List.of();
101 private boolean success;
103 // In some cases I did not understand deserialization can still produce null result
104 @SuppressWarnings("null")
105 public List<ResultType> getResult() {
106 List<ResultType> localResult = result;
107 return localResult != null ? localResult : List.of();
110 public boolean isSuccess() {
114 public LoginManager.Permission getMissingRight() {
118 public ErrorCode getErrorCode() {
122 public String getMsg() {