Package com.contentstack.sdk
Class AssetLibrary
- java.lang.Object
-
- com.contentstack.sdk.AssetLibrary
-
- All Implemented Interfaces:
INotifyClass
public class AssetLibrary extends Object implements INotifyClass
The Asset library is used to get list of assets available in the stack, We can apply filters on the assets also. The Get all assets request fetches the list of all the assets of a particular stack. It returns the content of each asset in JSON format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAssetLibrary.ORDERBYThe enum Orderby.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssetLibraryaddParam(@NotNull String paramKey, @NotNull Object paramValue)Add param assetlibrary.voidfetchAll(FetchAssetsCallback callback)Fetch all.intgetCount()Gets count.voidgetResult(Object object, String controller)voidgetResultObject(List<Object> objects, org.json.JSONObject jsonObject, boolean isSingleEntry)AssetLibraryincludeCount()Include count asset library.AssetLibraryincludeFallback()Retrieve the published content of the fallback locale if an entry is not localized in specified localeAssetLibraryincludeMetadata()Retrieve Metadata in the responseAssetLibraryincludeRelativeUrl()Include relative url asset library.AssetLibrarylimit(@org.jetbrains.annotations.NotNull int number)A limit on the number of objects to return.voidremoveHeader(@NotNull String headerKey)Remove header.AssetLibraryremoveParam(@NotNull String paramKey)Remove param key assetlibrary.voidsetHeader(@NotNull String headerKey, @NotNull String headerValue)Sets header.AssetLibraryskip(@org.jetbrains.annotations.NotNull int number)The number of objects to skip before returning any.AssetLibrarysort(String keyOrderBy, AssetLibrary.ORDERBY orderby)Sort asset library.AssetLibrarywhere(String key, String value)
-
-
-
Method Detail
-
setHeader
public void setHeader(@NotNull @NotNull String headerKey, @NotNull @NotNull String headerValue)Sets header.- Parameters:
headerKey- the header keyheaderValue- the header value
-
removeHeader
public void removeHeader(@NotNull @NotNull String headerKey)Remove header.- Parameters:
headerKey- the header key
-
sort
public AssetLibrary sort(String keyOrderBy, AssetLibrary.ORDERBY orderby)
Sort asset library.- Parameters:
keyOrderBy- the key order byorderby- the orderby- Returns:
- the asset library
-
includeCount
public AssetLibrary includeCount()
Include count asset library.- Returns:
- the asset library
-
includeRelativeUrl
public AssetLibrary includeRelativeUrl()
Include relative url asset library.- Returns:
- the asset library
-
includeFallback
public AssetLibrary includeFallback()
Retrieve the published content of the fallback locale if an entry is not localized in specified locale- Returns:
AssetLibraryobject, so you can chain this call.
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); AssetLibrary assetLibObject = stack.assetLibrary(); AssetLibrary.includeFallback();
-
includeMetadata
public AssetLibrary includeMetadata()
Retrieve Metadata in the response- Returns:
AssetLibraryobject, so you can chain this call.
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); AssetLibrary assetLibObject = stack.includeOwner(); AssetLibrary.includeMetadata();
-
getCount
public int getCount()
Gets count.- Returns:
- the count
-
addParam
public AssetLibrary addParam(@NotNull @NotNull String paramKey, @NotNull @NotNull Object paramValue)
Add param assetlibrary.- Parameters:
paramKey- the param keyparamValue- the param value- Returns:
- the assetlibrary
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); AssetLibrary assetLibObject = stack.assetlibrary(); assetLibObject.addParam();
-
removeParam
public AssetLibrary removeParam(@NotNull @NotNull String paramKey)
Remove param key assetlibrary.- Parameters:
paramKey- the param key- Returns:
- the assetlibrary
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); AssetLibrary assetLibObject = stack.assetlibrary(); assetLibObject.removeParam(paramKey);
-
skip
public AssetLibrary skip(@NotNull @org.jetbrains.annotations.NotNull int number)
The number of objects to skip before returning any.- Parameters:
number- No of objects to skip from returned objects- Returns:
Queryobject, so you can chain this call.Note: The skip parameter can be used for pagination, "skip" specifies the number of objects to skip in the response.
Example :
Stack stack = Contentstack.stack( "apiKey", "deliveryToken", "environment"); AssetLibrary assetLibObject = stack.assetlibrary.skip(4);
-
limit
public AssetLibrary limit(@NotNull @org.jetbrains.annotations.NotNull int number)
A limit on the number of objects to return.- Parameters:
number- No of objects to limit.- Returns:
Queryobject, so you can chain this call.Note: The limit parameter can be used for pagination, " limit" specifies the number of objects to limit to in the response.
Example :
Stack stack = Contentstack.stack( "apiKey", "deliveryToken", "environment"); AssetLibrary assetLibObject = stack.assetlibrary.limit(4);
-
fetchAll
public void fetchAll(FetchAssetsCallback callback)
Fetch all.- Parameters:
callback- the callback
-
getResult
public void getResult(Object object, String controller)
- Specified by:
getResultin interfaceINotifyClass
-
getResultObject
public void getResultObject(List<Object> objects, org.json.JSONObject jsonObject, boolean isSingleEntry)
- Specified by:
getResultObjectin interfaceINotifyClass
-
where
public AssetLibrary where(String key, String value)
-
-