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.freebox.internal.api.model;
15 import org.openhab.binding.freebox.internal.api.FreeboxException;
18 * The {@link FreeboxResponse} is the Java class used to map the "APIResponse"
19 * structure used by the API
20 * https://dev.freebox.fr/sdk/os/#
22 * @author Laurent Garnier - Initial contribution
24 public class FreeboxResponse<T> {
25 private static final String AUTHORIZATION_REQUIRED = "auth_required";
26 private static final String INSUFFICIENT_RIGHTS = "insufficient_rights";
28 private Boolean success;
29 private String errorCode;
32 private String missingRight;
35 public void evaluate() throws FreeboxException {
37 throw new FreeboxException(this);
41 public boolean isAuthRequired() {
42 return AUTHORIZATION_REQUIRED.equalsIgnoreCase(errorCode);
45 public boolean isMissingRights() {
46 return INSUFFICIENT_RIGHTS.equalsIgnoreCase(errorCode);
49 public Boolean isSuccess() {
53 public String getErrorCode() {
57 public String getUid() {
61 public String getMsg() {
65 public String getMissingRight() {
69 public T getResult() {