To manipulate the assets, access the assets object on the SDK. Through that, you can invoke all asset methods mentioned, like this:
const groups = await sdk.assets.getAssetGroups({
designSystemId, versionId
})
Read methods
Get all assets
Fetches all remote assets in the specified design system version.
async getAssets(from: RemoteVersionIdentifier): Promise<Array<Asset>>
Get all asset groups
Fetches all remote asset groups in the specified design system version.
async getAssetGroups(
from: RemoteVersionIdentifier
): Promise<Array<AssetGroup>>
Render all assets
Use this method to render and retrieve download URLs for a specified combination of asset format and scale. Assets can be rendered in formats such as "png," "svg," or "pdf" and at different scales like "1x," "2x," "3x," or "4x."
Keep in mind the following considerations:
- You can only render one combination of size/format with one request. If you need to render more combinations, use additional requests.
- Assets rendered as "png" will use the "scale" attribute, but when the format is "svg" or "pdf," the scale attribute is ignored, and the assets will always render at their original size.
- Rendered asset URLs are not persistent and will expire quickly. You must download and store them locally or remotely. These URLs cannot be used publicly as they will not work after a short time.
This method returns an array of rendered assets with their associated download URLs for the specified format and scale.
async getRenderedAssets(
from: RemoteVersionIdentifier,
assets: Array<Asset>,
groups: Array<AssetGroup>,
format: AssetFormat,
scale: AssetScale
): Promise<Array<RenderedAsset>>