Get all Product of a live¶
There is two ways to get all products of a live, passing live id or passing live alias. But both ways returns a same list of products in same format. the code below show a example using get products by live id:
import { Metalives } from "metalives-sdk"
import dotenv from 'dotenv'
dotenv.config();
const client = new Metalives(process.env.SDK_TOKEN);
const allProducts = await client.product.getLiveProductsById(liveId);
The return value is in the following format:
[
{
id: 'Product id',
name: 'Product name',
url: 'Link to product in original site',
price: 'Real price of the product',
originalPrice: 'Original price of the product',
imageUrl: 'Link to product image',
ref: 'Product reference in Marketplace',
createdAt: 'Timestamp when was created',
updatedAt: 'Timestamp when was updated last time',
storeId: 'id of product in store'
}
]