Class ApiClient
- java.lang.Object
-
- org.bonitasoft.web.client.invoker.ApiClient
-
@Generated("org.openapitools.codegen.languages.JavaClientCodegen") public class ApiClient extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceApiClient.Api
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.ObjectMapperobjectMapper
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuthorization(String authName, feign.RequestInterceptor authorization)Adds an authorization to be used by the client<T extends ApiClient.Api>
TbuildClient(Class<T> clientClass)Creates a feign client for given API interface.Map<String,feign.RequestInterceptor>getApiAuthorizations()feign.RequestInterceptorgetAuthorization(String authName)Gets request interceptor based on authentication nameStringgetBasePath()feign.Feign.BuildergetFeignBuilder()com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()StringselectHeaderAccept(String[] accepts)Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)StringselectHeaderContentType(String[] contentTypes)Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first one of the array.voidsetApiAuthorizations(Map<String,feign.RequestInterceptor> apiAuthorizations)voidsetApiKey(String apiKey)Helper method to configure the first api key foundApiClientsetBasePath(String basePath)voidsetBearerToken(String bearerToken)Helper method to configure the bearer token.voidsetCredentials(String username, String password)Helper method to configure the username/password for basic authApiClientsetFeignBuilder(feign.Feign.Builder feignBuilder)voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
-
Method Detail
-
getBasePath
public String getBasePath()
-
setApiAuthorizations
public void setApiAuthorizations(Map<String,feign.RequestInterceptor> apiAuthorizations)
-
getFeignBuilder
public feign.Feign.Builder getFeignBuilder()
-
setFeignBuilder
public ApiClient setFeignBuilder(feign.Feign.Builder feignBuilder)
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
buildClient
public <T extends ApiClient.Api> T buildClient(Class<T> clientClass)
Creates a feign client for given API interface. Usage: ApiClient apiClient = new ApiClient(); apiClient.setBasePath("http://localhost:8080"); XYZApi api = apiClient.buildClient(XYZApi.class); XYZResponse response = api.someMethod(...);- Type Parameters:
T- Type- Parameters:
clientClass- Client class- Returns:
- The Client
-
selectHeaderAccept
public String selectHeaderAccept(String[] accepts)
Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)- Parameters:
accepts- The accepts array to select from- Returns:
- The Accept header to use. If the given array is empty, null will be returned (not to set the Accept header explicitly).
-
selectHeaderContentType
public String selectHeaderContentType(String[] contentTypes)
Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first one of the array.- Parameters:
contentTypes- The Content-Type array to select from- Returns:
- The Content-Type header to use. If the given array is empty, JSON will be used.
-
setBearerToken
public void setBearerToken(String bearerToken)
Helper method to configure the bearer token.- Parameters:
bearerToken- the bearer token.
-
setApiKey
public void setApiKey(String apiKey)
Helper method to configure the first api key found- Parameters:
apiKey- API key
-
setCredentials
public void setCredentials(String username, String password)
Helper method to configure the username/password for basic auth- Parameters:
username- Usernamepassword- Password
-
getAuthorization
public feign.RequestInterceptor getAuthorization(String authName)
Gets request interceptor based on authentication name- Parameters:
authName- Authentication name- Returns:
- Request Interceptor
-
addAuthorization
public void addAuthorization(String authName, feign.RequestInterceptor authorization)
Adds an authorization to be used by the client- Parameters:
authName- Authentication nameauthorization- Request interceptor
-
-