Class Asset
Assets refer to all the media files (images, videos, PDFs, audio files, and so on) uploaded in your Contentstack repository for future use
Inheritance
System.Object
Asset
Implements
Contentstack.Utils.Interfaces.IEmbeddedObject
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Contentstack.Core.Models
Assembly: Contentstack.Core.dll
Syntax
public class Asset : IEmbeddedObject
Properties
| Improve this Doc View SourceContentTypeUid
This is Asset type uid.
Declaration
[JsonProperty("_content_type_uid")]
public string ContentTypeUid { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Description
This is Asset description.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FileName
The original name of the file.
Declaration
public string FileName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FileSize
The size of the file in bytes.
Declaration
[JsonProperty(PropertyName = "file_size")]
public string FileSize { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Item[String]
Declaration
public object this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Property Value
Type | Description |
---|---|
System.Object |
StackInstance
Declaration
public ContentstackClient StackInstance { get; set; }
Property Value
Type | Description |
---|---|
ContentstackClient |
Tags
Set array of Tags
Declaration
public object[] Tags { get; set; }
Property Value
Type | Description |
---|---|
System.Object[] |
Uid
This is Asset Uid of an Asset.
Declaration
public string Uid { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Url
An absolute URL to this file.
Declaration
public string Url { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceFetch()
Declaration
public async Task<Asset> Fetch()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Asset> |
Get(String)
Declaration
public object Get(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.Object |
GetCreateAt()
Declaration
public DateTime GetCreateAt()
Returns
Type | Description |
---|---|
System.DateTime |
GetCreatedBy()
Declaration
public string GetCreatedBy()
Returns
Type | Description |
---|---|
System.String |
GetDeleteAt()
Declaration
public DateTime GetDeleteAt()
Returns
Type | Description |
---|---|
System.DateTime |
GetDeletedBy()
Declaration
public string GetDeletedBy()
Returns
Type | Description |
---|---|
System.String |
GetUpdateAt()
Declaration
public DateTime GetUpdateAt()
Returns
Type | Description |
---|---|
System.DateTime |
GetUpdatedBy()
Declaration
public string GetUpdatedBy()
Returns
Type | Description |
---|---|
System.String |
includeBranch()
Include branch for publish content.
Declaration
public Asset includeBranch()
Returns
Type | Description |
---|---|
Asset | Current instance of Entry, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Asset asset = stack.Asset("asset_uid");
asset.includeBranch();
asset.Fetch<Product>().ContinueWith((assetResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
includeFallback()
Include fallback locale publish content, if specified locale content is not publish.
Declaration
public Asset includeFallback()
Returns
Type | Description |
---|---|
Asset | Current instance of Entry, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Asset asset = stack.Asset("asset_uid");
asset.IncludeFallback();
asset.Fetch<Product>().ContinueWith((assetResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
RemoveHeader(String)
Declaration
public void RemoveHeader(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
SetHeader(String, String)
To set headers for Backend rest calls.
Declaration
public void SetHeader(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | header name. |
System.String | value | header value against given header name. |
Implements
Contentstack.Utils.Interfaces.IEmbeddedObject