AssetBuilder
With the AssetBuilder class you are able to use a typesafe API to build metadata for the assets you want to publish or edit.
Instantiate AssetBuilder
There are two options on initialization of a new AssetBuilder instance.
The first example simply instantiates a clean empty builder to start adding metadata to and building your asset.
If you already have an asset published and rather want to toEditorSettings, you can use the getAquariusAsset method the fetch the existing metadata. The AssetBuilder then takes the aquariusAsset as parameter to prepare the editing.
import { AssetBuilder } from '@deltadao/nautilus'
const assetBuilder = new AssetBuilder()
empty ddo object will be createdUsing AssetBuilder to build metadata
With the instance ready, it is now possible to build your metadata using the available methods. To finalize the process and receive a NautilusAsset object, you have to run the build() method.
import { AssetBuilder } from '@deltadao/nautilus'
const assetBuilder = new AssetBuilder()
const asset = assetBuilder
.setName('Nautilus edit Example: New name')
.setAuthor('Author')
.setDescription(
'# Asset Description - Markdown supported'
)
.build()
ddo: { metadata: { name: 'Nautilus edit Example: New name', author: 'Author', description: '# Asset Description - Markdown supported' } }With the built asset object you are now able to call the nautilus.publish(), nautilus.edit() to publish your changes.
To get a full overview of all AssetBuilder methods, head over to the API documentation.