Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ fileignoreconfig:
checksum: 52a664f536cf5d1be0bea19cb6031ca6e8107b45b6314fe7d47b7fad7d800632
- filename: test/sanity-check/api/user-test.js
checksum: 6bb8251aad584e09f4d963a913bd0007e5f6e089357a44c3fb1529e3fda5509d
- filename: package-lock.json
checksum: 9d592c580a6890473e007c339d2f91c2d94ad936be1740dcef5ac500fde0cdb4
- filename: lib/stack/asset/index.js
checksum: b3358310e9cb2fb493d70890b7219db71e2202360be764465d505ef71907eefe
version: ""
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## [v1.23.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.23.0) (2025-07-28)
- Feature
- Added new getReferences method to Asset class for retrieving asset references
- Added comprehensive test coverage for Asset getReferences method across all test suites
- Dependency updates

## [v1.22.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.22.0) (2025-07-07)
- Enhancement
- AWS-AU Region support added
Expand Down
29 changes: 29 additions & 0 deletions lib/stack/asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,35 @@ export function Asset (http, data = {}) {
*
*/
this.unpublish = unpublish(http, 'asset')

/**
* @description The References function will get all the references for the asset.
* @memberof Asset
* @func references
* @returns {Promise<Array>} Array of references.
* @param {Object} param - Query parameters
* @example
* client.stack({ api_key: 'api_key'}).asset('uid').getReferences({ include_publish_details: true })
* .then((references) => console.log(references))
*/
this.getReferences = async function (param = {}) {
try {
const headers = {
headers: { ...cloneDeep(this.stackHeaders) },
params: {
...cloneDeep(param)
}
} || {}
const response = await http.get(this.urlPath + '/references', headers)
if (response.data) {
return response.data
} else {
throw error(response)
}
} catch (err) {
throw error(err)
}
}
} else {
/**
* @description The Folder allows to fetch and create folders in assets.
Expand Down
Loading
Loading