Skip to main content

LensStudio:AssetLibrary.GetAssetsByIdsService

Class

Service 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

ParameterType
requestGetAssetsByIdsRequest

Returns

Promise<GetAssetsByIdsResponse>


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.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

ScriptObject.isSame