LensStudio:AssetLibrary.MusicListResponse
ClassResponse returned from a music list query, containing either a success result or a service error.
Index
Example
// MusicListResponse is returned by provider.musicService.fetchAsync().
// It has a protected constructor — inspect ok/data/error/cancelled after the call.
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 = 'chill';
const response = await provider.musicService.fetchAsync(
new AssetListRequest(envSetting, filter)
);
if (response.ok && response.data) {
console.log('Got', response.data.musicAssets.length, 'music tracks');
} else if (response.cancelled) {
console.log('Music fetch was cancelled');
} else if (response.error) {
console.log('Music fetch failed:', response.error.description);
}
Properties
cancelled
readonlycancelled:boolean
Indicates whether the request was cancelled before completion.
data?
readonlyoptionaldata?:MusicListSuccess
Holds the successful result of the music list request, if available.
error?
readonlyoptionalerror?:ServiceError
Contains the service error if the request failed.
ok
readonlyok:boolean
Indicates whether the request completed successfully without errors.