10Duke Scale SDK for Java
Loading...
Searching...
No Matches
tenduke.scale.client.AbstractRestApiClient Class Referenceabstract

Detailed Description

Abstract class representing a REST API client.

Inheritance diagram for tenduke.scale.client.AbstractRestApiClient:
tenduke.scale.client.LicenseCheckoutHttpClient

Protected Member Functions

 AbstractRestApiClient (final AuthorizationProvider authzBearerProvider, final TendukeScaleConfig config)
 Initializes a new instance of this class with a null tenduke.sdk.core.service.JwtSignatureVerifierKeyProvider and a new OkHttpClient with internal default configuration options (15 sec.
 
 AbstractRestApiClient (final AuthorizationProvider authzBearerProvider, final TendukeScaleConfig config, final OkHttpClient okHttpClient)
 Initializes a new instance of this class.
 
void logErrorResponse (final Response response, final String entityType, final String action, final Logger logger) throws IOException
 Logs an error response.
 
void logErrorResponse (final ApiException apiException, final String entityType, final String action, final Logger logger)
 Logs an error response.
 
String extractBaseUrl ()
 Validates and extracts the 10Duke Scale base URL from previously provided TendukeScaleConfig.
 

Constructor & Destructor Documentation

◆ AbstractRestApiClient() [1/2]

tenduke.scale.client.AbstractRestApiClient.AbstractRestApiClient ( final AuthorizationProvider authzBearerProvider,
final TendukeScaleConfig config )
protected

Initializes a new instance of this class with a null tenduke.sdk.core.service.JwtSignatureVerifierKeyProvider and a new OkHttpClient with internal default configuration options (15 sec.

timeout for connect, call, read and write).

Parameters
authzBearerProviderAuthorizationProvider is called when a new value for HTTP Authorization header is needed.
configThe configuration to use for the 10Duke Scale base URL and settings for HTTP client.

◆ AbstractRestApiClient() [2/2]

tenduke.scale.client.AbstractRestApiClient.AbstractRestApiClient ( final AuthorizationProvider authzBearerProvider,
final TendukeScaleConfig config,
final OkHttpClient okHttpClient )
protected

Initializes a new instance of this class.

Parameters
authzBearerProviderAuthorizationProvider is called when a new value for HTTP Authorization header is needed.
configThe configuration to use for the 10Duke Scale base URL and settings for HTTP client.
okHttpClientAn instance of OkHttpClient to use for making HTTP requests. If a null value is provided then a new OkHttpClient with internal default configuration options (15 sec. timeout for connect, call, read and write).

Member Function Documentation

◆ extractBaseUrl()

String tenduke.scale.client.AbstractRestApiClient.extractBaseUrl ( )
protected

Validates and extracts the 10Duke Scale base URL from previously provided TendukeScaleConfig.

Asserts that the configuration and the URL are not null and that the URL is not blank.

Returns
the 10Duke Scale base URL.

◆ logErrorResponse() [1/2]

void tenduke.scale.client.AbstractRestApiClient.logErrorResponse ( final ApiException apiException,
final String entityType,
final String action,
final Logger logger )
protected

Logs an error response.

Parameters
apiExceptionreceived exception to log.
entityTypetype of the entity that the action was towards.
actionattempted action.
loggerto log the error.

◆ logErrorResponse() [2/2]

void tenduke.scale.client.AbstractRestApiClient.logErrorResponse ( final Response response,
final String entityType,
final String action,
final Logger logger ) throws IOException
protected

Logs an error response.

Parameters
responseerror response to log.
entityTypetype of the entity that the action was towards.
actionattempted action.
loggerto log the error.
Exceptions
IOExceptionif an IOException occurs while converting error body to string.

The documentation for this class was generated from the following file: