public abstract class BaseApi extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
BaseApi.RequestExecutor
RequestExecutor.
|
protected static interface |
BaseApi.RequestSupplier
RequestSupplier.
|
protected static interface |
BaseApi.ResponseHandler<T>
ResponseHandler.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,AuthManager> |
authManagers |
protected Configuration |
config
Protected variables to hold an instance of Configuration.
|
protected HttpCallback |
httpCallback
Protected variable to hold an instance of HttpCallback if the user provides it.
|
protected String |
internalUserAgent |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseApi(Configuration config,
HttpClient httpClient,
Map<String,AuthManager> authManagers) |
protected |
BaseApi(Configuration config,
HttpClient httpClient,
Map<String,AuthManager> authManagers,
HttpCallback httpCallback) |
| Modifier and Type | Method and Description |
|---|---|
HttpClient |
getClientInstance()
Shared instance of the Http client.
|
HttpCallback |
getHttpCallback()
Get httpCallback associated with this controller.
|
<T> CompletableFuture<T> |
makeHttpCallAsync(BaseApi.RequestSupplier requestSupplier,
BaseApi.RequestExecutor requestExecutor,
BaseApi.ResponseHandler<T> responseHandler)
Make an asynchronous HTTP endpoint call.
|
protected void |
validateResponse(HttpResponse response,
HttpContext context)
Validates the response against HTTP errors defined at the API level.
|
protected String internalUserAgent
protected final Configuration config
protected final HttpCallback httpCallback
protected Map<String,AuthManager> authManagers
protected BaseApi(Configuration config, HttpClient httpClient, Map<String,AuthManager> authManagers)
protected BaseApi(Configuration config, HttpClient httpClient, Map<String,AuthManager> authManagers, HttpCallback httpCallback)
public HttpCallback getHttpCallback()
public HttpClient getClientInstance()
protected void validateResponse(HttpResponse response, HttpContext context) throws ApiException
response - The response recievedcontext - Context of the request and the recieved responseApiException - Represents error response from the server.public <T> CompletableFuture<T> makeHttpCallAsync(BaseApi.RequestSupplier requestSupplier, BaseApi.RequestExecutor requestExecutor, BaseApi.ResponseHandler<T> responseHandler)
T - The type of the object for responserequestSupplier - An object of RequestSupplier to supply an instance of HttpRequestrequestExecutor - An object of RequestExecutor to execute the given requestresponseHandler - An object of ResponseHandler to handle the endpoint responseCopyright © 2022. All rights reserved.