Skip to content

Commit 7614218

Browse files
committed
v1.0.4
1 parent 844a4e2 commit 7614218

File tree

5 files changed

+66
-8
lines changed

5 files changed

+66
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.0.4] - 2024-02-14
2+
3+
* pubspec.yaml updates
4+
15
## [1.0.3] - 2024-02-13
26

37
* Updated README.md

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In your flutter project add the dependency:
1111
``` dart
1212
dependencies:
1313
...
14-
woosignal_shopify_api: ^1.0.3
14+
woosignal_shopify_api: ^1.0.4
1515
```
1616

1717
### Usage example #

lib/models/response/auth/auth_customer_info.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ class AuthCustomerInfo {
3232
this.phone,
3333
this.defaultAddress});
3434

35-
AuthCustomerInfo.fromJson(Map<String, dynamic> json) {
35+
AuthCustomerInfo.fromJson(dynamic json) {
36+
if (json is! Map<String, dynamic>) {
37+
return;
38+
}
3639
email = json['email'];
3740
firstName = json['firstName'];
3841
lastName = json['lastName'];

lib/networking/api_provider.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class ApiProvider {
8282
_dio.options.headers = {
8383
"Authorization": "Bearer $_apiKey",
8484
"Content-Type": "application/json",
85+
"Accept": "application/json",
8586
"X-DMETA": json.encode(_deviceMeta).toString()
8687
};
8788
}

lib/woosignal_shopify_api.dart

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import 'package:encrypt/encrypt.dart';
4646
import 'dart:convert';
4747

4848
/// WooSignal Package version
49-
const String wooSignalVersion = "1.0.3";
49+
const String wooSignalVersion = "1.0.4";
5050

5151
class WooSignalShopify {
5252
WooSignalShopify._privateConstructor();
@@ -247,6 +247,55 @@ class WooSignalShopify {
247247
jsonResponse: (json) => OrderCreatedResponse.fromJson(json));
248248
}
249249

250+
Future<List<Product>?> getProductsJson({
251+
int? limit,
252+
String? productType,
253+
int? collectionId,
254+
String? createdAtMax,
255+
String? createdAtMin,
256+
String? fields,
257+
String? handle,
258+
List<int>? ids,
259+
String? presentmentCurrencies,
260+
String? publishedAtMax,
261+
String? publishedAtMin,
262+
String? publishedStatus,
263+
int? sinceId,
264+
String? status,
265+
String? title,
266+
String? updatedAtMax,
267+
String? updatedAtMin,
268+
String? vendor,
269+
}) async {
270+
Map<String, dynamic> payload = {};
271+
if (limit != null) payload["limit"] = limit;
272+
if (productType != null) payload["product_type"] = productType;
273+
if (collectionId != null) payload["collection_id"] = collectionId;
274+
if (createdAtMax != null) payload["created_at_max"] = createdAtMax;
275+
if (createdAtMin != null) payload["created_at_min"] = createdAtMin;
276+
if (fields != null) payload["fields"] = fields;
277+
if (handle != null) payload["handle"] = handle;
278+
if (ids != null) payload["ids"] = ids;
279+
if (presentmentCurrencies != null) {
280+
payload["presentment_currencies"] = presentmentCurrencies;
281+
}
282+
if (publishedAtMax != null) payload["published_at_max"] = publishedAtMax;
283+
if (publishedAtMin != null) payload["published_at_min"] = publishedAtMin;
284+
if (publishedStatus != null) payload["published_status"] = publishedStatus;
285+
if (sinceId != null) payload["since_id"] = sinceId;
286+
if (status != null) payload["status"] = status;
287+
if (title != null) payload["title"] = title;
288+
if (updatedAtMax != null) payload["updated_at_max"] = updatedAtMax;
289+
if (updatedAtMin != null) payload["updated_at_min"] = updatedAtMin;
290+
if (vendor != null) payload["vendor"] = vendor;
291+
292+
return await _wooSignalRequest<List<Product>>(
293+
path: "products/json",
294+
method: "post",
295+
payload: payload,
296+
jsonResponse: (json) => List<Product>.from(json));
297+
}
298+
250299
Future<ShopifyProductResponse?> getProducts({
251300
int? first,
252301
String? after,
@@ -525,11 +574,12 @@ class WooSignalShopify {
525574
if (accessToken != null) payload["access_token"] = accessToken;
526575

527576
return await _wooSignalRequest<AuthCustomerInfo>(
528-
path: "auth/customer",
529-
method: "get",
530-
payload: payload,
531-
jsonResponse: (json) => AuthCustomerInfo.fromJson(json),
532-
auth: true);
577+
path: "auth/customer",
578+
method: "get",
579+
payload: payload,
580+
jsonResponse: (json) => AuthCustomerInfo.fromJson(json),
581+
auth: true,
582+
);
533583
}
534584

535585
/// Search products

0 commit comments

Comments
 (0)