Package com.algolia.internal
Class HttpRequester
java.lang.Object
com.algolia.internal.HttpRequester
- All Implemented Interfaces:
Requester
,Closeable
,AutoCloseable
HttpRequester is responsible for making HTTP requests using the OkHttp client. It provides a
mechanism for request serialization and deserialization using a given
JsonSerializer
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The Builder class for HttpRequester. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
<T> T
execute
(HttpRequest httpRequest, RequestOptions requestOptions, com.fasterxml.jackson.core.type.TypeReference<?> returnType) Executes an HTTP request and deserializes the response into a specified type reference.<T> T
execute
(HttpRequest httpRequest, RequestOptions requestOptions, Class<?> returnType, Class<?> innerType) Executes an HTTP request and deserializes the response into a specified Java type.
-
Method Details
-
execute
public <T> T execute(HttpRequest httpRequest, RequestOptions requestOptions, Class<?> returnType, Class<?> innerType) Description copied from interface:Requester
Executes an HTTP request and deserializes the response into a specified Java type.- Specified by:
execute
in interfaceRequester
- Type Parameters:
T
- The type of the returned object.- Parameters:
httpRequest
- The HTTP request to be executed.requestOptions
- Optional request options.returnType
- The class of the response.innerType
- The inner class type if the response is a container type.- Returns:
- The deserialized response.
-
execute
public <T> T execute(HttpRequest httpRequest, RequestOptions requestOptions, com.fasterxml.jackson.core.type.TypeReference<?> returnType) Description copied from interface:Requester
Executes an HTTP request and deserializes the response into a specified type reference. -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-