Class ApiClientBuilder
- java.lang.Object
-
- de.xima.fc.api.rest.pub.client.user.ApiClientBuilder
-
-
Constructor Summary
Constructors Constructor Description ApiClientBuilder(JaxRsAdapter jaxRsAdapter)Creates a new builder for configuring an API client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiClientBuilderapiCallInterceptor(ApiCallInterceptor interceptor)Sets the optional interceptor for reacting to and modifying API calls.ApiClientBuilderapiKey(String apiKey)Helper method to set API key value for the first API key authentication.ApiClientBuilderapiKeyPrefix(String apiKeyPrefix)Helper method to set API key prefix for the first API key authentication.ApiClientBuilderbasePath(String basePath)Sets the base path for all API endpoints.ApiClientBuilderbearerToken(String bearerToken)Helper method to set the bearer token for the first HTTP basic authentication.ApiBundlebuildBundle()Creates a bundle with all APIs.ApiClientbuildClient()Creates a new client.ApiClientBuilderdateFormat(DateFormat dateFormat)Set the date format used to parse/format date parameters.ApiClientBuilderdateTimeFormatter(DateTimeFormatter dateTimeFormatter)Set the date time formatter used to parse/format date parameters.ApiClientBuilderdefaultCookie(String name, String value)Add a default cookie.ApiClientBuilderdefaultCookieMap(Map<String,String> defaultCookieMap)Sets the default cookies applied to each request.ApiClientBuilderdefaultHeader(String name, String value)Add a default header.ApiClientBuilderdefaultHeaderMap(Map<String,String> defaultHeaderMap)Sets the default headers applied to each request.ApiClientBuilderdefaultPropertyMap(Map<String,Object> defaultPropertyMap)Sets the default properties applied to each request.ApiClientBuilderpassword(String password)Helper method to set the password for the first HTTP basic authentication.ApiClientBuilderuserAgent(String userAgent)Set the User-Agent header's value (by adding to the default header map).ApiClientBuilderusername(String username)Helper method to set the username for the first HTTP basic authentication.
-
-
-
Constructor Detail
-
ApiClientBuilder
public ApiClientBuilder(JaxRsAdapter jaxRsAdapter)
Creates a new builder for configuring an API client.- Parameters:
jaxRsAdapter- The adapter to use for integrating Jax RS.
-
-
Method Detail
-
buildClient
public ApiClient buildClient()
Creates a new client. Usually you can usebuildBundle()unless you need access to low-level methods of the client.- Returns:
- A new immutable client instance with the current settings. Modifications to this builder DO NOT affect the built client.
-
buildBundle
public ApiBundle buildBundle()
Creates a bundle with all APIs. Usually you should prefer this overbuildClient()unless you need to work with the client directly.- Returns:
- A new immutable API bundle instance with the current settings. Modifications to this builder DO NOT affect the built bundle.
-
dateFormat
public ApiClientBuilder dateFormat(DateFormat dateFormat)
Set the date format used to parse/format date parameters.- Parameters:
dateFormat- a date format used to parse/format date parameters- Returns:
- This builder instance for chaining method calls.
-
dateTimeFormatter
public ApiClientBuilder dateTimeFormatter(DateTimeFormatter dateTimeFormatter)
Set the date time formatter used to parse/format date parameters.- Parameters:
dateTimeFormatter- A date time formatter used to parse/format date parameters.- Returns:
- This builder instance for chaining method calls.
-
userAgent
public ApiClientBuilder userAgent(String userAgent)
Set the User-Agent header's value (by adding to the default header map).- Parameters:
userAgent- the User-Agent header value- Returns:
- This builder instance for chaining method calls.
-
defaultHeaderMap
public ApiClientBuilder defaultHeaderMap(Map<String,String> defaultHeaderMap)
Sets the default headers applied to each request.- Parameters:
defaultHeaderMap- The new headers to use- Returns:
- This builder instance for chaining method calls.
-
defaultPropertyMap
public ApiClientBuilder defaultPropertyMap(Map<String,Object> defaultPropertyMap)
Sets the default properties applied to each request.- Parameters:
defaultPropertyMap- The new default properties to use- Returns:
- This builder instance for chaining method calls.
-
defaultCookieMap
public ApiClientBuilder defaultCookieMap(Map<String,String> defaultCookieMap)
Sets the default cookies applied to each request.- Parameters:
defaultCookieMap- The new cookies to use.- Returns:
- This builder instance for chaining method calls.
-
defaultHeader
public ApiClientBuilder defaultHeader(String name, String value)
Add a default header.- Parameters:
name- The header's namevalue- The header's value- Returns:
- This builder instance for chaining method calls.
-
defaultCookie
public ApiClientBuilder defaultCookie(String name, String value)
Add a default cookie.- Parameters:
name- The cookies's namevalue- The cookies's value- Returns:
- This builder instance for chaining method calls.
-
basePath
public ApiClientBuilder basePath(String basePath)
Sets the base path for all API endpoints.- Parameters:
basePath- Base path with the URL of the API.- Returns:
- This builder instance for chaining method calls.
-
apiCallInterceptor
public ApiClientBuilder apiCallInterceptor(ApiCallInterceptor interceptor)
Sets the optional interceptor for reacting to and modifying API calls.- Parameters:
interceptor- The interceptor to use for API calls.- Returns:
- This builder instance for chaining method calls.
-
username
public ApiClientBuilder username(String username)
Helper method to set the username for the first HTTP basic authentication.- Parameters:
username- the username- Returns:
- This builder instance for chaining method calls.
-
password
public ApiClientBuilder password(String password)
Helper method to set the password for the first HTTP basic authentication.- Parameters:
password- the password- Returns:
- This builder instance for chaining method calls.
-
bearerToken
public ApiClientBuilder bearerToken(String bearerToken)
Helper method to set the bearer token for the first HTTP basic authentication.- Parameters:
bearerToken- the bearer token to use.- Returns:
- This builder instance for chaining method calls.
-
apiKey
public ApiClientBuilder apiKey(String apiKey)
Helper method to set API key value for the first API key authentication.- Parameters:
apiKey- the API key- Returns:
- This builder instance for chaining method calls.
-
apiKeyPrefix
public ApiClientBuilder apiKeyPrefix(String apiKeyPrefix)
Helper method to set API key prefix for the first API key authentication.- Parameters:
apiKeyPrefix- the API key prefix- Returns:
- This builder instance for chaining method calls.
-
-