public final class ModuleAssets
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ModuleAssets.Async
Async module.
|
Constructor and Description |
---|
ModuleAssets(retrofit2.Retrofit retrofit,
java.util.concurrent.Executor callbackExecutor,
java.lang.String spaceId,
java.lang.String environmentId,
boolean environmentIdConfigured)
Create the assets module.
|
Modifier and Type | Method and Description |
---|---|
CMAAsset |
archive(CMAAsset asset)
Archive an Asset.
|
ModuleAssets.Async |
async() |
CMAAsset |
create(CMAAsset asset)
Create a new Asset in the configured space and environment.
|
CMAAsset |
create(java.lang.String spaceId,
java.lang.String environmentId,
CMAAsset asset)
Create a new Asset.
|
protected com.contentful.java.cma.ServiceAssets |
createService(retrofit2.Retrofit retrofit) |
java.lang.Integer |
delete(CMAAsset asset)
Delete an Asset.
|
CMAArray<CMAAsset> |
fetchAll()
Fetch all Assets using configured space id and environment id.
|
CMAArray<CMAAsset> |
fetchAll(java.util.Map<java.lang.String,java.lang.String> map)
Fetch all Assets matching a query using configured space id and environment id.
|
CMAArray<CMAAsset> |
fetchAll(java.lang.String spaceId,
java.lang.String environmentId)
Fetch all Assets from the given space and environment.
|
CMAArray<CMAAsset> |
fetchAll(java.lang.String spaceId,
java.lang.String environmentId,
java.util.Map<java.lang.String,java.lang.String> query)
Fetch all Assets matching the given query from the given space and environment.
|
CMAAsset |
fetchOne(java.lang.String assetId)
Fetch an Asset with the given
assetId from the configured space and environment. |
CMAAsset |
fetchOne(java.lang.String spaceId,
java.lang.String environmentId,
java.lang.String assetId)
Fetch an Asset with the given
assetId from the given space and environment. |
java.lang.Integer |
process(CMAAsset asset,
java.lang.String locale)
Process an Asset.
|
CMAAsset |
publish(CMAAsset asset)
Publish an Asset.
|
CMAAsset |
unArchive(CMAAsset asset)
Un-Archive an Asset.
|
CMAAsset |
unPublish(CMAAsset asset)
Un-Publish an Asset.
|
CMAAsset |
update(CMAAsset asset)
Update an Asset.
|
public ModuleAssets(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 com.contentful.java.cma.ServiceAssets createService(retrofit2.Retrofit retrofit)
public CMAAsset archive(CMAAsset asset)
asset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset id is null.java.lang.IllegalArgumentException
- if asset space id is null.public CMAAsset create(java.lang.String spaceId, java.lang.String environmentId, CMAAsset asset)
In case the given asset
has 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)
and
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- Space IDenvironmentId
- Environment IDasset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset space id is null.java.lang.IllegalArgumentException
- if asset environment id is null.public CMAAsset create(CMAAsset asset)
In case the given asset
has 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.
asset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.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 java.lang.Integer delete(CMAAsset asset)
asset
- Assetjava.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if assetId is null.public CMAArray<CMAAsset> fetchAll()
This fetch uses the default parameter defined in DefaultQueryParameter.FETCH
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<CMAAsset> fetchAll(java.util.Map<java.lang.String,java.lang.String> map)
This fetch uses the default parameter defined in DefaultQueryParameter.FETCH
map
- the query to narrow down the results.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<CMAAsset> fetchAll(java.lang.String spaceId, java.lang.String environmentId)
This fetch uses the default parameter defined in DefaultQueryParameter.FETCH
spaceId
- Space IDenvironmentId
- Environment IDCMAArray
result instancejava.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if environment id is null.public CMAArray<CMAAsset> fetchAll(java.lang.String spaceId, java.lang.String environmentId, java.util.Map<java.lang.String,java.lang.String> query)
spaceId
- Space IDenvironmentId
- Environment IDquery
- specifying details about which assets to fetch.CMAArray
result instancejava.lang.IllegalArgumentException
- if spaceId is null.public CMAAsset fetchOne(java.lang.String assetId)
assetId
from the configured space and environment.assetId
- Asset IDCMAAsset
result instancejava.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 CMAAsset fetchOne(java.lang.String spaceId, java.lang.String environmentId, java.lang.String assetId)
assetId
from the given space and environment.spaceId
- Space IDenvironmentId
- Environment IDassetId
- Asset IDCMAAsset
result instancejava.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if assetId is null.public java.lang.Integer process(CMAAsset asset, java.lang.String locale)
asset
- Assetlocale
- Localejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset has no id.java.lang.IllegalArgumentException
- if asset has no space.java.lang.IllegalArgumentException
- if locale is null.public CMAAsset publish(CMAAsset asset)
asset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset has no id.java.lang.IllegalArgumentException
- if asset has no space id.public CMAAsset unArchive(CMAAsset asset)
asset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset id is empty.java.lang.IllegalArgumentException
- if asset's space id is empty.public CMAAsset unPublish(CMAAsset asset)
asset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset's id is not set.java.lang.IllegalArgumentException
- if asset's space id is not set.public CMAAsset update(CMAAsset asset)
asset
- AssetCMAAsset
result instancejava.lang.IllegalArgumentException
- if asset is null.java.lang.IllegalArgumentException
- if asset's id is null.java.lang.IllegalArgumentException
- if asset's space id is null.java.lang.IllegalArgumentException
- if asset's version is null.public ModuleAssets.Async async()
Copyright © 2019 Contentful, GmbH.. All Rights Reserved.