Skip to content

Commit e83cad1

Browse files
agordn52WooSignal
authored andcommitted
New method to retrieve a product
1 parent 23be7cc commit e83cad1

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.2.0] - 2020-09-05
2+
3+
* New method to retrieve a product
4+
15
## [1.1.2] - 2020-07-22
26

37
* Update FreeShipping model for minimum spend

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In your flutter project add the dependency:
1515
``` dart
1616
dependencies:
1717
...
18-
woosignal: ^1.1.2
18+
woosignal: ^1.2.0
1919
```
2020

2121
### Usage example #

lib/woosignal.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,22 @@ class WooSignal {
153153
return products;
154154
}
155155

156+
/// https://woosignal.com/docs/api/1.0/products#retrive-a-product-api-call
157+
Future<Product> retrieveProduct(
158+
{int id}) async {
159+
Map<String, dynamic> payload = {};
160+
161+
_printLog("Parameters: " + payload.toString());
162+
payload = _standardPayload("get", payload, "products/${id.toString()}");
163+
164+
Product product;
165+
await _apiProvider.post("/request", payload).then((json) {
166+
product = Product.fromJson(json);
167+
});
168+
_printLog(product.toString());
169+
return product;
170+
}
171+
156172
/// https://woosignal.com/docs/api/1.0/products-variations
157173
Future<List<ProductVariation>> getProductVariations(int productId,
158174
{int page,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: woosignal
22
description: WooCommerce REST API for dart, connect a WooCommerce store and start developing with our interface for their API endpoints.
3-
version: 1.1.2
3+
version: 1.2.0
44
homepage: https://woosignal.com
55
repository: https://github.com/woosignal/flutter-woocommerce-api
66
issue_tracker: https://github.com/woosignal/flutter-woocommerce-api/issues

0 commit comments

Comments
 (0)