|
| 1 | +import 'dart:convert'; |
| 2 | + |
| 3 | +List<SalesReports> salesReportsFromJson(String str) => List<SalesReports>.from( |
| 4 | + json.decode(str).map((x) => SalesReports.fromJson(x))); |
| 5 | + |
| 6 | +String salesReportsToJson(List<SalesReports> data) => |
| 7 | + json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); |
| 8 | + |
| 9 | +class SalesReports { |
| 10 | + SalesReports({ |
| 11 | + this.totalSales, |
| 12 | + this.netSales, |
| 13 | + this.averageSales, |
| 14 | + this.totalOrders, |
| 15 | + this.totalItems, |
| 16 | + this.totalTax, |
| 17 | + this.totalShipping, |
| 18 | + this.totalRefunds, |
| 19 | + this.totalDiscount, |
| 20 | + this.totalsGroupedBy, |
| 21 | + this.totals, |
| 22 | + this.totalCustomers, |
| 23 | + this.links, |
| 24 | + }); |
| 25 | + |
| 26 | + String totalSales; |
| 27 | + String netSales; |
| 28 | + String averageSales; |
| 29 | + int totalOrders; |
| 30 | + int totalItems; |
| 31 | + String totalTax; |
| 32 | + String totalShipping; |
| 33 | + int totalRefunds; |
| 34 | + String totalDiscount; |
| 35 | + String totalsGroupedBy; |
| 36 | + Totals totals; |
| 37 | + int totalCustomers; |
| 38 | + Links links; |
| 39 | + |
| 40 | + factory SalesReports.fromJson(Map<String, dynamic> json) => SalesReports( |
| 41 | + totalSales: json["total_sales"], |
| 42 | + netSales: json["net_sales"], |
| 43 | + averageSales: json["average_sales"], |
| 44 | + totalOrders: json["total_orders"], |
| 45 | + totalItems: json["total_items"], |
| 46 | + totalTax: json["total_tax"], |
| 47 | + totalShipping: json["total_shipping"], |
| 48 | + totalRefunds: json["total_refunds"], |
| 49 | + totalDiscount: json["total_discount"], |
| 50 | + totalsGroupedBy: json["totals_grouped_by"], |
| 51 | + totals: Totals.fromJson(json["totals"]), |
| 52 | + totalCustomers: json["total_customers"], |
| 53 | + links: Links.fromJson(json["_links"]), |
| 54 | + ); |
| 55 | + |
| 56 | + Map<String, dynamic> toJson() => { |
| 57 | + "total_sales": totalSales, |
| 58 | + "net_sales": netSales, |
| 59 | + "average_sales": averageSales, |
| 60 | + "total_orders": totalOrders, |
| 61 | + "total_items": totalItems, |
| 62 | + "total_tax": totalTax, |
| 63 | + "total_shipping": totalShipping, |
| 64 | + "total_refunds": totalRefunds, |
| 65 | + "total_discount": totalDiscount, |
| 66 | + "totals_grouped_by": totalsGroupedBy, |
| 67 | + "totals": totals.toJson(), |
| 68 | + "total_customers": totalCustomers, |
| 69 | + "_links": links.toJson(), |
| 70 | + }; |
| 71 | +} |
| 72 | + |
| 73 | +class Links { |
| 74 | + Links({ |
| 75 | + this.about, |
| 76 | + }); |
| 77 | + |
| 78 | + List<About> about; |
| 79 | + |
| 80 | + factory Links.fromJson(Map<String, dynamic> json) => Links( |
| 81 | + about: List<About>.from(json["about"].map((x) => About.fromJson(x))), |
| 82 | + ); |
| 83 | + |
| 84 | + Map<String, dynamic> toJson() => { |
| 85 | + "about": List<dynamic>.from(about.map((x) => x.toJson())), |
| 86 | + }; |
| 87 | +} |
| 88 | + |
| 89 | +class About { |
| 90 | + About({ |
| 91 | + this.href, |
| 92 | + }); |
| 93 | + |
| 94 | + String href; |
| 95 | + |
| 96 | + factory About.fromJson(Map<String, dynamic> json) => About( |
| 97 | + href: json["href"], |
| 98 | + ); |
| 99 | + |
| 100 | + Map<String, dynamic> toJson() => { |
| 101 | + "href": href, |
| 102 | + }; |
| 103 | +} |
| 104 | + |
| 105 | +class Totals { |
| 106 | + Totals({ |
| 107 | + this.the20201108, |
| 108 | + }); |
| 109 | + |
| 110 | + The20201108 the20201108; |
| 111 | + |
| 112 | + factory Totals.fromJson(Map<String, dynamic> json) => Totals( |
| 113 | + the20201108: The20201108.fromJson(json["2020-11-08"]), |
| 114 | + ); |
| 115 | + |
| 116 | + Map<String, dynamic> toJson() => { |
| 117 | + "2020-11-08": the20201108.toJson(), |
| 118 | + }; |
| 119 | +} |
| 120 | + |
| 121 | +class The20201108 { |
| 122 | + The20201108({ |
| 123 | + this.sales, |
| 124 | + this.orders, |
| 125 | + this.items, |
| 126 | + this.tax, |
| 127 | + this.shipping, |
| 128 | + this.discount, |
| 129 | + this.customers, |
| 130 | + }); |
| 131 | + |
| 132 | + String sales; |
| 133 | + int orders; |
| 134 | + int items; |
| 135 | + String tax; |
| 136 | + String shipping; |
| 137 | + String discount; |
| 138 | + int customers; |
| 139 | + |
| 140 | + factory The20201108.fromJson(Map<String, dynamic> json) => The20201108( |
| 141 | + sales: json["sales"], |
| 142 | + orders: json["orders"], |
| 143 | + items: json["items"], |
| 144 | + tax: json["tax"], |
| 145 | + shipping: json["shipping"], |
| 146 | + discount: json["discount"], |
| 147 | + customers: json["customers"], |
| 148 | + ); |
| 149 | + |
| 150 | + Map<String, dynamic> toJson() => { |
| 151 | + "sales": sales, |
| 152 | + "orders": orders, |
| 153 | + "items": items, |
| 154 | + "tax": tax, |
| 155 | + "shipping": shipping, |
| 156 | + "discount": discount, |
| 157 | + "customers": customers, |
| 158 | + }; |
| 159 | +} |
0 commit comments