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 classThe Builder class for HttpRequester. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<T> Texecute(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> Texecute(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:RequesterExecutes an HTTP request and deserializes the response into a specified Java type.- Specified by:
executein 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:RequesterExecutes an HTTP request and deserializes the response into a specified type reference. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-