Language
Analyze and audit how the content in your space is updated and used.
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.
Typescript
const transactions = await lingo.fetchAssetChangelog("<AssetId>");
Arguments
assetId
string • required
The id of the asset.
Typescript
transactions.forEach(transaction => {
if (transaction.event === "asset.created") {
console.log(`${transaction.user.name} created the asset`);
} else if (transaction.event === "asset.updated") {
console.log(`${transaction.user.name} updated the asset.`);
if (transaction.data.name) {
console.log(
`The name was changed from ${transaction.data.name.previous} to ${transaction.data.name.new}`
);
}
}
});