Class: ProductAPI
Product API client for managing products and product-related data. Provides methods to retrieve products, review summaries, and metadata.
Constructors
Constructor
new ProductAPI(http: HttpClient, apiKey: string): ProductAPI;Parameters
http
HttpClient
apiKey
string
Returns
ProductAPI
Methods
getProductReviewMeta()
getProductReviewMeta(productId: string, reviewCode: string): Promise<ProductReviewMeta>;Retrieves review metadata for a specific product and review code. Used for generating structured data (JSON-LD) for SEO purposes.
Parameters
productId
string
The product ID
reviewCode
string
The review code identifier
Returns
Promise<ProductReviewMeta>
Promise resolving to review metadata
Throws
When the API returns an error
Throws
When a network error occurs
Example
const meta = await sdk.productAPI().getProductReviewMeta('product-123', 'review-code');
// Use meta.review_meta for structured datagetProductReviewSummary()
getProductReviewSummary(productId: string, groupStatus?: boolean): Promise<ProductReviewSummary>;Retrieves review summary statistics for a specific product.
Parameters
productId
string
The product ID to get review summary for
groupStatus?
boolean = true
Whether to include group status in summary (default: true)
Returns
Promise<ProductReviewSummary>
Promise resolving to product review summary
Throws
When the API returns an error
Throws
When a network error occurs
Example
const summary = await sdk.productAPI().getProductReviewSummary('product-123');
console.log(`Average rating: ${summary.average_ratings}`);getProducts()
getProducts(params?: ProductRequestParams): Promise<Product[]>;Retrieves products with optional filtering.
Parameters
params?
Optional query parameters for filtering
Returns
Promise<Product[]>
Promise resolving to an array of products
Throws
When the API returns an error
Throws
When a network error occurs
Example
const products = await sdk.productAPI().getProducts({
limit: 20,
status: 'active'
});