Package com.contentstack.sdk
Class Asset
java.lang.Object
com.contentstack.sdk.Asset
public class Asset extends Object
The type Asset.
-
Field Summary
Fields Modifier and Type Field Description protected StringassetUidprotected StringcontentTypeprotected StringfileNameprotected StringfileSizeprotected LinkedHashMap<String,Object>headersprotected org.json.JSONObjectjsonprotected static Loggerloggerprotected StackstackInstanceprotected String[]tagsArrayprotected StringuploadUrlprotected org.json.JSONObjecturlQueries -
Constructor Summary
-
Method Summary
Modifier and Type Method Description AssetaddParam(String paramKey, String paramValue)Add param asset.Assetconfigure(org.json.JSONObject jsonObject)Configure asset.voidfetch(FetchResultCallback callback)Fetch.StringgetAssetUid()Gets asset uid.CalendargetCreateAt()Gets create at.StringgetCreatedBy()Gets created by.CalendargetDeleteAt()Gets delete at.StringgetDeletedBy()Gets deleted by.StringgetFileName()Gets file name.StringgetFileSize()Gets file size.StringgetFileType()Gets file type.String[]getTags()Get tags string [ ].CalendargetUpdateAt()Gets update at.StringgetUpdatedBy()Gets updated by.StringgetUrl()Gets url.AssetincludeBranch()Includes Branch in the asset responseAssetincludeDimension()Include dimension asset.AssetincludeFallback()Include fallback asset.voidremoveHeader(String headerKey)Remove header.voidsetHeader(String headerKey, String headerValue)Sets header.protected voidsetStackInstance(Stack stack)protected AssetsetTags(String[] tags)protected voidsetUid(String assetUid)org.json.JSONObjecttoJSON()To json json object.
-
Field Details
-
logger
-
urlQueries
protected final org.json.JSONObject urlQueries -
assetUid
-
contentType
-
fileSize
-
fileName
-
uploadUrl
-
json
protected org.json.JSONObject json -
tagsArray
-
headers
-
stackInstance
-
-
Constructor Details
-
Method Details
-
setStackInstance
-
configure
Configure asset.- Parameters:
jsonObject- the json object- Returns:
- the asset
-
setHeader
Sets header.- Parameters:
headerKey- the header keyheaderValue- the header value
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.setHeader();
-
removeHeader
Remove header.- Parameters:
headerKey- the header key
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.removeHeader();
-
setUid
-
getAssetUid
Gets asset uid.- Returns:
- the asset uid
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getAssetUid(); } });
-
getFileType
Gets file type.- Returns:
- the file type
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getFileType(); } });
-
getFileSize
Gets file size.- Returns:
- the file size
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getFileSize(); } });
-
getFileName
Gets file name.- Returns:
- the file name
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getFileName(); } });
-
getUrl
Gets url.- Returns:
- the url
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getUrl(); } });
-
toJSON
public org.json.JSONObject toJSON()To json json object.- Returns:
- the json object
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.toJSON(); } });
-
getCreateAt
Gets create at.- Returns:
- the create at
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getCreateAt(); } });
-
getCreatedBy
Gets created by.- Returns:
- the created by
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getCreatedBy(); } });
-
getUpdateAt
Gets update at.- Returns:
- the update at
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getUpdateAt(); } });
-
getUpdatedBy
Gets updated by.- Returns:
- the updated by
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getUpdatedBy(); } });
-
getDeleteAt
Gets delete at.- Returns:
- the delete at
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getDeleteAt(); } });
-
getDeletedBy
Gets deleted by.- Returns:
- the deleted by
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getDeletedBy(); } });
-
getTags
Get tags string [ ].- Returns:
- the string [ ]
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.fetch(new FetchResultCallback() { @Override public void onCompletion(ResponseType responseType, Error error) { asset.getTags(); } });
-
setTags
-
includeDimension
Include dimension asset.- Returns:
- the asset
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.includeDimension();
-
addParam
Add param asset.- Parameters:
paramKey- the param keyparamValue- the param value- Returns:
- the asset
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.addParam();
-
includeFallback
Include fallback asset.- Returns:
- the asset
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.includeFallback();
-
includeBranch
Includes Branch in the asset response- Returns:
Assetobject, so you can chain this call.
Example :
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment"); Asset asset = stack.asset(asset_uid); asset.includeBranch();
-
fetch
Fetch.- Parameters:
callback- the callback
-