Package kong.unirest.core
Interface Client
-
- All Known Implementing Classes:
CacheManager.CacheWrapper
,JavaClient
,MockClient
public interface Client
The client that does the work.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
getClient()
<T> HttpResponse<T>
request(HttpRequest request, java.util.function.Function<RawResponse,HttpResponse<T>> transformer, java.lang.Class<?> resultType)
Make a request<T> java.util.concurrent.CompletableFuture<HttpResponse<T>>
request(HttpRequest request, java.util.function.Function<RawResponse,HttpResponse<T>> transformer, java.util.concurrent.CompletableFuture<HttpResponse<T>> callback, java.lang.Class<?> resultType)
Make a Async requestWebSocketResponse
websocket(WebSocketRequest request, java.net.http.WebSocket.Listener listener)
Create a websocket connection
-
-
-
Method Detail
-
getClient
<T> T getClient()
- Type Parameters:
T
- the underlying client- Returns:
- the underlying client if this instance is wrapping another library.
-
request
<T> HttpResponse<T> request(HttpRequest request, java.util.function.Function<RawResponse,HttpResponse<T>> transformer, java.lang.Class<?> resultType)
Make a request- Type Parameters:
T
- The type of the body- Parameters:
request
- the prepared request objecttransformer
- the function to transform the responseresultType
- the final body result type. This is a hint to downstream systems to make up for type erasure.- Returns:
- a HttpResponse with a transformed body
-
request
<T> java.util.concurrent.CompletableFuture<HttpResponse<T>> request(HttpRequest request, java.util.function.Function<RawResponse,HttpResponse<T>> transformer, java.util.concurrent.CompletableFuture<HttpResponse<T>> callback, java.lang.Class<?> resultType)
Make a Async request- Type Parameters:
T
- The type of the body- Parameters:
request
- the prepared request objecttransformer
- the function to transform the responsecallback
- the CompletableFuture that will handle the eventual responseresultType
- the final body result type. This is a hint to downstream systems to make up for type erasure.- Returns:
- a CompletableFuture of a response
-
websocket
WebSocketResponse websocket(WebSocketRequest request, java.net.http.WebSocket.Listener listener)
Create a websocket connection- Parameters:
request
- the connectionlistener
- (in the voice of Cicero) the listener- Returns:
- a WebSocketResponse
-
-