Skip to main content

LensStudio:AssetLibrary.IAssetLibraryProvider

Class

A 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

readonly assetsByIdsService: GetAssetsByIdsService

Service for fetching assets by their IDs.


assetService

readonly assetService: AssetListService

Service for listing assets from the asset library.


interfaceId

static interfaceId: InterfaceId

Unique identifier for the IAssetLibraryProvider plugin component interface.


musicService

readonly musicService: MusicListService

Service for listing music assets from the asset library.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPluginComponent.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPluginComponent.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

IPluginComponent.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

IPluginComponent.isSame

See also

"LensStudio:AssetLibrary".Asset.