Class ModuleContentTypes
- java.lang.Object
-
- com.contentful.java.cma.ModuleContentTypes
-
public class ModuleContentTypes extends java.lang.ObjectContent Types Module.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classModuleContentTypes.AsyncAsync module.
-
Constructor Summary
Constructors Constructor Description ModuleContentTypes(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)Create content types module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleContentTypes.Asyncasync()CMAContentTypecreate(CMAContentType contentType)Create a new Content Type in the configured space and environment.CMAContentTypecreate(java.lang.String spaceId, java.lang.String environmentId, CMAContentType contentType)Create a new Content Type in an Environment.protected com.contentful.java.cma.ServiceContentTypescreateService(retrofit2.Retrofit retrofit)java.lang.Integerdelete(CMAContentType contentType)Delete a Content Type.CMAArray<CMAContentType>fetchAll()Fetch all Content Types from the configured space and environment, using default query parameter.CMAArray<CMAContentType>fetchAll(java.lang.String spaceId, java.lang.String environmentId)Fetch all Content Types from an Environment, using default query parameter.CMAArray<CMAContentType>fetchAll(java.lang.String spaceId, java.lang.String environmentId, java.util.Map<java.lang.String,java.lang.String> query)Fetch all Content Types from a Space with query parameters.CMAArray<CMAContentType>fetchAll(java.util.Map<java.lang.String,java.lang.String> query)Fetch all Content Types from the configured space and environment, using default query parameter.CMAArray<CMASnapshot>fetchAllSnapshots(CMAContentType contentType)Fetch all snapshots of this content type.CMAContentTypefetchOne(java.lang.String contentTypeId)Fetch a Content Type with the givencontentTypeIdfrom the configured environment and space.CMAContentTypefetchOne(java.lang.String spaceId, java.lang.String environmentId, java.lang.String contentTypeId)Fetch a Content Type with the givencontentTypeIdfrom a given space environment combination.CMASnapshotfetchOneSnapshot(CMAContentType contentType, java.lang.String snapshotId)Fetch a specific snapshot of this content type.CMAContentTypepublish(CMAContentType contentType)Publish a Content Type.CMAContentTypeunPublish(CMAContentType contentType)Un-Publish a Content Type.CMAContentTypeupdate(CMAContentType contentType)Update a Content Type.
-
-
-
Constructor Detail
-
ModuleContentTypes
public ModuleContentTypes(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)Create content types 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.ServiceContentTypes createService(retrofit2.Retrofit retrofit)
-
create
public CMAContentType create(CMAContentType contentType)
Create a new Content Type in the configured space and environment.In case the given
contentTypehas an ID associated with it, that ID will be used, otherwise the server will auto-generate an ID that will be contained in the response upon success.- Parameters:
contentType- Content Type- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if configured space id is null.java.lang.IllegalArgumentException- if configured environment id is null.java.lang.IllegalArgumentException- if contentType is null.- See Also:
CMAClient.Builder.setSpaceId(String),CMAClient.Builder.setEnvironmentId(String)
-
create
public CMAContentType create(java.lang.String spaceId, java.lang.String environmentId, CMAContentType contentType)
Create a new Content Type in an Environment.In case the given
contentTypehas an ID associated with it, that ID will be used, otherwise the server will auto-generate an ID that will be contained in the response upon success.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)andCMAClient.Builder.setEnvironmentId(String).- Parameters:
spaceId- Space IDenvironmentId- Environment IDcontentType- Content Type- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if spaceId is null.java.lang.IllegalArgumentException- if environmentId is null.java.lang.IllegalArgumentException- if contentType is null.
-
delete
public java.lang.Integer delete(CMAContentType contentType)
Delete a Content Type.- Parameters:
contentType- Content Type- Returns:
- Integer representing the result of the operation
- Throws:
java.lang.IllegalArgumentException- if spaceId is null.java.lang.IllegalArgumentException- if contentTypeId is null.
-
fetchAll
public CMAArray<CMAContentType> fetchAll()
Fetch all Content Types from the configured space and environment, using default query parameter.This fetch uses the default parameter defined in
DefaultQueryParameter.FETCH- Returns:
CMAArrayresult instance- Throws:
java.lang.IllegalArgumentException- if spaceId is null.- See Also:
CMAClient.Builder.setSpaceId(String),CMAClient.Builder.setEnvironmentId(String)
-
fetchAll
public CMAArray<CMAContentType> fetchAll(java.util.Map<java.lang.String,java.lang.String> query)
Fetch all Content Types from the configured space and environment, using default query parameter.This fetch uses the default parameter defined in
DefaultQueryParameter.FETCH- Parameters:
query- to specify to narrow down results.- Returns:
CMAArrayresult instance- Throws:
java.lang.IllegalArgumentException- if spaceId is null.- See Also:
CMAClient.Builder.setSpaceId(String),CMAClient.Builder.setEnvironmentId(String)
-
fetchAll
public CMAArray<CMAContentType> fetchAll(java.lang.String spaceId, java.lang.String environmentId)
Fetch all Content Types from an Environment, using default query parameter.This fetch uses the default parameter defined in
DefaultQueryParameter.FETCHThis method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)andCMAClient.Builder.setEnvironmentId(String).- Parameters:
spaceId- Space IDenvironmentId- Environment ID- Returns:
CMAArrayresult instance- Throws:
java.lang.IllegalArgumentException- if spaceId is null.
-
fetchAll
public CMAArray<CMAContentType> fetchAll(java.lang.String spaceId, java.lang.String environmentId, java.util.Map<java.lang.String,java.lang.String> query)
Fetch all Content Types from a Space with query parameters.- Parameters:
spaceId- Space IDenvironmentId- Environment IDquery- Query to narrow down the content_types to be searched for- Returns:
CMAArrayresult instance- Throws:
java.lang.IllegalArgumentException- if spaceId is null.java.lang.IllegalArgumentException- if environmentId is null.
-
fetchOne
public CMAContentType fetchOne(java.lang.String contentTypeId)
Fetch a Content Type with the givencontentTypeIdfrom the configured environment and space.- Parameters:
contentTypeId- Content Type ID- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if configured space id is null.java.lang.IllegalArgumentException- if configured environment id is null.java.lang.IllegalArgumentException- if contentTypeId is null.- See Also:
CMAClient.Builder.setSpaceId(String),CMAClient.Builder.setEnvironmentId(String)
-
fetchOne
public CMAContentType fetchOne(java.lang.String spaceId, java.lang.String environmentId, java.lang.String contentTypeId)
Fetch a Content Type with the givencontentTypeIdfrom a given space environment combination.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)andCMAClient.Builder.setEnvironmentId(String).- Parameters:
spaceId- Space IDenvironmentId- Environment IDcontentTypeId- Content Type ID- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if spaceId is null.java.lang.IllegalArgumentException- if environmentId is null.java.lang.IllegalArgumentException- if contentTypeId is null.
-
publish
public CMAContentType publish(CMAContentType contentType)
Publish a Content Type.- Parameters:
contentType- Content Type- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if contentType is null.java.lang.IllegalArgumentException- if contentType's id is null.java.lang.IllegalArgumentException- if contentType's space id is null.
-
unPublish
public CMAContentType unPublish(CMAContentType contentType)
Un-Publish a Content Type.- Parameters:
contentType- Content Type- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if contentType is null.java.lang.IllegalArgumentException- if contentType's id is null.java.lang.IllegalArgumentException- if contentType's space id is null.
-
update
public CMAContentType update(CMAContentType contentType)
Update a Content Type.- Parameters:
contentType- Content Type- Returns:
CMAContentTyperesult instance- Throws:
java.lang.IllegalArgumentException- if contentType is null.java.lang.IllegalArgumentException- if contentType's name is null.java.lang.IllegalArgumentException- if contentType's id is null.java.lang.IllegalArgumentException- if contentType's space id is null.java.lang.IllegalArgumentException- if contentType's version is null.
-
fetchAllSnapshots
public CMAArray<CMASnapshot> fetchAllSnapshots(CMAContentType contentType)
Fetch all snapshots of this content type.- Parameters:
contentType- the contentType whose snapshots to be returned.- Returns:
- an array of snapshots.
- Throws:
java.lang.IllegalArgumentException- if contentType is null.java.lang.IllegalArgumentException- if contentType's id is null.java.lang.IllegalArgumentException- if contentType's space id is null.
-
fetchOneSnapshot
public CMASnapshot fetchOneSnapshot(CMAContentType contentType, java.lang.String snapshotId)
Fetch a specific snapshot of this content type.- Parameters:
contentType- the contentType whose snapshot to be returned.snapshotId- the snapshot to be returned.- Returns:
- an array of snapshots.
- Throws:
java.lang.IllegalArgumentException- if contentType is null.java.lang.IllegalArgumentException- if contentType's id is null.java.lang.IllegalArgumentException- if contentType's space id is null.java.lang.IllegalArgumentException- if snapshotId is null.
-
async
public ModuleContentTypes.Async async()
- Returns:
- a module with a set of asynchronous methods.
-
-