public static class CMAClient.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
CMAClient |
build() |
okhttp3.OkHttpClient.Builder |
defaultCoreCallFactoryBuilder() |
okhttp3.OkHttpClient.Builder |
defaultUploadCallFactoryBuilder() |
CMAClient.Builder |
setAccessToken(java.lang.String accessToken)
Sets the access token for this client.
|
CMAClient.Builder |
setApplication(java.lang.String name,
java.lang.String version)
Tell the client which application this is.
|
CMAClient.Builder |
setCallbackExecutor(java.util.concurrent.Executor executor)
Sets the executor to use when invoking asynchronous callbacks.
|
CMAClient.Builder |
setCoreCallFactory(okhttp3.Call.Factory callFactory)
Sets a custom HTTP call factory for core modules.
|
CMAClient.Builder |
setCoreEndpoint(java.lang.String remoteUrl)
Overrides the default remote URL for core modules.
|
CMAClient.Builder |
setEnvironmentId(java.lang.String environmentId)
Configure which environment to use if none is specified.
|
CMAClient.Builder |
setIntegration(java.lang.String name,
java.lang.String version)
Which integration is used.
|
CMAClient.Builder |
setLogger(Logger logger)
Sets the logger to be used for logging all network requests or all application requests.
|
CMAClient.Builder |
setLogLevel(Logger.Level logLevel)
Sets the log level for this client.
|
CMAClient.Builder |
setRateLimitListener(RateLimitsListener listener)
Add a listener to receive information about rate limits.
|
CMAClient.Builder |
setSpaceId(java.lang.String spaceId)
Configure which space to use if none is specified.
|
CMAClient.Builder |
setUploadCallFactory(okhttp3.Call.Factory callFactory)
Sets a custom HTTP call factory for the upload module.
|
CMAClient.Builder |
setUploadEndpoint(java.lang.String remoteUrl)
Overrides the remote URL for upload module.
|
public CMAClient.Builder setCoreEndpoint(java.lang.String remoteUrl)
remoteUrl
- String representing the remote URLCMAClient.Builder
instancesetUploadEndpoint(String)
public CMAClient.Builder setUploadEndpoint(java.lang.String remoteUrl)
remoteUrl
- String representing the remote URLCMAClient.Builder
instancesetCoreEndpoint(String)
public CMAClient.Builder setAccessToken(java.lang.String accessToken)
accessToken
- access tokenCMAClient.Builder
instancepublic CMAClient.Builder setSpaceId(java.lang.String spaceId)
spaceId
- the id of the space to be used.CMAClient.Builder
instance.ModuleEntries.fetchAll()
public CMAClient.Builder setEnvironmentId(java.lang.String environmentId)
environmentId
- the id of the environment to be used.CMAClient.Builder
instance.ModuleEntries.fetchAll()
public CMAClient.Builder setCoreCallFactory(okhttp3.Call.Factory callFactory)
Please also add a AuthorizationHeaderInterceptor
ContentTypeInterceptor
if
you are using a custom call factory to ensure properly setup http headers.
callFactory
- Call.Factory
instanceBuilder
instancepublic CMAClient.Builder setUploadCallFactory(okhttp3.Call.Factory callFactory)
callFactory
- Call.Factory
instanceBuilder
instanceCall.Factory for needed interceptors.
public CMAClient.Builder setCallbackExecutor(java.util.concurrent.Executor executor)
executor
- Executor on which any CMACallback
methods 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.Builder
instancepublic CMAClient.Builder setLogger(Logger logger)
logger
- Logger
Builder
instancepublic CMAClient.Builder setLogLevel(Logger.Level logLevel)
logLevel
- Logger.Level
valueBuilder
instancepublic CMAClient.Builder setApplication(java.lang.String name, java.lang.String version)
It might be used for internal tracking of Contentfuls tools.
name
- the name of the app.version
- the version in semver of the app.public CMAClient.Builder setIntegration(java.lang.String name, java.lang.String version)
name
- name of the integration.version
- the version of the integration.public CMAClient.Builder setRateLimitListener(RateLimitsListener listener)
listener
- a listener interface to be informed, as soon as a rate limit header is found.public CMAClient build()
CMAClient
out of this CMAClient.Builder
.public okhttp3.OkHttpClient.Builder defaultCoreCallFactoryBuilder()
public okhttp3.OkHttpClient.Builder defaultUploadCallFactoryBuilder()
Copyright © 2019 Contentful, GmbH.. All Rights Reserved.