]> git.basschouten.com Git - openhab-addons.git/blob
739e34f41da191037464a65ebf8ded2b8414eb1a
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.bticinosmarther.internal.account;
14
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;
19
20 /**
21  * The {@code SmartherNotificationHandler} interface is used to decouple the Smarther notification handler
22  * implementation from other Bridge code.
23  *
24  * @author Fabio Possieri - Initial contribution
25  */
26 @NonNullByDefault
27 public interface SmartherNotificationHandler extends ThingHandler {
28
29     /**
30      * Tells whether the Smarther Bridge associated with this handler supports notifications.
31      *
32      * @return {@code true} if the Bridge supports notifications, {@code false} otherwise
33      */
34     boolean useNotifications();
35
36     /**
37      * Calls the Smarther API to register a new notification endpoint to the C2C Webhook service.
38      *
39      * @param plantId
40      *            the identifier of the plant the notification endpoint belongs to
41      *
42      * @throws {@link SmartherGatewayException}
43      *             in case of communication issues with the Smarther API
44      */
45     void registerNotification(String plantId) throws SmartherGatewayException;
46
47     /**
48      * Handles a new notifications received from the C2C Webhook notification service.
49      *
50      * @param notification
51      *            the received notification
52      */
53     void handleNotification(Notification notification);
54
55     /**
56      * Calls the Smarther API to unregister a notification endpoint already registered to the C2C Webhook service.
57      *
58      * @param plantId
59      *            the identifier of the plant the notification endpoint belongs to
60      *
61      * @throws {@link SmartherGatewayException}
62      *             in case of communication issues with the Smarther API
63      */
64     void unregisterNotification(String plantId) throws SmartherGatewayException;
65 }