Refactored model/OfferPrice.

This commit is contained in:
David Ball 2024-07-17 21:53:38 -04:00
parent ca5f4c5629
commit 8b63721743
2 changed files with 45 additions and 79 deletions

View File

@ -42,6 +42,7 @@ import { DeliveryFlag } from "./model/DeliveryFlag";
import { DimensionBasedAttribute } from "./model/DimensionBasedAttribute";
import { Languages } from "./model/Languages";
import { LanguageType } from "./model/LanguageType";
import { OfferPrice } from "./model/OfferPrice";
import { OfferSavings } from "./model/OfferSavings";
import { PriceType } from "./model/PriceType";
import { Rating } from "./model/Rating";

View File

@ -21,26 +21,6 @@
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/OfferSavings', 'model/PriceType'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('./OfferSavings'), require('./PriceType'));
} else {
// Browser globals (root is window)
if (!root.ProductAdvertisingAPIv1) {
root.ProductAdvertisingAPIv1 = {};
}
root.ProductAdvertisingAPIv1.OfferPrice = factory(root.ProductAdvertisingAPIv1.ApiClient, root.ProductAdvertisingAPIv1.OfferSavings, root.ProductAdvertisingAPIv1.PriceType);
}
}(this, function(ApiClient, OfferSavings, PriceType) {
'use strict';
/**
* The OfferPrice model module.
* @module model/OfferPrice
@ -48,23 +28,43 @@
*/
import { ApiClient } from '../ApiClient';
import { OfferSavings } from './OfferSavings';
import { PriceType } from './PriceType';
/**
* Constructs a new <code>OfferPrice</code>.
* @alias module:model/OfferPrice
* @class
*/
var exports = function() {
var _this = this;
};
export class OfferPrice {
/**
* @member {Number} Amount
*/
public Amount?: number;
/**
* @member {String} Currency
*/
public Currency?: string;
/**
* @member {String} DisplayAmount
*/
public DisplayAmount?: string;
/**
* @member {Number} PricePerUnit
*/
public PricePerUnit?: number;
/**
* @member {module:model/PriceType} PriceType
*/
public PriceType?: PriceType;
/**
* @member {String} PriceTypeLabel
*/
public PriceTypeLabel?: string;
/**
* @member {module:model/OfferSavings} Savings
*/
public Savings?: OfferSavings;
/**
* Constructs a <code>OfferPrice</code> from a plain JavaScript object, optionally creating a new instance.
@ -73,67 +73,32 @@ import { ApiClient } from '../ApiClient';
* @param {module:model/OfferPrice} obj Optional instance to populate.
* @return {module:model/OfferPrice} The populated <code>OfferPrice</code> instance.
*/
exports.constructFromObject = function(data, obj) {
public static constructFromObject(data: any, obj: OfferPrice) {
if (data) {
obj = obj || new exports();
obj = obj || new OfferPrice();
if (data.hasOwnProperty('Amount')) {
obj['Amount'] = ApiClient.convertToType(data['Amount'], 'Number');
obj.Amount = ApiClient.convertToType(data['Amount'], 'Number');
}
if (data.hasOwnProperty('Currency')) {
obj['Currency'] = ApiClient.convertToType(data['Currency'], 'String');
obj.Currency = ApiClient.convertToType(data['Currency'], 'String');
}
if (data.hasOwnProperty('DisplayAmount')) {
obj['DisplayAmount'] = ApiClient.convertToType(data['DisplayAmount'], 'String');
obj.DisplayAmount = ApiClient.convertToType(data['DisplayAmount'], 'String');
}
if (data.hasOwnProperty('PricePerUnit')) {
obj['PricePerUnit'] = ApiClient.convertToType(data['PricePerUnit'], 'Number');
obj.PricePerUnit = ApiClient.convertToType(data['PricePerUnit'], 'Number');
}
if (data.hasOwnProperty('PriceType')) {
obj['PriceType'] = PriceType.constructFromObject(data['PriceType']);
obj.PriceType = PriceType.constructFromObject(data['PriceType']);
}
if (data.hasOwnProperty('PriceTypeLabel')) {
obj['PriceTypeLabel'] = ApiClient.convertToType(data['PriceTypeLabel'], 'String');
obj.PriceTypeLabel = ApiClient.convertToType(data['PriceTypeLabel'], 'String');
}
if (data.hasOwnProperty('Savings')) {
obj['Savings'] = OfferSavings.constructFromObject(data['Savings']);
obj.Savings = OfferSavings.constructFromObject(data['Savings']);
}
}
return obj;
}
/**
* @member {Number} Amount
*/
exports.prototype['Amount'] = undefined;
/**
* @member {String} Currency
*/
exports.prototype['Currency'] = undefined;
/**
* @member {String} DisplayAmount
*/
exports.prototype['DisplayAmount'] = undefined;
/**
* @member {Number} PricePerUnit
*/
exports.prototype['PricePerUnit'] = undefined;
/**
* @member {module:model/PriceType} PriceType
*/
exports.prototype['PriceType'] = undefined;
/**
* @member {String} PriceTypeLabel
*/
exports.prototype['PriceTypeLabel'] = undefined;
/**
* @member {module:model/OfferSavings} Savings
*/
exports.prototype['Savings'] = undefined;
return exports;
}));
};