File tree Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Original file line number Diff line number Diff line change 1+ ## [ 1.0.6] - 2020-04-09
2+
3+ * Ability to create Product reviews
4+
15## [ 1.0.5] - 2020-04-03
26
37* Tweaks to ProductReviews model
Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ packages:
244244 path: ".."
245245 relative: true
246246 source: path
247- version: "1.0.3 "
247+ version: "1.0.6 "
248248 xml:
249249 dependency: transitive
250250 description:
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class ProductReview {
2424 String review;
2525 int rating;
2626 bool verified;
27- Map <String , String > reviewerAvatarUrls;
27+ Map <String , dynamic > reviewerAvatarUrls;
2828 Links links;
2929
3030 ProductReview (
@@ -53,7 +53,7 @@ class ProductReview {
5353 rating = json['rating' ];
5454 verified = json['verified' ];
5555 reviewerAvatarUrls = json['reviewer_avatar_urls' ] != null
56- ? (json['reviewer_avatar_urls' ]). cast < Map < String , String >>()
56+ ? (json['reviewer_avatar_urls' ])
5757 : null ;
5858 links = json['_links' ] != null ? new Links .fromJson (json['_links' ]) : null ;
5959 }
Original file line number Diff line number Diff line change @@ -392,6 +392,36 @@ class WooSignal {
392392 return productReviews;
393393 }
394394
395+ /// https://woosignal.com/docs/api/1.0/product-reviews
396+ Future <ProductReview > createProductReview (
397+ {int productId,
398+ int status,
399+ String reviewer,
400+ String reviewerEmail,
401+ String review,
402+ int rating,
403+ bool verified}) async {
404+ Map <String , dynamic > payload = {};
405+
406+ if (productId != null ) payload['product_id' ] = productId;
407+ if (status != null ) payload['status' ] = status;
408+ if (reviewer != null ) payload['reviewer' ] = reviewer;
409+ if (reviewerEmail != null ) payload['reviewer_email' ] = reviewerEmail;
410+ if (review != null ) payload['review' ] = review;
411+ if (rating != null ) payload['rating' ] = rating;
412+ if (verified != null ) payload['verified' ] = verified;
413+
414+ _printLog (payload.toString ());
415+ payload = _standardPayload ("post" , payload, "products/reviews" );
416+
417+ ProductReview productReview;
418+ await _apiProvider.post ("/request" , payload).then ((json) {
419+ productReview = ProductReview .fromJson (json);
420+ });
421+ _printLog (productReview.toString ());
422+ return productReview;
423+ }
424+
395425 /// https://woosignal.com/docs/api/1.0/customers
396426 Future <List <Customer >> getCustomers (
397427 {int page,
Original file line number Diff line number Diff line change 11name : woosignal
22description : WooCommerce REST API for dart, connect a WooCommerce store and start developing with our interface for their API endpoints.
3- version : 1.0.5
3+ version : 1.0.6
44homepage : https://woosignal.com
55repository : https://github.com/woosignal/flutter-woocommerce-api
66
You can’t perform that action at this time.
0 commit comments