Enhc/dx-4423- Add AssetFields() for CDA asset_fields[] — v2.26.0#152
Open
OMpawar-21 wants to merge 2 commits intodevelopmentfrom
Open
Enhc/dx-4423- Add AssetFields() for CDA asset_fields[] — v2.26.0#152OMpawar-21 wants to merge 2 commits intodevelopmentfrom
OMpawar-21 wants to merge 2 commits intodevelopmentfrom
Conversation
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
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
user_defined_fields,embedded_metadata,ai_generated_metadata,visual_markups), setsasset_fields[]on the request when at least one field is provided, and returnsthisfor chaining. No args /null/ empty array: parameter is not set.UrlQueries) and API/integration tests (real request success) for single/multiple fields, chaining, no-args, null, and empty-array behavior.File changes
Contentstack.Core/Models/Entry.csAssetFields(params string[] fields)Contentstack.Core/Models/Query.csAssetFields(params string[] fields)Contentstack.Core/Models/Asset.csAssetFields(params string[] fields)Contentstack.Core/Models/AssetLibrary.csAssetFields(params string[] fields)Contentstack.Core.Unit.Tests/EntryUnitTests.csContentstack.Core.Unit.Tests/QueryUnitTests.csContentstack.Core.Unit.Tests/AssetUnitTests.csContentstack.Core.Unit.Tests/AssetLibraryUnitTests.csContentstack.Core.Tests/EntryTest.csContentstack.Core.Tests/QueryTest.csContentstack.Core.Tests/AssetTest.csDirectory.Build.props2.25.2→2.26.0CHANGELOG.mdVersion bump
Directory.Build.propsCHANGELOG.mdupdated with Feat: CDA – AssetFields support.Usage
stack.ContentType(uid).Entry(uid).AssetFields("user_defined_fields", "embedded").Fetch()stack.ContentType(uid).Entry().AssetFields("user_defined_fields").Find()stack.Asset(uid).AssetFields("user_defined_fields", "ai_suggested").Fetch()stack.Asset().AssetFields("user_defined_fields").FetchAll()Testing
dotnet test Contentstack.Core.Unit.Tests/Contentstack.Core.Unit.Tests.csproj --filter "FullyQualifiedName~AssetFields"Contentstack.Core.Tests/app.config; AssetFields supported in NA region.