public class AssetLibrary
extends java.lang.Object
implements com.contentstack.sdk.INotifyClass
Modifier and Type | Class and Description |
---|---|
static class |
AssetLibrary.ORDERBY
Sorting order enum for
AssetLibrary . |
Modifier and Type | Field and Description |
---|---|
org.json.JSONObject |
urlQueries |
Modifier | Constructor and Description |
---|---|
protected |
AssetLibrary() |
Modifier and Type | Method and Description |
---|---|
void |
fetchAll(com.contentstack.sdk.FetchAssetsCallback assetsCallback)
Fetch a all asset.
|
int |
getCount()
Get a count of assets in success callback of
FetchAssetsCallback . |
void |
getResult(java.lang.Object object,
java.lang.String controller) |
void |
getResultObject(java.util.List<java.lang.Object> objects,
org.json.JSONObject jsonObject,
boolean isSingleEntry) |
AssetLibrary |
includeCount()
Retrieve count and data of assets in result.
|
AssetLibrary |
includeFallback()
Retrieve the published content of the fallback locale if an entry is not localized in specified locale
|
AssetLibrary |
includeRelativeUrl()
Retrieve relative urls objects in result.
|
void |
removeHeader(java.lang.String key)
Remove a header for a given key from headers.
|
void |
setHeader(java.lang.String key,
java.lang.String value)
To set headers for Contentstack rest calls.
|
protected void |
setStackInstance(Stack stack) |
AssetLibrary |
sort(java.lang.String key,
AssetLibrary.ORDERBY orderby)
Sort assets by fieldUid.
|
protected void setStackInstance(Stack stack)
public void setHeader(java.lang.String key, java.lang.String value)
key
- header name.value
- header value against given header name.
//'blt5d4sample2633b' is a dummy Application API key AssetLibrary assetLibObject = Contentstack.stack("blt5d4sample2633b", "bltdtsample_accessToken767vv", config).assetLibrary(); assetLibObject.setHeader("custom_header_key", "custom_header_value");
public void removeHeader(java.lang.String key)
key
- header key.
//'blt5d4sample2633b' is a dummy Application API key AssetLibrary assetLibObject = Contentstack.stack("blt5d4sample2633b", "bltdtsample_accessToken767vv", config).assetLibrary(); assetLibObject.removeHeader("custom_header_key");
public AssetLibrary sort(java.lang.String key, AssetLibrary.ORDERBY orderby)
key
- field Uid.orderby
- AssetLibrary.ORDERBY
value for ascending or descending.AssetLibrary
object, so you can chain this call.
//'blt5d4sample2633b' is a dummy Application API key AssetLibrary assetLibObject = Contentstack.stack("blt5d4sample2633b", "bltdtsample_accessToken767vv", config).assetLibrary(); assetLibObject.sort("fieldUid", AssetLibrary.ORDERBY.ASCENDING);
public AssetLibrary includeCount()
AssetLibrary
object, so you can chain this call.
//'blt5d4sample2633b' is a dummy Stack API key //'bltdtsample_accessToken767vv' is dummy access token. AssetLibrary assetLibObject = Contentstack.stack( "blt5d4sample2633b", "bltdtsample_accessToken767vv", config).assetLibrary(); assetLibObject.includeCount();
public AssetLibrary includeRelativeUrl()
AssetLibrary
object, so you can chain this call.
//'blt5d4sample2633b' is a dummy Stack API key //'bltdtsample_accessToken767vv' is dummy access token. AssetLibrary assetLibObject = Contentstack.stack( "blt5d4sample2633b", "bltdtsample_accessToken767vv", config).assetLibrary(); assetLibObject.includeRelativeUrl();
public int getCount()
FetchAssetsCallback
.public void fetchAll(com.contentstack.sdk.FetchAssetsCallback assetsCallback)
assetsCallback
- FetchAssetsCallback
instance for success and failure result.
AssetLibrary assetLibObject = Contentstack.stack("blt5d4sample2633b", "bltdtsample_accessToken767vv", config).assetLibrary();
assetLibObject.fetchAll(new FetchAssetsCallback() {
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error)
{
if (error == null) {
//Success Block.
} else {
//Error Block.
}
}
});
public void getResult(java.lang.Object object, java.lang.String controller)
getResult
in interface com.contentstack.sdk.INotifyClass
public void getResultObject(java.util.List<java.lang.Object> objects, org.json.JSONObject jsonObject, boolean isSingleEntry)
getResultObject
in interface com.contentstack.sdk.INotifyClass
public AssetLibrary includeFallback()
AssetLibrary
object, so you can chain this call.
Stack stack = Contentstack.stack( "ApiKey", "deliveryToken", environment_name); AssetLibrary assetLibObject = stack.assetLibrary(); assetLibObject.includeFallback();