🌈
Get Items
Use this method to get metadata of multiple Items at the same time.
JavaScript
TypeScript
const response = await altura.getItems();
// customize options
const response = await altura.getItems({
perPage: 20,
page: 1,
sortBy: 'name',
sortDir: 'asc',
slim: true,
});
// filter documents by any properties
const response = await altura.getItems(
{}, // default options
{
collectionAddress: "0x78e99615063da7c12c247e6bc01240da00df77ae"
} // fetching items with the specified collection address only
)
const items = response.items;
const itemCount = response.count;
const response: { items: IAlturaItem[], count: number } = await altura.getItems();
// customize options
const response: { items: IAlturaItem[], count: number } = await altura.getItems({
perPage: 20,
page: 1,
sortBy: 'name',
sortDir: 'asc',
slim: true,
stateOnly: true
});
// filter documents by any properties
const response: { items: IAlturaItem[], count: number } = await altura.getItems(
{}, // default options
{
collectionAddress: "0x78e99615063da7c12c247e6bc01240da00df77ae"
} // fetching items with the specified collection address only
)
const items = response.items;
const itemCount = response.count;
Parameter | Type | Required | Description |
---|---|---|---|
perPage | number | Optional | The number of items to return |
page | number | Optional | The offset for returned items. Calculated as (page - 1) * perPage |
sortBy | string | Optional | The field to sort the items by (any field in the item schema may be used) |
sortDir | 'asc' | 'desc' | Optional | Choose to sort in ascending (asc) or descending (desc) order |
slim | boolean | Optional | Returns a more condensed version of the items. Limits the item schema to: name, properties, tokenId, collectionAddress, supply, maxSupply, image, imageUrl, imageIndex, and imageCount |
Last modified 6mo ago