-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
c6987d2
8aea7a1
351f326
ff091e2
0ec4771
8eb01e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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'll probably need to add the other nutripatrol classes. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import '../interface/json_object.dart'; | ||
|
||
part 'create_flag.g.dart'; | ||
|
||
@JsonSerializable() | ||
class Flag extends JsonObject { | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonKey() | ||
late String id; | ||
|
||
@JsonKey() | ||
String? barcode; | ||
|
||
@JsonKey() | ||
late Type type; | ||
|
||
@JsonKey() | ||
String? url; | ||
|
||
@JsonKey(name: 'user_id') | ||
late String userId; | ||
|
||
@JsonKey() | ||
late Source source; | ||
|
||
@JsonKey() | ||
double? confidence; | ||
|
||
@JsonKey(name: 'image_id') | ||
String? imageId; | ||
|
||
@JsonKey() | ||
late Flavor flavor; | ||
|
||
@JsonKey() | ||
String? reason; | ||
|
||
@JsonKey() | ||
String? comment; | ||
|
||
@JsonKey(name: 'created_at') | ||
late DateTime CreatedAt; | ||
|
||
@JsonKey(name: 'ticket_id') | ||
late int ticketId; | ||
|
||
@JsonKey(name: 'device_id') | ||
late String deviceId; | ||
|
||
Flag(); | ||
|
||
factory Flag.fromJson(Map<String, dynamic> json) => _$FlagFromJson(json); | ||
|
||
@override Map<String, dynamic> toJson() => _$FlagToJson(this); | ||
} | ||
|
||
/// Enum for ticket type | ||
enum Type { | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonValue('image') | ||
image, | ||
|
||
@JsonValue('product') | ||
product, | ||
|
||
@JsonValue('search') | ||
search | ||
} | ||
|
||
/// Enum for ticket type | ||
enum Source { | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonValue('mobile') | ||
mobile, | ||
|
||
@JsonValue('web') | ||
web, | ||
|
||
@JsonValue('robotoff') | ||
robotoff | ||
} | ||
|
||
/// Enum for ticket flavor | ||
enum Flavor { | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonValue('off') | ||
off, | ||
|
||
@JsonValue('obf') | ||
obf, | ||
|
||
@JsonValue('opff') | ||
opff, | ||
|
||
@JsonValue('opf') | ||
opf, | ||
|
||
@JsonValue('off-pro') | ||
offPro | ||
} |
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,85 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import '../interface/json_object.dart'; | ||
|
||
part 'get_ticket.g.dart'; | ||
|
||
@JsonSerializable() | ||
class Ticket extends JsonObject { | ||
/// Flag ID. Read-only. | ||
@JsonKey() | ||
late int id; | ||
|
||
/// Barcode of the product. Read-only. | ||
@JsonKey() | ||
String? barcode; | ||
|
||
/// Type of the ticket. | ||
@JsonKey() | ||
late TicketType type; | ||
|
||
/// Url of the ticket. Read-only. | ||
@JsonKey() | ||
late String url; | ||
|
||
/// Status of the ticket. | ||
@JsonKey() | ||
late TicketStatus status; | ||
|
||
/// Image id of the ticket. Read-only. | ||
@JsonKey(name: 'image_id') | ||
String? imageId; | ||
|
||
/// Flavor of the ticket. | ||
@JsonKey() | ||
late Flavor flavor; | ||
|
||
/// created date of the ticket. Read-only. | ||
@JsonKey(name: 'created_at') | ||
late String CreatedAt; | ||
|
||
Ticket(); | ||
|
||
factory Ticket.fromJson(Map<String, dynamic> json) => _$TicketFromJson(json); | ||
|
||
@override Map<String, dynamic> toJson() => _$TicketToJson(this); | ||
} | ||
|
||
/// Enum for ticket type | ||
enum TicketType { | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonValue('image') | ||
image, | ||
|
||
@JsonValue('product') | ||
product, | ||
|
||
@JsonValue('search') | ||
search | ||
} | ||
|
||
/// Enum for ticket status | ||
enum TicketStatus { | ||
@JsonValue('open') | ||
open, | ||
|
||
@JsonValue('closed') | ||
closed | ||
} | ||
|
||
/// Enum for ticket flavor | ||
enum Flavor { | ||
Valimp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonValue('off') | ||
off, | ||
|
||
@JsonValue('obf') | ||
obf, | ||
|
||
@JsonValue('opff') | ||
opff, | ||
|
||
@JsonValue('opf') | ||
opf, | ||
|
||
@JsonValue('off-pro') | ||
offPro | ||
} |
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,23 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'get_ticket.dart'; | ||
|
||
import '../interface/json_object.dart'; | ||
|
||
part 'get_tickets.g.dart'; | ||
|
||
@JsonSerializable() | ||
class Tickets extends JsonObject { | ||
/// List of Tickets | ||
@JsonKey() | ||
late List<Ticket> tickets; | ||
|
||
/// Max Page | ||
@JsonKey(name: 'max_page') | ||
late int maxPage; | ||
|
||
Tickets(); | ||
|
||
factory Tickets.fromJson(Map<String, dynamic> json) => _$TicketsFromJson(json); | ||
|
||
@override Map<String, dynamic> toJson() => _$TicketsToJson(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.
Quickly said: test your code in test files, not in main.