Skip to content

Enhc/dx-4423- Add AssetFields() for CDA asset_fields[] — v2.26.0#152

Open
OMpawar-21 wants to merge 2 commits intodevelopmentfrom
enhc/DX-4423
Open

Enhc/dx-4423- Add AssetFields() for CDA asset_fields[] — v2.26.0#152
OMpawar-21 wants to merge 2 commits intodevelopmentfrom
enhc/DX-4423

Conversation

@OMpawar-21
Copy link

Summary

Implements AssetFields(params string[] fields) across the SDK so callers can request specific asset-related metadata when fetching entries or assets, using the Content Delivery API (CDA) asset_fields[] query parameter.

What changed

  • API: New method on Entry, Query, Asset, and AssetLibrary that accepts optional asset field names (user_defined_fields, embedded_metadata, ai_generated_metadata, visual_markups), sets asset_fields[] on the request when at least one field is provided, and returns this for chaining. No args / null / empty array: parameter is not set.
  • Tests: Unit tests (reflection on UrlQueries) and API/integration tests (real request success) for single/multiple fields, chaining, no-args, null, and empty-array behavior.
  • Version: Bumped to 2.26.0 and documented in CHANGELOG.

File changes

Area File Change
Core Contentstack.Core/Models/Entry.cs Add AssetFields(params string[] fields)
Core Contentstack.Core/Models/Query.cs Add AssetFields(params string[] fields)
Core Contentstack.Core/Models/Asset.cs Add AssetFields(params string[] fields)
Core Contentstack.Core/Models/AssetLibrary.cs Add AssetFields(params string[] fields)
Unit tests Contentstack.Core.Unit.Tests/EntryUnitTests.cs Add AssetFields region (6 tests)
Unit tests Contentstack.Core.Unit.Tests/QueryUnitTests.cs Add AssetFields region (6 tests)
Unit tests Contentstack.Core.Unit.Tests/AssetUnitTests.cs Add AssetFields region (6 tests)
Unit tests Contentstack.Core.Unit.Tests/AssetLibraryUnitTests.cs Add AssetFields region (6 tests)
API tests Contentstack.Core.Tests/EntryTest.cs Add AssetFields API tests (single entry, chaining, single field, no-args, null, empty array)
API tests Contentstack.Core.Tests/QueryTest.cs Add AssetFields API tests (query entries, chaining, single field, no-args, null, empty array)
API tests Contentstack.Core.Tests/AssetTest.cs Add AssetFields API tests (single asset, asset library, chaining, single field, no-args, null, empty array for both Asset and AssetLibrary)
Version Directory.Build.props Version 2.25.22.26.0
Changelog CHANGELOG.md New entry for v2.26.0 (Feb-10-2026) – AssetFields feature

Version bump

  • Previous: 2.25.2
  • New: 2.26.0
  • Location: Directory.Build.props
  • Changelog: CHANGELOG.md updated with Feat: CDA – AssetFields support.

Usage

  • Single entry: stack.ContentType(uid).Entry(uid).AssetFields("user_defined_fields", "embedded").Fetch()
  • Query entries: stack.ContentType(uid).Entry().AssetFields("user_defined_fields").Find()
  • Single asset: stack.Asset(uid).AssetFields("user_defined_fields", "ai_suggested").Fetch()
  • Query assets: stack.Asset().AssetFields("user_defined_fields").FetchAll()

Testing

  • Unit: dotnet test Contentstack.Core.Unit.Tests/Contentstack.Core.Unit.Tests.csproj --filter "FullyQualifiedName~AssetFields"
  • API: Valid stack in Contentstack.Core.Tests/app.config; AssetFields supported in NA region.

Add AssetFields(params string[] fields) across Entry, Query, Asset, and
AssetLibrary to support the Content Delivery API (CDA) asset_fields[]
query parameter. This enables requesting specific asset-related metadata
(user_defined_fields, embedded, ai_suggested, visual_markups) when
fetching entries or assets.

Changes:
- Entry: AssetFields() before Fetch (single entry).
- Query: AssetFields() before Find (entries).
- Asset: AssetFields() before Fetch (single asset).
- AssetLibrary: AssetFields() before FetchAll (assets).

Behavior: when called with one or more fields, sets asset_fields[] in
the request; when called with no arguments, null, or empty array, the
parameter is not set. Method returns this for chaining.

Tests:
- Unit tests (Contentstack.Core.Unit.Tests): 24 tests across Entry,
  Query, Asset, AssetLibrary (single/multiple fields, chaining,
  no-args/null/empty-array).
- API tests (Contentstack.Core.Tests): AssetFields request success,
  chaining with IncludeMetadata, and scenarios mirroring unit tests
  (single field, no args, null, empty array) for Entry, Query, Asset,
  and AssetLibrary.

Version: 2.26.0 (Directory.Build.props, CHANGELOG.md).
Parameters are:
1. user_defined_fields
2. embedded_metadata
3. ai_generated_metadata
4. visual_markups
@OMpawar-21 OMpawar-21 requested a review from a team as a code owner February 13, 2026 09:33
@github-actions
Copy link

We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.

@OMpawar-21 OMpawar-21 changed the base branch from master to development February 13, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant