-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Integrate all routes from nutripatrol's API #991
base: master
Are you sure you want to change the base?
Changes from all commits
74d2d47
9a8f218
934bb33
a499d84
9713eb4
83c0c64
117de10
7a58401
e2c1017
c253ad4
3f20cca
290d3fa
7525254
e5507fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:openfoodfacts/src/nutripatrol/get_ticket.dart'; | ||
|
||
import '../interface/json_object.dart'; | ||
|
||
part 'create_flag.g.dart'; | ||
|
||
@JsonSerializable() | ||
class CreateNutripatrolFlag extends JsonObject { | ||
/// Ticket ID associated with the flag | ||
@JsonKey() | ||
late NutripatrolTicket ticket; | ||
|
||
/// Barcode of the product. | ||
@JsonKey() | ||
String? barcode; | ||
|
||
/// Type of the flag | ||
@JsonKey() | ||
late String type; | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Url of the product | ||
@JsonKey() | ||
late String url; | ||
|
||
/// User ID | ||
@JsonKey(name: 'user_id') | ||
late String userId; | ||
|
||
/// Device ID | ||
@JsonKey(name: 'device_id') | ||
late String deviceId; | ||
|
||
/// Source of the flag | ||
@JsonKey() | ||
late String source; | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Confidence of the flag | ||
@JsonKey() | ||
double? confidence; | ||
|
||
/// Image ID of the flag | ||
@JsonKey(name: 'image_id') | ||
String? imageId; | ||
|
||
/// Flavor of the flag | ||
@JsonKey() | ||
late String flavor; | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Reason for the flag | ||
@JsonKey() | ||
String? reason; | ||
|
||
/// Comment associated with the flag | ||
@JsonKey() | ||
String? comment; | ||
|
||
/// Created date of the flag | ||
@JsonKey(name: 'created_at') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably need method to/from json. |
||
late DateTime createdAt; | ||
|
||
CreateNutripatrolFlag(); | ||
|
||
factory CreateNutripatrolFlag.fromJson(Map<String, dynamic> json) => | ||
_$CreateNutripatrolFlagFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$CreateNutripatrolFlagToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:openfoodfacts/openfoodfacts.dart'; | ||
import 'package:openfoodfacts/src/utils/nutripatrol_source.dart'; | ||
|
||
import '../interface/json_object.dart'; | ||
|
||
part 'create_flag_request.g.dart'; | ||
|
||
@JsonSerializable() | ||
class CreateNutripatrolFlagRequest extends JsonObject { | ||
/// Barcode of the product. | ||
@JsonKey() | ||
String? barcode; | ||
|
||
/// Type of the flag | ||
@JsonKey() | ||
late NutripatrolType type; | ||
|
||
/// Url of the product | ||
@JsonKey() | ||
late String url; | ||
|
||
/// User ID | ||
@JsonKey(name: 'user_id') | ||
late String userId; | ||
|
||
/// Device ID | ||
@JsonKey(name: 'device_id') | ||
late String deviceId; | ||
|
||
/// Source of the flag | ||
@JsonKey() | ||
late NutripatrolSource source; | ||
|
||
/// Confidence of the flag | ||
@JsonKey() | ||
double? confidence; | ||
|
||
/// Image ID of the flag | ||
@JsonKey(name: 'image_id') | ||
String? imageId; | ||
|
||
/// Flavor of the flag | ||
@JsonKey() | ||
late Flavor flavor; | ||
|
||
/// Reason for the flag | ||
@JsonKey() | ||
List<NutripatrolFlagReason>? reason; | ||
|
||
/// Comment associated with the flag | ||
@JsonKey() | ||
String? comment; | ||
|
||
/// Created date of the flag | ||
@JsonKey(name: 'created_at') | ||
late DateTime createdAt; | ||
|
||
CreateNutripatrolFlagRequest(); | ||
|
||
factory CreateNutripatrolFlagRequest.fromJson(Map<String, dynamic> json) => | ||
_$CreateNutripatrolFlagRequestFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$CreateNutripatrolFlagRequestToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll probably need to add the other nutripatrol classes.