]> git.basschouten.com Git - openhab-addons.git/blob
372ed5179d984fbbe338b5fb6f1a172a028dc1cd
[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.mielecloud.internal.webservice.request;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jetty.client.api.Request;
17
18 /**
19  * Factory for {@link Request} objects.
20  *
21  * @author Björn Lange - Initial contribution
22  */
23 @NonNullByDefault
24 public interface RequestFactory extends AutoCloseable {
25     /**
26      * Creates a GET {@link Request} for the given URL decorated with all required headers to interact with the Miele
27      * cloud.
28      *
29      * @param url The URL to GET.
30      * @param accessToken The OAuth2 access token for bearer authentication.
31      * @return The {@link Request}.
32      */
33     Request createGetRequest(String url, String accessToken);
34
35     /**
36      * Creates a PUT {@link Request} for the given URL decorated with all required headers to interact with the Miele
37      * cloud.
38      *
39      * @param url The URL to PUT.
40      * @param accessToken The OAuth2 access token for bearer authentication.
41      * @param jsonContent Json content to send in the body of the request.
42      * @return The {@link Request}.
43      */
44     Request createPutRequest(String url, String accessToken, String jsonContent);
45
46     /**
47      * Creates a POST {@link Request} for the given URL decorated with all required headers to interact with the Miele
48      * cloud.
49      *
50      * @param url The URL to POST.
51      * @param accessToken The OAuth2 access token for bearer authentication.
52      * @return The {@link Request}.
53      */
54     Request createPostRequest(String url, String accessToken);
55
56     /**
57      * Creates a GET request prepared for HTTP event stream data (also referred to as Server Sent Events, SSE).
58      *
59      * @param url The URL to subscribe to.
60      * @param accessToken The OAuth2 access token for bearer authentication.
61      * @return The {@link Request}.
62      */
63     Request createSseRequest(String url, String accessToken);
64 }