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.boschshc.internal.services;
15 import java.util.concurrent.ExecutionException;
16 import java.util.concurrent.TimeoutException;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.binding.boschshc.internal.devices.bridge.BridgeHandler;
22 * Abstract implementation for services that only allow setting states via HTTP POST requests.
23 * State-less services can not receive any states from the bridge.
25 * This implementation does not support request bodies when submitting the POST request.
26 * Request bodies are supported by the subclass {@link AbstractStatelessBoschSHCServiceWithRequestBody}.
28 * Examples for this kind of service are the following actions of the intrusion detection system:
31 * /intrusion/actions/arm
32 * /intrusion/actions/disarm
33 * /intrusion/actions/mute
36 * The services of the devices and their official APIs can be found
37 * <a href="https://apidocs.bosch-smarthome.com/local/">here</a>.
39 * @author David Pace - Initial contribution
42 public abstract class AbstractStatelessBoschSHCService extends AbstractBoschSHCService {
44 private String endpoint;
46 protected AbstractStatelessBoschSHCService(String serviceName, String endpoint) {
48 this.endpoint = endpoint;
52 * Sends a HTTP POST request without request body to the endpoint specified by {@link #endpoint}.
54 * @throws InterruptedException
55 * @throws TimeoutException
56 * @throws ExecutionException
58 public void postAction() throws InterruptedException, TimeoutException, ExecutionException {
59 BridgeHandler bridgeHandler = getBridgeHandler();
60 if (bridgeHandler == null) {
64 bridgeHandler.postAction(endpoint);
67 public String getEndpoint() {