From 2014f5b5d3ed65c7ea6bd4327d82b06acc8095e2 Mon Sep 17 00:00:00 2001 From: David Ball Date: Thu, 18 Jul 2024 00:01:43 -0400 Subject: [PATCH] Refactored model/ProductInfo. Fixed an issue with SingleBooleanValuedAttribute. --- src/index.ts | 1 + src/model/ProductInfo.ts | 119 ++++++++-------------- src/model/SingleBooleanValuedAttribute.ts | 2 +- 3 files changed, 46 insertions(+), 76 deletions(-) diff --git a/src/index.ts b/src/index.ts index 95c6d3f..50e385b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,6 +63,7 @@ import { OfferSavings } from "./model/OfferSavings"; import { PartnerType } from "./model/PartnerType"; import { Price } from "./model/Price"; import { PriceType } from "./model/PriceType"; +import { ProductInfo } from "./model/ProductInfo"; import { Properties } from "./model/Properties"; import { Rating } from "./model/Rating"; import { Refinement } from "./model/Refinement"; diff --git a/src/model/ProductInfo.ts b/src/model/ProductInfo.ts index 6ad506d..ba912f1 100644 --- a/src/model/ProductInfo.ts +++ b/src/model/ProductInfo.ts @@ -21,47 +21,47 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/DimensionBasedAttribute', 'model/SingleBooleanValuedAttribute', 'model/SingleIntegerValuedAttribute', 'model/SingleStringValuedAttribute'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./DimensionBasedAttribute'), require('./SingleBooleanValuedAttribute'), require('./SingleIntegerValuedAttribute'), require('./SingleStringValuedAttribute')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.ProductInfo = factory(root.ProductAdvertisingAPIv1.ApiClient, root.ProductAdvertisingAPIv1.DimensionBasedAttribute, root.ProductAdvertisingAPIv1.SingleBooleanValuedAttribute, root.ProductAdvertisingAPIv1.SingleIntegerValuedAttribute, root.ProductAdvertisingAPIv1.SingleStringValuedAttribute); - } -}(this, function(ApiClient, DimensionBasedAttribute, SingleBooleanValuedAttribute, SingleIntegerValuedAttribute, SingleStringValuedAttribute) { - 'use strict'; - - +/** + * The ProductInfo model module. + * @module model/ProductInfo + * @version 1.0.0 + */ +import { DimensionBasedAttribute } from "./DimensionBasedAttribute"; +import { SingleBooleanValuedAttribute } from "./SingleBooleanValuedAttribute"; +import { SingleIntegerValuedAttribute } from "./SingleIntegerValuedAttribute"; +import { SingleStringValuedAttribute } from "./SingleStringValuedAttribute"; +/** + * Constructs a new ProductInfo. + * @alias module:model/ProductInfo + * @class + */ +export class ProductInfo { /** - * The ProductInfo model module. - * @module model/ProductInfo - * @version 1.0.0 + * @member {module:model/SingleStringValuedAttribute} Color */ - + public Color?: SingleStringValuedAttribute /** - * Constructs a new ProductInfo. - * @alias module:model/ProductInfo - * @class + * @member {module:model/SingleBooleanValuedAttribute} IsAdultProduct */ - var exports = function() { - var _this = this; - - - - - - - - }; + public IsAdultProduct?: SingleBooleanValuedAttribute; + /** + * @member {module:model/DimensionBasedAttribute} ItemDimensions + */ + public ItemDimensions?: DimensionBasedAttribute; + /** + * @member {module:model/SingleStringValuedAttribute} ReleaseDate + */ + public ReleaseDate?: SingleStringValuedAttribute; + /** + * @member {module:model/SingleStringValuedAttribute} Size + */ + public Size?: SingleStringValuedAttribute; + /** + * @member {module:model/SingleIntegerValuedAttribute} UnitCount + */ + public UnitCount?: SingleIntegerValuedAttribute /** * Constructs a ProductInfo from a plain JavaScript object, optionally creating a new instance. @@ -70,60 +70,29 @@ * @param {module:model/ProductInfo} obj Optional instance to populate. * @return {module:model/ProductInfo} The populated ProductInfo instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: ProductInfo) { if (data) { - obj = obj || new exports(); + obj = obj || new ProductInfo(); if (data.hasOwnProperty('Color')) { - obj['Color'] = SingleStringValuedAttribute.constructFromObject(data['Color']); + obj.Color = SingleStringValuedAttribute.constructFromObject(data['Color']); } if (data.hasOwnProperty('IsAdultProduct')) { - obj['IsAdultProduct'] = SingleBooleanValuedAttribute.constructFromObject(data['IsAdultProduct']); + obj.IsAdultProduct = SingleBooleanValuedAttribute.constructFromObject(data['IsAdultProduct']); } if (data.hasOwnProperty('ItemDimensions')) { - obj['ItemDimensions'] = DimensionBasedAttribute.constructFromObject(data['ItemDimensions']); + obj.ItemDimensions = DimensionBasedAttribute.constructFromObject(data['ItemDimensions']); } if (data.hasOwnProperty('ReleaseDate')) { - obj['ReleaseDate'] = SingleStringValuedAttribute.constructFromObject(data['ReleaseDate']); + obj.ReleaseDate = SingleStringValuedAttribute.constructFromObject(data['ReleaseDate']); } if (data.hasOwnProperty('Size')) { - obj['Size'] = SingleStringValuedAttribute.constructFromObject(data['Size']); + obj.Size = SingleStringValuedAttribute.constructFromObject(data['Size']); } if (data.hasOwnProperty('UnitCount')) { - obj['UnitCount'] = SingleIntegerValuedAttribute.constructFromObject(data['UnitCount']); + obj.UnitCount = SingleIntegerValuedAttribute.constructFromObject(data['UnitCount']); } } return obj; } - - /** - * @member {module:model/SingleStringValuedAttribute} Color - */ - exports.prototype['Color'] = undefined; - /** - * @member {module:model/SingleBooleanValuedAttribute} IsAdultProduct - */ - exports.prototype['IsAdultProduct'] = undefined; - /** - * @member {module:model/DimensionBasedAttribute} ItemDimensions - */ - exports.prototype['ItemDimensions'] = undefined; - /** - * @member {module:model/SingleStringValuedAttribute} ReleaseDate - */ - exports.prototype['ReleaseDate'] = undefined; - /** - * @member {module:model/SingleStringValuedAttribute} Size - */ - exports.prototype['Size'] = undefined; - /** - * @member {module:model/SingleIntegerValuedAttribute} UnitCount - */ - exports.prototype['UnitCount'] = undefined; - - - - return exports; -})); - - +}; diff --git a/src/model/SingleBooleanValuedAttribute.ts b/src/model/SingleBooleanValuedAttribute.ts index 78f8fb4..d520195 100644 --- a/src/model/SingleBooleanValuedAttribute.ts +++ b/src/model/SingleBooleanValuedAttribute.ts @@ -55,7 +55,7 @@ export class SingleBooleanValuedAttribute { * @param {module:model/SingleBooleanValuedAttribute} obj Optional instance to populate. * @return {module:model/SingleBooleanValuedAttribute} The populated SingleBooleanValuedAttribute instance. */ - public constructFromObject(data: any, obj?: SingleBooleanValuedAttribute) { + public static constructFromObject(data: any, obj?: SingleBooleanValuedAttribute) { if (data) { obj = obj || new SingleBooleanValuedAttribute();