Class ApiClient
- java.lang.Object
-
- de.tsystems.mms.apm.performancesignature.dynatrace.rest.json.ApiClient
-
public class ApiClient extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringAPI_SUFFIXstatic StringREST_DF
-
Constructor Summary
Constructors Constructor Description ApiClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <S> ScreateService(Class<S> serviceClass)<T> ApiResponse<T>execute(retrofit2.Call<T> call)Execute HTTP call and deserialize the HTTP response body into the given return type.retrofit2.Retrofit.BuildergetAdapterBuilder()okhttp3.OkHttpClient.BuildergetOkBuilder()ApiClientsetAdapterBuilder(retrofit2.Retrofit.Builder adapterBuilder)ApiClientsetBasePath(String basePath)Set base pathApiClientsetCredentials(com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials creds)Helper method to set credentials for the HTTP basic authentication.ApiClientsetDebugging(boolean debugging)Enable/disable debugging for this API client.ApiClientsetProxy(Proxy proxy)ApiClientsetReadTimeout(int timeout)ApiClientsetVerifyingSsl(boolean verifyingSsl)Configure whether to verify certificate and hostname when making https requests.
-
-
-
Field Detail
-
API_SUFFIX
public static final String API_SUFFIX
- See Also:
- Constant Field Values
-
REST_DF
public static final String REST_DF
- See Also:
- Constant Field Values
-
-
Method Detail
-
setBasePath
public ApiClient setBasePath(String basePath)
Set base path- Parameters:
basePath- Base path of the URL (e.g https://localhost/api/v2- Returns:
- An instance of OkHttpClient
-
setVerifyingSsl
public ApiClient setVerifyingSsl(boolean verifyingSsl)
Configure whether to verify certificate and hostname when making https requests. Default to true. NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks.- Parameters:
verifyingSsl- True to verify TLS/SSL connection- Returns:
- ApiClient
-
setDebugging
public ApiClient setDebugging(boolean debugging)
Enable/disable debugging for this API client.- Parameters:
debugging- To enable (true) or disable (false) debugging- Returns:
- ApiClient
-
createService
public <S> S createService(Class<S> serviceClass)
-
setCredentials
public ApiClient setCredentials(com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials creds)
Helper method to set credentials for the HTTP basic authentication.- Parameters:
creds- UsernamePasswordCredentials
-
getAdapterBuilder
public retrofit2.Retrofit.Builder getAdapterBuilder()
-
setAdapterBuilder
public ApiClient setAdapterBuilder(retrofit2.Retrofit.Builder adapterBuilder)
-
getOkBuilder
public okhttp3.OkHttpClient.Builder getOkBuilder()
-
execute
public <T> ApiResponse<T> execute(retrofit2.Call<T> call) throws ApiException
Execute HTTP call and deserialize the HTTP response body into the given return type.- Type Parameters:
T- The return type corresponding to (same with) returnType- Parameters:
call- Call- Returns:
- ApiResponse object containing response status, headers and data, which is a Java object deserialized from response body and would be null when returnType is null.
- Throws:
ApiException- If fail to execute the call
-
setReadTimeout
public ApiClient setReadTimeout(int timeout)
-
-