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.bticinosmarther.internal.account;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bticinosmarther.internal.api.dto.Notification;
17 import org.openhab.binding.bticinosmarther.internal.api.exception.SmartherGatewayException;
18 import org.openhab.core.thing.binding.ThingHandler;
21 * The {@code SmartherNotificationHandler} interface is used to decouple the Smarther notification handler
22 * implementation from other Bridge code.
24 * @author Fabio Possieri - Initial contribution
27 public interface SmartherNotificationHandler extends ThingHandler {
30 * Tells whether the Smarther Bridge associated with this handler supports notifications.
32 * @return {@code true} if the Bridge supports notifications, {@code false} otherwise
34 boolean useNotifications();
37 * Calls the Smarther API to register a new notification endpoint to the C2C Webhook service.
40 * the identifier of the plant the notification endpoint belongs to
42 * @throws SmartherGatewayException in case of communication issues with the Smarther API
44 void registerNotification(String plantId) throws SmartherGatewayException;
47 * Handles a new notifications received from the C2C Webhook notification service.
50 * the received notification
52 void handleNotification(Notification notification);
55 * Calls the Smarther API to unregister a notification endpoint already registered to the C2C Webhook service.
58 * the identifier of the plant the notification endpoint belongs to
60 * @throws SmartherGatewayException in case of communication issues with the Smarther API
62 void unregisterNotification(String plantId) throws SmartherGatewayException;