Insights
Analyze and audit how the contnet in your space is updated and used.
Asset changelog
Fetch a list of all changes made to an asset. The first change will always be asset.created
. All subsequent events will be asset.updated
.
The data
field is also slightly different for the two events. Creation events contain all asset data while update events contain each key that was changed. Each updated key will have a previous
and new
value.
const transactions = await lingo.fetchAssetChangelog("<AssetId>");
Arguments
assetId
string • required
The id of the asset.
changeEvents.forEach((transaction) => {
if (transactions.event === "asset.created") {
console.log(`${event.user.name} created the asset`);
} else if (transactions.event === "asset.updated") {
console.log(`${event.user.name} updated the asset.`);
if (event.data.name) {
console.log(`The name was changed from ${event.data.name.previous} to ${event.data.name.new}`);
}
}
});