forked from openfoodfacts/openfoodfacts-dart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 978 - new prices features (thumbnails, stats)
New file: * `price_total_stats.dart`: Total stats for Prices. Impacted files: * `api_get_product_test.dart`: unrelated minor fix * `api_prices_test.dart`: added test for the new `getStats` method; added test for thumbnails * `location.dart`: added new count fields * `location.g.dart`: generated * `open_prices_api_client.dart`: new method `getStats` * `openfoodfacts.dart`: exported new file `price_total_stats.dart` * `price_product.dart`: added new count fields * `price_product.g.dart`: generated * `price_user.dart`: added new count fields * `price_user.g.dart`: generated * `proof.dart`: added thumbnail field and getter * `proof.g.dart`: generated * `proof_type.dart`: added new "SHOP_IMPORT" value
- Loading branch information
1 parent
0d3f6fc
commit 6ed58f8
Showing
14 changed files
with
244 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import '../interface/json_object.dart'; | ||
import '../utils/json_helper.dart'; | ||
|
||
part 'price_total_stats.g.dart'; | ||
|
||
/// Total stats for Prices. | ||
/// | ||
/// cf. `TotalStats` in https://prices.openfoodfacts.org/api/docs | ||
@JsonSerializable() | ||
class PriceTotalStats extends JsonObject { | ||
@JsonKey(name: 'price_count') | ||
int? priceCount; | ||
|
||
@JsonKey(name: 'price_type_product_code_count') | ||
int? priceTypeProductCodeCount; | ||
|
||
@JsonKey(name: 'price_type_category_tag_count') | ||
int? priceTypeCategoryTagCount; | ||
|
||
@JsonKey(name: 'product_count') | ||
int? productCount; | ||
|
||
@JsonKey(name: 'product_with_price_count') | ||
int? productWithPriceCount; | ||
|
||
@JsonKey(name: 'location_count') | ||
int? locationCount; | ||
|
||
@JsonKey(name: 'location_with_price_count') | ||
int? locationWithPriceCount; | ||
|
||
@JsonKey(name: 'proof_count') | ||
int? proofCount; | ||
|
||
@JsonKey(name: 'proof_with_price_count') | ||
int? proofWithPriceCount; | ||
|
||
@JsonKey(name: 'proof_type_price_tag_count') | ||
int? proofTypePriceTagCount; | ||
|
||
@JsonKey(name: 'proof_type_receipt_count') | ||
int? proofTypeReceiptCount; | ||
|
||
@JsonKey(name: 'user_count') | ||
int? userCount; | ||
|
||
@JsonKey(name: 'user_with_price_count') | ||
int? userWithPriceCount; | ||
|
||
@JsonKey(fromJson: JsonHelper.nullableStringTimestampToDate) | ||
DateTime? updated; | ||
|
||
PriceTotalStats(); | ||
|
||
factory PriceTotalStats.fromJson(Map<String, dynamic> json) => | ||
_$PriceTotalStatsFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$PriceTotalStatsToJson(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.