From 805aba56885eafd82cfc6c5a93c2966ccb7e291e Mon Sep 17 00:00:00 2001 From: David Ball Date: Thu, 18 Jul 2024 01:19:53 -0400 Subject: [PATCH] Refactored model/SearchResult. --- src/index.ts | 1 + src/model/SearchResult.ts | 96 ++++++++++++++------------------------- 2 files changed, 34 insertions(+), 63 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3d25798..83b0791 100644 --- a/src/index.ts +++ b/src/index.ts @@ -90,6 +90,7 @@ import { RefinementBin } from "./model/RefinementBin"; import { RentalOfferListing } from "./model/RentalOfferListing"; import { RentalOffers } from "./model/RentalOffers"; import { SearchRefinements } from "./model/SearchRefinements"; +import { SearchResult } from "./model/SearchResult"; import { SingleBooleanValuedAttribute } from "./model/SingleBooleanValuedAttribute"; import { SingleIntegerValuedAttribute } from "./model/SingleIntegerValuedAttribute"; import { SingleStringValuedAttribute } from "./model/SingleStringValuedAttribute"; diff --git a/src/model/SearchResult.ts b/src/model/SearchResult.ts index 1993047..b01f21e 100644 --- a/src/model/SearchResult.ts +++ b/src/model/SearchResult.ts @@ -21,45 +21,38 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Item', 'model/SearchRefinements'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./Item'), require('./SearchRefinements')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.SearchResult = factory(root.ProductAdvertisingAPIv1.ApiClient, root.ProductAdvertisingAPIv1.Item, root.ProductAdvertisingAPIv1.SearchRefinements); - } -}(this, function(ApiClient, Item, SearchRefinements) { - 'use strict'; - - +/** + * The SearchResult model module. + * @module model/SearchResult + * @version 1.0.0 + */ +import { ApiClient } from "../ApiClient"; +import { Item } from "./Item"; +import { SearchRefinements } from "./SearchRefinements"; +/** + * Constructs a new SearchResult. + * @alias module:model/SearchResult + * @class + */ +export class SearchResult { /** - * The SearchResult model module. - * @module model/SearchResult - * @version 1.0.0 + * @member {Number} TotalResultCount */ - + public TotalResultCount?: number; /** - * Constructs a new SearchResult. - * @alias module:model/SearchResult - * @class + * @member {String} SearchURL */ - var exports = function() { - var _this = this; - - - - - - }; + public SearchURL?: string; + /** + * @member {Array.} Items + */ + public Items?: Item[]; + /** + * @member {module:model/SearchRefinements} SearchRefinements + */ + public SearchRefinements?: SearchRefinements; /** * Constructs a SearchResult from a plain JavaScript object, optionally creating a new instance. @@ -68,46 +61,23 @@ * @param {module:model/SearchResult} obj Optional instance to populate. * @return {module:model/SearchResult} The populated SearchResult instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: SearchResult) { if (data) { - obj = obj || new exports(); + obj = obj || new SearchResult(); if (data.hasOwnProperty('TotalResultCount')) { - obj['TotalResultCount'] = ApiClient.convertToType(data['TotalResultCount'], 'Number'); + obj.TotalResultCount = ApiClient.convertToType(data['TotalResultCount'], 'Number'); } if (data.hasOwnProperty('SearchURL')) { - obj['SearchURL'] = ApiClient.convertToType(data['SearchURL'], 'String'); + obj.SearchURL = ApiClient.convertToType(data['SearchURL'], 'String'); } if (data.hasOwnProperty('Items')) { - obj['Items'] = ApiClient.convertToType(data['Items'], [Item]); + obj.Items = ApiClient.convertToType(data['Items'], [Item]); } if (data.hasOwnProperty('SearchRefinements')) { - obj['SearchRefinements'] = SearchRefinements.constructFromObject(data['SearchRefinements']); + obj.SearchRefinements = SearchRefinements.constructFromObject(data['SearchRefinements']); } } return obj; } - - /** - * @member {Number} TotalResultCount - */ - exports.prototype['TotalResultCount'] = undefined; - /** - * @member {String} SearchURL - */ - exports.prototype['SearchURL'] = undefined; - /** - * @member {Array.} Items - */ - exports.prototype['Items'] = undefined; - /** - * @member {module:model/SearchRefinements} SearchRefinements - */ - exports.prototype['SearchRefinements'] = undefined; - - - - return exports; -})); - - +};