Class DefaultApiClient
java.lang.Object
de.xima.fc.api.rest.pub.client.generic.DefaultApiClient
- All Implemented Interfaces:
ApiClient
-
Method Summary
Modifier and TypeMethodDescriptionconfig()Accesses the configuration that was used to create this client.javax.ws.rs.client.ClientAccesses 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 Details
-
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
Description copied from interface:ApiClientAccesses the configuration that was used to create this client. -
formatter
-
createBundle
- Specified by:
createBundlein interfaceApiClient- Returns:
- A bundle with convenience methods to access the individual APIs.
-
invokeApiAsync
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
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
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.
-