2 * Copyright (c) 2010-2022 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.netatmo.internal.api.dto;
15 import java.time.ZonedDateTime;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.netatmo.internal.api.data.EventType;
20 import org.openhab.binding.netatmo.internal.deserialization.NAObjectMap;
21 import org.openhab.binding.netatmo.internal.deserialization.NAPushType;
24 * The {@link WebhookEvent} is responsible to hold
25 * data given back by the Netatmo API when calling the webhook
27 * @author Gaƫl L'hopital - Initial contribution
31 public class WebhookEvent extends Event {
32 private @NonNullByDefault({}) NAPushType pushType;
33 private String homeId = "";
34 private @Nullable String snapshotUrl;
35 private NAObjectMap<Person> persons = new NAObjectMap<>();
36 // Webhook does not provide the event generation time, so we'll use the event reception time
37 private ZonedDateTime time = ZonedDateTime.now();
39 public String getHomeId() {
43 public NAObjectMap<Person> getPersons() {
48 public EventType getEventType() {
49 return pushType.getEvent();
53 public ZonedDateTime getTime() {
58 public @Nullable String getPersonId() {
59 return persons.size() > 0 ? persons.keySet().iterator().next() : null;
63 public @Nullable String getSnapshotUrl() {