Class DefaultApiClient
- java.lang.Object
-
- de.xima.fc.api.rest.pub.client.generic.DefaultApiClient
-
- All Implemented Interfaces:
ApiClient
@Generated("de.xima.openapi.codegen.java_jaxrs.XimaJavaJaxrsGenerator") public final class DefaultApiClient extends Object implements ApiClientThe default API client that is responsible for sending REST-like calls to an API endpoint and also takes care of serialization and deserialization.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiClientConfigconfig()Accesses the configuration that was used to create this client.ApiBundlecreateBundle()Formatterformatter()javax.ws.rs.client.ClienthttpClient()Accesses the HTTP client that is used for sending HTTP requests.<T> Future<ApiResponse<T>>invokeApiAsync(ApiCall<?> call)Invoke an API endpoint by sending an HTTP request with the given options.<T> Future<ApiResponse<T>>invokeApiAsync(ApiCall<?> call, javax.ws.rs.client.InvocationCallback<ApiResponse<T>> invocationCallback)Invoke an API endpoint by sending an HTTP request with the given options.<T> CompletionStage<ApiResponse<T>>invokeApiRx(ApiCall<?> call)Invoke an API endpoint by sending an HTTP request with the given options.<T> ApiResponse<T>invokeApiSync(ApiCall<?> call)Invoke an API endpoint by sending an HTTP request with the given options.
-
-
-
Method Detail
-
httpClient
public javax.ws.rs.client.Client httpClient()
Description copied from interface:ApiClientAccesses the HTTP client that is used for sending HTTP requests. You can use this if you ever need to send requests manually.- Specified by:
httpClientin interfaceApiClient- Returns:
- The HTTP client used by this client.
-
config
public ApiClientConfig config()
Description copied from interface:ApiClientAccesses the configuration that was used to create this client.
-
formatter
public Formatter formatter()
-
createBundle
public ApiBundle createBundle()
- Specified by:
createBundlein interfaceApiClient- Returns:
- A bundle with convenience methods to access the individual APIs.
-
invokeApiAsync
public <T> Future<ApiResponse<T>> invokeApiAsync(ApiCall<?> call)
Description copied from interface:ApiClientInvoke an API endpoint by sending an HTTP request with the given options. This method always returns an asynchronousFuture. That future may throw an execution exception, but this method never throws an exception directly.- Specified by:
invokeApiAsyncin interfaceApiClient- Type Parameters:
T- The expected return type of the request.- Parameters:
call- API call to send with the data of the requests.- Returns:
- A future encapsulating the eventual response with the meta data and the body of the response.
-
invokeApiAsync
public <T> Future<ApiResponse<T>> invokeApiAsync(ApiCall<?> call, javax.ws.rs.client.InvocationCallback<ApiResponse<T>> invocationCallback)
Description copied from interface:ApiClientInvoke an API endpoint by sending an HTTP request with the given options. This method always returns an asynchronousFuture. That future may throw an execution exception, but this method never throws an exception directly. You should not read the result of the future, use the callback instead.- Specified by:
invokeApiAsyncin interfaceApiClient- Type Parameters:
T- The expected return type of the request.- Parameters:
call- API call to send with the data of the requests.invocationCallback- Callback which is invoked when the request finishes.- Returns:
- A future encapsulating the eventual response with the meta data and the body of the response.
-
invokeApiRx
public <T> CompletionStage<ApiResponse<T>> invokeApiRx(ApiCall<?> call)
Description copied from interface:ApiClientInvoke an API endpoint by sending an HTTP request with the given options. This method always returns an asynchronousCompletionStage. That stage may be completed exceptionally, but this method never throws an exception directly.- Specified by:
invokeApiRxin interfaceApiClient- Type Parameters:
T- The expected return type of the request.- Parameters:
call- API call to send with the data of the requests.- Returns:
- A completion stage that resolves with the meta data and the body of the response.
-
invokeApiSync
public <T> ApiResponse<T> invokeApiSync(ApiCall<?> call) throws ApiException
Description copied from interface:ApiClientInvoke an API endpoint by sending an HTTP request with the given options. This method always returns the result synchronously.- Specified by:
invokeApiSyncin interfaceApiClient- Type Parameters:
T- The expected return type of the request.- Parameters:
call- API call to send with the data of the requests.- Returns:
- The response with the meta data and the body of the response.
- Throws:
ApiException- When the request could not be executed. No exception is thrown if the server simply sends a 4xx or 5xx status code and that status code was defined in the API specification.
-
-