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.rest;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.freeboxos.internal.api.FreeboxException;
17 import org.openhab.binding.freeboxos.internal.api.Response;
20 * The {@link AirMediaManager} is the Java class used to handle api requests related to air media global configuration
22 * @author Gaƫl L'hopital - Initial contribution
25 public class AirMediaManager extends ConfigurableRest<AirMediaManager.Config, AirMediaManager.ConfigResponse> {
26 private static final String PATH = "airmedia";
28 protected static record Config(boolean enabled) {
31 protected static class ConfigResponse extends Response<Config> {
34 public AirMediaManager(FreeboxOsSession session) throws FreeboxException {
35 super(session, LoginManager.Permission.NONE, ConfigResponse.class, session.getUriBuilder().path(PATH),
37 session.addManager(MediaReceiverManager.class, new MediaReceiverManager(session, getUriBuilder()));
40 public boolean getStatus() throws FreeboxException {
41 return getConfig().enabled();
44 public boolean setStatus(boolean enabled) throws FreeboxException {
45 return setConfig(new Config(enabled)).enabled();