Skip to content

Commit

Permalink
Merge pull request #71 from contentstack/development
Browse files Browse the repository at this point in the history
DX | 18-11-2024 | Release
  • Loading branch information
cs-raj authored Nov 12, 2024
2 parents 7567398 + 546f011 commit b6670b6
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2"><PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="contentstack.csharp" Version="2.15.0" />
<PackageReference Include="contentstack.csharp" Version="2.17.0" />
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions Contentstack.Core.Tests/AssetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion Contentstack.Core/Internals/HttpRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<string> ProcessRequest(string Url, Dictionary<string, object>
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)
Expand Down
50 changes: 50 additions & 0 deletions Contentstack.Core/Models/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public string Url
/// <summary>
/// The original name of the file.
/// </summary>
[JsonProperty(PropertyName = "filename")]
public string FileName { get; set; }

/// <summary>
Expand All @@ -122,6 +123,55 @@ public string Url
/// </summary>
public Object[] Tags { get; set; }

/// <summary>
/// This content_type in asset.
/// </summary>
[JsonProperty(propertyName: "content_type")]
public string ContentType { get; set; }

/// <summary>
/// This for whether it is asset directory
/// </summary>
[JsonProperty(propertyName: "is_dir")]
public Boolean IsDir { get; set; }

/// <summary>
/// Uid of user who updated the file
/// </summary>
[JsonProperty(PropertyName = "updated_by")]
public string UpdatedBy { get; set; }

/// <summary>
/// Uid of user who updated the file
/// </summary>
[JsonProperty(PropertyName = "created_by")]
public string CreatedBy { get; set; }


/// <summary>
/// The Uid of folder in which the asset is present
/// </summary>
[JsonProperty(PropertyName = "parent_uid")]
public string ParentUid { get; set; }

/// <summary>
/// The Version of Asset
/// </summary>
[JsonProperty(PropertyName = "_version")]
public string Version { get; set; }

/// <summary>
/// Dimension Object of the asset containing Height and width
/// </summary>
[JsonProperty(PropertyName = "dimension")]
public Dictionary<string, object> Dimension { get; set; }

/// <summary>
/// Dimension Object of the asset containing Height and width
/// </summary>
[JsonProperty(PropertyName = "publish_details")]
public Dictionary<string, object> PublishDetails { get; set; }

#region Internal Constructors
internal Asset(ContentstackClient stack, string uid)
{
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>2.17.0</Version>
<Version>2.18.0</Version>
</PropertyGroup>
</Project>

0 comments on commit b6670b6

Please sign in to comment.