You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
804 lines
26 KiB
Dart
804 lines
26 KiB
Dart
4 years ago
|
// To parse this JSON data, do
|
||
|
//
|
||
|
// final review = reviewFromJson(jsonString);
|
||
|
|
||
|
import 'dart:convert';
|
||
|
|
||
|
List<Review> reviewFromJson(String str) => List<Review>.from(json.decode(str).map((x) => Review.fromJson(x)));
|
||
|
|
||
|
String reviewToJson(List<Review> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
||
|
|
||
|
class Product {
|
||
|
Product({
|
||
|
this.id,
|
||
|
this.visibleIndividually,
|
||
|
this.name,
|
||
|
this.namen,
|
||
|
this.localizedNames,
|
||
|
this.shortDescription,
|
||
|
this.shortDescriptionn,
|
||
|
this.fullDescription,
|
||
|
this.fullDescriptionn,
|
||
|
this.markasNew,
|
||
|
this.showOnHomePage,
|
||
|
this.metaKeywords,
|
||
|
this.metaDescription,
|
||
|
this.metaTitle,
|
||
|
this.allowCustomerReviews,
|
||
|
this.approvedRatingSum,
|
||
|
this.notApprovedRatingSum,
|
||
|
this.approvedTotalReviews,
|
||
|
this.notApprovedTotalReviews,
|
||
|
this.sku,
|
||
|
this.isRx,
|
||
|
this.prescriptionRequired,
|
||
|
this.rxMessage,
|
||
|
this.rxMessagen,
|
||
|
this.manufacturerPartNumber,
|
||
|
this.gtin,
|
||
|
this.isGiftCard,
|
||
|
this.requireOtherProducts,
|
||
|
this.automaticallyAddRequiredProducts,
|
||
|
this.isDownload,
|
||
|
this.unlimitedDownloads,
|
||
|
this.maxNumberOfDownloads,
|
||
|
this.downloadExpirationDays,
|
||
|
this.hasSampleDownload,
|
||
|
this.hasUserAgreement,
|
||
|
this.isRecurring,
|
||
|
this.recurringCycleLength,
|
||
|
this.recurringTotalCycles,
|
||
|
this.isRental,
|
||
|
this.rentalPriceLength,
|
||
|
this.isShipEnabled,
|
||
|
this.isFreeShipping,
|
||
|
this.shipSeparately,
|
||
|
this.additionalShippingCharge,
|
||
|
this.isTaxExempt,
|
||
|
this.isTelecommunicationsOrBroadcastingOrElectronicServices,
|
||
|
this.useMultipleWarehouses,
|
||
|
this.manageInventoryMethodId,
|
||
|
this.stockQuantity,
|
||
|
this.stockAvailability,
|
||
|
this.stockAvailabilityn,
|
||
|
this.displayStockAvailability,
|
||
|
this.displayStockQuantity,
|
||
|
this.minStockQuantity,
|
||
|
this.notifyAdminForQuantityBelow,
|
||
|
this.allowBackInStockSubscriptions,
|
||
|
this.orderMinimumQuantity,
|
||
|
this.orderMaximumQuantity,
|
||
|
this.allowedQuantities,
|
||
|
this.allowAddingOnlyExistingAttributeCombinations,
|
||
|
this.disableBuyButton,
|
||
|
this.disableWishlistButton,
|
||
|
this.availableForPreOrder,
|
||
|
this.preOrderAvailabilityStartDateTimeUtc,
|
||
|
this.callForPrice,
|
||
|
this.price,
|
||
|
this.oldPrice,
|
||
|
this.productCost,
|
||
|
this.specialPrice,
|
||
|
this.specialPriceStartDateTimeUtc,
|
||
|
this.specialPriceEndDateTimeUtc,
|
||
|
this.customerEntersPrice,
|
||
|
this.minimumCustomerEnteredPrice,
|
||
|
this.maximumCustomerEnteredPrice,
|
||
|
this.basepriceEnabled,
|
||
|
this.basepriceAmount,
|
||
|
this.basepriceBaseAmount,
|
||
|
this.hasTierPrices,
|
||
|
this.hasDiscountsApplied,
|
||
|
this.discountName,
|
||
|
this.discountNamen,
|
||
|
this.discountDescription,
|
||
|
this.discountDescriptionn,
|
||
|
this.discountPercentage,
|
||
|
this.currency,
|
||
|
this.currencyn,
|
||
|
this.weight,
|
||
|
this.length,
|
||
|
this.width,
|
||
|
this.height,
|
||
|
this.availableStartDateTimeUtc,
|
||
|
this.availableEndDateTimeUtc,
|
||
|
this.displayOrder,
|
||
|
this.published,
|
||
|
this.deleted,
|
||
|
this.createdOnUtc,
|
||
|
this.updatedOnUtc,
|
||
|
this.productType,
|
||
|
this.parentGroupedProductId,
|
||
|
this.roleIds,
|
||
|
this.discountIds,
|
||
|
this.storeIds,
|
||
|
this.manufacturerIds,
|
||
|
this.reviews,
|
||
|
this.images,
|
||
|
this.attributes,
|
||
|
this.specifications,
|
||
|
this.associatedProductIds,
|
||
|
this.tags,
|
||
|
this.vendorId,
|
||
|
this.seName,
|
||
|
});
|
||
|
|
||
|
String id;
|
||
|
bool visibleIndividually;
|
||
|
String name;
|
||
|
String namen;
|
||
|
List<LocalizedName> localizedNames;
|
||
|
String shortDescription;
|
||
|
String shortDescriptionn;
|
||
|
String fullDescription;
|
||
|
String fullDescriptionn;
|
||
|
bool markasNew;
|
||
|
bool showOnHomePage;
|
||
|
String metaKeywords;
|
||
|
String metaDescription;
|
||
|
String metaTitle;
|
||
|
bool allowCustomerReviews;
|
||
|
dynamic approvedRatingSum;
|
||
|
dynamic notApprovedRatingSum;
|
||
|
dynamic approvedTotalReviews;
|
||
|
dynamic notApprovedTotalReviews;
|
||
|
String sku;
|
||
|
bool isRx;
|
||
|
bool prescriptionRequired;
|
||
|
dynamic rxMessage;
|
||
|
dynamic rxMessagen;
|
||
|
dynamic manufacturerPartNumber;
|
||
|
dynamic gtin;
|
||
|
bool isGiftCard;
|
||
|
bool requireOtherProducts;
|
||
|
bool automaticallyAddRequiredProducts;
|
||
|
bool isDownload;
|
||
|
bool unlimitedDownloads;
|
||
|
dynamic maxNumberOfDownloads;
|
||
|
dynamic downloadExpirationDays;
|
||
|
bool hasSampleDownload;
|
||
|
bool hasUserAgreement;
|
||
|
bool isRecurring;
|
||
|
dynamic recurringCycleLength;
|
||
|
dynamic recurringTotalCycles;
|
||
|
bool isRental;
|
||
|
dynamic rentalPriceLength;
|
||
|
bool isShipEnabled;
|
||
|
bool isFreeShipping;
|
||
|
bool shipSeparately;
|
||
|
dynamic additionalShippingCharge;
|
||
|
bool isTaxExempt;
|
||
|
bool isTelecommunicationsOrBroadcastingOrElectronicServices;
|
||
|
bool useMultipleWarehouses;
|
||
|
dynamic manageInventoryMethodId;
|
||
|
dynamic stockQuantity;
|
||
|
String stockAvailability;
|
||
|
String stockAvailabilityn;
|
||
|
bool displayStockAvailability;
|
||
|
bool displayStockQuantity;
|
||
|
dynamic minStockQuantity;
|
||
|
dynamic notifyAdminForQuantityBelow;
|
||
|
bool allowBackInStockSubscriptions;
|
||
|
dynamic orderMinimumQuantity;
|
||
|
dynamic orderMaximumQuantity;
|
||
|
dynamic allowedQuantities;
|
||
|
bool allowAddingOnlyExistingAttributeCombinations;
|
||
|
bool disableBuyButton;
|
||
|
bool disableWishlistButton;
|
||
|
bool availableForPreOrder;
|
||
|
dynamic preOrderAvailabilityStartDateTimeUtc;
|
||
|
bool callForPrice;
|
||
|
dynamic price;
|
||
|
dynamic oldPrice;
|
||
|
dynamic productCost;
|
||
|
dynamic specialPrice;
|
||
|
dynamic specialPriceStartDateTimeUtc;
|
||
|
dynamic specialPriceEndDateTimeUtc;
|
||
|
bool customerEntersPrice;
|
||
|
dynamic minimumCustomerEnteredPrice;
|
||
|
dynamic maximumCustomerEnteredPrice;
|
||
|
bool basepriceEnabled;
|
||
|
dynamic basepriceAmount;
|
||
|
dynamic basepriceBaseAmount;
|
||
|
bool hasTierPrices;
|
||
|
bool hasDiscountsApplied;
|
||
|
dynamic discountName;
|
||
|
dynamic discountNamen;
|
||
|
dynamic discountDescription;
|
||
|
dynamic discountDescriptionn;
|
||
|
dynamic discountPercentage;
|
||
|
String currency;
|
||
|
String currencyn;
|
||
|
double weight;
|
||
|
dynamic length;
|
||
|
dynamic width;
|
||
|
dynamic height;
|
||
|
dynamic availableStartDateTimeUtc;
|
||
|
dynamic availableEndDateTimeUtc;
|
||
|
dynamic displayOrder;
|
||
|
bool published;
|
||
|
bool deleted;
|
||
|
DateTime createdOnUtc;
|
||
|
DateTime updatedOnUtc;
|
||
|
String productType;
|
||
|
dynamic parentGroupedProductId;
|
||
|
List<dynamic> roleIds;
|
||
|
List<dynamic> discountIds;
|
||
|
List<dynamic> storeIds;
|
||
|
List<dynamic> manufacturerIds;
|
||
|
List<Review> reviews;
|
||
|
List<Image> images;
|
||
|
List<dynamic> attributes;
|
||
|
List<Specification> specifications;
|
||
|
List<dynamic> associatedProductIds;
|
||
|
List<dynamic> tags;
|
||
|
dynamic vendorId;
|
||
|
String seName;
|
||
|
|
||
|
factory Product.fromJson(Map<String, dynamic> json) => Product(
|
||
|
id: json["id"],
|
||
|
visibleIndividually: json["visible_individually"],
|
||
|
name: json["name"],
|
||
|
namen: json["namen"],
|
||
|
localizedNames: List<LocalizedName>.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))),
|
||
|
shortDescription: json["short_description"],
|
||
|
shortDescriptionn: json["short_descriptionn"],
|
||
|
fullDescription: json["full_description"],
|
||
|
fullDescriptionn: json["full_descriptionn"],
|
||
|
markasNew: json["markas_new"],
|
||
|
showOnHomePage: json["show_on_home_page"],
|
||
|
metaKeywords: json["meta_keywords"],
|
||
|
metaDescription: json["meta_description"],
|
||
|
metaTitle: json["meta_title"],
|
||
|
allowCustomerReviews: json["allow_customer_reviews"],
|
||
|
approvedRatingSum: json["approved_rating_sum"],
|
||
|
notApprovedRatingSum: json["not_approved_rating_sum"],
|
||
|
approvedTotalReviews: json["approved_total_reviews"],
|
||
|
notApprovedTotalReviews: json["not_approved_total_reviews"],
|
||
|
sku: json["sku"],
|
||
|
isRx: json["is_rx"],
|
||
|
prescriptionRequired: json["prescription_required"],
|
||
|
rxMessage: json["rx_message"],
|
||
|
rxMessagen: json["rx_messagen"],
|
||
|
manufacturerPartNumber: json["manufacturer_part_number"],
|
||
|
gtin: json["gtin"],
|
||
|
isGiftCard: json["is_gift_card"],
|
||
|
requireOtherProducts: json["require_other_products"],
|
||
|
automaticallyAddRequiredProducts: json["automatically_add_required_products"],
|
||
|
isDownload: json["is_download"],
|
||
|
unlimitedDownloads: json["unlimited_downloads"],
|
||
|
maxNumberOfDownloads: json["max_number_of_downloads"],
|
||
|
downloadExpirationDays: json["download_expiration_days"],
|
||
|
hasSampleDownload: json["has_sample_download"],
|
||
|
hasUserAgreement: json["has_user_agreement"],
|
||
|
isRecurring: json["is_recurring"],
|
||
|
recurringCycleLength: json["recurring_cycle_length"],
|
||
|
recurringTotalCycles: json["recurring_total_cycles"],
|
||
|
isRental: json["is_rental"],
|
||
|
rentalPriceLength: json["rental_price_length"],
|
||
|
isShipEnabled: json["is_ship_enabled"],
|
||
|
isFreeShipping: json["is_free_shipping"],
|
||
|
shipSeparately: json["ship_separately"],
|
||
|
additionalShippingCharge: json["additional_shipping_charge"],
|
||
|
isTaxExempt: json["is_tax_exempt"],
|
||
|
isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"],
|
||
|
useMultipleWarehouses: json["use_multiple_warehouses"],
|
||
|
manageInventoryMethodId: json["manage_inventory_method_id"],
|
||
|
stockQuantity: json["stock_quantity"],
|
||
|
stockAvailability: json["stock_availability"],
|
||
|
stockAvailabilityn: json["stock_availabilityn"],
|
||
|
displayStockAvailability: json["display_stock_availability"],
|
||
|
displayStockQuantity: json["display_stock_quantity"],
|
||
|
minStockQuantity: json["min_stock_quantity"],
|
||
|
notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"],
|
||
|
allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"],
|
||
|
orderMinimumQuantity: json["order_minimum_quantity"],
|
||
|
orderMaximumQuantity: json["order_maximum_quantity"],
|
||
|
allowedQuantities: json["allowed_quantities"],
|
||
|
allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"],
|
||
|
disableBuyButton: json["disable_buy_button"],
|
||
|
disableWishlistButton: json["disable_wishlist_button"],
|
||
|
availableForPreOrder: json["available_for_pre_order"],
|
||
|
preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"],
|
||
|
callForPrice: json["call_for_price"],
|
||
|
price: json["price"],
|
||
|
oldPrice: json["old_price"],
|
||
|
productCost: json["product_cost"],
|
||
|
specialPrice: json["special_price"],
|
||
|
specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"],
|
||
|
specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"],
|
||
|
customerEntersPrice: json["customer_enters_price"],
|
||
|
minimumCustomerEnteredPrice: json["minimum_customer_entered_price"],
|
||
|
maximumCustomerEnteredPrice: json["maximum_customer_entered_price"],
|
||
|
basepriceEnabled: json["baseprice_enabled"],
|
||
|
basepriceAmount: json["baseprice_amount"],
|
||
|
basepriceBaseAmount: json["baseprice_base_amount"],
|
||
|
hasTierPrices: json["has_tier_prices"],
|
||
|
hasDiscountsApplied: json["has_discounts_applied"],
|
||
|
discountName: json["discount_name"],
|
||
|
discountNamen: json["discount_namen"],
|
||
|
discountDescription: json["discount_description"],
|
||
|
discountDescriptionn: json["discount_Descriptionn"],
|
||
|
discountPercentage: json["discount_percentage"],
|
||
|
currency: json["currency"],
|
||
|
currencyn: json["currencyn"],
|
||
|
weight: json["weight"].toDouble(),
|
||
|
length: json["length"],
|
||
|
width: json["width"],
|
||
|
height: json["height"],
|
||
|
availableStartDateTimeUtc: json["available_start_date_time_utc"],
|
||
|
availableEndDateTimeUtc: json["available_end_date_time_utc"],
|
||
|
displayOrder: json["display_order"],
|
||
|
published: json["published"],
|
||
|
deleted: json["deleted"],
|
||
|
createdOnUtc: DateTime.parse(json["created_on_utc"]),
|
||
|
updatedOnUtc: DateTime.parse(json["updated_on_utc"]),
|
||
|
productType: json["product_type"],
|
||
|
parentGroupedProductId: json["parent_grouped_product_id"],
|
||
|
roleIds: List<dynamic>.from(json["role_ids"].map((x) => x)),
|
||
|
discountIds: List<dynamic>.from(json["discount_ids"].map((x) => x)),
|
||
|
storeIds: List<dynamic>.from(json["store_ids"].map((x) => x)),
|
||
|
manufacturerIds: List<dynamic>.from(json["manufacturer_ids"].map((x) => x)),
|
||
|
reviews: List<Review>.from(json["reviews"].map((x) => Review.fromJson(x))),
|
||
|
images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))),
|
||
|
attributes: List<dynamic>.from(json["attributes"].map((x) => x)),
|
||
|
specifications: List<Specification>.from(json["specifications"].map((x) => Specification.fromJson(x))),
|
||
|
associatedProductIds: List<dynamic>.from(json["associated_product_ids"].map((x) => x)),
|
||
|
tags: List<dynamic>.from(json["tags"].map((x) => x)),
|
||
|
vendorId: json["vendor_id"],
|
||
|
seName: json["se_name"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"visible_individually": visibleIndividually,
|
||
|
"name": name,
|
||
|
"namen": namen,
|
||
|
"localized_names": List<dynamic>.from(localizedNames.map((x) => x.toJson())),
|
||
|
"short_description": shortDescription,
|
||
|
"short_descriptionn": shortDescriptionn,
|
||
|
"full_description": fullDescription,
|
||
|
"full_descriptionn": fullDescriptionn,
|
||
|
"markas_new": markasNew,
|
||
|
"show_on_home_page": showOnHomePage,
|
||
|
"meta_keywords": metaKeywords,
|
||
|
"meta_description": metaDescription,
|
||
|
"meta_title": metaTitle,
|
||
|
"allow_customer_reviews": allowCustomerReviews,
|
||
|
"approved_rating_sum": approvedRatingSum,
|
||
|
"not_approved_rating_sum": notApprovedRatingSum,
|
||
|
"approved_total_reviews": approvedTotalReviews,
|
||
|
"not_approved_total_reviews": notApprovedTotalReviews,
|
||
|
"sku": sku,
|
||
|
"is_rx": isRx,
|
||
|
"prescription_required": prescriptionRequired,
|
||
|
"rx_message": rxMessage,
|
||
|
"rx_messagen": rxMessagen,
|
||
|
"manufacturer_part_number": manufacturerPartNumber,
|
||
|
"gtin": gtin,
|
||
|
"is_gift_card": isGiftCard,
|
||
|
"require_other_products": requireOtherProducts,
|
||
|
"automatically_add_required_products": automaticallyAddRequiredProducts,
|
||
|
"is_download": isDownload,
|
||
|
"unlimited_downloads": unlimitedDownloads,
|
||
|
"max_number_of_downloads": maxNumberOfDownloads,
|
||
|
"download_expiration_days": downloadExpirationDays,
|
||
|
"has_sample_download": hasSampleDownload,
|
||
|
"has_user_agreement": hasUserAgreement,
|
||
|
"is_recurring": isRecurring,
|
||
|
"recurring_cycle_length": recurringCycleLength,
|
||
|
"recurring_total_cycles": recurringTotalCycles,
|
||
|
"is_rental": isRental,
|
||
|
"rental_price_length": rentalPriceLength,
|
||
|
"is_ship_enabled": isShipEnabled,
|
||
|
"is_free_shipping": isFreeShipping,
|
||
|
"ship_separately": shipSeparately,
|
||
|
"additional_shipping_charge": additionalShippingCharge,
|
||
|
"is_tax_exempt": isTaxExempt,
|
||
|
"is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices,
|
||
|
"use_multiple_warehouses": useMultipleWarehouses,
|
||
|
"manage_inventory_method_id": manageInventoryMethodId,
|
||
|
"stock_quantity": stockQuantity,
|
||
|
"stock_availability": stockAvailability,
|
||
|
"stock_availabilityn": stockAvailabilityn,
|
||
|
"display_stock_availability": displayStockAvailability,
|
||
|
"display_stock_quantity": displayStockQuantity,
|
||
|
"min_stock_quantity": minStockQuantity,
|
||
|
"notify_admin_for_quantity_below": notifyAdminForQuantityBelow,
|
||
|
"allow_back_in_stock_subscriptions": allowBackInStockSubscriptions,
|
||
|
"order_minimum_quantity": orderMinimumQuantity,
|
||
|
"order_maximum_quantity": orderMaximumQuantity,
|
||
|
"allowed_quantities": allowedQuantities,
|
||
|
"allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations,
|
||
|
"disable_buy_button": disableBuyButton,
|
||
|
"disable_wishlist_button": disableWishlistButton,
|
||
|
"available_for_pre_order": availableForPreOrder,
|
||
|
"pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc,
|
||
|
"call_for_price": callForPrice,
|
||
|
"price": price,
|
||
|
"old_price": oldPrice,
|
||
|
"product_cost": productCost,
|
||
|
"special_price": specialPrice,
|
||
|
"special_price_start_date_time_utc": specialPriceStartDateTimeUtc,
|
||
|
"special_price_end_date_time_utc": specialPriceEndDateTimeUtc,
|
||
|
"customer_enters_price": customerEntersPrice,
|
||
|
"minimum_customer_entered_price": minimumCustomerEnteredPrice,
|
||
|
"maximum_customer_entered_price": maximumCustomerEnteredPrice,
|
||
|
"baseprice_enabled": basepriceEnabled,
|
||
|
"baseprice_amount": basepriceAmount,
|
||
|
"baseprice_base_amount": basepriceBaseAmount,
|
||
|
"has_tier_prices": hasTierPrices,
|
||
|
"has_discounts_applied": hasDiscountsApplied,
|
||
|
"discount_name": discountName,
|
||
|
"discount_namen": discountNamen,
|
||
|
"discount_description": discountDescription,
|
||
|
"discount_Descriptionn": discountDescriptionn,
|
||
|
"discount_percentage": discountPercentage,
|
||
|
"currency": currency,
|
||
|
"currencyn": currencyn,
|
||
|
"weight": weight,
|
||
|
"length": length,
|
||
|
"width": width,
|
||
|
"height": height,
|
||
|
"available_start_date_time_utc": availableStartDateTimeUtc,
|
||
|
"available_end_date_time_utc": availableEndDateTimeUtc,
|
||
|
"display_order": displayOrder,
|
||
|
"published": published,
|
||
|
"deleted": deleted,
|
||
|
"created_on_utc": createdOnUtc.toIso8601String(),
|
||
|
"updated_on_utc": updatedOnUtc.toIso8601String(),
|
||
|
"product_type": productType,
|
||
|
"parent_grouped_product_id": parentGroupedProductId,
|
||
|
"role_ids": List<dynamic>.from(roleIds.map((x) => x)),
|
||
|
"discount_ids": List<dynamic>.from(discountIds.map((x) => x)),
|
||
|
"store_ids": List<dynamic>.from(storeIds.map((x) => x)),
|
||
|
"manufacturer_ids": List<dynamic>.from(manufacturerIds.map((x) => x)),
|
||
|
"reviews": List<dynamic>.from(reviews.map((x) => x.toJson())),
|
||
|
"images": List<dynamic>.from(images.map((x) => x.toJson())),
|
||
|
"attributes": List<dynamic>.from(attributes.map((x) => x)),
|
||
|
"specifications": List<dynamic>.from(specifications.map((x) => x.toJson())),
|
||
|
"associated_product_ids": List<dynamic>.from(associatedProductIds.map((x) => x)),
|
||
|
"tags": List<dynamic>.from(tags.map((x) => x)),
|
||
|
"vendor_id": vendorId,
|
||
|
"se_name": seName,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Review {
|
||
|
Review({
|
||
|
this.id,
|
||
|
this.position,
|
||
|
this.reviewId,
|
||
|
this.customerId,
|
||
|
this.productId,
|
||
|
this.storeId,
|
||
|
this.isApproved,
|
||
|
this.title,
|
||
|
this.reviewText,
|
||
|
this.replyText,
|
||
|
this.rating,
|
||
|
this.helpfulYesTotal,
|
||
|
this.helpfulNoTotal,
|
||
|
this.createdOnUtc,
|
||
|
this.customer,
|
||
|
this.product,
|
||
|
});
|
||
|
|
||
|
dynamic id;
|
||
|
dynamic position;
|
||
|
dynamic reviewId;
|
||
|
dynamic customerId;
|
||
|
dynamic productId;
|
||
|
dynamic storeId;
|
||
|
bool isApproved;
|
||
|
String title;
|
||
|
ReviewText reviewText;
|
||
|
dynamic replyText;
|
||
|
dynamic rating;
|
||
|
dynamic helpfulYesTotal;
|
||
|
dynamic helpfulNoTotal;
|
||
|
DateTime createdOnUtc;
|
||
|
Customer customer;
|
||
|
Product product;
|
||
|
|
||
|
factory Review.fromJson(Map<String, dynamic> json) => Review(
|
||
|
id: json["id"],
|
||
|
position: json["position"],
|
||
|
reviewId: json["review_id"],
|
||
|
customerId: json["customer_id"],
|
||
|
productId: json["product_id"],
|
||
|
storeId: json["store_id"],
|
||
|
isApproved: json["is_approved"],
|
||
|
title: json["title"],
|
||
|
reviewText: reviewTextValues.map[json["review_text"]],
|
||
|
replyText: json["reply_text"],
|
||
|
rating: json["rating"],
|
||
|
helpfulYesTotal: json["helpful_yes_total"],
|
||
|
helpfulNoTotal: json["helpful_no_total"],
|
||
|
createdOnUtc: DateTime.parse(json["created_on_utc"]),
|
||
|
customer: Customer.fromJson(json["customer"]),
|
||
|
product: json["product"] == null ? null : Product.fromJson(json["product"]),
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"position": position,
|
||
|
"review_id": reviewId,
|
||
|
"customer_id": customerId,
|
||
|
"product_id": productId,
|
||
|
"store_id": storeId,
|
||
|
"is_approved": isApproved,
|
||
|
"title": title,
|
||
|
"review_text": reviewText,
|
||
|
"reply_text": replyText,
|
||
|
"rating": rating,
|
||
|
"helpful_yes_total": helpfulYesTotal,
|
||
|
"helpful_no_total": helpfulNoTotal,
|
||
|
"created_on_utc": createdOnUtc.toIso8601String(),
|
||
|
"customer": customer.toJson(),
|
||
|
"product": product == null ? null : product.toJson(),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Image {
|
||
|
Image({
|
||
|
this.id,
|
||
|
this.position,
|
||
|
this.src,
|
||
|
this.thumb,
|
||
|
this.attachment,
|
||
|
});
|
||
|
|
||
|
dynamic id;
|
||
|
dynamic position;
|
||
|
String src;
|
||
|
String thumb;
|
||
|
String attachment;
|
||
|
|
||
|
factory Image.fromJson(Map<String, dynamic> json) => Image(
|
||
|
id: json["id"],
|
||
|
position: json["position"],
|
||
|
src: json["src"],
|
||
|
thumb: json["thumb"],
|
||
|
attachment: json["attachment"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"position": position,
|
||
|
"src": src,
|
||
|
"thumb": thumb,
|
||
|
"attachment": attachment,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class LocalizedName {
|
||
|
LocalizedName({
|
||
|
this.languageId,
|
||
|
this.localizedName,
|
||
|
});
|
||
|
|
||
|
dynamic languageId;
|
||
|
String localizedName;
|
||
|
|
||
|
factory LocalizedName.fromJson(Map<String, dynamic> json) => LocalizedName(
|
||
|
languageId: json["language_id"],
|
||
|
localizedName: json["localized_name"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"language_id": languageId,
|
||
|
"localized_name": localizedName,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Specification {
|
||
|
Specification({
|
||
|
this.id,
|
||
|
this.displayOrder,
|
||
|
this.defaultValue,
|
||
|
this.defaultValuen,
|
||
|
this.name,
|
||
|
this.nameN,
|
||
|
});
|
||
|
|
||
|
dynamic id;
|
||
|
dynamic displayOrder;
|
||
|
String defaultValue;
|
||
|
String defaultValuen;
|
||
|
String name;
|
||
|
String nameN;
|
||
|
|
||
|
factory Specification.fromJson(Map<String, dynamic> json) => Specification(
|
||
|
id: json["id"],
|
||
|
displayOrder: json["display_order"],
|
||
|
defaultValue: json["default_value"],
|
||
|
defaultValuen: json["default_valuen"],
|
||
|
name: json["name"],
|
||
|
nameN: json["nameN"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"display_order": displayOrder,
|
||
|
"default_value": defaultValue,
|
||
|
"default_valuen": defaultValuen,
|
||
|
"name": name,
|
||
|
"nameN": nameN,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Customer {
|
||
|
Customer({
|
||
|
this.fileNumber,
|
||
|
this.iqamaNumber,
|
||
|
this.isOutSa,
|
||
|
this.patientType,
|
||
|
this.gender,
|
||
|
this.birthDate,
|
||
|
this.phone,
|
||
|
this.countryCode,
|
||
|
this.yahalaAccountno,
|
||
|
this.billingAddress,
|
||
|
this.shippingAddress,
|
||
|
this.addresses,
|
||
|
this.id,
|
||
|
this.username,
|
||
|
this.email,
|
||
|
this.firstName,
|
||
|
this.lastName,
|
||
|
this.languageId,
|
||
|
this.adminComment,
|
||
|
this.isTaxExempt,
|
||
|
this.hasShoppingCartItems,
|
||
|
this.active,
|
||
|
this.deleted,
|
||
|
this.isSystemAccount,
|
||
|
this.systemName,
|
||
|
this.lastIpAddress,
|
||
|
this.createdOnUtc,
|
||
|
this.lastLoginDateUtc,
|
||
|
this.lastActivityDateUtc,
|
||
|
this.registeredInStoreId,
|
||
|
this.roleIds,
|
||
|
});
|
||
|
|
||
|
dynamic fileNumber;
|
||
|
dynamic iqamaNumber;
|
||
|
dynamic isOutSa;
|
||
|
dynamic patientType;
|
||
|
dynamic gender;
|
||
|
DateTime birthDate;
|
||
|
dynamic phone;
|
||
|
dynamic countryCode;
|
||
|
dynamic yahalaAccountno;
|
||
|
dynamic billingAddress;
|
||
|
dynamic shippingAddress;
|
||
|
List<dynamic> addresses;
|
||
|
String id;
|
||
|
Username username;
|
||
|
Email email;
|
||
|
dynamic firstName;
|
||
|
dynamic lastName;
|
||
|
dynamic languageId;
|
||
|
dynamic adminComment;
|
||
|
dynamic isTaxExempt;
|
||
|
dynamic hasShoppingCartItems;
|
||
|
dynamic active;
|
||
|
dynamic deleted;
|
||
|
dynamic isSystemAccount;
|
||
|
dynamic systemName;
|
||
|
dynamic lastIpAddress;
|
||
|
dynamic createdOnUtc;
|
||
|
dynamic lastLoginDateUtc;
|
||
|
dynamic lastActivityDateUtc;
|
||
|
dynamic registeredInStoreId;
|
||
|
List<dynamic> roleIds;
|
||
|
|
||
|
factory Customer.fromJson(Map<String, dynamic> json) => Customer(
|
||
|
fileNumber: json["file_number"],
|
||
|
iqamaNumber: json["iqama_number"],
|
||
|
isOutSa: json["is_out_sa"],
|
||
|
patientType: json["patient_type"],
|
||
|
gender: json["gender"],
|
||
|
birthDate: DateTime.parse(json["birth_date"]),
|
||
|
phone: json["phone"],
|
||
|
countryCode: json["country_code"],
|
||
|
yahalaAccountno: json["yahala_accountno"],
|
||
|
billingAddress: json["billing_address"],
|
||
|
shippingAddress: json["shipping_address"],
|
||
|
addresses: List<dynamic>.from(json["addresses"].map((x) => x)),
|
||
|
id: json["id"],
|
||
|
username: usernameValues.map[json["username"]],
|
||
|
email: emailValues.map[json["email"]],
|
||
|
firstName: json["first_name"],
|
||
|
lastName: json["last_name"],
|
||
|
languageId: json["language_id"],
|
||
|
adminComment: json["admin_comment"],
|
||
|
isTaxExempt: json["is_tax_exempt"],
|
||
|
hasShoppingCartItems: json["has_shopping_cart_items"],
|
||
|
active: json["active"],
|
||
|
deleted: json["deleted"],
|
||
|
isSystemAccount: json["is_system_account"],
|
||
|
systemName: json["system_name"],
|
||
|
lastIpAddress: json["last_ip_address"],
|
||
|
createdOnUtc: json["created_on_utc"],
|
||
|
lastLoginDateUtc: json["last_login_date_utc"],
|
||
|
lastActivityDateUtc: json["last_activity_date_utc"],
|
||
|
registeredInStoreId: json["registered_in_store_id"],
|
||
|
roleIds: List<dynamic>.from(json["role_ids"].map((x) => x)),
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"file_number": fileNumber,
|
||
|
"iqama_number": iqamaNumber,
|
||
|
"is_out_sa": isOutSa,
|
||
|
"patient_type": patientType,
|
||
|
"gender": gender,
|
||
|
"birth_date": birthDate.toIso8601String(),
|
||
|
"phone": phone,
|
||
|
"country_code": countryCode,
|
||
|
"yahala_accountno": yahalaAccountno,
|
||
|
"billing_address": billingAddress,
|
||
|
"shipping_address": shippingAddress,
|
||
|
"addresses": List<dynamic>.from(addresses.map((x) => x)),
|
||
|
"id": id,
|
||
|
"username": usernameValues.reverse[username],
|
||
|
"email": emailValues.reverse[email],
|
||
|
"first_name": firstName,
|
||
|
"last_name": lastName,
|
||
|
"language_id": languageId,
|
||
|
"admin_comment": adminComment,
|
||
|
"is_tax_exempt": isTaxExempt,
|
||
|
"has_shopping_cart_items": hasShoppingCartItems,
|
||
|
"active": active,
|
||
|
"deleted": deleted,
|
||
|
"is_system_account": isSystemAccount,
|
||
|
"system_name": systemName,
|
||
|
"last_ip_address": lastIpAddress,
|
||
|
"created_on_utc": createdOnUtc,
|
||
|
"last_login_date_utc": lastLoginDateUtc,
|
||
|
"last_activity_date_utc": lastActivityDateUtc,
|
||
|
"registered_in_store_id": registeredInStoreId,
|
||
|
"role_ids": List<dynamic>.from(roleIds.map((x) => x)),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
enum Email { TAMER_FANASHEH_DRSULAIMANALHABIB_COM, STEVE_GATES_NOP_COMMERCE_COM }
|
||
|
|
||
|
final emailValues = EnumValues({
|
||
|
"steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM,
|
||
|
"tamer.fanasheh@drsulaimanalhabib.com": Email.TAMER_FANASHEH_DRSULAIMANALHABIB_COM
|
||
|
});
|
||
|
|
||
|
enum Username { TAMERF, STEVE_GATES_NOP_COMMERCE_COM }
|
||
|
|
||
|
final usernameValues = EnumValues({
|
||
|
"steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM,
|
||
|
"tamerf": Username.TAMERF
|
||
|
});
|
||
|
|
||
|
enum ReviewText { ENADDD, ENAD_TEST_0001, GOOD, ENAD_TEST_REVIEW_001, ENAD }
|
||
|
|
||
|
final reviewTextValues = EnumValues({
|
||
|
"ENAD ": ReviewText.ENAD,
|
||
|
"enaddd": ReviewText.ENADDD,
|
||
|
"ENAD TEST 0001": ReviewText.ENAD_TEST_0001,
|
||
|
"Enad Test Review 001": ReviewText.ENAD_TEST_REVIEW_001,
|
||
|
"good": ReviewText.GOOD
|
||
|
});
|
||
|
|
||
|
class EnumValues<T> {
|
||
|
Map<String, T> map;
|
||
|
Map<T, String> reverseMap;
|
||
|
|
||
|
EnumValues(this.map);
|
||
|
|
||
|
Map<T, String> get reverse {
|
||
|
if (reverseMap == null) {
|
||
|
reverseMap = map.map((k, v) => new MapEntry(v, k));
|
||
|
}
|
||
|
return reverseMap;
|
||
|
}
|
||
|
}
|