Package com.contentful.java.cma
Class ModuleEnvironments
- java.lang.Object
-
- com.contentful.java.cma.ModuleEnvironments
-
public class ModuleEnvironments extends java.lang.ObjectEnvironments Module.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classModuleEnvironments.AsyncAsync module.
-
Constructor Summary
Constructors Constructor Description ModuleEnvironments(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)Create environments module.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ModuleEnvironments.Asyncasync()CMAEnvironmentbranch(CMAEnvironment sourceEnvironment, CMAEnvironment newEnvironment)Deprecated.This method has been renamed toclone(CMAEnvironment, CMAEnvironment).CMAEnvironmentclone(CMAEnvironment sourceEnvironment, CMAEnvironment newEnvironment)Create an environment based on the content of another environment.CMAEnvironmentcreate(CMAEnvironment environment)Create an environment in the configured space.CMAEnvironmentcreate(java.lang.String spaceId, CMAEnvironment environment)Create an environment using the given space id.protected com.contentful.java.cma.ServiceEnvironmentscreateService(retrofit2.Retrofit retrofit)java.lang.Integerdelete(CMAEnvironment environment)Delete an environment.CMAArray<CMAEnvironment>fetchAll()Fetch all environments of the configured space.CMAArray<CMAEnvironment>fetchAll(java.lang.String spaceId)Fetch all environments of the given space.CMAEnvironmentfetchOne(java.lang.String environmentId)Fetch an environment with a givenenvironmentIdfrom the configured space.CMAEnvironmentfetchOne(java.lang.String spaceId, java.lang.String environmentId)Fetch an environment with a givenenvironmentIdand space.CMAEnvironmentupdate(CMAEnvironment environment)Update an environment.
-
-
-
Constructor Detail
-
ModuleEnvironments
public ModuleEnvironments(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)Create environments module.- Parameters:
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.
-
-
Method Detail
-
createService
protected com.contentful.java.cma.ServiceEnvironments createService(retrofit2.Retrofit retrofit)
-
create
public CMAEnvironment create(CMAEnvironment environment)
Create an environment in the configured space.- Parameters:
environment- CMAEnvironment- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if the configured space id is null.java.lang.IllegalArgumentException- if environment is null.- See Also:
CMAClient.Builder.setSpaceId(String)
-
create
public CMAEnvironment create(java.lang.String spaceId, CMAEnvironment environment)
Create an environment using the given space id.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String).- Parameters:
spaceId- the id of the space to be usedenvironment- CMAEnvironment- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if space id is null.java.lang.IllegalArgumentException- if environment is null.
-
clone
public CMAEnvironment clone(CMAEnvironment sourceEnvironment, CMAEnvironment newEnvironment)
Create an environment based on the content of another environment.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String).- Parameters:
sourceEnvironment- the environment to be taken as a source of branchingnewEnvironment- the environment to be created, based on the source.- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if sourceEnvironment is null.java.lang.IllegalArgumentException- if newEnvironment is null.java.lang.IllegalArgumentException- if the space of the source environment is not set.
-
branch
@Deprecated public CMAEnvironment branch(CMAEnvironment sourceEnvironment, CMAEnvironment newEnvironment)
Deprecated.This method has been renamed toclone(CMAEnvironment, CMAEnvironment). It will be removed in the next major release.Create an environment based on the content of another environment.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String).- Parameters:
sourceEnvironment- the environment to be taken as a source of branchingnewEnvironment- the environment to be created, based on the source.- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if sourceEnvironment is null.java.lang.IllegalArgumentException- if newEnvironment is null.java.lang.IllegalArgumentException- if the space of the source environment is not set.
-
delete
public java.lang.Integer delete(CMAEnvironment environment)
Delete an environment.- Parameters:
environment- the environment to be deleted- Returns:
- Integer representing the result (204, or an error code)
- Throws:
java.lang.IllegalArgumentException- if environment's space id is null.java.lang.IllegalArgumentException- if environment's id is null.java.lang.IllegalArgumentException- if environment's version is null.
-
fetchAll
public CMAArray<CMAEnvironment> fetchAll()
Fetch all environments of the configured space.- Returns:
CMAArrayresult instance- Throws:
java.lang.IllegalArgumentException- if configured space id is null.- See Also:
CMAClient.Builder.setSpaceId(String)
-
fetchAll
public CMAArray<CMAEnvironment> fetchAll(java.lang.String spaceId)
Fetch all environments of the given space.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String).- Parameters:
spaceId- space ID- Returns:
CMAArrayresult instance- Throws:
java.lang.IllegalArgumentException- if environment's space id is null.
-
fetchOne
public CMAEnvironment fetchOne(java.lang.String environmentId)
Fetch an environment with a givenenvironmentIdfrom the configured space.- Parameters:
environmentId- environment ID- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if the configured space id is null.java.lang.IllegalArgumentException- if environment's id is null.- See Also:
CMAClient.Builder.setSpaceId(String)
-
fetchOne
public CMAEnvironment fetchOne(java.lang.String spaceId, java.lang.String environmentId)
Fetch an environment with a givenenvironmentIdand space.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String).- Parameters:
spaceId- space IDenvironmentId- environment ID- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if space id is null.java.lang.IllegalArgumentException- if environment's id is null.
-
update
public CMAEnvironment update(CMAEnvironment environment)
Update an environment.- Parameters:
environment- environment- Returns:
CMAEnvironmentresult instance- Throws:
java.lang.IllegalArgumentException- if environment is null.java.lang.IllegalArgumentException- if environment's name is null.java.lang.IllegalArgumentException- if environment's space id is null.java.lang.IllegalArgumentException- if environment's environment id is null.java.lang.IllegalArgumentException- if environment's version is null.
-
async
public ModuleEnvironments.Async async()
- Returns:
- a module with a set of asynchronous methods.
-
-