LensStudio:AssetLibrary.IAssetLibraryProvider
ClassA handle that provides access to the AssetLibraryListService.
Index
Example
// IAssetLibraryProvider is the entry point for the online asset library.
// Resolve via findInterface, then use one of its three services.
// Below: list a few assets, then fetch them by id with assetsByIdsService.
const provider = this.pluginSystem.findInterface(
IAssetLibraryProvider.interfaceId
) as import('LensStudio:AssetLibrary').IAssetLibraryProvider;
const envSetting = new EnvironmentSetting();
envSetting.environment = Environment.Production;
envSetting.space = Space.Public;
// 1) Discover ids via assetService
const listFilter = new AssetFilter();
listFilter.searchText = 'material';
const listResp = await provider.assetService.fetchAsync(
new AssetListRequest(envSetting, listFilter)
);
const ids = listResp.ok && listResp.data
? listResp.data.assets.slice(0, 3).map(a => a.assetId)
: [];
// 2) Resolve full asset records by id with assetsByIdsService
const idResp = await provider.assetsByIdsService.fetchAsync(
new GetAssetsByIdsRequest(envSetting, ids)
);
if (idResp.ok && idResp.data) {
console.log(`Fetched ${ids.length} assets by id`);
}
Extends
Properties
assetsByIdsService
readonlyassetsByIdsService:GetAssetsByIdsService
Service for fetching assets by their IDs.
assetService
readonlyassetService:AssetListService
Service for listing assets from the asset library.
interfaceId
staticinterfaceId:InterfaceId
Unique identifier for the IAssetLibraryProvider plugin component interface.
musicService
readonlymusicService:MusicListService
Service for listing music assets from the asset library.
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean