-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 617 - new "save packagings V3" feature (#640)
New files: * `api_saveProductV3_test.dart`: Integration tests around the "save packagings V3" feature. * `ProductPackaging.dart`: Packaging component for a product, e.g. recyclable bottle made of glass. * `ProductPackaging.g.dart`: generated Impacted files: * `AbstractQueryConfiguration.dart`: populated parameter `tags_lc` * `api_getProduct_test.dart`: removed references to now deprecated field `packaging`; added a test about the new packagings field * `api_saveProduct_test.dart`: skipped one 504 test; removed references to deprecated field `packaging` * `HttpHelper.dart`: new method `doPatchRequest`; minor refactoring * `openfoodfacts.dart`: new method `temporarySaveProductV3` * `Product.dart`: deprecated field `packaging`; added field `packagings` * `Product.g.dart`: generated * `ProductFields.dart`: deprecated `PACKAGING`; added `PACKAGINGS` and `RAW` * `ProductSearchQueryConfiguration.dart`: added api version parameter * `UriHelper.dart`: new method `getPatchUri`
- Loading branch information
1 parent
8d54c3e
commit 55ffbf2
Showing
13 changed files
with
394 additions
and
29 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
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,38 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:openfoodfacts/model/LocalizedTag.dart'; | ||
import '../interface/JsonObject.dart'; | ||
|
||
part 'ProductPackaging.g.dart'; | ||
|
||
/// Packaging component for a product, e.g. recyclable bottle made of glass. | ||
@JsonSerializable() | ||
class ProductPackaging extends JsonObject { | ||
@JsonKey(includeIfNull: false) | ||
LocalizedTag? shape; | ||
|
||
@JsonKey(includeIfNull: false) | ||
LocalizedTag? material; | ||
|
||
@JsonKey(includeIfNull: false) | ||
LocalizedTag? recycling; | ||
|
||
@JsonKey( | ||
name: 'number_of_units', | ||
includeIfNull: false, | ||
fromJson: JsonObject.parseInt, | ||
) | ||
int? numberOfUnits; | ||
|
||
ProductPackaging(); | ||
|
||
factory ProductPackaging.fromJson(dynamic json) => | ||
_$ProductPackagingFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$ProductPackagingToJson(this); | ||
|
||
Map<String, String> toServerData() => JsonObject.toDataStatic(toJson()); | ||
|
||
@override | ||
String toString() => toServerData().toString(); | ||
} |
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
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
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.