]> git.basschouten.com Git - openhab-addons.git/blob
724683b0b0f8389888fad7027d3f9cadc27bb71c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.meteoalerte.internal.json;
14
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Optional;
18 import java.util.stream.Stream;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22
23 import com.google.gson.annotations.SerializedName;
24
25 /**
26  * The {@link ApiResponse} is the Java class used to map the JSON
27  * response to the webservice request.
28  *
29  * @author GaĆ«l L'hopital - Initial contribution
30  */
31 @NonNullByDefault
32 public class ApiResponse {
33     @SerializedName("nhits")
34     private int nHits;
35     private @Nullable Parameters parameters;
36     private List<Record> records = new ArrayList<>();
37
38     public int getNHits() {
39         return nHits;
40     }
41
42     public Optional<Parameters> getParameters() {
43         return Optional.ofNullable(parameters);
44     }
45
46     public Stream<Record> getRecords() {
47         return records.stream();
48     }
49 }