]> git.basschouten.com Git - openhab-addons.git/blob
09aacae9d7acd4058550225107a36b71e2450c1f
[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.homeconnect.internal.client.model;
14
15 import java.time.ZonedDateTime;
16 import java.util.UUID;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 /**
22  *
23  * API request model.
24  *
25  * @author Jonas BrĂ¼stel - Initial Contribution
26  */
27 @NonNullByDefault
28 public class ApiRequest {
29     private final String id;
30     private final ZonedDateTime time;
31     private final HomeConnectRequest homeConnectRequest;
32     private final @Nullable HomeConnectResponse homeConnectResponse;
33
34     public ApiRequest(ZonedDateTime time, HomeConnectRequest homeConnectRequest,
35             @Nullable HomeConnectResponse homeConnectResponse) {
36         this.id = UUID.randomUUID().toString();
37         this.time = time;
38         this.homeConnectRequest = homeConnectRequest;
39         this.homeConnectResponse = homeConnectResponse;
40     }
41
42     public String getId() {
43         return id;
44     }
45
46     public ZonedDateTime getTime() {
47         return time;
48     }
49
50     public HomeConnectRequest getRequest() {
51         return homeConnectRequest;
52     }
53
54     public @Nullable HomeConnectResponse getResponse() {
55         return homeConnectResponse;
56     }
57
58     @Override
59     public String toString() {
60         return "ApiRequest [id=" + id + ", time=" + time + ", request=" + homeConnectRequest + ", response="
61                 + homeConnectResponse + "]";
62     }
63 }