Enum ZendeskConfig
- java.lang.Object
-
- java.lang.Enum<ZendeskConfig>
-
- com.zendesk.sdk.network.impl.ZendeskConfig
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<ZendeskConfig>
public enum ZendeskConfig extends java.lang.Enum<ZendeskConfig>
Configuration class for Zendesk initialization. Call this first to configure Zendesk to use the correct credentials and Zendesk URL.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description INSTANCE
-
Field Summary
Fields Modifier and Type Field and Description static int
HEADER_SUFFIX_MAX_LENGTH
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
disablePush(java.lang.String identifier, <any> callback)
Unregister the device for push notifications.void
enablePushWithIdentifier(java.lang.String identifier, <any> callback)
Register the device for push notifications with the given identifier.void
enablePushWithUAChannelId(java.lang.String identifier, <any> callback)
Register the device for push notifications with the given UrbanAirship channel id.java.lang.String
getApplicationId()
Gets the application id.java.util.List<CustomField>
getCustomFields()
Gets the custom fieldsSafeMobileSettings
getMobileSettings()
Gets the SDK settings.java.lang.String
getOauthClientId()
Gets the oauth client id.SdkOptions
getSdkOptions()
Gets the SdkOptions.java.lang.Long
getTicketFormId()
Gets the ticket form IdZendeskTracker
getTracker()
Gets the current tracker.java.lang.String
getZendeskUrl()
Gets the Zendesk URL.void
init(Context context, java.lang.String zendeskUrl, java.lang.String applicationId, java.lang.String oauthClientId)
Initialises the Zendesk SDKboolean
isAuthenticationAvailable()
Determines whether the SDK has been configured to allow authentication.boolean
isCoppaEnabled()
Gets whether we are in COPPA mode or not.boolean
isInitialized()
Gets whetherZendeskConfig.init(Context, String, String, String)
was called or not.ProviderStore
provider()
Gets aProviderStore
for accessing all available SDK Providers.void
setCoppaEnabled(boolean enabled)
Sets whether we should enable COPPA mode.void
setCustomFields(java.util.List<CustomField> customFields)
Set a List of typeCustomField
to be used on request submission until unset See Mobile SDK documentation for more information on setting this.void
setDeviceLocale(java.util.Locale deviceLocale)
Sets the preferred device locale.void
setIdentity(Identity identity)
Sets the identity which the SDK uses to access and create resourcesvoid
setSdkOptions(SdkOptions sdkOptions)
Sets the options for the sdk.void
setTicketFormId(java.lang.Long ticketFormId)
Set a ticket form id which will be included in all request submission until unset See Mobile SDK documentation for more information on setting this.StorageStore
storage()
Gets aStorageModule
for accessing all avaiable storages.static ZendeskConfig
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ZendeskConfig[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final ZendeskConfig INSTANCE
-
-
Field Detail
-
HEADER_SUFFIX_MAX_LENGTH
public static final int HEADER_SUFFIX_MAX_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static ZendeskConfig[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ZendeskConfig c : ZendeskConfig.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ZendeskConfig valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
init
public void init(Context context, java.lang.String zendeskUrl, java.lang.String applicationId, java.lang.String oauthClientId)
Initialises the Zendesk SDKUse this constructor when you have enabled the Conversations feature. This requires some authentication settings. Your zendeskUrl must be your full Zendesk URL in the form of https://{subdomain.zendesk.com You should replace {subdomain} with your own subdomain.
As of SDK version, 1.5.0.1 , this constructor will no longer start a background service to poll the server for updates to
SdkSettings
. A lazy loading strategy is applied to all Provider calls instead, to ensure that settings are always present before a call to Zendesk.- Parameters:
context
- A context, used for initialising stored settingszendeskUrl
- The full URL of your Zendesk instance, https://{subdomain}.zendesk.comapplicationId
- The application id of your SDK app, as found in the web interfaceoauthClientId
- The oauth client id that was supplied when you set up oauth in the web interface- Throws:
ConfigurationRuntimeException
- if context is null, the zendeskUrl is invalid or if the application or client id is not supplied.
-
isInitialized
public boolean isInitialized()
Gets whetherZendeskConfig.init(Context, String, String, String)
was called or not.- Returns:
- true if init was successfully called, false otherwise.
-
getZendeskUrl
public java.lang.String getZendeskUrl()
Gets the Zendesk URL.This is the URL in the form of https://{subdomain}.zendesk.com
- Returns:
- The Zendesk URL
-
getOauthClientId
public java.lang.String getOauthClientId()
Gets the oauth client id.- Returns:
- The oauth client id
-
getMobileSettings
public SafeMobileSettings getMobileSettings()
Gets the SDK settings.This method will never return a null
RateMyAppSettings
. This is because it is only a container for the actual settings and it simplifies client code as they don't have to null check this container.- Returns:
- the SDK settings wrapped in a
SafeMobileSettings
.
-
isAuthenticationAvailable
public boolean isAuthenticationAvailable()
Determines whether the SDK has been configured to allow authentication.Certain UI features of the SDK such as
RequestListFragment
requires that anIdentity
has been initialised by callingZendeskConfig.setIdentity(Identity)
- Returns:
- true if an end user is available, false otherwise
-
getApplicationId
public java.lang.String getApplicationId()
Gets the application id.The application id is used to retrieve
MobileSettings
from your Zendesk instance.- Returns:
- The application id or null if it was not previously set.
-
setIdentity
public void setIdentity(Identity identity)
Sets the identity which the SDK uses to access and create resources- Parameters:
identity
- Identity that the SDK will identify as
-
setCustomFields
public void setCustomFields(java.util.List<CustomField> customFields)
Set a List of typeCustomField
to be used on request submission until unset See Mobile SDK documentation for more information on setting this.- Parameters:
customFields
- List contain CustomField objects which will be included as part of the request
-
getCustomFields
public java.util.List<CustomField> getCustomFields()
Gets the custom fields- Returns:
- the list of custom fields or null if they have not been set
-
setTicketFormId
public void setTicketFormId(java.lang.Long ticketFormId)
Set a ticket form id which will be included in all request submission until unset See Mobile SDK documentation for more information on setting this.- Parameters:
ticketFormId
- Long of ticket form id
-
getTicketFormId
public java.lang.Long getTicketFormId()
Gets the ticket form Id- Returns:
- the ticket form id or null if it has not been set
-
setDeviceLocale
public void setDeviceLocale(java.util.Locale deviceLocale)
Sets the preferred device locale.This will be the locale that is preferred when requesting content from your Zendesk. Please note that the preferred locale may not be available in your Zendesk and the actual locale that is used will be specified in
HelpCenterSettings.getLocale()
- Parameters:
deviceLocale
- the preferred device locale
-
setCoppaEnabled
public void setCoppaEnabled(boolean enabled)
Sets whether we should enable COPPA mode.- Parameters:
enabled
- true to enable COPPA mode, false otherwise.
-
isCoppaEnabled
public boolean isCoppaEnabled()
Gets whether we are in COPPA mode or not.- Returns:
- true if COPPA mode is enabled, false otherwise.
-
enablePushWithIdentifier
public void enablePushWithIdentifier(java.lang.String identifier, <any> callback)
Register the device for push notifications with the given identifier.- Parameters:
identifier
- The device identifiercallback
- Callback that will deliver aPushRegistrationResponse
orErrorResponse
-
enablePushWithUAChannelId
public void enablePushWithUAChannelId(java.lang.String identifier, <any> callback)
Register the device for push notifications with the given UrbanAirship channel id.- Parameters:
identifier
- The UrbanAirship channel identifiercallback
- Callback that will deliver aPushRegistrationResponse
orErrorResponse
-
disablePush
public void disablePush(java.lang.String identifier, <any> callback)
Unregister the device for push notifications.- Parameters:
identifier
- The device identifiercallback
- Callback that will deliver aretrofit2.Response
orErrorResponse
-
getSdkOptions
public SdkOptions getSdkOptions()
Gets the SdkOptions.If no options have been explicitly set it will return DefaultSdkOptions
- Returns:
- The current SdkOptions
-
setSdkOptions
public void setSdkOptions(SdkOptions sdkOptions)
Sets the options for the sdk. Generally you do not have to call this.- Parameters:
sdkOptions
- The options to set.
-
provider
public ProviderStore provider()
Gets aProviderStore
for accessing all available SDK Providers.- Returns:
- an instance of
ProviderStore
-
storage
public StorageStore storage()
Gets aStorageModule
for accessing all avaiable storages.- Returns:
- an instance of
StorageModule
-
getTracker
public ZendeskTracker getTracker()
Gets the current tracker.- Returns:
- The tracker, or the default tracker if no tracker was installed
-
-