ProductApi class

Product API for Magento integration.

This class provides comprehensive product catalog functionality for Magento, including product listing, search, categories, and product relationships.

Features

  • Product Listing: Get products with pagination and filtering
  • Product Details: Retrieve detailed product information by SKU
  • Category Management: Browse product categories and hierarchy
  • Search Functionality: Search products by name, SKU, or description
  • Product Relationships: Get related, cross-sell, and up-sell products
  • Product Reviews: Retrieve customer reviews for products
  • Advanced Filtering: Filter by price, stock status, and custom attributes

Usage

final productApi = ProductApi(apiClient);

// Get products with pagination
final products = await productApi.getProducts(
  page: 1,
  pageSize: 20,
  categoryId: '123',
);

// Get product details
final product = await productApi.getProduct('SKU123');
Implementers

Constructors

ProductApi.new(MagentoApiClient _client)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getCategories() Future<CategoryTree>
Get categories
getCategory(int categoryId) Future<Category>
Get category by ID
getCrossSellProducts(String sku) Future<List<Product>>
Get cross-sell products
getProduct(String sku) Future<Product>
Get detailed product information by SKU.
getProductReviews(String sku, {int page = 1, int pageSize = 10}) Future<List<Review>>
Get product reviews
getProducts({ProductFilterParams? params, int page = 1, int pageSize = 20, String? searchQuery, String? categoryId, String? sortBy, String? sortOrder, Map<String, dynamic>? filters, double? minPrice, double? maxPrice, List<String>? attributes, bool? inStock, String? brand, List<String>? tags}) Future<ProductListResponse>
Get products with pagination and advanced filtering.
getProductsByCategory(int categoryId, {int page = 1, int pageSize = 20, String? sortBy, String? sortOrder, Map<String, dynamic>? filters}) Future<ProductListResponse>
Get products by category
getProductVariants(String sku) Future<List<ProductOption>>
Get product variants (configurable options)
getRelatedProducts(String sku) Future<List<Product>>
Get related products
getUpSellProducts(String sku) Future<List<Product>>
Get up-sell products
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
searchProducts(String query, {int page = 1, int pageSize = 20, Map<String, dynamic>? filters, String? sortBy, String? sortOrder}) Future<ProductListResponse>
Search products
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited