fetchProducts method
Future<ShopifyProduct?>
fetchProducts({
- List<
int> ? ids, - int limit = 50,
- int? sinceId,
- String? title,
- String? vendor,
- String? handle,
- String? productType,
- String status = 'active',
- int? collectionId,
- String? createdAtMin,
- String? createdAtMax,
- String? updatedAtMin,
- String? updatedAtMax,
- String? publishedAtMin,
- String? publishedAtMax,
- dynamic publishedStatus = 'any',
- List<
String> ? fields, - List<
String> ? presentmentCurrencies, - String? pageInfo,
Implementation
Future<ShopifyProduct?> fetchProducts(
{List<int>? ids,
int limit = 50,
int? sinceId,
String? title,
String? vendor,
String? handle,
String? productType,
String status = 'active', // active, archived, draft
int? collectionId,
String? createdAtMin,
String? createdAtMax,
String? updatedAtMin,
String? updatedAtMax,
String? publishedAtMin,
String? publishedAtMax,
publishedStatus = 'any', // any, published, unpublished
List<String>? fields,
List<String>? presentmentCurrencies,
String? pageInfo}) async {
Map query = {
'ids': ids,
'limit': limit,
'since_id': sinceId,
'title': title,
'vendor': vendor,
'handle': handle,
'product_type': productType,
'status': status,
'collection_id': collectionId,
'created_at_min': createdAtMin,
'created_at_max': createdAtMax,
'updated_at_min': updatedAtMin,
'updated_at_max': updatedAtMax,
'published_at_min': publishedAtMin,
'published_at_max': publishedAtMax,
'published_status': publishedStatus,
'fields': fields,
'presentment_currencies': presentmentCurrencies,
'page_info': pageInfo
};
query.removeWhere((key, value) => value == null);
try {
Response response = await this.client.post("/products", data: query);
return ShopifyProduct.fromJson(response.data);
} on Exception catch (e) {
logResponse(e.toString());
}
return null;
}