Skip to main content

LensStudio:AssetLibrary.AssetListResponse

Class

A handle returned by the "LensStudio:AssetLibrary".AssetListService.

Index

Example

// AssetListResponse is returned by AssetListService.fetchAsync().
// It has a protected constructor -- inspect ok, then read data or error.
const { IAssetLibraryProvider, AssetFilter, AssetListRequest, EnvironmentSetting, Environment, Space } = await import('LensStudio:AssetLibrary');
const provider = this.pluginSystem.findInterface(IAssetLibraryProvider.interfaceId) as import('LensStudio:AssetLibrary').IAssetLibraryProvider;
const envSetting = new EnvironmentSetting();
envSetting.environment = Environment.Production;
envSetting.space = Space.Public;
const filter = new AssetFilter();
filter.searchText = 'hat';
const request = new AssetListRequest(envSetting, filter);

const response = await provider.assetService.fetchAsync(request);
console.log('ok:', response.ok);
console.log('cancelled:', response.cancelled);
if (response.ok && response.data) {
console.log('Asset count:', response.data.assets.length);
} else if (response.error) {
console.log('Error:', response.error);
}

Properties

cancelled

readonly cancelled: boolean

Indicates whether the asset list request was cancelled before completion.


data?

readonly optional data?: AssetListSuccess

The successful result payload of the asset list request, present when the request succeeded.


error?

readonly optional error?: ServiceError

The error details from the asset list request, present when the request failed.


ok

readonly ok: boolean

Indicates whether the asset list request completed successfully without errors.

See also

"LensStudio:AssetLibrary".Asset.