LensStudio:AssetLibrary.GetAssetsByIdsService
ClassService interface for submitting get-assets-by-IDs requests.
Index
Example
// Resolve IAssetLibraryProvider to access GetAssetsByIdsService.
const provider = this.pluginSystem.findInterface(
IAssetLibraryProvider.interfaceId
) as IAssetLibraryProvider;
if (Editor.isNull(provider)) {
console.log('IAssetLibraryProvider not available');
return;
}
const service = provider.assetsByIdsService;
console.log('GetAssetsByIdsService obtained from provider');
// Build request with environment and asset IDs
const envSetting = new EnvironmentSetting();
envSetting.environment = Environment.Production;
envSetting.space = Space.Public;
const request = new GetAssetsByIdsRequest(envSetting, ['example-asset-id']);
const response = await service.fetchAsync(request);
if (response.ok) {
console.log('Fetch succeeded, data:', response.data);
} else {
console.log('Fetch failed or cancelled:', response.cancelled);
}
Extends
Methods
fetchAsync()
fetchAsync(
request):Promise<GetAssetsByIdsResponse>
Fetches assets matching the given IDs request and returns a promise resolving to the response.
Parameters
| Parameter | Type |
|---|---|
request | GetAssetsByIdsRequest |
Returns
Promise<GetAssetsByIdsResponse>
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