Package com.contentful.java.cma
Class CMAClient.Builder
- java.lang.Object
-
- com.contentful.java.cma.CMAClient.Builder
-
- Enclosing class:
- CMAClient
public static class CMAClient.Builder extends java.lang.ObjectBuilder.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMAClientbuild()okhttp3.OkHttpClient.BuilderdefaultCoreCallFactoryBuilder()okhttp3.OkHttpClient.BuilderdefaultUploadCallFactoryBuilder()CMAClient.BuildersetAccessToken(java.lang.String accessToken)Sets the access token for this client.CMAClient.BuildersetApplication(java.lang.String name, java.lang.String version)Tell the client which application this is.CMAClient.BuildersetCallbackExecutor(java.util.concurrent.Executor executor)Sets the executor to use when invoking asynchronous callbacks.CMAClient.BuildersetCoreCallFactory(okhttp3.Call.Factory callFactory)Sets a custom HTTP call factory for core modules.CMAClient.BuildersetCoreEndpoint(java.lang.String remoteUrl)Overrides the default remote URL for core modules.CMAClient.BuildersetEnvironmentId(java.lang.String environmentId)Configure which environment to use if none is specified.CMAClient.BuildersetIntegration(java.lang.String name, java.lang.String version)Which integration is used.CMAClient.BuildersetLogger(Logger logger)Sets the logger to be used for logging all network requests or all application requests.CMAClient.BuildersetLogLevel(Logger.Level logLevel)Sets the log level for this client.CMAClient.BuildersetRateLimitListener(RateLimitsListener listener)Add a listener to receive information about rate limits.CMAClient.BuildersetSpaceId(java.lang.String spaceId)Configure which space to use if none is specified.CMAClient.BuildersetUploadCallFactory(okhttp3.Call.Factory callFactory)Sets a custom HTTP call factory for the upload module.CMAClient.BuildersetUploadEndpoint(java.lang.String remoteUrl)Overrides the remote URL for upload module.
-
-
-
Method Detail
-
setCoreEndpoint
public CMAClient.Builder setCoreEndpoint(java.lang.String remoteUrl)
Overrides the default remote URL for core modules.- Parameters:
remoteUrl- String representing the remote URL- Returns:
- this
CMAClient.Builderinstance - See Also:
setUploadEndpoint(String)
-
setUploadEndpoint
public CMAClient.Builder setUploadEndpoint(java.lang.String remoteUrl)
Overrides the remote URL for upload module.- Parameters:
remoteUrl- String representing the remote URL- Returns:
- this
CMAClient.Builderinstance - See Also:
setCoreEndpoint(String)
-
setAccessToken
public CMAClient.Builder setAccessToken(java.lang.String accessToken)
Sets the access token for this client.- Parameters:
accessToken- access token- Returns:
- this
CMAClient.Builderinstance
-
setSpaceId
public CMAClient.Builder setSpaceId(java.lang.String spaceId)
Configure which space to use if none is specified.- Parameters:
spaceId- the id of the space to be used.- Returns:
- this
CMAClient.Builderinstance. - See Also:
ModuleEntries.fetchAll()
-
setEnvironmentId
public CMAClient.Builder setEnvironmentId(java.lang.String environmentId)
Configure which environment to use if none is specified.- Parameters:
environmentId- the id of the environment to be used.- Returns:
- this
CMAClient.Builderinstance. - See Also:
ModuleEntries.fetchAll()
-
setCoreCallFactory
public CMAClient.Builder setCoreCallFactory(okhttp3.Call.Factory callFactory)
Sets a custom HTTP call factory for core modules.Please also add a
AuthorizationHeaderInterceptorContentTypeInterceptorif you are using a custom call factory to ensure properly setup http headers.- Parameters:
callFactory-Call.Factoryinstance- Returns:
- this
Builderinstance
-
setUploadCallFactory
public CMAClient.Builder setUploadCallFactory(okhttp3.Call.Factory callFactory)
Sets a custom HTTP call factory for the upload module.- Parameters:
callFactory-Call.Factoryinstance- Returns:
- this
Builderinstance - See Also:
Call.Factory for needed interceptors.
-
setCallbackExecutor
public CMAClient.Builder setCallbackExecutor(java.util.concurrent.Executor executor)
Sets the executor to use when invoking asynchronous callbacks.- Parameters:
executor- Executor on which anyCMACallbackmethods will be invoked. This defaults to execute on the main thread for Android projects. For non-Android projects this defaults to the same thread of the HTTP client.- Returns:
- this
Builderinstance
-
setLogger
public CMAClient.Builder setLogger(Logger logger)
Sets the logger to be used for logging all network requests or all application requests.- Parameters:
logger-Logger- Returns:
- this
Builderinstance
-
setLogLevel
public CMAClient.Builder setLogLevel(Logger.Level logLevel)
Sets the log level for this client.- Parameters:
logLevel-Logger.Levelvalue- Returns:
- this
Builderinstance
-
setApplication
public CMAClient.Builder setApplication(java.lang.String name, java.lang.String version)
Tell the client which application this is.It might be used for internal tracking of Contentfuls tools.
- Parameters:
name- the name of the app.version- the version in semver of the app.- Returns:
- this builder for chaining.
-
setIntegration
public CMAClient.Builder setIntegration(java.lang.String name, java.lang.String version)
Which integration is used.- Parameters:
name- name of the integration.version- the version of the integration.- Returns:
- this builder for chaining.
-
setRateLimitListener
public CMAClient.Builder setRateLimitListener(RateLimitsListener listener)
Add a listener to receive information about rate limits.- Parameters:
listener- a listener interface to be informed, as soon as a rate limit header is found.- Returns:
- this builder for chaining.
-
build
public CMAClient build()
- Returns:
- a
CMAClientout of thisCMAClient.Builder.
-
defaultCoreCallFactoryBuilder
public okhttp3.OkHttpClient.Builder defaultCoreCallFactoryBuilder()
- Returns:
- default core call factory builder, used by the sdk.
-
defaultUploadCallFactoryBuilder
public okhttp3.OkHttpClient.Builder defaultUploadCallFactoryBuilder()
- Returns:
- default update api call factory builder, used by the sdk.
-
-