diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d3d9b0..88cbad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### Version: 2.18.0 +#### Date: Nov-18-2024 + +##### Feat: +- Added support to access different properties of asset + ### Version: 2.17.0 #### Date: Oct-21-2024 diff --git a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj index dcd0c98..82e51a8 100644 --- a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj +++ b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj @@ -31,6 +31,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Contentstack.Core.Tests/AssetTest.cs b/Contentstack.Core.Tests/AssetTest.cs index a49aa6d..c9e0eeb 100644 --- a/Contentstack.Core.Tests/AssetTest.cs +++ b/Contentstack.Core.Tests/AssetTest.cs @@ -40,6 +40,22 @@ await asset.Fetch().ContinueWith((t) => }); } + [Fact] + public async Task FetchAssetToAccessAttributes() + { + string uid = await FetchAssetUID(); + Asset a1 = await client.Asset(uid).AddParam("include_dimension", "true").Fetch(); + Assert.NotEmpty(a1.Url); + Assert.NotEmpty(a1.ContentType); + Assert.NotEmpty(a1.Version); + Assert.NotEmpty(a1.FileSize); + Assert.NotEmpty(a1.FileName); + Assert.NotEmpty(a1.Description); + Assert.NotEmpty(a1.UpdatedBy); + Assert.NotEmpty(a1.CreatedBy); + Assert.NotEmpty(a1.PublishDetails); + } + [Fact] public async Task FetchAssetsPublishFallback() { diff --git a/Contentstack.Core/Internals/HttpRequestHandler.cs b/Contentstack.Core/Internals/HttpRequestHandler.cs index 86a180d..54eae42 100644 --- a/Contentstack.Core/Internals/HttpRequestHandler.cs +++ b/Contentstack.Core/Internals/HttpRequestHandler.cs @@ -48,7 +48,7 @@ public async Task ProcessRequest(string Url, Dictionary var request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; request.ContentType = "application/json"; - request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.17.0"; + request.Headers["x-user-agent"]="contentstack-delivery-dotnet/2.18.0"; request.Timeout = timeout; if (proxy != null) diff --git a/Contentstack.Core/Models/Asset.cs b/Contentstack.Core/Models/Asset.cs index f902863..05756a2 100644 --- a/Contentstack.Core/Models/Asset.cs +++ b/Contentstack.Core/Models/Asset.cs @@ -110,6 +110,7 @@ public string Url /// /// The original name of the file. /// + [JsonProperty(PropertyName = "filename")] public string FileName { get; set; } /// @@ -122,6 +123,55 @@ public string Url /// public Object[] Tags { get; set; } + /// + /// This content_type in asset. + /// + [JsonProperty(propertyName: "content_type")] + public string ContentType { get; set; } + + /// + /// This for whether it is asset directory + /// + [JsonProperty(propertyName: "is_dir")] + public Boolean IsDir { get; set; } + + /// + /// Uid of user who updated the file + /// + [JsonProperty(PropertyName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// Uid of user who updated the file + /// + [JsonProperty(PropertyName = "created_by")] + public string CreatedBy { get; set; } + + + /// + /// The Uid of folder in which the asset is present + /// + [JsonProperty(PropertyName = "parent_uid")] + public string ParentUid { get; set; } + + /// + /// The Version of Asset + /// + [JsonProperty(PropertyName = "_version")] + public string Version { get; set; } + + /// + /// Dimension Object of the asset containing Height and width + /// + [JsonProperty(PropertyName = "dimension")] + public Dictionary Dimension { get; set; } + + /// + /// Dimension Object of the asset containing Height and width + /// + [JsonProperty(PropertyName = "publish_details")] + public Dictionary PublishDetails { get; set; } + #region Internal Constructors internal Asset(ContentstackClient stack, string uid) { diff --git a/Directory.Build.props b/Directory.Build.props index db361ea..47a2019 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 2.17.0 + 2.18.0