|
| 1 | +// To parse this JSON data, do |
| 2 | +// |
| 3 | +// final reports = reportsFromJson(jsonString); |
| 4 | + |
| 5 | +import 'dart:convert'; |
| 6 | + |
| 7 | +List<Reports> reportsFromJson(String str) => |
| 8 | + List<Reports>.from(json.decode(str).map((x) => Reports.fromJson(x))); |
| 9 | + |
| 10 | +String reportsToJson(List<Reports> data) => |
| 11 | + json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); |
| 12 | + |
| 13 | +class Reports { |
| 14 | + Reports({ |
| 15 | + this.slug, |
| 16 | + this.description, |
| 17 | + this.links, |
| 18 | + }); |
| 19 | + |
| 20 | + String slug; |
| 21 | + String description; |
| 22 | + Links links; |
| 23 | + |
| 24 | + factory Reports.fromJson(Map<String, dynamic> json) => Reports( |
| 25 | + slug: json["slug"], |
| 26 | + description: json["description"], |
| 27 | + links: Links.fromJson(json["_links"]), |
| 28 | + ); |
| 29 | + |
| 30 | + Map<String, dynamic> toJson() => { |
| 31 | + "slug": slug, |
| 32 | + "description": description, |
| 33 | + "_links": links.toJson(), |
| 34 | + }; |
| 35 | +} |
| 36 | + |
| 37 | +class Links { |
| 38 | + Links({ |
| 39 | + this.self, |
| 40 | + this.collection, |
| 41 | + }); |
| 42 | + |
| 43 | + List<Collection> self; |
| 44 | + List<Collection> collection; |
| 45 | + |
| 46 | + factory Links.fromJson(Map<String, dynamic> json) => Links( |
| 47 | + self: List<Collection>.from( |
| 48 | + json["self"].map((x) => Collection.fromJson(x))), |
| 49 | + collection: List<Collection>.from( |
| 50 | + json["collection"].map((x) => Collection.fromJson(x))), |
| 51 | + ); |
| 52 | + |
| 53 | + Map<String, dynamic> toJson() => { |
| 54 | + "self": List<dynamic>.from(self.map((x) => x.toJson())), |
| 55 | + "collection": List<dynamic>.from(collection.map((x) => x.toJson())), |
| 56 | + }; |
| 57 | +} |
| 58 | + |
| 59 | +class Collection { |
| 60 | + Collection({ |
| 61 | + this.href, |
| 62 | + }); |
| 63 | + |
| 64 | + String href; |
| 65 | + |
| 66 | + factory Collection.fromJson(Map<String, dynamic> json) => Collection( |
| 67 | + href: json["href"], |
| 68 | + ); |
| 69 | + |
| 70 | + Map<String, dynamic> toJson() => { |
| 71 | + "href": href, |
| 72 | + }; |
| 73 | +} |
| 74 | +// To parse this JSON data, do |
| 75 | +// |
| 76 | +// final salesReports = salesReportsFromJson(jsonString); |
| 77 | + |
| 78 | +// To parse this JSON data, do |
| 79 | +// |
| 80 | +// final salesReports = salesReportsFromJson(jsonString); |
| 81 | + |
| 82 | +SalesReports salesReportsFromJson(String str) => |
| 83 | + SalesReports.fromJson(json.decode(str)); |
| 84 | + |
| 85 | +String salesReportsToJson(SalesReports data) => json.encode(data.toJson()); |
| 86 | + |
| 87 | +class SalesReports { |
| 88 | + SalesReports({ |
| 89 | + this.totalSales, |
| 90 | + this.netSales, |
| 91 | + this.averageSales, |
| 92 | + this.totalOrders, |
| 93 | + this.totalItems, |
| 94 | + this.totalTax, |
| 95 | + this.totalShipping, |
| 96 | + this.totalRefunds, |
| 97 | + this.totalDiscount, |
| 98 | + this.totalsGroupedBy, |
| 99 | + this.totals, |
| 100 | + this.totalCustomers, |
| 101 | + this.links, |
| 102 | + }); |
| 103 | + |
| 104 | + String totalSales; |
| 105 | + String netSales; |
| 106 | + String averageSales; |
| 107 | + int totalOrders; |
| 108 | + int totalItems; |
| 109 | + String totalTax; |
| 110 | + String totalShipping; |
| 111 | + int totalRefunds; |
| 112 | + String totalDiscount; |
| 113 | + String totalsGroupedBy; |
| 114 | + Map<String, Total> totals; |
| 115 | + int totalCustomers; |
| 116 | + Links links; |
| 117 | + |
| 118 | + factory SalesReports.fromJson(Map<String, dynamic> json) => SalesReports( |
| 119 | + totalSales: json["total_sales"], |
| 120 | + netSales: json["net_sales"], |
| 121 | + averageSales: json["average_sales"], |
| 122 | + totalOrders: json["total_orders"], |
| 123 | + totalItems: json["total_items"], |
| 124 | + totalTax: json["total_tax"], |
| 125 | + totalShipping: json["total_shipping"], |
| 126 | + totalRefunds: json["total_refunds"], |
| 127 | + totalDiscount: json["total_discount"], |
| 128 | + totalsGroupedBy: json["totals_grouped_by"], |
| 129 | + totals: Map.from(json["totals"]) |
| 130 | + .map((k, v) => MapEntry<String, Total>(k, Total.fromJson(v))), |
| 131 | + totalCustomers: json["total_customers"], |
| 132 | + links: Links.fromJson(json["_links"]), |
| 133 | + ); |
| 134 | + |
| 135 | + Map<String, dynamic> toJson() => { |
| 136 | + "total_sales": totalSales, |
| 137 | + "net_sales": netSales, |
| 138 | + "average_sales": averageSales, |
| 139 | + "total_orders": totalOrders, |
| 140 | + "total_items": totalItems, |
| 141 | + "total_tax": totalTax, |
| 142 | + "total_shipping": totalShipping, |
| 143 | + "total_refunds": totalRefunds, |
| 144 | + "total_discount": totalDiscount, |
| 145 | + "totals_grouped_by": totalsGroupedBy, |
| 146 | + "totals": Map.from(totals) |
| 147 | + .map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), |
| 148 | + "total_customers": totalCustomers, |
| 149 | + "_links": links.toJson(), |
| 150 | + }; |
| 151 | +} |
| 152 | + |
| 153 | +class About { |
| 154 | + About({ |
| 155 | + this.href, |
| 156 | + }); |
| 157 | + |
| 158 | + String href; |
| 159 | + |
| 160 | + factory About.fromJson(Map<String, dynamic> json) => About( |
| 161 | + href: json["href"], |
| 162 | + ); |
| 163 | + |
| 164 | + Map<String, dynamic> toJson() => { |
| 165 | + "href": href, |
| 166 | + }; |
| 167 | +} |
| 168 | + |
| 169 | +class Total { |
| 170 | + Total({ |
| 171 | + this.sales, |
| 172 | + this.orders, |
| 173 | + this.items, |
| 174 | + this.tax, |
| 175 | + this.shipping, |
| 176 | + this.discount, |
| 177 | + this.customers, |
| 178 | + }); |
| 179 | + |
| 180 | + String sales; |
| 181 | + int orders; |
| 182 | + int items; |
| 183 | + String tax; |
| 184 | + String shipping; |
| 185 | + String discount; |
| 186 | + int customers; |
| 187 | + |
| 188 | + factory Total.fromJson(Map<String, dynamic> json) => Total( |
| 189 | + sales: json["sales"], |
| 190 | + orders: json["orders"], |
| 191 | + items: json["items"], |
| 192 | + tax: json["tax"], |
| 193 | + shipping: json["shipping"], |
| 194 | + discount: json["discount"], |
| 195 | + customers: json["customers"], |
| 196 | + ); |
| 197 | + |
| 198 | + Map<String, dynamic> toJson() => { |
| 199 | + "sales": sales, |
| 200 | + "orders": orders, |
| 201 | + "items": items, |
| 202 | + "tax": tax, |
| 203 | + "shipping": shipping, |
| 204 | + "discount": discount, |
| 205 | + "customers": customers, |
| 206 | + }; |
| 207 | +} |
| 208 | +// To parse this JSON data, do |
| 209 | +// |
| 210 | +// final topSellerReport = topSellerReportFromJson(jsonString); |
| 211 | + |
| 212 | +TopSellerReport topSellerReportFromJson(String str) => |
| 213 | + TopSellerReport.fromJson(json.decode(str)); |
| 214 | + |
| 215 | +String topSellerReportToJson(TopSellerReport data) => |
| 216 | + json.encode(data.toJson()); |
| 217 | + |
| 218 | +class TopSellerReport { |
| 219 | + TopSellerReport({ |
| 220 | + this.title, |
| 221 | + this.productId, |
| 222 | + this.quantity, |
| 223 | + this.links, |
| 224 | + }); |
| 225 | + |
| 226 | + String title; |
| 227 | + int productId; |
| 228 | + int quantity; |
| 229 | + Links links; |
| 230 | + |
| 231 | + factory TopSellerReport.fromJson(Map<String, dynamic> json) => |
| 232 | + TopSellerReport( |
| 233 | + title: json["title"], |
| 234 | + productId: json["product_id"], |
| 235 | + quantity: json["quantity"], |
| 236 | + links: Links.fromJson(json["_links"]), |
| 237 | + ); |
| 238 | + |
| 239 | + Map<String, dynamic> toJson() => { |
| 240 | + "title": title, |
| 241 | + "product_id": productId, |
| 242 | + "quantity": quantity, |
| 243 | + "_links": links.toJson(), |
| 244 | + }; |
| 245 | +} |
| 246 | + |
| 247 | +class Links2 { |
| 248 | + Links2({ |
| 249 | + this.about, |
| 250 | + this.product, |
| 251 | + }); |
| 252 | + |
| 253 | + List<About> about; |
| 254 | + List<About> product; |
| 255 | + |
| 256 | + factory Links2.fromJson(Map<String, dynamic> json) => Links2( |
| 257 | + about: List<About>.from(json["about"].map((x) => About.fromJson(x))), |
| 258 | + product: |
| 259 | + List<About>.from(json["product"].map((x) => About.fromJson(x))), |
| 260 | + ); |
| 261 | + |
| 262 | + Map<String, dynamic> toJson() => { |
| 263 | + "about": List<dynamic>.from(about.map((x) => x.toJson())), |
| 264 | + "product": List<dynamic>.from(product.map((x) => x.toJson())), |
| 265 | + }; |
| 266 | +} |
| 267 | + |
| 268 | +class About2 { |
| 269 | + About2({ |
| 270 | + this.href, |
| 271 | + }); |
| 272 | + |
| 273 | + String href; |
| 274 | + |
| 275 | + factory About2.fromJson(Map<String, dynamic> json) => About2( |
| 276 | + href: json["href"], |
| 277 | + ); |
| 278 | + |
| 279 | + Map<String, dynamic> toJson() => { |
| 280 | + "href": href, |
| 281 | + }; |
| 282 | +} |
| 283 | +// To parse this JSON data, do |
| 284 | +// |
| 285 | +// final couponReport = couponReportFromJson(jsonString); |
| 286 | + |
| 287 | +// To parse this JSON data, do |
| 288 | +// |
| 289 | +// final totalReport = totalReportFromJson(jsonString); |
| 290 | + |
| 291 | +TotalReport totalReportFromJson(String str) => |
| 292 | + TotalReport.fromJson(json.decode(str)); |
| 293 | + |
| 294 | +String totalReportToJson(TotalReport data) => json.encode(data.toJson()); |
| 295 | + |
| 296 | +class TotalReport { |
| 297 | + TotalReport({ |
| 298 | + this.slug, |
| 299 | + this.name, |
| 300 | + this.total, |
| 301 | + }); |
| 302 | + |
| 303 | + String slug; |
| 304 | + String name; |
| 305 | + int total; |
| 306 | + |
| 307 | + factory TotalReport.fromJson(Map<String, dynamic> json) => TotalReport( |
| 308 | + slug: json["slug"], |
| 309 | + name: json["name"], |
| 310 | + total: json["total"], |
| 311 | + ); |
| 312 | + |
| 313 | + Map<String, dynamic> toJson() => { |
| 314 | + "slug": slug, |
| 315 | + "name": name, |
| 316 | + "total": total, |
| 317 | + }; |
| 318 | +} |
0 commit comments