public class ModuleLocales
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ModuleLocales.Async
Handler for asynchronous requests.
|
Constructor and Description |
---|
ModuleLocales(retrofit2.Retrofit retrofit,
java.util.concurrent.Executor callbackExecutor,
java.lang.String spaceId,
java.lang.String environmentId,
boolean environmentIdConfigured)
Create a new locale module.
|
Modifier and Type | Method and Description |
---|---|
ModuleLocales.Async |
async()
Use all functionalities of this module asynchronously.
|
CMALocale |
create(CMALocale locale)
Create a new locale in the configured space and environment.
|
CMALocale |
create(java.lang.String spaceId,
java.lang.String environmentId,
CMALocale locale)
Create a new locale in the given space and environment.
|
protected ServiceLocales |
createService(retrofit2.Retrofit retrofit)
Initialize retrofit with the current service.
|
int |
delete(CMALocale locale)
Delete the given locale instance.
|
CMAArray<CMALocale> |
fetchAll()
Fetch all locales of the configured space.
|
CMAArray<CMALocale> |
fetchAll(java.lang.String spaceId,
java.lang.String environmentId)
Fetch all locales of the given space and environment.
|
CMALocale |
fetchOne(java.lang.String localeId)
Fetches one locale by its id using the configured space and environment.
|
CMALocale |
fetchOne(java.lang.String spaceId,
java.lang.String environmentId,
java.lang.String localeId)
Fetches one locale by its id from the given space and environment.
|
CMALocale |
update(CMALocale locale)
Update the given locale instance on Contentful.
|
public ModuleLocales(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)
retrofit
- the retrofit instance to be used to create the service.callbackExecutor
- to tell on which thread it should run.spaceId
- the space to be used when not given.environmentId
- the environment to be used when not given.environmentIdConfigured
- internal helper to see if environment was set.protected ServiceLocales createService(retrofit2.Retrofit retrofit)
retrofit
- the instance to use the service with.public ModuleLocales.Async async()
public CMAArray<CMALocale> fetchAll()
java.lang.IllegalArgumentException
- if configured space id is null.java.lang.IllegalArgumentException
- if configured environment id is null.CMAClient.Builder.setSpaceId(String)
,
CMAClient.Builder.setEnvironmentId(String)
public CMAArray<CMALocale> fetchAll(java.lang.String spaceId, java.lang.String environmentId)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space identifier, identifying the space.environmentId
- the environment identifier, identifying the environment.java.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if environmentId is null.public CMALocale fetchOne(java.lang.String localeId)
localeId
- the id of the locale to be found.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if locale id is null.CMAClient.Builder.setSpaceId(String)
,
CMAClient.Builder.setEnvironmentId(String)
public CMALocale fetchOne(java.lang.String spaceId, java.lang.String environmentId, java.lang.String localeId)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space this environment is hosted in.environmentId
- the environment this locale is hosted in.localeId
- the id of the locale to be found.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if environment id is null.java.lang.IllegalArgumentException
- if locale id is null.public CMALocale create(CMALocale locale)
locale
- the new locale to be created.java.lang.IllegalArgumentException
- if the configured space id is null.java.lang.IllegalArgumentException
- if the configured locale is null.CMAClient.Builder.setSpaceId(String)
,
CMAClient.Builder.setEnvironmentId(String)
public CMALocale create(java.lang.String spaceId, java.lang.String environmentId, CMALocale locale)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space id hosting the environment.environmentId
- the environment id to host the locale.locale
- the new locale to be created.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if environment is null.java.lang.IllegalArgumentException
- if locale is null.public CMALocale update(CMALocale locale)
Please make sure that the instance provided is fetched from Contentful. Otherwise you will get an exception thrown.
locale
- the locale fetched from Contentful, updated by caller, to be updated.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if locale is null.java.lang.IllegalArgumentException
- if locale id is null.java.lang.IllegalArgumentException
- if locale does not have a version attached.public int delete(CMALocale locale)
Please make sure that the instance provided is fetched from Contentful. Otherwise you will get an exception thrown.
locale
- the locale fetched from Contentful, updated by caller, to be deleted.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if locale id is null.Copyright © 2019 Contentful, GmbH.. All Rights Reserved.