LensStudio:AssetLibrary.AssetFilter
ClassA filter used to narrow down an AssetListRequest.
Index
Properties
Example
// AssetFilter narrows the AssetListRequest passed to assetService.
// searchText is a free-text match across name + description.
// categoryIds are opaque category identifiers from the Asset Library
// backend (NOT TypeScript values) — typically a Contentful entry id.
// For type-based filtering use the AssetType enum on the result side.
const provider = this.pluginSystem.findInterface(
IAssetLibraryProvider.interfaceId
) as import('LensStudio:AssetLibrary').IAssetLibraryProvider;
const env = new EnvironmentSetting();
env.environment = Environment.Production;
env.space = Space.Public;
const filter = new AssetFilter();
filter.searchText = 'particle';
filter.pagination = Pagination.singleBatch(0, 50);
// filter.categoryIds = ['<contentful-category-id>']; // uncomment when known
const resp = await provider.assetService.fetchAsync(
new AssetListRequest(env, filter)
);
if (resp.ok && resp.data) {
// Type-based filtering on the result — AssetType IS an enum.
const customComponents = resp.data.assets.filter(
a => a.assetType === AssetType.CustomComponent,
);
console.log(`${resp.data.assets.length} hits, ${customComponents.length} custom components`);
}
Constructors
Constructor
new AssetFilter():
AssetFilter
Constructs a new AssetFilter for narrowing down an AssetListRequest.
Returns
AssetFilter
Properties
categoryIds
categoryIds:
string[]
Array of category ID strings used to filter assets by category.
pagination
pagination:
Pagination
Pagination settings controlling page size and offset for asset query results.
searchText
searchText:
string
Text string used to filter assets by name or keyword.