From 839bab9679bb6ee00e37ea4dcc53e1823b95d7eb Mon Sep 17 00:00:00 2001 From: David Ball Date: Wed, 17 Jul 2024 20:55:29 -0400 Subject: [PATCH] Refactored a few things, renamed all the files. Added name to top of all the files. Still much reworking to do. Currently TypeScript compiler is reporting 847 syntax errors. --- src/ApiClient.js | 600 ------------------ src/ApiClient.ts | 588 +++++++++++++++++ src/api/DefaultApi.js | 250 -------- src/api/DefaultApi.ts | 238 +++++++ src/auth/SignHelper.ts | 2 +- src/index.js | 523 --------------- src/index.ts | 522 +++++++++++++++ .../{Availability.js => Availability.ts} | 2 + src/model/{BrowseNode.js => BrowseNode.ts} | 2 + ...eNodeAncestor.js => BrowseNodeAncestor.ts} | 2 + ...{BrowseNodeChild.js => BrowseNodeChild.ts} | 2 + .../{BrowseNodeInfo.js => BrowseNodeInfo.ts} | 2 + ...wseNodesResult.js => BrowseNodesResult.ts} | 2 + src/model/ByLineInfo.js | 103 --- src/model/ByLineInfo.ts | 75 +++ ...{Classifications.js => Classifications.ts} | 75 +-- src/model/Condition.js | 84 --- src/model/Condition.ts | 89 +++ src/model/{ContentInfo.js => ContentInfo.ts} | 2 + .../{ContentRating.js => ContentRating.ts} | 2 + src/model/{Contributor.js => Contributor.ts} | 96 +-- ...{CustomerReviews.js => CustomerReviews.ts} | 2 + .../{DeliveryFlag.js => DeliveryFlag.ts} | 2 + ...ttribute.js => DimensionBasedAttribute.ts} | 2 + .../{DurationPrice.js => DurationPrice.ts} | 2 + src/model/{ErrorData.js => ErrorData.ts} | 2 + src/model/{ExternalIds.js => ExternalIds.ts} | 2 + ...desRequest.js => GetBrowseNodesRequest.ts} | 2 + ...sResource.js => GetBrowseNodesResource.ts} | 2 + ...sResponse.js => GetBrowseNodesResponse.ts} | 2 + ...{GetItemsRequest.js => GetItemsRequest.ts} | 2 + ...etItemsResource.js => GetItemsResource.ts} | 2 + ...etItemsResponse.js => GetItemsResponse.ts} | 2 + ...ionsRequest.js => GetVariationsRequest.ts} | 2 + ...nsResource.js => GetVariationsResource.ts} | 2 + ...nsResponse.js => GetVariationsResponse.ts} | 2 + src/model/{ImageSize.js => ImageSize.ts} | 2 + src/model/{ImageType.js => ImageType.ts} | 2 + src/model/{Images.js => Images.ts} | 2 + src/model/{Item.js => Item.ts} | 2 + src/model/{ItemIdType.js => ItemIdType.ts} | 2 + src/model/{ItemInfo.js => ItemInfo.ts} | 2 + src/model/{ItemsResult.js => ItemsResult.ts} | 2 + .../{LanguageType.js => LanguageType.ts} | 2 + src/model/{Languages.js => Languages.ts} | 2 + ...{ManufactureInfo.js => ManufactureInfo.ts} | 2 + src/model/{MaxPrice.js => MaxPrice.ts} | 2 + src/model/{Merchant.js => Merchant.ts} | 2 + src/model/{MinPrice.js => MinPrice.ts} | 2 + ...inReviewsRating.js => MinReviewsRating.ts} | 2 + ...inSavingPercent.js => MinSavingPercent.ts} | 2 + ...edAttribute.js => MultiValuedAttribute.ts} | 2 + ...erAvailability.js => OfferAvailability.ts} | 2 + .../{OfferCondition.js => OfferCondition.ts} | 2 + ...ConditionNote.js => OfferConditionNote.ts} | 2 + src/model/{OfferCount.js => OfferCount.ts} | 2 + ...erDeliveryInfo.js => OfferDeliveryInfo.ts} | 2 + .../{OfferListing.js => OfferListing.ts} | 2 + ...LoyaltyPoints.js => OfferLoyaltyPoints.ts} | 2 + ...erMerchantInfo.js => OfferMerchantInfo.ts} | 2 + src/model/{OfferPrice.js => OfferPrice.ts} | 14 +- ...gibility.js => OfferProgramEligibility.ts} | 2 + .../{OfferPromotion.js => OfferPromotion.ts} | 2 + .../{OfferSavings.js => OfferSavings.ts} | 107 ++-- ...ippingCharge.js => OfferShippingCharge.ts} | 2 + ...erSubCondition.js => OfferSubCondition.ts} | 2 + .../{OfferSummary.js => OfferSummary.ts} | 2 + src/model/{Offers.js => Offers.ts} | 2 + src/model/{PartnerType.js => PartnerType.ts} | 2 + src/model/{Price.js => Price.ts} | 2 + src/model/PriceType.js | 79 --- src/model/PriceType.ts | 81 +++ ...> ProductAdvertisingAPIClientException.ts} | 2 + ... ProductAdvertisingAPIServiceException.ts} | 2 + src/model/{ProductInfo.js => ProductInfo.ts} | 2 + src/model/{Properties.js => Properties.ts} | 2 + src/model/{Rating.js => Rating.ts} | 2 + src/model/{Refinement.js => Refinement.ts} | 2 + .../{RefinementBin.js => RefinementBin.ts} | 2 + ...lOfferListing.js => RentalOfferListing.ts} | 2 + .../{RentalOffers.js => RentalOffers.ts} | 2 + ...hItemsRequest.js => SearchItemsRequest.ts} | 2 + ...temsResource.js => SearchItemsResource.ts} | 2 + ...temsResponse.js => SearchItemsResponse.ts} | 2 + ...rchRefinements.js => SearchRefinements.ts} | 2 + .../{SearchResult.js => SearchResult.ts} | 2 + ...ute.js => SingleBooleanValuedAttribute.ts} | 85 +-- ...ute.js => SingleIntegerValuedAttribute.ts} | 85 +-- ...bute.js => SingleStringValuedAttribute.ts} | 87 +-- src/model/{SortBy.js => SortBy.ts} | 2 + .../{TechnicalInfo.js => TechnicalInfo.ts} | 2 + src/model/{TradeInInfo.js => TradeInInfo.ts} | 2 + .../{TradeInPrice.js => TradeInPrice.ts} | 2 + ...asedAttribute.js => UnitBasedAttribute.ts} | 2 + ...tionAttribute.js => VariationAttribute.ts} | 2 + ...tionDimension.js => VariationDimension.ts} | 2 + ...ariationSummary.js => VariationSummary.ts} | 2 + ...ariationsResult.js => VariationsResult.ts} | 2 + ...ebsiteSalesRank.js => WebsiteSalesRank.ts} | 2 + 99 files changed, 1941 insertions(+), 2000 deletions(-) delete mode 100644 src/ApiClient.js create mode 100644 src/ApiClient.ts delete mode 100644 src/api/DefaultApi.js create mode 100644 src/api/DefaultApi.ts delete mode 100644 src/index.js create mode 100644 src/index.ts rename src/model/{Availability.js => Availability.ts} (97%) rename src/model/{BrowseNode.js => BrowseNode.ts} (98%) rename src/model/{BrowseNodeAncestor.js => BrowseNodeAncestor.ts} (98%) rename src/model/{BrowseNodeChild.js => BrowseNodeChild.ts} (98%) rename src/model/{BrowseNodeInfo.js => BrowseNodeInfo.ts} (98%) rename src/model/{BrowseNodesResult.js => BrowseNodesResult.ts} (97%) delete mode 100644 src/model/ByLineInfo.js create mode 100644 src/model/ByLineInfo.ts rename src/model/{Classifications.js => Classifications.ts} (50%) delete mode 100644 src/model/Condition.js create mode 100644 src/model/Condition.ts rename src/model/{ContentInfo.js => ContentInfo.ts} (98%) rename src/model/{ContentRating.js => ContentRating.ts} (97%) rename src/model/{Contributor.js => Contributor.ts} (51%) rename src/model/{CustomerReviews.js => CustomerReviews.ts} (98%) rename src/model/{DeliveryFlag.js => DeliveryFlag.ts} (97%) rename src/model/{DimensionBasedAttribute.js => DimensionBasedAttribute.ts} (98%) rename src/model/{DurationPrice.js => DurationPrice.ts} (98%) rename src/model/{ErrorData.js => ErrorData.ts} (97%) rename src/model/{ExternalIds.js => ExternalIds.ts} (98%) rename src/model/{GetBrowseNodesRequest.js => GetBrowseNodesRequest.ts} (98%) rename src/model/{GetBrowseNodesResource.js => GetBrowseNodesResource.ts} (97%) rename src/model/{GetBrowseNodesResponse.js => GetBrowseNodesResponse.ts} (98%) rename src/model/{GetItemsRequest.js => GetItemsRequest.ts} (99%) rename src/model/{GetItemsResource.js => GetItemsResource.ts} (99%) rename src/model/{GetItemsResponse.js => GetItemsResponse.ts} (98%) rename src/model/{GetVariationsRequest.js => GetVariationsRequest.ts} (99%) rename src/model/{GetVariationsResource.js => GetVariationsResource.ts} (99%) rename src/model/{GetVariationsResponse.js => GetVariationsResponse.ts} (98%) rename src/model/{ImageSize.js => ImageSize.ts} (98%) rename src/model/{ImageType.js => ImageType.ts} (98%) rename src/model/{Images.js => Images.ts} (97%) rename src/model/{Item.js => Item.ts} (98%) rename src/model/{ItemIdType.js => ItemIdType.ts} (97%) rename src/model/{ItemInfo.js => ItemInfo.ts} (99%) rename src/model/{ItemsResult.js => ItemsResult.ts} (97%) rename src/model/{LanguageType.js => LanguageType.ts} (97%) rename src/model/{Languages.js => Languages.ts} (98%) rename src/model/{ManufactureInfo.js => ManufactureInfo.ts} (98%) rename src/model/{MaxPrice.js => MaxPrice.ts} (97%) rename src/model/{Merchant.js => Merchant.ts} (97%) rename src/model/{MinPrice.js => MinPrice.ts} (97%) rename src/model/{MinReviewsRating.js => MinReviewsRating.ts} (97%) rename src/model/{MinSavingPercent.js => MinSavingPercent.ts} (97%) rename src/model/{MultiValuedAttribute.js => MultiValuedAttribute.ts} (98%) rename src/model/{OfferAvailability.js => OfferAvailability.ts} (98%) rename src/model/{OfferCondition.js => OfferCondition.ts} (98%) rename src/model/{OfferConditionNote.js => OfferConditionNote.ts} (97%) rename src/model/{OfferCount.js => OfferCount.ts} (97%) rename src/model/{OfferDeliveryInfo.js => OfferDeliveryInfo.ts} (98%) rename src/model/{OfferListing.js => OfferListing.ts} (99%) rename src/model/{OfferLoyaltyPoints.js => OfferLoyaltyPoints.ts} (97%) rename src/model/{OfferMerchantInfo.js => OfferMerchantInfo.ts} (98%) rename src/model/{OfferPrice.js => OfferPrice.ts} (95%) rename src/model/{OfferProgramEligibility.js => OfferProgramEligibility.ts} (98%) rename src/model/{OfferPromotion.js => OfferPromotion.ts} (98%) rename src/model/{OfferSavings.js => OfferSavings.ts} (50%) rename src/model/{OfferShippingCharge.js => OfferShippingCharge.ts} (98%) rename src/model/{OfferSubCondition.js => OfferSubCondition.ts} (98%) rename src/model/{OfferSummary.js => OfferSummary.ts} (98%) rename src/model/{Offers.js => Offers.ts} (98%) rename src/model/{PartnerType.js => PartnerType.ts} (97%) rename src/model/{Price.js => Price.ts} (98%) delete mode 100644 src/model/PriceType.js create mode 100644 src/model/PriceType.ts rename src/model/{ProductAdvertisingAPIClientException.js => ProductAdvertisingAPIClientException.ts} (98%) rename src/model/{ProductAdvertisingAPIServiceException.js => ProductAdvertisingAPIServiceException.ts} (97%) rename src/model/{ProductInfo.js => ProductInfo.ts} (98%) rename src/model/{Properties.js => Properties.ts} (97%) rename src/model/{Rating.js => Rating.ts} (97%) rename src/model/{Refinement.js => Refinement.ts} (98%) rename src/model/{RefinementBin.js => RefinementBin.ts} (97%) rename src/model/{RentalOfferListing.js => RentalOfferListing.ts} (98%) rename src/model/{RentalOffers.js => RentalOffers.ts} (97%) rename src/model/{SearchItemsRequest.js => SearchItemsRequest.ts} (99%) rename src/model/{SearchItemsResource.js => SearchItemsResource.ts} (99%) rename src/model/{SearchItemsResponse.js => SearchItemsResponse.ts} (98%) rename src/model/{SearchRefinements.js => SearchRefinements.ts} (98%) rename src/model/{SearchResult.js => SearchResult.ts} (98%) rename src/model/{SingleBooleanValuedAttribute.js => SingleBooleanValuedAttribute.ts} (51%) rename src/model/{SingleIntegerValuedAttribute.js => SingleIntegerValuedAttribute.ts} (51%) rename src/model/{SingleStringValuedAttribute.js => SingleStringValuedAttribute.ts} (51%) rename src/model/{SortBy.js => SortBy.ts} (97%) rename src/model/{TechnicalInfo.js => TechnicalInfo.ts} (98%) rename src/model/{TradeInInfo.js => TradeInInfo.ts} (98%) rename src/model/{TradeInPrice.js => TradeInPrice.ts} (98%) rename src/model/{UnitBasedAttribute.js => UnitBasedAttribute.ts} (98%) rename src/model/{VariationAttribute.js => VariationAttribute.ts} (97%) rename src/model/{VariationDimension.js => VariationDimension.ts} (98%) rename src/model/{VariationSummary.js => VariationSummary.ts} (98%) rename src/model/{VariationsResult.js => VariationsResult.ts} (98%) rename src/model/{WebsiteSalesRank.js => WebsiteSalesRank.ts} (98%) diff --git a/src/ApiClient.js b/src/ApiClient.js deleted file mode 100644 index 8a21b33..0000000 --- a/src/ApiClient.js +++ /dev/null @@ -1,600 +0,0 @@ -/** - * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - /** - * ProductAdvertisingAPI - * https://webservices.amazon.com/paapi5/documentation/index.html - * - */ - -var awsv4 = require('./auth/SignHelper'); - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['superagent', 'querystring'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('superagent'), require('querystring')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.ApiClient = factory(root.superagent, root.querystring); - } -}(this, function(superagent, querystring) { - 'use strict'; - - /** - * @module ApiClient - * @version 1.0.0 - */ - - /** - * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an - * application to use this class directly - the *Api and model classes provide the public API for the service. The - * contents of this file should be regarded as internal but are documented for completeness. - * @alias module:ApiClient - * @class - */ - var exports = function() { - /** - * The base URL against which to resolve every API call's (relative) path. - * @type {String} - * @default https://webservices.amazon.com - */ - this.basePath = 'https://webservices.amazon.com'.replace(/\/+$/, ''); - - /** - * The Access Key ID which uniquely identifies you. - * @type {String} - */ - this.accessKey = null; - - /** - * A key that is used in conjunction with the Access Key ID to cryptographically - * sign an API request. - * @type {String} - */ - this.secretKey = null; - - /** - * The host that receives the Amazon Product Advertising API GenNext request. - * @type {String} - * @default webservices.amazon.com - */ - this.host = 'webservices.amazon.com'; - - /** - * The service's region where the request is targeted. - * @type {String} - * @default us-east-1 - */ - this.region = 'us-east-1'; - - /** - * The authentication methods to be included for all API calls. - * @type {Array.} - */ - this.authentications = { - }; - /** - * The default HTTP headers to be included for all API calls. - * @type {Array.} - * @default {} - */ - this.defaultHeaders = {}; - - /** - * The default HTTP timeout for all API calls. - * @type {Number} - * @default 60000 - */ - this.timeout = 60000; - - /** - * If set to false an additional timestamp parameter is added to all API GET calls to - * prevent browser caching - * @type {Boolean} - * @default true - */ - this.cache = true; - - /** - * If set to true, the client will save the cookies from each server - * response, and return them in the next request. - * @default false - */ - this.enableCookies = false; - - /* - * Used to save and return cookies in a node.js (non-browser) setting, - * if this.enableCookies is set to true. - */ - if (typeof window === 'undefined') { - this.agent = new superagent.agent(); - } - - /* - * Allow user to override superagent agent - */ - this.requestAgent = { - 'User-Agent': 'paapi5-nodejs-sdk/1.0.0' - }; - }; - - /** - * Returns a string representation for an actual parameter. - * @param param The actual parameter. - * @returns {String} The string representation of param. - */ - exports.prototype.paramToString = function(param) { - if (param == undefined || param == null) { - return ''; - } - if (param instanceof Date) { - return param.toJSON(); - } - return param.toString(); - }; - - /** - * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. - * NOTE: query parameters are not handled here. - * @param {String} path The path to append to the base URL. - * @param {Object} pathParams The parameter values to append. - * @returns {String} The encoded path with parameter values substituted. - */ - exports.prototype.buildUrl = function(path, pathParams) { - if (!path.match(/^\//)) { - path = '/' + path; - } - var url = "https://" + this.host + path; - var _this = this; - url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) { - var value; - if (pathParams.hasOwnProperty(key)) { - value = _this.paramToString(pathParams[key]); - } else { - value = fullMatch; - } - return encodeURIComponent(value); - }); - return url; - }; - - /** - * Checks whether the given content type represents JSON.
- * JSON content type examples:
- *
    - *
  • application/json
  • - *
  • application/json; charset=UTF8
  • - *
  • APPLICATION/JSON
  • - *
- * @param {String} contentType The MIME content type to check. - * @returns {Boolean} true if contentType represents JSON, otherwise false. - */ - exports.prototype.isJsonMime = function(contentType) { - return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); - }; - - /** - * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. - * @param {Array.} contentTypes - * @returns {String} The chosen content type, preferring JSON. - */ - exports.prototype.jsonPreferredMime = function(contentTypes) { - for (var i = 0; i < contentTypes.length; i++) { - if (this.isJsonMime(contentTypes[i])) { - return contentTypes[i]; - } - } - return contentTypes[0]; - }; - - /** - * Checks whether the given parameter value represents file-like content. - * @param param The parameter to check. - * @returns {Boolean} true if param represents a file. - */ - exports.prototype.isFileParam = function(param) { - // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) - if (typeof require === 'function') { - var fs; - try { - fs = require('fs'); - } catch (err) {} - if (fs && fs.ReadStream && param instanceof fs.ReadStream) { - return true; - } - } - // Buffer in Node.js - if (typeof Buffer === 'function' && param instanceof Buffer) { - return true; - } - // Blob in browser - if (typeof Blob === 'function' && param instanceof Blob) { - return true; - } - // File in browser (it seems File object is also instance of Blob, but keep this for safe) - if (typeof File === 'function' && param instanceof File) { - return true; - } - return false; - }; - - /** - * Normalizes parameter values: - *
    - *
  • remove nils
  • - *
  • keep files and arrays
  • - *
  • format to string with `paramToString` for other cases
  • - *
- * @param {Object.} params The parameters as object properties. - * @returns {Object.} normalized parameters. - */ - exports.prototype.normalizeParams = function(params) { - var newParams = {}; - for (var key in params) { - if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) { - var value = params[key]; - if (this.isFileParam(value) || Array.isArray(value)) { - newParams[key] = value; - } else { - newParams[key] = this.paramToString(value); - } - } - } - return newParams; - }; - - /** - * Enumeration of collection format separator strategies. - * @enum {String} - * @readonly - */ - exports.CollectionFormatEnum = { - /** - * Comma-separated values. Value: csv - * @const - */ - CSV: ',', - /** - * Space-separated values. Value: ssv - * @const - */ - SSV: ' ', - /** - * Tab-separated values. Value: tsv - * @const - */ - TSV: '\t', - /** - * Pipe(|)-separated values. Value: pipes - * @const - */ - PIPES: '|', - /** - * Native array. Value: multi - * @const - */ - MULTI: 'multi' - }; - - /** - * Builds a string representation of an array-type actual parameter, according to the given collection format. - * @param {Array} param An array parameter. - * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. - * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns - * param as is if collectionFormat is multi. - */ - exports.prototype.buildCollectionParam = function buildCollectionParam(param, collectionFormat) { - if (param == null) { - return null; - } - switch (collectionFormat) { - case 'csv': - return param.map(this.paramToString).join(','); - case 'ssv': - return param.map(this.paramToString).join(' '); - case 'tsv': - return param.map(this.paramToString).join('\t'); - case 'pipes': - return param.map(this.paramToString).join('|'); - case 'multi': - // return the array directly as SuperAgent will handle it as expected - return param.map(this.paramToString); - default: - throw new Error('Unknown collection format: ' + collectionFormat); - } - }; - - /** - * Deserializes an HTTP response body into a value of the specified type. - * @param {Object} response A SuperAgent response object. - * @param {(String|Array.|Object.|Function)} returnType The type to return. Pass a string for simple types - * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To - * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: - * all properties on data will be converted to this type. - * @returns A value of the specified type. - */ - exports.prototype.deserialize = function deserialize(response, returnType) { - if (response == null || returnType == null || response.status == 204) { - return null; - } - // Rely on SuperAgent for parsing response body. - // See http://visionmedia.github.io/superagent/#parsing-response-bodies - var data = response.body; - if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) { - // SuperAgent does not always produce a body; use the unparsed response as a fallback - data = response.text; - } - return exports.convertToType(data, returnType); - }; - - /** - * Invokes the REST service using the supplied settings and parameters. - * @param {String} path The base URL to invoke. - * @param {String} httpMethod The HTTP method to use. - * @param {Object.} pathParams A map of path parameters and their values. - * @param {Object.} queryParams A map of query parameters and their values. - * @param {Object.} collectionQueryParams A map of collection query parameters and their values. - * @param {Object.} headerParams A map of header parameters and their values. - * @param {Object.} formParams A map of form parameters and their values. - * @param {Object} bodyParam The value to pass as the request body. - * @param {Array.} authNames An array of authentication type names. - * @param {Array.} contentTypes An array of request MIME types. - * @param {Array.} accepts An array of acceptable response MIME types. - * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the - * constructor for a complex type. - * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object. - */ - exports.prototype.callApi = function callApi(path, httpMethod, apiName, pathParams, - queryParams, collectionQueryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, - returnType) { - - // Throw error if credentials are not specified - if (this.accessKey === undefined || this.secretKey === undefined || this.accessKey === null || this.secretKey === null) { - throw new Error("Missing Credentials. Please specify accessKey and secretKey in client object."); - } - - var _this = this; - var url = this.buildUrl(path, pathParams); - var request = superagent(httpMethod, url); - - // apply authentications - var region = this.region - var service = 'ProductAdvertisingAPI'; - var timestamp = Date.now(); - - var requestHeaders = { - 'content-encoding': 'amz-1.0', - 'content-type': 'application/json; charset=utf-8', - 'host': this.host, - 'x-amz-target': 'com.amazon.paapi5.v1.ProductAdvertisingAPIv1.' + apiName, - 'x-amz-date': awsv4.toAmzDate(timestamp) - }; - - var authorizationHeader = awsv4.createAuthorizationHeader(this.accessKey, this.secretKey, requestHeaders, httpMethod, path, bodyParam, region, service, timestamp); - - var authHeader = { - 'Authorization': authorizationHeader - }; - request.set(authHeader); - - // set collection query parameters - for (var key in collectionQueryParams) { - if (collectionQueryParams.hasOwnProperty(key)) { - var param = collectionQueryParams[key]; - if (param.collectionFormat === 'csv') { - // SuperAgent normally percent-encodes all reserved characters in a query parameter. However, - // commas are used as delimiters for the 'csv' collectionFormat so they must not be encoded. We - // must therefore construct and encode 'csv' collection query parameters manually. - if (param.value != null) { - var value = param.value.map(this.paramToString).map(encodeURIComponent).join(','); - request.query(encodeURIComponent(key) + "=" + value); - } - } else { - // All other collection query parameters should be treated as ordinary query parameters. - queryParams[key] = this.buildCollectionParam(param.value, param.collectionFormat); - } - } - } - - // set query parameters - if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { - queryParams['_'] = new Date().getTime(); - } - - // set header parameters - request.set(requestHeaders); - - - // set requestAgent if it is set by user - request.set(this.requestAgent); - - // set request timeout - request.timeout(this.timeout); - - var contentType = 'application/json; charset=utf-8'; - if (contentType) { - // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) - if(contentType != 'multipart/form-data') { - request.type(contentType); - } - } else if (!request.header['Content-Type']) { - request.type('application/json'); - } - - if (contentType === 'application/x-www-form-urlencoded') { - request.send(querystring.stringify(this.normalizeParams(formParams))); - } else if (contentType == 'multipart/form-data') { - var _formParams = this.normalizeParams(formParams); - for (var key in _formParams) { - if (_formParams.hasOwnProperty(key)) { - if (this.isFileParam(_formParams[key])) { - // file field - request.attach(key, _formParams[key]); - } else { - request.field(key, _formParams[key]); - } - } - } - } else if (bodyParam) { - request.send(bodyParam); - } - - var accept = this.jsonPreferredMime(accepts); - if (accept) { - request.accept(accept); - } - - if (returnType === 'Blob') { - request.responseType('blob'); - } else if (returnType === 'String') { - request.responseType('string'); - } - - // Attach previously saved cookies, if enabled - if (this.enableCookies){ - if (typeof window === 'undefined') { - this.agent.attachCookies(request); - } - else { - request.withCredentials(); - } - } - - return new Promise(function(resolve, reject) { - request.end(function(error, response) { - if (error) { - reject(error); - } else { - try { - var data = _this.deserialize(response, returnType); - if (_this.enableCookies && typeof window === 'undefined'){ - _this.agent.saveCookies(response); - } - resolve({data: data, response: response}); - } catch (err) { - reject(err); - } - } - }); - }); - }; - - /** - * Parses an ISO-8601 string representation of a date value. - * @param {String} str The date value as a string. - * @returns {Date} The parsed date object. - */ - exports.parseDate = function(str) { - return new Date(str.replace(/T/i, ' ')); - }; - - /** - * Converts a value to the specified type. - * @param {(String|Object)} data The data to convert, as a string or object. - * @param {(String|Array.|Object.|Function)} type The type to return. Pass a string for simple types - * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To - * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: - * all properties on data will be converted to this type. - * @returns An instance of the specified type or null or undefined if data is null or undefined. - */ - exports.convertToType = function(data, type) { - if (data === null || data === undefined) - return data - - switch (type) { - case 'Boolean': - return Boolean(data); - case 'Integer': - return parseInt(data, 10); - case 'Number': - return parseFloat(data); - case 'String': - return String(data); - case 'Date': - return this.parseDate(String(data)); - case 'Blob': - return data; - default: - if (type === Object) { - // generic object, return directly - return data; - } else if (typeof type === 'function') { - // for model type like: User - return type.constructFromObject(data); - } else if (Array.isArray(type)) { - // for array type like: ['String'] - var itemType = type[0]; - return data.map(function(item) { - return exports.convertToType(item, itemType); - }); - } else if (typeof type === 'object') { - // for plain object type like: {'String': 'Integer'} - var keyType, valueType; - for (var k in type) { - if (type.hasOwnProperty(k)) { - keyType = k; - valueType = type[k]; - break; - } - } - var result = {}; - for (var k in data) { - if (data.hasOwnProperty(k)) { - var key = exports.convertToType(k, keyType); - var value = exports.convertToType(data[k], valueType); - result[key] = value; - } - } - return result; - } else { - // for unknown type, return the data directly - return data; - } - } - }; - - /** - * Constructs a new map or array model from REST data. - * @param data {Object|Array} The REST data. - * @param obj {Object|Array} The target object or array. - */ - exports.constructFromObject = function(data, obj, itemType) { - if (Array.isArray(data)) { - for (var i = 0; i < data.length; i++) { - if (data.hasOwnProperty(i)) - obj[i] = exports.convertToType(data[i], itemType); - } - } else { - for (var k in data) { - if (data.hasOwnProperty(k)) - obj[k] = exports.convertToType(data[k], itemType); - } - } - }; - - /** - * The default API client implementation. - * @type {module:ApiClient} - */ - exports.instance = new exports(); - - return exports; -})); diff --git a/src/ApiClient.ts b/src/ApiClient.ts new file mode 100644 index 0000000..09611f6 --- /dev/null +++ b/src/ApiClient.ts @@ -0,0 +1,588 @@ +/** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * + * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + + /** + * ProductAdvertisingAPI + * https://webservices.amazon.com/paapi5/documentation/index.html + * + */ + + import * as awsv4 from './auth/SignHelper'; + import superagent from 'superagent'; + import querystring from 'querystring'; + + export interface Stringifiable { + toString(): string; + } + + const PRODUCT_ADVERTISING_API = 'ProductAdvertisingAPI'; + + //wtf: + // (function(root, factory) { + // if (typeof define === 'function' && define.amd) { + // // AMD. Register as an anonymous module. + // define(['superagent', 'querystring'], factory); + // } else if (typeof module === 'object' && module.exports) { + // // CommonJS-like environments that support module.exports, like Node. + // module.exports = factory(require('superagent'), require('querystring')); + // } else { + // // Browser globals (root is window) + // if (!root.ProductAdvertisingAPIv1) { + // root.ProductAdvertisingAPIv1 = {}; + // } + // root.ProductAdvertisingAPIv1.ApiClient = factory(root.superagent, root.querystring); + // } + // }(this, function(superagent, querystring) { + // 'use strict'; + + /** + * @module ApiClient + * @version 1.0.0 + */ + + /** + * Enumeration of collection format separator strategies. + * @enum {String} + * @readonly + */ + export enum CollectionFormatEnum { + /** + * Comma-separated values. Value: csv + * @const + */ + CSV = ',', + /** + * Space-separated values. Value: ssv + * @const + */ + SSV = ' ', + /** + * Tab-separated values. Value: tsv + * @const + */ + TSV = '\t', + /** + * Pipe(|)-separated values. Value: pipes + * @const + */ + PIPES = '|', + /** + * Native array. Value: multi + * @const + */ + MULTI = 'multi', + }; + + /** + * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an + * application to use this class directly - the *Api and model classes provide the public API for the service. The + * contents of this file should be regarded as internal but are documented for completeness. + * @alias module:ApiClient + * @class + */ + export class ApiClient { + /** + * The default API client implementation. + * @type {module:ApiClient} + */ + public static instance = new ApiClient(); + /** + * The base URL against which to resolve every API call's (relative) path. + * @type {String} + * @default https://webservices.amazon.com + */ + public basePath: string = 'https://webservices.amazon.com'.replace(/\/+$/, ''); + /** + * The Access Key ID which uniquely identifies you. + * @type {String} + */ + public accessKey: string|null = null; + /** + * A key that is used in conjunction with the Access Key ID to cryptographically + * sign an API request. + * @type string + */ + public secretKey: string|null = null; + /** + * The host that receives the Amazon Product Advertising API GenNext request. + * @type string + * @default 'webservices.amazon.com' + */ + public host: string = 'webservices.amazon.com'; + /** + * The service's region where the request is targeted. + * @type string + * @default 'us-east-1' + */ + public region: string = 'us-east-1'; + /** + * The authentication methods to be included for all API calls. + * @type {Array.} + */ + public authentications = { + }; + /** + * The default HTTP headers to be included for all API calls. + * @type {Array.} + * @default {} + */ + public defaultHeaders = {}; + /** + * The default HTTP timeout for all API calls. + * @type {Number} + * @default 60000 + */ + public timeout = 60000; + /** + * If set to false an additional timestamp parameter is added to all API GET calls to + * prevent browser caching + * @type {Boolean} + * @default true + */ + public cache = true; + /** + * If set to true, the client will save the cookies from each server + * response, and return them in the next request. + * @default false + */ + public enableCookies = false; + /* + * Allow user to override superagent agent + */ + public requestAgent = { + 'User-Agent': 'dashersupply-fork-paapi5-nodejs-sdk/1.0.0' + }; + public agent = new superagent.agent(); + + /** + * Returns a string representation for an actual parameter. + * @param param The actual parameter. + * @returns {String} The string representation of param. + */ + public paramToString(param: string|Stringifiable|Date|undefined|null) { + if (param == undefined || param == null) { + return ''; + } + if (param instanceof Date) { + return param.toJSON(); + } + return param.toString(); + }; + + /** + * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. + * NOTE: query parameters are not handled here. + * @param {String} path The path to append to the base URL. + * @param {Object} pathParams The parameter values to append. + * @returns {String} The encoded path with parameter values substituted. + */ + public buildUrl(path: string, pathParams: Record) { + if (!path.match(/^\//)) { + path = '/' + path; + } + var url = "https://" + this.host + path; + var _this = this; + url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) { + var value; + if (pathParams.hasOwnProperty(key)) { + value = _this.paramToString(pathParams[key]); + } else { + value = fullMatch; + } + return encodeURIComponent(value); + }); + return url; + }; + + /** + * Checks whether the given content type represents JSON.
+ * JSON content type examples:
+ *
    + *
  • application/json
  • + *
  • application/json; charset=UTF8
  • + *
  • APPLICATION/JSON
  • + *
+ * @param {String} contentType The MIME content type to check. + * @returns {Boolean} true if contentType represents JSON, otherwise false. + */ + public isJsonMime(contentType: string) { + return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); + }; + + /** + * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. + * @param {Array.} contentTypes + * @returns {String} The chosen content type, preferring JSON. + */ + public jsonPreferredMime(contentTypes: string[]) { + for (var i = 0; i < contentTypes.length; i++) { + if (this.isJsonMime(contentTypes[i])) { + return contentTypes[i]; + } + } + return contentTypes[0]; + }; + + /** + * Checks whether the given parameter value represents file-like content. + * @param param The parameter to check. + * @returns {Boolean} true if param represents a file. + */ + public isFileParam(param: any) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + var fs; + try { + fs = require('fs'); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof fs.ReadStream) { + return true; + } + } + // Buffer in Node.js + if (typeof Buffer === 'function' && param instanceof Buffer) { + return true; + } + // Blob in browser + if (typeof Blob === 'function' && param instanceof Blob) { + return true; + } + // File in browser (it seems File object is also instance of Blob, but keep this for safe) + if (typeof File === 'function' && param instanceof File) { + return true; + } + return false; + }; + + /** + * Normalizes parameter values: + *
    + *
  • remove nils
  • + *
  • keep files and arrays
  • + *
  • format to string with `paramToString` for other cases
  • + *
+ * @param {Object.} params The parameters as object properties. + * @returns {Object.} normalized parameters. + */ + public normalizeParams(params: Record) { + var newParams: Record = {}; + for (var key in params) { + if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) { + var value = params[key]; + if (this.isFileParam(value) || Array.isArray(value)) { + newParams[key] = value; + } else { + newParams[key] = this.paramToString(value); + } + } + } + return newParams; + }; + + /** + * Builds a string representation of an array-type actual parameter, according to the given collection format. + * @param {Array} param An array parameter. + * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. + * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns + * param as is if collectionFormat is multi. + */ + public buildCollectionParam(param: any[], collectionFormat: CollectionFormatEnum) { + if (param == null) { + return null; + } + switch (collectionFormat) { + case CollectionFormatEnum.CSV: + return param.map(this.paramToString).join(','); + case CollectionFormatEnum.SSV: + return param.map(this.paramToString).join(' '); + case CollectionFormatEnum.TSV: + return param.map(this.paramToString).join('\t'); + case CollectionFormatEnum.PIPES: + return param.map(this.paramToString).join('|'); + case CollectionFormatEnum.MULTI: + // return the array directly as SuperAgent will handle it as expected + return param.map(this.paramToString); + default: + throw new Error('Unknown collection format: ' + collectionFormat); + } + }; + + /** + * Deserializes an HTTP response body into a value of the specified type. + * @param {Object} response A SuperAgent response object. + * @param {(String|Array.|Object.|Function)} returnType The type to return. Pass a string for simple types + * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To + * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: + * all properties on data will be converted to this type. + * @returns A value of the specified type. + */ + public deserialize(response: superagent.Response, returnType: string|string[]|any|any[]) { + if (response == null || returnType == null || response.status == 204) { + return null; + } + // Rely on SuperAgent for parsing response body. + // See http://visionmedia.github.io/superagent/#parsing-response-bodies + var data = response.body; + if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) { + // SuperAgent does not always produce a body; use the unparsed response as a fallback + data = response.text; + } + return ApiClient.convertToType(data, returnType); + }; + + /** + * Invokes the REST service using the supplied settings and parameters. + * @param {String} path The base URL to invoke. + * @param {String} httpMethod The HTTP method to use. + * @param {String} apiName + * @param {Object.} pathParams A map of path parameters and their values. + * @param {Object.} queryParams A map of query parameters and their values. + * @param {Object.} collectionQueryParams A map of collection query parameters and their values. + * @param {Object.} headerParams A map of header parameters and their values. + * @param {Object.} formParams A map of form parameters and their values. + * @param {Object} bodyParam The value to pass as the request body. + * @param {Array.} authNames An array of authentication type names. + * @param {Array.} contentTypes An array of request MIME types. + * @param {Array.} accepts An array of acceptable response MIME types. + * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the + * constructor for a complex type. + * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object. + */ + public callApi(path: string, httpMethod: string, apiName: string, pathParams: Record, + queryParams: Record, collectionQueryParams: Record, headerParams: Record, formParams: Record, bodyParam: any, authNames: string[], contentTypes: string[], accepts: string[], + returnType: string|string[]|any|any[]) { + + // Throw error if credentials are not specified + if (this.accessKey === undefined || this.secretKey === undefined || this.accessKey === null || this.secretKey === null) { + throw new Error("Missing Credentials. Please specify accessKey and secretKey in client object."); + } + + const self = this; + const url = this.buildUrl(path, pathParams); + const request = superagent(httpMethod, url); + + // apply authentications + const region = this.region + const service = PRODUCT_ADVERTISING_API; + const timestamp = Date.now(); + + let requestHeaders = { + 'content-encoding': 'amz-1.0', + 'content-type': 'application/json; charset=utf-8', + 'host': this.host, + 'x-amz-target': 'com.amazon.paapi5.v1.ProductAdvertisingAPIv1.' + apiName, + 'x-amz-date': awsv4.toAmzDate(timestamp) + }; + + let authorizationHeader = awsv4.createAuthorizationHeader(this.accessKey, this.secretKey, requestHeaders, httpMethod, path, bodyParam, region, service, timestamp); + + let authHeader = { + 'Authorization': authorizationHeader + }; + request.set(authHeader); + + // set collection query parameters + for (const key in collectionQueryParams) { + if (collectionQueryParams.hasOwnProperty(key)) { + const param = collectionQueryParams[key]; + if (param.collectionFormat === 'csv') { + // SuperAgent normally percent-encodes all reserved characters in a query parameter. However, + // commas are used as delimiters for the 'csv' collectionFormat so they must not be encoded. We + // must therefore construct and encode 'csv' collection query parameters manually. + if (param.value != null) { + const value = param.value.map(this.paramToString).map(encodeURIComponent).join(','); + request.query(encodeURIComponent(key) + "=" + value); + } + } else { + // All other collection query parameters should be treated as ordinary query parameters. + queryParams[key] = this.buildCollectionParam(param.value, param.collectionFormat); + } + } + } + + // set query parameters + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); + } + + // set header parameters + request.set(requestHeaders); + + // set requestAgent if it is set by user + request.set(this.requestAgent); + + // set request timeout + request.timeout(this.timeout); + + var contentType = 'application/json; charset=utf-8'; + if (contentType) { + // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) + if(contentType != 'multipart/form-data') { + request.type(contentType); + } + } else if (!request.getHeader('Content-Type')) { + request.type('application/json'); + } + + if (contentType === 'application/x-www-form-urlencoded') { + request.send(querystring.stringify(this.normalizeParams(formParams))); + } else if (contentType == 'multipart/form-data') { + var _formParams = this.normalizeParams(formParams); + for (var key in _formParams) { + if (_formParams.hasOwnProperty(key)) { + if (this.isFileParam(_formParams[key])) { + // file field + request.attach(key, _formParams[key]); + } else { + request.field(key, _formParams[key]); + } + } + } + } else if (bodyParam) { + request.send(bodyParam); + } + + var accept = this.jsonPreferredMime(accepts); + if (accept) { + request.accept(accept); + } + + if (returnType === 'Blob') { + request.responseType('blob'); + } else if (returnType === 'String') { + request.responseType('string'); + } + + // Attach previously saved cookies, if enabled + if (this.enableCookies){ + this.agent.attachCookies(request); + } + + return new Promise(function(resolve, reject) { + request.end(function(error, response) { + if (error) { + reject(error); + } else { + try { + var data = self.deserialize(response, returnType); + if (self.enableCookies && typeof window === 'undefined'){ + self.agent.saveCookies(response); + } + resolve({data: data, response: response}); + } catch (err) { + reject(err); + } + } + }); + }); + }; + + /** + * Parses an ISO-8601 string representation of a date value. + * @param {String} str The date value as a string. + * @returns {Date} The parsed date object. + */ + public static parseDate(str: string): Date { + return new Date(str.replace(/T/i, ' ')); + }; + + /** + * Converts a value to the specified type. + * @param {(String|Object)} data The data to convert, as a string or object. + * @param {(String|Array.|Object.|Function)} type The type to return. Pass a string for simple types + * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To + * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: + * all properties on data will be converted to this type. + * @returns An instance of the specified type or null or undefined if data is null or undefined. + */ + public static convertToType(data: string|any|any[], type: string|string[]|any|any[]) { + if (data === null || data === undefined) + return data + + switch (type) { + case 'Boolean': + return Boolean(data); + case 'Integer': + return parseInt(data, 10); + case 'Number': + return parseFloat(data); + case 'String': + return String(data); + case 'Date': + return ApiClient.parseDate(String(data)); + case 'Blob': + return data; + default: + if (type === Object) { + // generic object, return directly + return data; + } else if (typeof type === 'function') { + // for model type like: User + return type.constructFromObject(data); + } else if (Array.isArray(type)) { + // for array type like: ['String'] + var itemType = type[0]; + return data.map(function(item: any) { + return ApiClient.convertToType(item, itemType); + }); + } else if (typeof type === 'object') { + // for plain object type like: {'String': 'Integer'} + var keyType, valueType; + for (var k in type) { + if (type.hasOwnProperty(k)) { + keyType = k; + valueType = type[k]; + break; + } + } + var result: Record = {}; + for (var k in data) { + if (data.hasOwnProperty(k)) { + var key = this.convertToType(k, keyType); + var value = this.convertToType(data[k], valueType); + result[key] = value; + } + } + return result; + } else { + // for unknown type, return the data directly + return data; + } + } + }; + + /** + * Constructs a new map or array model from REST data. + * @param data {Object|Array} The REST data. + * @param obj {Object|Array} The target object or array. + */ + public static constructFromObject(data: any|any[], obj: any|any[], itemType: string | string[] | any | any[]) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = ApiClient.convertToType(data[i], itemType); + } + } else { + for (var k in data) { + if (data.hasOwnProperty(k)) + obj[k] = ApiClient.convertToType(data[k], itemType); + } + } + }; + + } + \ No newline at end of file diff --git a/src/api/DefaultApi.js b/src/api/DefaultApi.js deleted file mode 100644 index 295714a..0000000 --- a/src/api/DefaultApi.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - /** - * ProductAdvertisingAPI - * https://webservices.amazon.com/paapi5/documentation/index.html - * - */ - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/GetBrowseNodesRequest', 'model/GetBrowseNodesResponse', 'model/GetItemsRequest', 'model/GetItemsResponse', 'model/GetVariationsRequest', 'model/GetVariationsResponse', 'model/ProductAdvertisingAPIClientException', 'model/ProductAdvertisingAPIServiceException', 'model/SearchItemsRequest', 'model/SearchItemsResponse'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/GetBrowseNodesRequest'), require('../model/GetBrowseNodesResponse'), require('../model/GetItemsRequest'), require('../model/GetItemsResponse'), require('../model/GetVariationsRequest'), require('../model/GetVariationsResponse'), require('../model/ProductAdvertisingAPIClientException'), require('../model/ProductAdvertisingAPIServiceException'), require('../model/SearchItemsRequest'), require('../model/SearchItemsResponse')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.DefaultApi = factory(root.ProductAdvertisingAPIv1.ApiClient, root.ProductAdvertisingAPIv1.GetBrowseNodesRequest, root.ProductAdvertisingAPIv1.GetBrowseNodesResponse, root.ProductAdvertisingAPIv1.GetItemsRequest, root.ProductAdvertisingAPIv1.GetItemsResponse, root.ProductAdvertisingAPIv1.GetVariationsRequest, root.ProductAdvertisingAPIv1.GetVariationsResponse, root.ProductAdvertisingAPIv1.ProductAdvertisingAPIClientException, root.ProductAdvertisingAPIv1.ProductAdvertisingAPIServiceException, root.ProductAdvertisingAPIv1.SearchItemsRequest, root.ProductAdvertisingAPIv1.SearchItemsResponse); - } -}(this, function(ApiClient, GetBrowseNodesRequest, GetBrowseNodesResponse, GetItemsRequest, GetItemsResponse, GetVariationsRequest, GetVariationsResponse, ProductAdvertisingAPIClientException, ProductAdvertisingAPIServiceException, SearchItemsRequest, SearchItemsResponse) { - 'use strict'; - - /** - * Default service. - * @module api/DefaultApi - * @version 1.0.0 - */ - - /** - * Constructs a new DefaultApi. - * @alias module:api/DefaultApi - * @class - * @param {module:ApiClient} [apiClient] Optional API client implementation to use, - * default to {@link module:ApiClient#instance} if unspecified. - */ - var exports = function(apiClient) { - this.apiClient = apiClient || ApiClient.instance; - - - - /** - * @param {module:model/GetBrowseNodesRequest} getBrowseNodesRequest GetBrowseNodesRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetBrowseNodesResponse} and HTTP response - */ - this.getBrowseNodesWithHttpInfo = function(getBrowseNodesRequest) { - var postBody = getBrowseNodesRequest; - - // verify the required parameter 'getBrowseNodesRequest' is set - if (getBrowseNodesRequest === undefined || getBrowseNodesRequest === null) { - throw new Error("Missing the required parameter 'getBrowseNodesRequest' when calling getBrowseNodes"); - } - - - var pathParams = { - }; - var queryParams = { - }; - var collectionQueryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = []; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = GetBrowseNodesResponse; - - return this.apiClient.callApi( - '/paapi5/getbrowsenodes', 'POST', 'GetBrowseNodes', - pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** - * @param {module:model/GetBrowseNodesRequest} getBrowseNodesRequest GetBrowseNodesRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetBrowseNodesResponse} - */ - this.getBrowseNodes = function(getBrowseNodesRequest) { - return this.getBrowseNodesWithHttpInfo(getBrowseNodesRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - - /** - * @param {module:model/GetItemsRequest} getItemsRequest GetItemsRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetItemsResponse} and HTTP response - */ - this.getItemsWithHttpInfo = function(getItemsRequest) { - var postBody = getItemsRequest; - - // verify the required parameter 'getItemsRequest' is set - if (getItemsRequest === undefined || getItemsRequest === null) { - throw new Error("Missing the required parameter 'getItemsRequest' when calling getItems"); - } - - - var pathParams = { - }; - var queryParams = { - }; - var collectionQueryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = []; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = GetItemsResponse; - - return this.apiClient.callApi( - '/paapi5/getitems', 'POST', 'GetItems', - pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** - * @param {module:model/GetItemsRequest} getItemsRequest GetItemsRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetItemsResponse} - */ - this.getItems = function(getItemsRequest) { - return this.getItemsWithHttpInfo(getItemsRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - - /** - * @param {module:model/GetVariationsRequest} getVariationsRequest GetVariationsRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetVariationsResponse} and HTTP response - */ - this.getVariationsWithHttpInfo = function(getVariationsRequest) { - var postBody = getVariationsRequest; - - // verify the required parameter 'getVariationsRequest' is set - if (getVariationsRequest === undefined || getVariationsRequest === null) { - throw new Error("Missing the required parameter 'getVariationsRequest' when calling getVariations"); - } - - - var pathParams = { - }; - var queryParams = { - }; - var collectionQueryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = []; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = GetVariationsResponse; - - return this.apiClient.callApi( - '/paapi5/getvariations', 'POST', 'GetVariations', - pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** - * @param {module:model/GetVariationsRequest} getVariationsRequest GetVariationsRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetVariationsResponse} - */ - this.getVariations = function(getVariationsRequest) { - return this.getVariationsWithHttpInfo(getVariationsRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - - /** - * @param {module:model/SearchItemsRequest} searchItemsRequest SearchItemsRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SearchItemsResponse} and HTTP response - */ - this.searchItemsWithHttpInfo = function(searchItemsRequest) { - var postBody = searchItemsRequest; - - // verify the required parameter 'searchItemsRequest' is set - if (searchItemsRequest === undefined || searchItemsRequest === null) { - throw new Error("Missing the required parameter 'searchItemsRequest' when calling searchItems"); - } - - - var pathParams = { - }; - var queryParams = { - }; - var collectionQueryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = []; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = SearchItemsResponse; - - return this.apiClient.callApi( - '/paapi5/searchitems', 'POST', 'SearchItems', - pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** - * @param {module:model/SearchItemsRequest} searchItemsRequest SearchItemsRequest - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SearchItemsResponse} - */ - this.searchItems = function(searchItemsRequest) { - return this.searchItemsWithHttpInfo(searchItemsRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - }; - - return exports; -})); diff --git a/src/api/DefaultApi.ts b/src/api/DefaultApi.ts new file mode 100644 index 0000000..8aaa863 --- /dev/null +++ b/src/api/DefaultApi.ts @@ -0,0 +1,238 @@ +/** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * + * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + + /** + * ProductAdvertisingAPI + * https://webservices.amazon.com/paapi5/documentation/index.html + * + */ + + import { ApiClient } from "../ApiClient"; + import { GetBrowseNodesRequest } from "../model/GetBrowseNodesRequest"; + + /** + * Default service. + * @module api/DefaultApi + * @version 1.0.0 + */ + + /** + * Constructs a new DefaultApi. + * @alias module:api/DefaultApi + * @class + * @param {module:ApiClient} [apiClient] Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. + */ + export class DefaultApi { + public apiClient: ApiClient = ApiClient.instance; + public contructor(apiClient?: ApiClient) { + if (apiClient) + this.apiClient = apiClient; + } + + /** + * @param {module:model/GetBrowseNodesRequest} getBrowseNodesRequest GetBrowseNodesRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetBrowseNodesResponse} and HTTP response + */ + public getBrowseNodesWithHttpInfo(getBrowseNodesRequest) { + var postBody = getBrowseNodesRequest; + + // verify the required parameter 'getBrowseNodesRequest' is set + if (getBrowseNodesRequest === undefined || getBrowseNodesRequest === null) { + throw new Error("Missing the required parameter 'getBrowseNodesRequest' when calling getBrowseNodes"); + } + + + var pathParams = { + }; + var queryParams = { + }; + var collectionQueryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = ['application/json']; + var accepts = ['application/json']; + var returnType = GetBrowseNodesResponse; + + return this.apiClient.callApi( + '/paapi5/getbrowsenodes', 'POST', 'GetBrowseNodes', + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * @param {module:model/GetBrowseNodesRequest} getBrowseNodesRequest GetBrowseNodesRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetBrowseNodesResponse} + */ + public getBrowseNodes(getBrowseNodesRequest) { + return this.getBrowseNodesWithHttpInfo(getBrowseNodesRequest) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + + /** + * @param {module:model/GetItemsRequest} getItemsRequest GetItemsRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetItemsResponse} and HTTP response + */ + public getItemsWithHttpInfo(getItemsRequest) { + var postBody = getItemsRequest; + + // verify the required parameter 'getItemsRequest' is set + if (getItemsRequest === undefined || getItemsRequest === null) { + throw new Error("Missing the required parameter 'getItemsRequest' when calling getItems"); + } + + + var pathParams = { + }; + var queryParams = { + }; + var collectionQueryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = ['application/json']; + var accepts = ['application/json']; + var returnType = GetItemsResponse; + + return this.apiClient.callApi( + '/paapi5/getitems', 'POST', 'GetItems', + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * @param {module:model/GetItemsRequest} getItemsRequest GetItemsRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetItemsResponse} + */ + public getItems(getItemsRequest) { + return this.getItemsWithHttpInfo(getItemsRequest) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + + /** + * @param {module:model/GetVariationsRequest} getVariationsRequest GetVariationsRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetVariationsResponse} and HTTP response + */ + public getVariationsWithHttpInfo(getVariationsRequest) { + var postBody = getVariationsRequest; + + // verify the required parameter 'getVariationsRequest' is set + if (getVariationsRequest === undefined || getVariationsRequest === null) { + throw new Error("Missing the required parameter 'getVariationsRequest' when calling getVariations"); + } + + + var pathParams = { + }; + var queryParams = { + }; + var collectionQueryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = ['application/json']; + var accepts = ['application/json']; + var returnType = GetVariationsResponse; + + return this.apiClient.callApi( + '/paapi5/getvariations', 'POST', 'GetVariations', + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * @param {module:model/GetVariationsRequest} getVariationsRequest GetVariationsRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetVariationsResponse} + */ + public getVariations(getVariationsRequest) { + return this.getVariationsWithHttpInfo(getVariationsRequest) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + + /** + * @param {module:model/SearchItemsRequest} searchItemsRequest SearchItemsRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SearchItemsResponse} and HTTP response + */ + public searchItemsWithHttpInfo(searchItemsRequest) { + var postBody = searchItemsRequest; + + // verify the required parameter 'searchItemsRequest' is set + if (searchItemsRequest === undefined || searchItemsRequest === null) { + throw new Error("Missing the required parameter 'searchItemsRequest' when calling searchItems"); + } + + + var pathParams = { + }; + var queryParams = { + }; + var collectionQueryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = ['application/json']; + var accepts = ['application/json']; + var returnType = SearchItemsResponse; + + return this.apiClient.callApi( + '/paapi5/searchitems', 'POST', 'SearchItems', + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * @param {module:model/SearchItemsRequest} searchItemsRequest SearchItemsRequest + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SearchItemsResponse} + */ + public searchItems(searchItemsRequest) { + return this.searchItemsWithHttpInfo(searchItemsRequest) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + }; + \ No newline at end of file diff --git a/src/auth/SignHelper.ts b/src/auth/SignHelper.ts index 99b2a20..d47c32f 100644 --- a/src/auth/SignHelper.ts +++ b/src/auth/SignHelper.ts @@ -120,4 +120,4 @@ export const createAuthorizationHeader = (accessKey: string, secretKey: string, signature ); return authorizationHeader; -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 6fc4cfb..0000000 --- a/src/index.js +++ /dev/null @@ -1,523 +0,0 @@ -/** - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - /** - * ProductAdvertisingAPI - * https://webservices.amazon.com/paapi5/documentation/index.html - * - */ - -(function(factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Availability', 'model/BrowseNode', 'model/BrowseNodeAncestor', 'model/BrowseNodeChild', 'model/BrowseNodeInfo', 'model/BrowseNodesResult', 'model/ByLineInfo', 'model/Classifications', 'model/Condition', 'model/ContentInfo', 'model/ContentRating', 'model/Contributor', 'model/CustomerReviews', 'model/DeliveryFlag', 'model/DimensionBasedAttribute', 'model/DurationPrice', 'model/ErrorData', 'model/ExternalIds', 'model/GetBrowseNodesRequest', 'model/GetBrowseNodesResource', 'model/GetBrowseNodesResponse', 'model/GetItemsRequest', 'model/GetItemsResource', 'model/GetItemsResponse', 'model/GetVariationsRequest', 'model/GetVariationsResource', 'model/GetVariationsResponse', 'model/ImageSize', 'model/ImageType', 'model/Images', 'model/Item', 'model/ItemIdType', 'model/ItemInfo', 'model/ItemsResult', 'model/LanguageType', 'model/Languages', 'model/ManufactureInfo', 'model/MaxPrice', 'model/Merchant', 'model/MinPrice', 'model/MinReviewsRating', 'model/MinSavingPercent', 'model/MultiValuedAttribute', 'model/OfferAvailability', 'model/OfferCondition', 'model/OfferConditionNote', 'model/OfferCount', 'model/OfferDeliveryInfo', 'model/OfferListing', 'model/OfferLoyaltyPoints', 'model/OfferMerchantInfo', 'model/OfferPrice', 'model/OfferProgramEligibility', 'model/OfferPromotion', 'model/OfferSavings', 'model/OfferShippingCharge', 'model/OfferSubCondition', 'model/OfferSummary', 'model/Offers', 'model/PartnerType', 'model/Price', 'model/PriceType', 'model/ProductAdvertisingAPIClientException', 'model/ProductAdvertisingAPIServiceException', 'model/ProductInfo', 'model/Properties', 'model/Rating', 'model/Refinement', 'model/RefinementBin', 'model/RentalOfferListing', 'model/RentalOffers', 'model/SearchItemsRequest', 'model/SearchItemsResource', 'model/SearchItemsResponse', 'model/SearchRefinements', 'model/SearchResult', 'model/SingleBooleanValuedAttribute', 'model/SingleIntegerValuedAttribute', 'model/SingleStringValuedAttribute', 'model/SortBy', 'model/TechnicalInfo', 'model/TradeInInfo', 'model/TradeInPrice', 'model/UnitBasedAttribute', 'model/VariationAttribute', 'model/VariationDimension', 'model/VariationSummary', 'model/VariationsResult', 'model/WebsiteSalesRank', 'api/DefaultApi'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Availability'), require('./model/BrowseNode'), require('./model/BrowseNodeAncestor'), require('./model/BrowseNodeChild'), require('./model/BrowseNodeInfo'), require('./model/BrowseNodesResult'), require('./model/ByLineInfo'), require('./model/Classifications'), require('./model/Condition'), require('./model/ContentInfo'), require('./model/ContentRating'), require('./model/Contributor'), require('./model/CustomerReviews'), require('./model/DeliveryFlag'), require('./model/DimensionBasedAttribute'), require('./model/DurationPrice'), require('./model/ErrorData'), require('./model/ExternalIds'), require('./model/GetBrowseNodesRequest'), require('./model/GetBrowseNodesResource'), require('./model/GetBrowseNodesResponse'), require('./model/GetItemsRequest'), require('./model/GetItemsResource'), require('./model/GetItemsResponse'), require('./model/GetVariationsRequest'), require('./model/GetVariationsResource'), require('./model/GetVariationsResponse'), require('./model/ImageSize'), require('./model/ImageType'), require('./model/Images'), require('./model/Item'), require('./model/ItemIdType'), require('./model/ItemInfo'), require('./model/ItemsResult'), require('./model/LanguageType'), require('./model/Languages'), require('./model/ManufactureInfo'), require('./model/MaxPrice'), require('./model/Merchant'), require('./model/MinPrice'), require('./model/MinReviewsRating'), require('./model/MinSavingPercent'), require('./model/MultiValuedAttribute'), require('./model/OfferAvailability'), require('./model/OfferCondition'), require('./model/OfferConditionNote'), require('./model/OfferCount'), require('./model/OfferDeliveryInfo'), require('./model/OfferListing'), require('./model/OfferLoyaltyPoints'), require('./model/OfferMerchantInfo'), require('./model/OfferPrice'), require('./model/OfferProgramEligibility'), require('./model/OfferPromotion'), require('./model/OfferSavings'), require('./model/OfferShippingCharge'), require('./model/OfferSubCondition'), require('./model/OfferSummary'), require('./model/Offers'), require('./model/PartnerType'), require('./model/Price'), require('./model/PriceType'), require('./model/ProductAdvertisingAPIClientException'), require('./model/ProductAdvertisingAPIServiceException'), require('./model/ProductInfo'), require('./model/Properties'), require('./model/Rating'), require('./model/Refinement'), require('./model/RefinementBin'), require('./model/RentalOfferListing'), require('./model/RentalOffers'), require('./model/SearchItemsRequest'), require('./model/SearchItemsResource'), require('./model/SearchItemsResponse'), require('./model/SearchRefinements'), require('./model/SearchResult'), require('./model/SingleBooleanValuedAttribute'), require('./model/SingleIntegerValuedAttribute'), require('./model/SingleStringValuedAttribute'), require('./model/SortBy'), require('./model/TechnicalInfo'), require('./model/TradeInInfo'), require('./model/TradeInPrice'), require('./model/UnitBasedAttribute'), require('./model/VariationAttribute'), require('./model/VariationDimension'), require('./model/VariationSummary'), require('./model/VariationsResult'), require('./model/WebsiteSalesRank'), require('./api/DefaultApi')); - } -}(function(ApiClient, Availability, BrowseNode, BrowseNodeAncestor, BrowseNodeChild, BrowseNodeInfo, BrowseNodesResult, ByLineInfo, Classifications, Condition, ContentInfo, ContentRating, Contributor, CustomerReviews, DeliveryFlag, DimensionBasedAttribute, DurationPrice, ErrorData, ExternalIds, GetBrowseNodesRequest, GetBrowseNodesResource, GetBrowseNodesResponse, GetItemsRequest, GetItemsResource, GetItemsResponse, GetVariationsRequest, GetVariationsResource, GetVariationsResponse, ImageSize, ImageType, Images, Item, ItemIdType, ItemInfo, ItemsResult, LanguageType, Languages, ManufactureInfo, MaxPrice, Merchant, MinPrice, MinReviewsRating, MinSavingPercent, MultiValuedAttribute, OfferAvailability, OfferCondition, OfferConditionNote, OfferCount, OfferDeliveryInfo, OfferListing, OfferLoyaltyPoints, OfferMerchantInfo, OfferPrice, OfferProgramEligibility, OfferPromotion, OfferSavings, OfferShippingCharge, OfferSubCondition, OfferSummary, Offers, PartnerType, Price, PriceType, ProductAdvertisingAPIClientException, ProductAdvertisingAPIServiceException, ProductInfo, Properties, Rating, Refinement, RefinementBin, RentalOfferListing, RentalOffers, SearchItemsRequest, SearchItemsResource, SearchItemsResponse, SearchRefinements, SearchResult, SingleBooleanValuedAttribute, SingleIntegerValuedAttribute, SingleStringValuedAttribute, SortBy, TechnicalInfo, TradeInInfo, TradeInPrice, UnitBasedAttribute, VariationAttribute, VariationDimension, VariationSummary, VariationsResult, WebsiteSalesRank, DefaultApi) { - 'use strict'; - - /** - * ProductAdvertisingAPI 5.0 NodeJS SDK.
- * The index module provides access to constructors for all the classes which comprise the public API. - *

- * An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: - *

-   * var ProductAdvertisingAPIv1 = require('index'); // See note below*.
-   * var xxxSvc = new ProductAdvertisingAPIv1.XxxApi(); // Allocate the API class we're going to use.
-   * var yyyModel = new ProductAdvertisingAPIv1.Yyy(); // Construct a model instance.
-   * yyyModel.someProperty = 'someValue';
-   * ...
-   * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
-   * ...
-   * 
- * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) - * and put the application logic within the callback function. - *

- *

- * A non-AMD browser application (discouraged) might do something like this: - *

-   * var xxxSvc = new ProductAdvertisingAPIv1.XxxApi(); // Allocate the API class we're going to use.
-   * var yyy = new ProductAdvertisingAPIv1.Yyy(); // Construct a model instance.
-   * yyyModel.someProperty = 'someValue';
-   * ...
-   * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
-   * ...
-   * 
- *

- * @module index - * @version 1.0.0 - */ - var exports = { - /** - * The ApiClient constructor. - * @property {module:ApiClient} - */ - ApiClient: ApiClient, - /** - * The Availability model constructor. - * @property {module:model/Availability} - */ - Availability: Availability, - /** - * The BrowseNode model constructor. - * @property {module:model/BrowseNode} - */ - BrowseNode: BrowseNode, - /** - * The BrowseNodeAncestor model constructor. - * @property {module:model/BrowseNodeAncestor} - */ - BrowseNodeAncestor: BrowseNodeAncestor, - /** - * The BrowseNodeChild model constructor. - * @property {module:model/BrowseNodeChild} - */ - BrowseNodeChild: BrowseNodeChild, - /** - * The BrowseNodeInfo model constructor. - * @property {module:model/BrowseNodeInfo} - */ - BrowseNodeInfo: BrowseNodeInfo, - /** - * The BrowseNodesResult model constructor. - * @property {module:model/BrowseNodesResult} - */ - BrowseNodesResult: BrowseNodesResult, - /** - * The ByLineInfo model constructor. - * @property {module:model/ByLineInfo} - */ - ByLineInfo: ByLineInfo, - /** - * The Classifications model constructor. - * @property {module:model/Classifications} - */ - Classifications: Classifications, - /** - * The Condition model constructor. - * @property {module:model/Condition} - */ - Condition: Condition, - /** - * The ContentInfo model constructor. - * @property {module:model/ContentInfo} - */ - ContentInfo: ContentInfo, - /** - * The ContentRating model constructor. - * @property {module:model/ContentRating} - */ - ContentRating: ContentRating, - /** - * The Contributor model constructor. - * @property {module:model/Contributor} - */ - Contributor: Contributor, - /** - * The CustomerReviews model constructor. - * @property {module:model/CustomerReviews} - */ - CustomerReviews: CustomerReviews, - /** - * The DeliveryFlag model constructor. - * @property {module:model/DeliveryFlag} - */ - DeliveryFlag: DeliveryFlag, - /** - * The DimensionBasedAttribute model constructor. - * @property {module:model/DimensionBasedAttribute} - */ - DimensionBasedAttribute: DimensionBasedAttribute, - /** - * The DurationPrice model constructor. - * @property {module:model/DurationPrice} - */ - DurationPrice: DurationPrice, - /** - * The ErrorData model constructor. - * @property {module:model/ErrorData} - */ - ErrorData: ErrorData, - /** - * The ExternalIds model constructor. - * @property {module:model/ExternalIds} - */ - ExternalIds: ExternalIds, - /** - * The GetBrowseNodesRequest model constructor. - * @property {module:model/GetBrowseNodesRequest} - */ - GetBrowseNodesRequest: GetBrowseNodesRequest, - /** - * The GetBrowseNodesResource model constructor. - * @property {module:model/GetBrowseNodesResource} - */ - GetBrowseNodesResource: GetBrowseNodesResource, - /** - * The GetBrowseNodesResponse model constructor. - * @property {module:model/GetBrowseNodesResponse} - */ - GetBrowseNodesResponse: GetBrowseNodesResponse, - /** - * The GetItemsRequest model constructor. - * @property {module:model/GetItemsRequest} - */ - GetItemsRequest: GetItemsRequest, - /** - * The GetItemsResource model constructor. - * @property {module:model/GetItemsResource} - */ - GetItemsResource: GetItemsResource, - /** - * The GetItemsResponse model constructor. - * @property {module:model/GetItemsResponse} - */ - GetItemsResponse: GetItemsResponse, - /** - * The GetVariationsRequest model constructor. - * @property {module:model/GetVariationsRequest} - */ - GetVariationsRequest: GetVariationsRequest, - /** - * The GetVariationsResource model constructor. - * @property {module:model/GetVariationsResource} - */ - GetVariationsResource: GetVariationsResource, - /** - * The GetVariationsResponse model constructor. - * @property {module:model/GetVariationsResponse} - */ - GetVariationsResponse: GetVariationsResponse, - /** - * The ImageSize model constructor. - * @property {module:model/ImageSize} - */ - ImageSize: ImageSize, - /** - * The ImageType model constructor. - * @property {module:model/ImageType} - */ - ImageType: ImageType, - /** - * The Images model constructor. - * @property {module:model/Images} - */ - Images: Images, - /** - * The Item model constructor. - * @property {module:model/Item} - */ - Item: Item, - /** - * The ItemIdType model constructor. - * @property {module:model/ItemIdType} - */ - ItemIdType: ItemIdType, - /** - * The ItemInfo model constructor. - * @property {module:model/ItemInfo} - */ - ItemInfo: ItemInfo, - /** - * The ItemsResult model constructor. - * @property {module:model/ItemsResult} - */ - ItemsResult: ItemsResult, - /** - * The LanguageType model constructor. - * @property {module:model/LanguageType} - */ - LanguageType: LanguageType, - /** - * The Languages model constructor. - * @property {module:model/Languages} - */ - Languages: Languages, - /** - * The ManufactureInfo model constructor. - * @property {module:model/ManufactureInfo} - */ - ManufactureInfo: ManufactureInfo, - /** - * The MaxPrice model constructor. - * @property {module:model/MaxPrice} - */ - MaxPrice: MaxPrice, - /** - * The Merchant model constructor. - * @property {module:model/Merchant} - */ - Merchant: Merchant, - /** - * The MinPrice model constructor. - * @property {module:model/MinPrice} - */ - MinPrice: MinPrice, - /** - * The MinReviewsRating model constructor. - * @property {module:model/MinReviewsRating} - */ - MinReviewsRating: MinReviewsRating, - /** - * The MinSavingPercent model constructor. - * @property {module:model/MinSavingPercent} - */ - MinSavingPercent: MinSavingPercent, - /** - * The MultiValuedAttribute model constructor. - * @property {module:model/MultiValuedAttribute} - */ - MultiValuedAttribute: MultiValuedAttribute, - /** - * The OfferAvailability model constructor. - * @property {module:model/OfferAvailability} - */ - OfferAvailability: OfferAvailability, - /** - * The OfferCondition model constructor. - * @property {module:model/OfferCondition} - */ - OfferCondition: OfferCondition, - /** - * The OfferConditionNote model constructor. - * @property {module:model/OfferConditionNote} - */ - OfferConditionNote: OfferConditionNote, - /** - * The OfferCount model constructor. - * @property {module:model/OfferCount} - */ - OfferCount: OfferCount, - /** - * The OfferDeliveryInfo model constructor. - * @property {module:model/OfferDeliveryInfo} - */ - OfferDeliveryInfo: OfferDeliveryInfo, - /** - * The OfferListing model constructor. - * @property {module:model/OfferListing} - */ - OfferListing: OfferListing, - /** - * The OfferLoyaltyPoints model constructor. - * @property {module:model/OfferLoyaltyPoints} - */ - OfferLoyaltyPoints: OfferLoyaltyPoints, - /** - * The OfferMerchantInfo model constructor. - * @property {module:model/OfferMerchantInfo} - */ - OfferMerchantInfo: OfferMerchantInfo, - /** - * The OfferPrice model constructor. - * @property {module:model/OfferPrice} - */ - OfferPrice: OfferPrice, - /** - * The OfferProgramEligibility model constructor. - * @property {module:model/OfferProgramEligibility} - */ - OfferProgramEligibility: OfferProgramEligibility, - /** - * The OfferPromotion model constructor. - * @property {module:model/OfferPromotion} - */ - OfferPromotion: OfferPromotion, - /** - * The OfferSavings model constructor. - * @property {module:model/OfferSavings} - */ - OfferSavings: OfferSavings, - /** - * The OfferShippingCharge model constructor. - * @property {module:model/OfferShippingCharge} - */ - OfferShippingCharge: OfferShippingCharge, - /** - * The OfferSubCondition model constructor. - * @property {module:model/OfferSubCondition} - */ - OfferSubCondition: OfferSubCondition, - /** - * The OfferSummary model constructor. - * @property {module:model/OfferSummary} - */ - OfferSummary: OfferSummary, - /** - * The Offers model constructor. - * @property {module:model/Offers} - */ - Offers: Offers, - /** - * The PartnerType model constructor. - * @property {module:model/PartnerType} - */ - PartnerType: PartnerType, - /** - * The Price model constructor. - * @property {module:model/Price} - */ - Price: Price, - /** - * The PriceType model constructor. - * @property {module:model/PriceType} - */ - PriceType: PriceType, - /** - * The ProductAdvertisingAPIClientException model constructor. - * @property {module:model/ProductAdvertisingAPIClientException} - */ - ProductAdvertisingAPIClientException: ProductAdvertisingAPIClientException, - /** - * The ProductAdvertisingAPIServiceException model constructor. - * @property {module:model/ProductAdvertisingAPIServiceException} - */ - ProductAdvertisingAPIServiceException: ProductAdvertisingAPIServiceException, - /** - * The ProductInfo model constructor. - * @property {module:model/ProductInfo} - */ - ProductInfo: ProductInfo, - /** - * The Properties model constructor. - * @property {module:model/Properties} - */ - Properties: Properties, - /** - * The Rating model constructor. - * @property {module:model/Rating} - */ - Rating: Rating, - /** - * The Refinement model constructor. - * @property {module:model/Refinement} - */ - Refinement: Refinement, - /** - * The RefinementBin model constructor. - * @property {module:model/RefinementBin} - */ - RefinementBin: RefinementBin, - /** - * The RentalOfferListing model constructor. - * @property {module:model/RentalOfferListing} - */ - RentalOfferListing: RentalOfferListing, - /** - * The RentalOffers model constructor. - * @property {module:model/RentalOffers} - */ - RentalOffers: RentalOffers, - /** - * The SearchItemsRequest model constructor. - * @property {module:model/SearchItemsRequest} - */ - SearchItemsRequest: SearchItemsRequest, - /** - * The SearchItemsResource model constructor. - * @property {module:model/SearchItemsResource} - */ - SearchItemsResource: SearchItemsResource, - /** - * The SearchItemsResponse model constructor. - * @property {module:model/SearchItemsResponse} - */ - SearchItemsResponse: SearchItemsResponse, - /** - * The SearchRefinements model constructor. - * @property {module:model/SearchRefinements} - */ - SearchRefinements: SearchRefinements, - /** - * The SearchResult model constructor. - * @property {module:model/SearchResult} - */ - SearchResult: SearchResult, - /** - * The SingleBooleanValuedAttribute model constructor. - * @property {module:model/SingleBooleanValuedAttribute} - */ - SingleBooleanValuedAttribute: SingleBooleanValuedAttribute, - /** - * The SingleIntegerValuedAttribute model constructor. - * @property {module:model/SingleIntegerValuedAttribute} - */ - SingleIntegerValuedAttribute: SingleIntegerValuedAttribute, - /** - * The SingleStringValuedAttribute model constructor. - * @property {module:model/SingleStringValuedAttribute} - */ - SingleStringValuedAttribute: SingleStringValuedAttribute, - /** - * The SortBy model constructor. - * @property {module:model/SortBy} - */ - SortBy: SortBy, - /** - * The TechnicalInfo model constructor. - * @property {module:model/TechnicalInfo} - */ - TechnicalInfo: TechnicalInfo, - /** - * The TradeInInfo model constructor. - * @property {module:model/TradeInInfo} - */ - TradeInInfo: TradeInInfo, - /** - * The TradeInPrice model constructor. - * @property {module:model/TradeInPrice} - */ - TradeInPrice: TradeInPrice, - /** - * The UnitBasedAttribute model constructor. - * @property {module:model/UnitBasedAttribute} - */ - UnitBasedAttribute: UnitBasedAttribute, - /** - * The VariationAttribute model constructor. - * @property {module:model/VariationAttribute} - */ - VariationAttribute: VariationAttribute, - /** - * The VariationDimension model constructor. - * @property {module:model/VariationDimension} - */ - VariationDimension: VariationDimension, - /** - * The VariationSummary model constructor. - * @property {module:model/VariationSummary} - */ - VariationSummary: VariationSummary, - /** - * The VariationsResult model constructor. - * @property {module:model/VariationsResult} - */ - VariationsResult: VariationsResult, - /** - * The WebsiteSalesRank model constructor. - * @property {module:model/WebsiteSalesRank} - */ - WebsiteSalesRank: WebsiteSalesRank, - /** - * The DefaultApi service constructor. - * @property {module:api/DefaultApi} - */ - DefaultApi: DefaultApi - }; - - return exports; -})); diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..0eaec59 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,522 @@ +/** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + + /** + * ProductAdvertisingAPI + * https://webservices.amazon.com/paapi5/documentation/index.html + * + */ + +import { ApiClient } from "./ApiClient"; +import { ByLineInfo } from "./model/ByLineInfo"; +import { Classifications } from "./model/Classifications"; +import { Condition } from "./model/Condition"; +import { Contributor } from "./model/Contributor"; +import { OfferSavings } from "./model/OfferSavings"; +import { PriceType } from "./model/PriceType"; +import { SingleBooleanValuedAttribute } from "./model/SingleBooleanValuedAttribute"; +import { SingleIntegerValuedAttribute } from "./model/SingleIntegerValuedAttribute"; +import { SingleStringValuedAttribute } from "./model/SingleStringValuedAttribute"; + +/** + * ProductAdvertisingAPI 5.0 NodeJS SDK.
+ * The index module provides access to constructors for all the classes which comprise the public API. + *

+ * An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: + *

+ * var ProductAdvertisingAPIv1 = require('index'); // See note below*.
+ * var xxxSvc = new ProductAdvertisingAPIv1.XxxApi(); // Allocate the API class we're going to use.
+ * var yyyModel = new ProductAdvertisingAPIv1.Yyy(); // Construct a model instance.
+ * yyyModel.someProperty = 'someValue';
+ * ...
+ * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+ * ...
+ * 
+ * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) + * and put the application logic within the callback function. + *

+ *

+ * A non-AMD browser application (discouraged) might do something like this: + *

+ * var xxxSvc = new ProductAdvertisingAPIv1.XxxApi(); // Allocate the API class we're going to use.
+ * var yyy = new ProductAdvertisingAPIv1.Yyy(); // Construct a model instance.
+ * yyyModel.someProperty = 'someValue';
+ * ...
+ * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+ * ...
+ * 
+ *

+ * @module index + * @version 1.0.0 + */ +export { + /** + * The ApiClient constructor. + * @property {module:ApiClient} + */ + ApiClient, + /** + * The Availability model constructor. + * @property {module:model/Availability} + */ + Availability: Availability, + /** + * The BrowseNode model constructor. + * @property {module:model/BrowseNode} + */ + BrowseNode: BrowseNode, + /** + * The BrowseNodeAncestor model constructor. + * @property {module:model/BrowseNodeAncestor} + */ + BrowseNodeAncestor: BrowseNodeAncestor, + /** + * The BrowseNodeChild model constructor. + * @property {module:model/BrowseNodeChild} + */ + BrowseNodeChild: BrowseNodeChild, + /** + * The BrowseNodeInfo model constructor. + * @property {module:model/BrowseNodeInfo} + */ + BrowseNodeInfo: BrowseNodeInfo, + /** + * The BrowseNodesResult model constructor. + * @property {module:model/BrowseNodesResult} + */ + BrowseNodesResult: BrowseNodesResult, + /** + * The ByLineInfo model constructor. + * @property {module:model/ByLineInfo} + */ + ByLineInfo, + /** + * The Classifications model constructor. + * @property {module:model/Classifications} + */ + Classifications, + /** + * The Condition model constructor. + * @property {module:model/Condition} + */ + Condition, + /** + * The ContentInfo model constructor. + * @property {module:model/ContentInfo} + */ + ContentInfo: ContentInfo, + /** + * The ContentRating model constructor. + * @property {module:model/ContentRating} + */ + ContentRating: ContentRating, + /** + * The Contributor model constructor. + * @property {module:model/Contributor} + */ + Contributor, + /** + * The CustomerReviews model constructor. + * @property {module:model/CustomerReviews} + */ + CustomerReviews: CustomerReviews, + /** + * The DeliveryFlag model constructor. + * @property {module:model/DeliveryFlag} + */ + DeliveryFlag: DeliveryFlag, + /** + * The DimensionBasedAttribute model constructor. + * @property {module:model/DimensionBasedAttribute} + */ + DimensionBasedAttribute: DimensionBasedAttribute, + /** + * The DurationPrice model constructor. + * @property {module:model/DurationPrice} + */ + DurationPrice: DurationPrice, + /** + * The ErrorData model constructor. + * @property {module:model/ErrorData} + */ + ErrorData: ErrorData, + /** + * The ExternalIds model constructor. + * @property {module:model/ExternalIds} + */ + ExternalIds: ExternalIds, + /** + * The GetBrowseNodesRequest model constructor. + * @property {module:model/GetBrowseNodesRequest} + */ + GetBrowseNodesRequest: GetBrowseNodesRequest, + /** + * The GetBrowseNodesResource model constructor. + * @property {module:model/GetBrowseNodesResource} + */ + GetBrowseNodesResource: GetBrowseNodesResource, + /** + * The GetBrowseNodesResponse model constructor. + * @property {module:model/GetBrowseNodesResponse} + */ + GetBrowseNodesResponse: GetBrowseNodesResponse, + /** + * The GetItemsRequest model constructor. + * @property {module:model/GetItemsRequest} + */ + GetItemsRequest: GetItemsRequest, + /** + * The GetItemsResource model constructor. + * @property {module:model/GetItemsResource} + */ + GetItemsResource: GetItemsResource, + /** + * The GetItemsResponse model constructor. + * @property {module:model/GetItemsResponse} + */ + GetItemsResponse: GetItemsResponse, + /** + * The GetVariationsRequest model constructor. + * @property {module:model/GetVariationsRequest} + */ + GetVariationsRequest: GetVariationsRequest, + /** + * The GetVariationsResource model constructor. + * @property {module:model/GetVariationsResource} + */ + GetVariationsResource: GetVariationsResource, + /** + * The GetVariationsResponse model constructor. + * @property {module:model/GetVariationsResponse} + */ + GetVariationsResponse: GetVariationsResponse, + /** + * The ImageSize model constructor. + * @property {module:model/ImageSize} + */ + ImageSize: ImageSize, + /** + * The ImageType model constructor. + * @property {module:model/ImageType} + */ + ImageType: ImageType, + /** + * The Images model constructor. + * @property {module:model/Images} + */ + Images: Images, + /** + * The Item model constructor. + * @property {module:model/Item} + */ + Item: Item, + /** + * The ItemIdType model constructor. + * @property {module:model/ItemIdType} + */ + ItemIdType: ItemIdType, + /** + * The ItemInfo model constructor. + * @property {module:model/ItemInfo} + */ + ItemInfo: ItemInfo, + /** + * The ItemsResult model constructor. + * @property {module:model/ItemsResult} + */ + ItemsResult: ItemsResult, + /** + * The LanguageType model constructor. + * @property {module:model/LanguageType} + */ + LanguageType: LanguageType, + /** + * The Languages model constructor. + * @property {module:model/Languages} + */ + Languages: Languages, + /** + * The ManufactureInfo model constructor. + * @property {module:model/ManufactureInfo} + */ + ManufactureInfo: ManufactureInfo, + /** + * The MaxPrice model constructor. + * @property {module:model/MaxPrice} + */ + MaxPrice: MaxPrice, + /** + * The Merchant model constructor. + * @property {module:model/Merchant} + */ + Merchant: Merchant, + /** + * The MinPrice model constructor. + * @property {module:model/MinPrice} + */ + MinPrice: MinPrice, + /** + * The MinReviewsRating model constructor. + * @property {module:model/MinReviewsRating} + */ + MinReviewsRating: MinReviewsRating, + /** + * The MinSavingPercent model constructor. + * @property {module:model/MinSavingPercent} + */ + MinSavingPercent: MinSavingPercent, + /** + * The MultiValuedAttribute model constructor. + * @property {module:model/MultiValuedAttribute} + */ + MultiValuedAttribute: MultiValuedAttribute, + /** + * The OfferAvailability model constructor. + * @property {module:model/OfferAvailability} + */ + OfferAvailability: OfferAvailability, + /** + * The OfferCondition model constructor. + * @property {module:model/OfferCondition} + */ + OfferCondition: OfferCondition, + /** + * The OfferConditionNote model constructor. + * @property {module:model/OfferConditionNote} + */ + OfferConditionNote: OfferConditionNote, + /** + * The OfferCount model constructor. + * @property {module:model/OfferCount} + */ + OfferCount: OfferCount, + /** + * The OfferDeliveryInfo model constructor. + * @property {module:model/OfferDeliveryInfo} + */ + OfferDeliveryInfo: OfferDeliveryInfo, + /** + * The OfferListing model constructor. + * @property {module:model/OfferListing} + */ + OfferListing: OfferListing, + /** + * The OfferLoyaltyPoints model constructor. + * @property {module:model/OfferLoyaltyPoints} + */ + OfferLoyaltyPoints: OfferLoyaltyPoints, + /** + * The OfferMerchantInfo model constructor. + * @property {module:model/OfferMerchantInfo} + */ + OfferMerchantInfo: OfferMerchantInfo, + /** + * The OfferPrice model constructor. + * @property {module:model/OfferPrice} + */ + OfferPrice: OfferPrice, + /** + * The OfferProgramEligibility model constructor. + * @property {module:model/OfferProgramEligibility} + */ + OfferProgramEligibility: OfferProgramEligibility, + /** + * The OfferPromotion model constructor. + * @property {module:model/OfferPromotion} + */ + OfferPromotion: OfferPromotion, + /** + * The OfferSavings model constructor. + * @property {module:model/OfferSavings} + */ + OfferSavings, + /** + * The OfferShippingCharge model constructor. + * @property {module:model/OfferShippingCharge} + */ + OfferShippingCharge: OfferShippingCharge, + /** + * The OfferSubCondition model constructor. + * @property {module:model/OfferSubCondition} + */ + OfferSubCondition: OfferSubCondition, + /** + * The OfferSummary model constructor. + * @property {module:model/OfferSummary} + */ + OfferSummary: OfferSummary, + /** + * The Offers model constructor. + * @property {module:model/Offers} + */ + Offers: Offers, + /** + * The PartnerType model constructor. + * @property {module:model/PartnerType} + */ + PartnerType: PartnerType, + /** + * The Price model constructor. + * @property {module:model/Price} + */ + Price: Price, + /** + * The PriceType model constructor. + * @property {module:model/PriceType} + */ + PriceType, + /** + * The ProductAdvertisingAPIClientException model constructor. + * @property {module:model/ProductAdvertisingAPIClientException} + */ + ProductAdvertisingAPIClientException: ProductAdvertisingAPIClientException, + /** + * The ProductAdvertisingAPIServiceException model constructor. + * @property {module:model/ProductAdvertisingAPIServiceException} + */ + ProductAdvertisingAPIServiceException: ProductAdvertisingAPIServiceException, + /** + * The ProductInfo model constructor. + * @property {module:model/ProductInfo} + */ + ProductInfo: ProductInfo, + /** + * The Properties model constructor. + * @property {module:model/Properties} + */ + Properties: Properties, + /** + * The Rating model constructor. + * @property {module:model/Rating} + */ + Rating: Rating, + /** + * The Refinement model constructor. + * @property {module:model/Refinement} + */ + Refinement: Refinement, + /** + * The RefinementBin model constructor. + * @property {module:model/RefinementBin} + */ + RefinementBin: RefinementBin, + /** + * The RentalOfferListing model constructor. + * @property {module:model/RentalOfferListing} + */ + RentalOfferListing: RentalOfferListing, + /** + * The RentalOffers model constructor. + * @property {module:model/RentalOffers} + */ + RentalOffers: RentalOffers, + /** + * The SearchItemsRequest model constructor. + * @property {module:model/SearchItemsRequest} + */ + SearchItemsRequest: SearchItemsRequest, + /** + * The SearchItemsResource model constructor. + * @property {module:model/SearchItemsResource} + */ + SearchItemsResource: SearchItemsResource, + /** + * The SearchItemsResponse model constructor. + * @property {module:model/SearchItemsResponse} + */ + SearchItemsResponse: SearchItemsResponse, + /** + * The SearchRefinements model constructor. + * @property {module:model/SearchRefinements} + */ + SearchRefinements: SearchRefinements, + /** + * The SearchResult model constructor. + * @property {module:model/SearchResult} + */ + SearchResult: SearchResult, + /** + * The SingleBooleanValuedAttribute model constructor. + * @property {module:model/SingleBooleanValuedAttribute} + */ + SingleBooleanValuedAttribute, + /** + * The SingleIntegerValuedAttribute model constructor. + * @property {module:model/SingleIntegerValuedAttribute} + */ + SingleIntegerValuedAttribute, + /** + * The SingleStringValuedAttribute model constructor. + * @property {module:model/SingleStringValuedAttribute} + */ + SingleStringValuedAttribute, + /** + * The SortBy model constructor. + * @property {module:model/SortBy} + */ + SortBy: SortBy, + /** + * The TechnicalInfo model constructor. + * @property {module:model/TechnicalInfo} + */ + TechnicalInfo: TechnicalInfo, + /** + * The TradeInInfo model constructor. + * @property {module:model/TradeInInfo} + */ + TradeInInfo: TradeInInfo, + /** + * The TradeInPrice model constructor. + * @property {module:model/TradeInPrice} + */ + TradeInPrice: TradeInPrice, + /** + * The UnitBasedAttribute model constructor. + * @property {module:model/UnitBasedAttribute} + */ + UnitBasedAttribute: UnitBasedAttribute, + /** + * The VariationAttribute model constructor. + * @property {module:model/VariationAttribute} + */ + VariationAttribute: VariationAttribute, + /** + * The VariationDimension model constructor. + * @property {module:model/VariationDimension} + */ + VariationDimension: VariationDimension, + /** + * The VariationSummary model constructor. + * @property {module:model/VariationSummary} + */ + VariationSummary: VariationSummary, + /** + * The VariationsResult model constructor. + * @property {module:model/VariationsResult} + */ + VariationsResult: VariationsResult, + /** + * The WebsiteSalesRank model constructor. + * @property {module:model/WebsiteSalesRank} + */ + WebsiteSalesRank: WebsiteSalesRank, + /** + * The DefaultApi service constructor. + * @property {module:api/DefaultApi} + */ + DefaultApi: DefaultApi +}; \ No newline at end of file diff --git a/src/model/Availability.js b/src/model/Availability.ts similarity index 97% rename from src/model/Availability.js rename to src/model/Availability.ts index d6f9ec5..df9a50e 100644 --- a/src/model/Availability.js +++ b/src/model/Availability.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/BrowseNode.js b/src/model/BrowseNode.ts similarity index 98% rename from src/model/BrowseNode.js rename to src/model/BrowseNode.ts index cc6f918..f2a2d9b 100644 --- a/src/model/BrowseNode.js +++ b/src/model/BrowseNode.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/BrowseNodeAncestor.js b/src/model/BrowseNodeAncestor.ts similarity index 98% rename from src/model/BrowseNodeAncestor.js rename to src/model/BrowseNodeAncestor.ts index e46fbaa..ed3282a 100644 --- a/src/model/BrowseNodeAncestor.js +++ b/src/model/BrowseNodeAncestor.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/BrowseNodeChild.js b/src/model/BrowseNodeChild.ts similarity index 98% rename from src/model/BrowseNodeChild.js rename to src/model/BrowseNodeChild.ts index f2e5e2e..9cf2241 100644 --- a/src/model/BrowseNodeChild.js +++ b/src/model/BrowseNodeChild.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/BrowseNodeInfo.js b/src/model/BrowseNodeInfo.ts similarity index 98% rename from src/model/BrowseNodeInfo.js rename to src/model/BrowseNodeInfo.ts index 8f4754a..1680e93 100644 --- a/src/model/BrowseNodeInfo.js +++ b/src/model/BrowseNodeInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/BrowseNodesResult.js b/src/model/BrowseNodesResult.ts similarity index 97% rename from src/model/BrowseNodesResult.js rename to src/model/BrowseNodesResult.ts index 4f9f1a0..521a267 100644 --- a/src/model/BrowseNodesResult.js +++ b/src/model/BrowseNodesResult.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ByLineInfo.js b/src/model/ByLineInfo.js deleted file mode 100644 index d189cee..0000000 --- a/src/model/ByLineInfo.js +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - /** - * ProductAdvertisingAPI - * https://webservices.amazon.com/paapi5/documentation/index.html - * - */ - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Contributor', '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('./Contributor'), require('./SingleStringValuedAttribute')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.ByLineInfo = factory(root.ProductAdvertisingAPIv1.ApiClient, root.ProductAdvertisingAPIv1.Contributor, root.ProductAdvertisingAPIv1.SingleStringValuedAttribute); - } -}(this, function(ApiClient, Contributor, SingleStringValuedAttribute) { - 'use strict'; - - - - - /** - * The ByLineInfo model module. - * @module model/ByLineInfo - * @version 1.0.0 - */ - - /** - * Constructs a new ByLineInfo. - * @alias module:model/ByLineInfo - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a ByLineInfo from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/ByLineInfo} obj Optional instance to populate. - * @return {module:model/ByLineInfo} The populated ByLineInfo instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('Brand')) { - obj['Brand'] = SingleStringValuedAttribute.constructFromObject(data['Brand']); - } - if (data.hasOwnProperty('Contributors')) { - obj['Contributors'] = ApiClient.convertToType(data['Contributors'], [Contributor]); - } - if (data.hasOwnProperty('Manufacturer')) { - obj['Manufacturer'] = SingleStringValuedAttribute.constructFromObject(data['Manufacturer']); - } - } - return obj; - } - - /** - * @member {module:model/SingleStringValuedAttribute} Brand - */ - exports.prototype['Brand'] = undefined; - /** - * @member {Array.} Contributors - */ - exports.prototype['Contributors'] = undefined; - /** - * @member {module:model/SingleStringValuedAttribute} Manufacturer - */ - exports.prototype['Manufacturer'] = undefined; - - - - return exports; -})); - - diff --git a/src/model/ByLineInfo.ts b/src/model/ByLineInfo.ts new file mode 100644 index 0000000..eaf582b --- /dev/null +++ b/src/model/ByLineInfo.ts @@ -0,0 +1,75 @@ +/** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * ProductAdvertisingAPI + * https://webservices.amazon.com/paapi5/documentation/index.html + * + */ + +/** + * The ByLineInfo model module. + * @module model/ByLineInfo + * @version 1.0.0 + */ + +import { ApiClient } from '../ApiClient'; +import { Contributor } from './Contributor'; +import { SingleStringValuedAttribute } from './SingleStringValuedAttribute'; + +/** + * Constructs a new ByLineInfo. + * @alias module:model/ByLineInfo + * @class + */ +export class ByLineInfo { + /** + * @member {module:model/SingleStringValuedAttribute} Brand + */ + public Brand?: SingleStringValuedAttribute; + /** + * @member {Array.} Contributors + */ + public Contributors?: Contributor[]; + /** + * @member {module:model/SingleStringValuedAttribute} Manufacturer + */ + public Manufacturer?: SingleStringValuedAttribute; + /** + * Constructs a ByLineInfo from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ByLineInfo} obj Optional instance to populate. + * @return {module:model/ByLineInfo} The populated ByLineInfo instance. + */ + public static constructFromObject(data: any, obj?: ByLineInfo) { + if (data) { + obj = obj || new ByLineInfo(); + + if (data.hasOwnProperty('Brand')) { + obj.Brand = SingleStringValuedAttribute.constructFromObject(data['Brand']); + } + if (data.hasOwnProperty('Contributors')) { + obj.Contributors = ApiClient.convertToType(data['Contributors'], [Contributor]); + } + if (data.hasOwnProperty('Manufacturer')) { + obj.Manufacturer = SingleStringValuedAttribute.constructFromObject(data['Manufacturer']); + } + } + return obj; + } +}; diff --git a/src/model/Classifications.js b/src/model/Classifications.ts similarity index 50% rename from src/model/Classifications.js rename to src/model/Classifications.ts index a3338b6..c521c23 100644 --- a/src/model/Classifications.js +++ b/src/model/Classifications.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -19,43 +21,29 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', '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('./SingleStringValuedAttribute')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.Classifications = factory(root.ProductAdvertisingAPIv1.ApiClient, root.ProductAdvertisingAPIv1.SingleStringValuedAttribute); - } -}(this, function(ApiClient, SingleStringValuedAttribute) { - 'use strict'; - - +/** + * The Classifications model module. + * @module model/Classifications + * @version 1.0.0 + */ +import { ApiClient } from "../ApiClient"; +import { SingleStringValuedAttribute } from "./SingleStringValuedAttribute"; +/** + * Constructs a new Classifications. + * @alias module:model/Classifications + * @class + */ +export class Classifications { /** - * The Classifications model module. - * @module model/Classifications - * @version 1.0.0 + * @member {module:model/SingleStringValuedAttribute} Binding */ - + public Binding?: SingleStringValuedAttribute; /** - * Constructs a new Classifications. - * @alias module:model/Classifications - * @class + * @member {module:model/SingleStringValuedAttribute} ProductGroup */ - var exports = function() { - var _this = this; - - - - }; + public ProductGroup?: SingleStringValuedAttribute; /** * Constructs a Classifications from a plain JavaScript object, optionally creating a new instance. @@ -64,32 +52,17 @@ * @param {module:model/Classifications} obj Optional instance to populate. * @return {module:model/Classifications} The populated Classifications instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: Classifications) { if (data) { - obj = obj || new exports(); + obj = obj || new Classifications(); if (data.hasOwnProperty('Binding')) { - obj['Binding'] = SingleStringValuedAttribute.constructFromObject(data['Binding']); + obj.Binding = SingleStringValuedAttribute.constructFromObject(data['Binding']); } if (data.hasOwnProperty('ProductGroup')) { - obj['ProductGroup'] = SingleStringValuedAttribute.constructFromObject(data['ProductGroup']); + obj.ProductGroup = SingleStringValuedAttribute.constructFromObject(data['ProductGroup']); } } return obj; } - - /** - * @member {module:model/SingleStringValuedAttribute} Binding - */ - exports.prototype['Binding'] = undefined; - /** - * @member {module:model/SingleStringValuedAttribute} ProductGroup - */ - exports.prototype['ProductGroup'] = undefined; - - - - return exports; -})); - - +}; diff --git a/src/model/Condition.js b/src/model/Condition.js deleted file mode 100644 index 2737732..0000000 --- a/src/model/Condition.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - /** - * ProductAdvertisingAPI - * https://webservices.amazon.com/paapi5/documentation/index.html - * - */ - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.Condition = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - - /** - * Enum class Condition. - * @enum {} - * @readonly - */ - var exports = { - /** - * value: "Any" - * @const - */ - "Any": "Any", - /** - * value: "Collectible" - * @const - */ - "Collectible": "Collectible", - /** - * value: "New" - * @const - */ - "New": "New", - /** - * value: "Refurbished" - * @const - */ - "Refurbished": "Refurbished", - /** - * value: "Used" - * @const - */ - "Used": "Used" }; - - /** - * Returns a Condition enum value from a Javascript object name. - * @param {Object} data The plain JavaScript object containing the name of the enum value. - * @return {module:model/Condition} The enum Condition value. - */ - exports.constructFromObject = function(object) { - return object; - } - - return exports; -})); - - diff --git a/src/model/Condition.ts b/src/model/Condition.ts new file mode 100644 index 0000000..a624147 --- /dev/null +++ b/src/model/Condition.ts @@ -0,0 +1,89 @@ +/** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * ProductAdvertisingAPI + * https://webservices.amazon.com/paapi5/documentation/index.html + * + */ + +export const enum ConditionValue { + /** + * value: "Any" + * @const + */ + Any = "Any", + /** + * value: "Collectible" + * @const + */ + Collectible = "Collectible", + /** + * value: "New" + * @const + */ + New = "New", + /** + * value: "Refurbished" + * @const + */ + Refurbished = "Refurbished", + /** + * value: "Used" + * @const + */ + Used = "Used", +} + +/** + * Enum class Condition. + * @enum {} + * @readonly + */ +export class Condition extends String { + /** + * value: "Any" + * @const + */ + public static get Any() { return ConditionValue.Any; } + /** + * value: "Collectible" + * @const + */ + public static get Collectible() { return ConditionValue.Collectible; } + /** + * value: "New" + * @const + */ + public static get New() { return ConditionValue.New; } + /** + * value: "Refurbished" + * @const + */ + public static get Refurbished() { return ConditionValue.Refurbished; } + /** + * value: "Used" + * @const + */ + public static get Used() { return ConditionValue.Used; } + /** + * Returns a Condition enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/Condition} The enum Condition value. + */ + public static constructFromObject = function(object: Condition|ConditionValue|string) { return object; } +}; diff --git a/src/model/ContentInfo.js b/src/model/ContentInfo.ts similarity index 98% rename from src/model/ContentInfo.js rename to src/model/ContentInfo.ts index 89aebfd..aa63631 100644 --- a/src/model/ContentInfo.js +++ b/src/model/ContentInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ContentRating.js b/src/model/ContentRating.ts similarity index 97% rename from src/model/ContentRating.js rename to src/model/ContentRating.ts index 1d2f130..c547549 100644 --- a/src/model/ContentRating.js +++ b/src/model/ContentRating.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Contributor.js b/src/model/Contributor.ts similarity index 51% rename from src/model/Contributor.js rename to src/model/Contributor.ts index 615e12c..a5d5ef2 100644 --- a/src/model/Contributor.js +++ b/src/model/Contributor.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -19,45 +21,36 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.Contributor = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - +/** + * The Contributor model module. + * @module model/Contributor + * @version 1.0.0 + */ +import { ApiClient } from "../ApiClient"; +/** + * Constructs a new Contributor. + * @alias module:model/Contributor + * @class + */ +export class Contributor { /** - * The Contributor model module. - * @module model/Contributor - * @version 1.0.0 + * @member {String} Locale */ - + public Locale?: string; /** - * Constructs a new Contributor. - * @alias module:model/Contributor - * @class + * @member {String} Name */ - var exports = function() { - var _this = this; - - - - - - }; + public Name?: string; + /** + * @member {String} Role + */ + public Role?: string; + /** + * @member {String} RoleType + */ + public RoleType?: string; /** * Constructs a Contributor from a plain JavaScript object, optionally creating a new instance. @@ -66,46 +59,23 @@ * @param {module:model/Contributor} obj Optional instance to populate. * @return {module:model/Contributor} The populated Contributor instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: Contributor) { if (data) { - obj = obj || new exports(); + obj = obj || new Contributor(); if (data.hasOwnProperty('Locale')) { - obj['Locale'] = ApiClient.convertToType(data['Locale'], 'String'); + obj.Locale = ApiClient.convertToType(data['Locale'], 'String'); } if (data.hasOwnProperty('Name')) { - obj['Name'] = ApiClient.convertToType(data['Name'], 'String'); + obj.Name = ApiClient.convertToType(data['Name'], 'String'); } if (data.hasOwnProperty('Role')) { - obj['Role'] = ApiClient.convertToType(data['Role'], 'String'); + obj.Role = ApiClient.convertToType(data['Role'], 'String'); } if (data.hasOwnProperty('RoleType')) { - obj['RoleType'] = ApiClient.convertToType(data['RoleType'], 'String'); + obj.RoleType = ApiClient.convertToType(data['RoleType'], 'String'); } } return obj; } - - /** - * @member {String} Locale - */ - exports.prototype['Locale'] = undefined; - /** - * @member {String} Name - */ - exports.prototype['Name'] = undefined; - /** - * @member {String} Role - */ - exports.prototype['Role'] = undefined; - /** - * @member {String} RoleType - */ - exports.prototype['RoleType'] = undefined; - - - - return exports; -})); - - +} diff --git a/src/model/CustomerReviews.js b/src/model/CustomerReviews.ts similarity index 98% rename from src/model/CustomerReviews.js rename to src/model/CustomerReviews.ts index efa6459..fe17a0e 100644 --- a/src/model/CustomerReviews.js +++ b/src/model/CustomerReviews.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/DeliveryFlag.js b/src/model/DeliveryFlag.ts similarity index 97% rename from src/model/DeliveryFlag.js rename to src/model/DeliveryFlag.ts index 8e6d843..005acd2 100644 --- a/src/model/DeliveryFlag.js +++ b/src/model/DeliveryFlag.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/DimensionBasedAttribute.js b/src/model/DimensionBasedAttribute.ts similarity index 98% rename from src/model/DimensionBasedAttribute.js rename to src/model/DimensionBasedAttribute.ts index 3497650..04dc7a1 100644 --- a/src/model/DimensionBasedAttribute.js +++ b/src/model/DimensionBasedAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/DurationPrice.js b/src/model/DurationPrice.ts similarity index 98% rename from src/model/DurationPrice.js rename to src/model/DurationPrice.ts index 120f60a..0bf0e42 100644 --- a/src/model/DurationPrice.js +++ b/src/model/DurationPrice.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ErrorData.js b/src/model/ErrorData.ts similarity index 97% rename from src/model/ErrorData.js rename to src/model/ErrorData.ts index f39015f..16d3096 100644 --- a/src/model/ErrorData.js +++ b/src/model/ErrorData.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ExternalIds.js b/src/model/ExternalIds.ts similarity index 98% rename from src/model/ExternalIds.js rename to src/model/ExternalIds.ts index 8dd3beb..e43a48b 100644 --- a/src/model/ExternalIds.js +++ b/src/model/ExternalIds.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetBrowseNodesRequest.js b/src/model/GetBrowseNodesRequest.ts similarity index 98% rename from src/model/GetBrowseNodesRequest.js rename to src/model/GetBrowseNodesRequest.ts index 26897cf..4e2de03 100644 --- a/src/model/GetBrowseNodesRequest.js +++ b/src/model/GetBrowseNodesRequest.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetBrowseNodesResource.js b/src/model/GetBrowseNodesResource.ts similarity index 97% rename from src/model/GetBrowseNodesResource.js rename to src/model/GetBrowseNodesResource.ts index 4e65b10..b2d6ff7 100644 --- a/src/model/GetBrowseNodesResource.js +++ b/src/model/GetBrowseNodesResource.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetBrowseNodesResponse.js b/src/model/GetBrowseNodesResponse.ts similarity index 98% rename from src/model/GetBrowseNodesResponse.js rename to src/model/GetBrowseNodesResponse.ts index afbd6f0..3b04e3c 100644 --- a/src/model/GetBrowseNodesResponse.js +++ b/src/model/GetBrowseNodesResponse.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetItemsRequest.js b/src/model/GetItemsRequest.ts similarity index 99% rename from src/model/GetItemsRequest.js rename to src/model/GetItemsRequest.ts index e3c976d..2e9097b 100644 --- a/src/model/GetItemsRequest.js +++ b/src/model/GetItemsRequest.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetItemsResource.js b/src/model/GetItemsResource.ts similarity index 99% rename from src/model/GetItemsResource.js rename to src/model/GetItemsResource.ts index ac8c4af..e607eac 100644 --- a/src/model/GetItemsResource.js +++ b/src/model/GetItemsResource.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetItemsResponse.js b/src/model/GetItemsResponse.ts similarity index 98% rename from src/model/GetItemsResponse.js rename to src/model/GetItemsResponse.ts index 50eae7c..3460e3e 100644 --- a/src/model/GetItemsResponse.js +++ b/src/model/GetItemsResponse.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetVariationsRequest.js b/src/model/GetVariationsRequest.ts similarity index 99% rename from src/model/GetVariationsRequest.js rename to src/model/GetVariationsRequest.ts index bd2ca34..fc94c25 100644 --- a/src/model/GetVariationsRequest.js +++ b/src/model/GetVariationsRequest.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetVariationsResource.js b/src/model/GetVariationsResource.ts similarity index 99% rename from src/model/GetVariationsResource.js rename to src/model/GetVariationsResource.ts index 311d91a..1520c16 100644 --- a/src/model/GetVariationsResource.js +++ b/src/model/GetVariationsResource.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/GetVariationsResponse.js b/src/model/GetVariationsResponse.ts similarity index 98% rename from src/model/GetVariationsResponse.js rename to src/model/GetVariationsResponse.ts index 2b638e9..f6f3124 100644 --- a/src/model/GetVariationsResponse.js +++ b/src/model/GetVariationsResponse.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ImageSize.js b/src/model/ImageSize.ts similarity index 98% rename from src/model/ImageSize.js rename to src/model/ImageSize.ts index f9ec6c6..5c7ab10 100644 --- a/src/model/ImageSize.js +++ b/src/model/ImageSize.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ImageType.js b/src/model/ImageType.ts similarity index 98% rename from src/model/ImageType.js rename to src/model/ImageType.ts index b8da3dd..e66f3a9 100644 --- a/src/model/ImageType.js +++ b/src/model/ImageType.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Images.js b/src/model/Images.ts similarity index 97% rename from src/model/Images.js rename to src/model/Images.ts index 6e545c9..cd95e26 100644 --- a/src/model/Images.js +++ b/src/model/Images.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Item.js b/src/model/Item.ts similarity index 98% rename from src/model/Item.js rename to src/model/Item.ts index 6a7de7e..d944147 100644 --- a/src/model/Item.js +++ b/src/model/Item.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ItemIdType.js b/src/model/ItemIdType.ts similarity index 97% rename from src/model/ItemIdType.js rename to src/model/ItemIdType.ts index 91442eb..065e1cd 100644 --- a/src/model/ItemIdType.js +++ b/src/model/ItemIdType.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ItemInfo.js b/src/model/ItemInfo.ts similarity index 99% rename from src/model/ItemInfo.js rename to src/model/ItemInfo.ts index 9444e13..23e3609 100644 --- a/src/model/ItemInfo.js +++ b/src/model/ItemInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ItemsResult.js b/src/model/ItemsResult.ts similarity index 97% rename from src/model/ItemsResult.js rename to src/model/ItemsResult.ts index 64f0bee..80e22e0 100644 --- a/src/model/ItemsResult.js +++ b/src/model/ItemsResult.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/LanguageType.js b/src/model/LanguageType.ts similarity index 97% rename from src/model/LanguageType.js rename to src/model/LanguageType.ts index 90e1a33..de27180 100644 --- a/src/model/LanguageType.js +++ b/src/model/LanguageType.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Languages.js b/src/model/Languages.ts similarity index 98% rename from src/model/Languages.js rename to src/model/Languages.ts index b4b6f77..b30b67c 100644 --- a/src/model/Languages.js +++ b/src/model/Languages.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ManufactureInfo.js b/src/model/ManufactureInfo.ts similarity index 98% rename from src/model/ManufactureInfo.js rename to src/model/ManufactureInfo.ts index 460b39b..c2f4a39 100644 --- a/src/model/ManufactureInfo.js +++ b/src/model/ManufactureInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/MaxPrice.js b/src/model/MaxPrice.ts similarity index 97% rename from src/model/MaxPrice.js rename to src/model/MaxPrice.ts index dfeb99a..d523c02 100644 --- a/src/model/MaxPrice.js +++ b/src/model/MaxPrice.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Merchant.js b/src/model/Merchant.ts similarity index 97% rename from src/model/Merchant.js rename to src/model/Merchant.ts index 0795b3e..4842697 100644 --- a/src/model/Merchant.js +++ b/src/model/Merchant.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/MinPrice.js b/src/model/MinPrice.ts similarity index 97% rename from src/model/MinPrice.js rename to src/model/MinPrice.ts index e5b8b24..7c04803 100644 --- a/src/model/MinPrice.js +++ b/src/model/MinPrice.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/MinReviewsRating.js b/src/model/MinReviewsRating.ts similarity index 97% rename from src/model/MinReviewsRating.js rename to src/model/MinReviewsRating.ts index 10e09c8..8985ce7 100644 --- a/src/model/MinReviewsRating.js +++ b/src/model/MinReviewsRating.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/MinSavingPercent.js b/src/model/MinSavingPercent.ts similarity index 97% rename from src/model/MinSavingPercent.js rename to src/model/MinSavingPercent.ts index b53a04e..7272a4f 100644 --- a/src/model/MinSavingPercent.js +++ b/src/model/MinSavingPercent.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/MultiValuedAttribute.js b/src/model/MultiValuedAttribute.ts similarity index 98% rename from src/model/MultiValuedAttribute.js rename to src/model/MultiValuedAttribute.ts index 3457fe0..51c70a9 100644 --- a/src/model/MultiValuedAttribute.js +++ b/src/model/MultiValuedAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferAvailability.js b/src/model/OfferAvailability.ts similarity index 98% rename from src/model/OfferAvailability.js rename to src/model/OfferAvailability.ts index 191beb6..81ac273 100644 --- a/src/model/OfferAvailability.js +++ b/src/model/OfferAvailability.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferCondition.js b/src/model/OfferCondition.ts similarity index 98% rename from src/model/OfferCondition.js rename to src/model/OfferCondition.ts index f30709e..f2f6c21 100644 --- a/src/model/OfferCondition.js +++ b/src/model/OfferCondition.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferConditionNote.js b/src/model/OfferConditionNote.ts similarity index 97% rename from src/model/OfferConditionNote.js rename to src/model/OfferConditionNote.ts index 109c33d..be468b1 100644 --- a/src/model/OfferConditionNote.js +++ b/src/model/OfferConditionNote.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferCount.js b/src/model/OfferCount.ts similarity index 97% rename from src/model/OfferCount.js rename to src/model/OfferCount.ts index f90d34f..1df7ee9 100644 --- a/src/model/OfferCount.js +++ b/src/model/OfferCount.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferDeliveryInfo.js b/src/model/OfferDeliveryInfo.ts similarity index 98% rename from src/model/OfferDeliveryInfo.js rename to src/model/OfferDeliveryInfo.ts index cce4a60..2821cf9 100644 --- a/src/model/OfferDeliveryInfo.js +++ b/src/model/OfferDeliveryInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferListing.js b/src/model/OfferListing.ts similarity index 99% rename from src/model/OfferListing.js rename to src/model/OfferListing.ts index 50bf770..0dfd60d 100644 --- a/src/model/OfferListing.js +++ b/src/model/OfferListing.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferLoyaltyPoints.js b/src/model/OfferLoyaltyPoints.ts similarity index 97% rename from src/model/OfferLoyaltyPoints.js rename to src/model/OfferLoyaltyPoints.ts index 795300a..e66c304 100644 --- a/src/model/OfferLoyaltyPoints.js +++ b/src/model/OfferLoyaltyPoints.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferMerchantInfo.js b/src/model/OfferMerchantInfo.ts similarity index 98% rename from src/model/OfferMerchantInfo.js rename to src/model/OfferMerchantInfo.ts index fee3aa8..b38fb76 100644 --- a/src/model/OfferMerchantInfo.js +++ b/src/model/OfferMerchantInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferPrice.js b/src/model/OfferPrice.ts similarity index 95% rename from src/model/OfferPrice.js rename to src/model/OfferPrice.ts index 14d1cd6..83716c5 100644 --- a/src/model/OfferPrice.js +++ b/src/model/OfferPrice.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -39,11 +41,13 @@ - /** - * The OfferPrice model module. - * @module model/OfferPrice - * @version 1.0.0 - */ +/** + * The OfferPrice model module. + * @module model/OfferPrice + * @version 1.0.0 + */ + +import { ApiClient } from '../ApiClient'; /** * Constructs a new OfferPrice. diff --git a/src/model/OfferProgramEligibility.js b/src/model/OfferProgramEligibility.ts similarity index 98% rename from src/model/OfferProgramEligibility.js rename to src/model/OfferProgramEligibility.ts index aee2ee2..64f0689 100644 --- a/src/model/OfferProgramEligibility.js +++ b/src/model/OfferProgramEligibility.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferPromotion.js b/src/model/OfferPromotion.ts similarity index 98% rename from src/model/OfferPromotion.js rename to src/model/OfferPromotion.ts index 70e7572..4429cb8 100644 --- a/src/model/OfferPromotion.js +++ b/src/model/OfferPromotion.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferSavings.js b/src/model/OfferSavings.ts similarity index 50% rename from src/model/OfferSavings.js rename to src/model/OfferSavings.ts index 5880396..8c558e6 100644 --- a/src/model/OfferSavings.js +++ b/src/model/OfferSavings.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -19,46 +21,40 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.OfferSavings = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - +/** + * The OfferSavings model module. + * @module model/OfferSavings + * @version 1.0.0 + */ +import { ApiClient } from "../ApiClient"; +/** + * Constructs a new OfferSavings. + * @alias module:model/OfferSavings + * @class + */ +export class OfferSavings { /** - * The OfferSavings model module. - * @module model/OfferSavings - * @version 1.0.0 + * @member {Number} Amount */ - + public Amount?: number; /** - * Constructs a new OfferSavings. - * @alias module:model/OfferSavings - * @class + * @member {String} Currency */ - var exports = function() { - var _this = this; - - - - - - - }; + public Currency?: string; + /** + * @member {String} DisplayAmount + */ + public DisplayAmount?: string; + /** + * @member {Number} Percentage + */ + public Percentage?: number; + /** + * @member {Number} PricePerUnit + */ + public PricePerUnit?: number; /** * Constructs a OfferSavings from a plain JavaScript object, optionally creating a new instance. @@ -67,53 +63,26 @@ * @param {module:model/OfferSavings} obj Optional instance to populate. * @return {module:model/OfferSavings} The populated OfferSavings instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: OfferSavings) { if (data) { - obj = obj || new exports(); + obj = obj || new OfferSavings(); 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('Percentage')) { - obj['Percentage'] = ApiClient.convertToType(data['Percentage'], 'Number'); + obj.Percentage = ApiClient.convertToType(data['Percentage'], 'Number'); } if (data.hasOwnProperty('PricePerUnit')) { - obj['PricePerUnit'] = ApiClient.convertToType(data['PricePerUnit'], 'Number'); + obj.PricePerUnit = ApiClient.convertToType(data['PricePerUnit'], 'Number'); } } 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} Percentage - */ - exports.prototype['Percentage'] = undefined; - /** - * @member {Number} PricePerUnit - */ - exports.prototype['PricePerUnit'] = undefined; - - - - return exports; -})); - - +}; diff --git a/src/model/OfferShippingCharge.js b/src/model/OfferShippingCharge.ts similarity index 98% rename from src/model/OfferShippingCharge.js rename to src/model/OfferShippingCharge.ts index f68f008..e8934dd 100644 --- a/src/model/OfferShippingCharge.js +++ b/src/model/OfferShippingCharge.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferSubCondition.js b/src/model/OfferSubCondition.ts similarity index 98% rename from src/model/OfferSubCondition.js rename to src/model/OfferSubCondition.ts index 5583c2a..69efd51 100644 --- a/src/model/OfferSubCondition.js +++ b/src/model/OfferSubCondition.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/OfferSummary.js b/src/model/OfferSummary.ts similarity index 98% rename from src/model/OfferSummary.js rename to src/model/OfferSummary.ts index c99284c..738a270 100644 --- a/src/model/OfferSummary.js +++ b/src/model/OfferSummary.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Offers.js b/src/model/Offers.ts similarity index 98% rename from src/model/Offers.js rename to src/model/Offers.ts index a24f9f2..a5fcc73 100644 --- a/src/model/Offers.js +++ b/src/model/Offers.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/PartnerType.js b/src/model/PartnerType.ts similarity index 97% rename from src/model/PartnerType.js rename to src/model/PartnerType.ts index 0077984..c9fca93 100644 --- a/src/model/PartnerType.js +++ b/src/model/PartnerType.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Price.js b/src/model/Price.ts similarity index 98% rename from src/model/Price.js rename to src/model/Price.ts index 46ecd0f..dffa294 100644 --- a/src/model/Price.js +++ b/src/model/Price.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/PriceType.js b/src/model/PriceType.js deleted file mode 100644 index fbcac64..0000000 --- a/src/model/PriceType.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - /** - * ProductAdvertisingAPI - * https://webservices.amazon.com/paapi5/documentation/index.html - * - */ - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.PriceType = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - - /** - * Enum class PriceType. - * @enum {} - * @readonly - */ - var exports = { - /** - * value: "LIST_PRICE" - * @const - */ - "LIST_PRICE": "LIST_PRICE", - /** - * value: "LOWEST_PRICE" - * @const - */ - "LOWEST_PRICE": "LOWEST_PRICE", - /** - * value: "LOWEST_PRICE_STRIKETHROUGH" - * @const - */ - "LOWEST_PRICE_STRIKETHROUGH": "LOWEST_PRICE_STRIKETHROUGH", - /** - * value: "WAS_PRICE" - * @const - */ - "WAS_PRICE": "WAS_PRICE" }; - - /** - * Returns a PriceType enum value from a Javascript object name. - * @param {Object} data The plain JavaScript object containing the name of the enum value. - * @return {module:model/PriceType} The enum PriceType value. - */ - exports.constructFromObject = function(object) { - return object; - } - - return exports; -})); - - diff --git a/src/model/PriceType.ts b/src/model/PriceType.ts new file mode 100644 index 0000000..6587e55 --- /dev/null +++ b/src/model/PriceType.ts @@ -0,0 +1,81 @@ +/** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + + /** + * ProductAdvertisingAPI + * https://webservices.amazon.com/paapi5/documentation/index.html + * + */ + +/** + * Enum class PriceType. + * @enum {} + * @readonly + */ +export const enum PriceTypeValue { + /** + * value: "LIST_PRICE" + * @const + */ + LIST_PRICE = "LIST_PRICE", + /** + * value: "LOWEST_PRICE" + * @const + */ + LOWEST_PRICE = "LOWEST_PRICE", + /** + * value: "LOWEST_PRICE_STRIKETHROUGH" + * @const + */ + LOWEST_PRICE_STRIKETHROUGH = "LOWEST_PRICE_STRIKETHROUGH", + /** + * value: "WAS_PRICE" + * @const + */ + WAS_PRICE = "WAS_PRICE" +}; + +export class PriceType extends String { + /** + * value: "LIST_PRICE" + * @const + */ + public static get LIST_PRICE() { return PriceTypeValue.LIST_PRICE; } + /** + * value: "LOWEST_PRICE" + * @const + */ + public static get LOWEST_PRICE() { return PriceTypeValue.LOWEST_PRICE; } + /** + * value: "LOWEST_PRICE_STRIKETHROUGH" + * @const + */ + public static get LOWEST_PRICE_STRIKETHROUGH() { return PriceTypeValue.LOWEST_PRICE_STRIKETHROUGH; } + /** + * value: "WAS_PRICE" + * @const + */ + public static get WAS_PRICE() { return PriceType.WAS_PRICE; } + /** + * Returns a PriceType enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/PriceType} The enum PriceType value. + */ + public static constructFromObject(object: PriceType|PriceTypeValue|string) { + return object; + } +}; diff --git a/src/model/ProductAdvertisingAPIClientException.js b/src/model/ProductAdvertisingAPIClientException.ts similarity index 98% rename from src/model/ProductAdvertisingAPIClientException.js rename to src/model/ProductAdvertisingAPIClientException.ts index 4ea4027..a296d20 100644 --- a/src/model/ProductAdvertisingAPIClientException.js +++ b/src/model/ProductAdvertisingAPIClientException.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ProductAdvertisingAPIServiceException.js b/src/model/ProductAdvertisingAPIServiceException.ts similarity index 97% rename from src/model/ProductAdvertisingAPIServiceException.js rename to src/model/ProductAdvertisingAPIServiceException.ts index 3b1abbd..958f9d1 100644 --- a/src/model/ProductAdvertisingAPIServiceException.js +++ b/src/model/ProductAdvertisingAPIServiceException.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/ProductInfo.js b/src/model/ProductInfo.ts similarity index 98% rename from src/model/ProductInfo.js rename to src/model/ProductInfo.ts index 719aa0d..6ad506d 100644 --- a/src/model/ProductInfo.js +++ b/src/model/ProductInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Properties.js b/src/model/Properties.ts similarity index 97% rename from src/model/Properties.js rename to src/model/Properties.ts index c0d844c..48f0857 100644 --- a/src/model/Properties.js +++ b/src/model/Properties.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Rating.js b/src/model/Rating.ts similarity index 97% rename from src/model/Rating.js rename to src/model/Rating.ts index 82faf6e..5d16fe0 100644 --- a/src/model/Rating.js +++ b/src/model/Rating.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/Refinement.js b/src/model/Refinement.ts similarity index 98% rename from src/model/Refinement.js rename to src/model/Refinement.ts index 44febc6..72368fa 100644 --- a/src/model/Refinement.js +++ b/src/model/Refinement.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/RefinementBin.js b/src/model/RefinementBin.ts similarity index 97% rename from src/model/RefinementBin.js rename to src/model/RefinementBin.ts index ebb0573..935a25f 100644 --- a/src/model/RefinementBin.js +++ b/src/model/RefinementBin.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/RentalOfferListing.js b/src/model/RentalOfferListing.ts similarity index 98% rename from src/model/RentalOfferListing.js rename to src/model/RentalOfferListing.ts index 71e948e..05b4e60 100644 --- a/src/model/RentalOfferListing.js +++ b/src/model/RentalOfferListing.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/RentalOffers.js b/src/model/RentalOffers.ts similarity index 97% rename from src/model/RentalOffers.js rename to src/model/RentalOffers.ts index 2856276..b5de45f 100644 --- a/src/model/RentalOffers.js +++ b/src/model/RentalOffers.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/SearchItemsRequest.js b/src/model/SearchItemsRequest.ts similarity index 99% rename from src/model/SearchItemsRequest.js rename to src/model/SearchItemsRequest.ts index 1e2a410..7b29608 100644 --- a/src/model/SearchItemsRequest.js +++ b/src/model/SearchItemsRequest.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/SearchItemsResource.js b/src/model/SearchItemsResource.ts similarity index 99% rename from src/model/SearchItemsResource.js rename to src/model/SearchItemsResource.ts index 685328f..4d24f54 100644 --- a/src/model/SearchItemsResource.js +++ b/src/model/SearchItemsResource.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/SearchItemsResponse.js b/src/model/SearchItemsResponse.ts similarity index 98% rename from src/model/SearchItemsResponse.js rename to src/model/SearchItemsResponse.ts index 0f0c1a3..94f588d 100644 --- a/src/model/SearchItemsResponse.js +++ b/src/model/SearchItemsResponse.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/SearchRefinements.js b/src/model/SearchRefinements.ts similarity index 98% rename from src/model/SearchRefinements.js rename to src/model/SearchRefinements.ts index 5428032..cbe86a3 100644 --- a/src/model/SearchRefinements.js +++ b/src/model/SearchRefinements.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/SearchResult.js b/src/model/SearchResult.ts similarity index 98% rename from src/model/SearchResult.js rename to src/model/SearchResult.ts index 5baf6c2..1993047 100644 --- a/src/model/SearchResult.js +++ b/src/model/SearchResult.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/SingleBooleanValuedAttribute.js b/src/model/SingleBooleanValuedAttribute.ts similarity index 51% rename from src/model/SingleBooleanValuedAttribute.js rename to src/model/SingleBooleanValuedAttribute.ts index 4136fb3..78f8fb4 100644 --- a/src/model/SingleBooleanValuedAttribute.js +++ b/src/model/SingleBooleanValuedAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -19,44 +21,32 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.SingleBooleanValuedAttribute = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - +import { ApiClient } from "../ApiClient"; +/** + * The SingleBooleanValuedAttribute model module. + * @module model/SingleBooleanValuedAttribute + * @version 1.0.0 + */ +/** + * Constructs a new SingleBooleanValuedAttribute. + * @alias module:model/SingleBooleanValuedAttribute + * @class + */ +export class SingleBooleanValuedAttribute { /** - * The SingleBooleanValuedAttribute model module. - * @module model/SingleBooleanValuedAttribute - * @version 1.0.0 + * @member {Boolean} DisplayValue */ - + public DisplayValue?: boolean; /** - * Constructs a new SingleBooleanValuedAttribute. - * @alias module:model/SingleBooleanValuedAttribute - * @class + * @member {String} Label */ - var exports = function() { - var _this = this; - - - - - }; + public Label?: string; + /** + * @member {String} Locale + */ + public Locale?: string; /** * Constructs a SingleBooleanValuedAttribute from a plain JavaScript object, optionally creating a new instance. @@ -65,39 +55,20 @@ * @param {module:model/SingleBooleanValuedAttribute} obj Optional instance to populate. * @return {module:model/SingleBooleanValuedAttribute} The populated SingleBooleanValuedAttribute instance. */ - exports.constructFromObject = function(data, obj) { + public constructFromObject(data: any, obj?: SingleBooleanValuedAttribute) { if (data) { - obj = obj || new exports(); + obj = obj || new SingleBooleanValuedAttribute(); if (data.hasOwnProperty('DisplayValue')) { - obj['DisplayValue'] = ApiClient.convertToType(data['DisplayValue'], 'Boolean'); + obj.DisplayValue = ApiClient.convertToType(data['DisplayValue'], 'Boolean'); } if (data.hasOwnProperty('Label')) { - obj['Label'] = ApiClient.convertToType(data['Label'], 'String'); + obj.Label = ApiClient.convertToType(data['Label'], 'String'); } if (data.hasOwnProperty('Locale')) { - obj['Locale'] = ApiClient.convertToType(data['Locale'], 'String'); + obj.Locale = ApiClient.convertToType(data['Locale'], 'String'); } } return obj; } - - /** - * @member {Boolean} DisplayValue - */ - exports.prototype['DisplayValue'] = undefined; - /** - * @member {String} Label - */ - exports.prototype['Label'] = undefined; - /** - * @member {String} Locale - */ - exports.prototype['Locale'] = undefined; - - - - return exports; -})); - - +} diff --git a/src/model/SingleIntegerValuedAttribute.js b/src/model/SingleIntegerValuedAttribute.ts similarity index 51% rename from src/model/SingleIntegerValuedAttribute.js rename to src/model/SingleIntegerValuedAttribute.ts index 67e2880..3900b06 100644 --- a/src/model/SingleIntegerValuedAttribute.js +++ b/src/model/SingleIntegerValuedAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -19,44 +21,32 @@ * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.SingleIntegerValuedAttribute = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - +import { ApiClient } from "../ApiClient"; +/** + * The SingleIntegerValuedAttribute model module. + * @module model/SingleIntegerValuedAttribute + * @version 1.0.0 + */ +/** + * Constructs a new SingleIntegerValuedAttribute. + * @alias module:model/SingleIntegerValuedAttribute + * @class + */ +export class SingleIntegerValuedAttribute { /** - * The SingleIntegerValuedAttribute model module. - * @module model/SingleIntegerValuedAttribute - * @version 1.0.0 + * @member {Number} DisplayValue */ - + public DisplayValue?: number; /** - * Constructs a new SingleIntegerValuedAttribute. - * @alias module:model/SingleIntegerValuedAttribute - * @class + * @member {String} Label */ - var exports = function() { - var _this = this; - - - - - }; + public Label?: string; + /** + * @member {String} Locale + */ + public Locale?: string; /** * Constructs a SingleIntegerValuedAttribute from a plain JavaScript object, optionally creating a new instance. @@ -65,39 +55,20 @@ * @param {module:model/SingleIntegerValuedAttribute} obj Optional instance to populate. * @return {module:model/SingleIntegerValuedAttribute} The populated SingleIntegerValuedAttribute instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: SingleIntegerValuedAttribute) { if (data) { - obj = obj || new exports(); + obj = obj || new SingleIntegerValuedAttribute(); if (data.hasOwnProperty('DisplayValue')) { - obj['DisplayValue'] = ApiClient.convertToType(data['DisplayValue'], 'Number'); + obj.DisplayValue = ApiClient.convertToType(data['DisplayValue'], 'Number'); } if (data.hasOwnProperty('Label')) { - obj['Label'] = ApiClient.convertToType(data['Label'], 'String'); + obj.Label = ApiClient.convertToType(data['Label'], 'String'); } if (data.hasOwnProperty('Locale')) { - obj['Locale'] = ApiClient.convertToType(data['Locale'], 'String'); + obj.Locale = ApiClient.convertToType(data['Locale'], 'String'); } } return obj; } - - /** - * @member {Number} DisplayValue - */ - exports.prototype['DisplayValue'] = undefined; - /** - * @member {String} Label - */ - exports.prototype['Label'] = undefined; - /** - * @member {String} Locale - */ - exports.prototype['Locale'] = undefined; - - - - return exports; -})); - - +} diff --git a/src/model/SingleStringValuedAttribute.js b/src/model/SingleStringValuedAttribute.ts similarity index 51% rename from src/model/SingleStringValuedAttribute.js rename to src/model/SingleStringValuedAttribute.ts index 1a6c83c..97644b7 100644 --- a/src/model/SingleStringValuedAttribute.js +++ b/src/model/SingleStringValuedAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). @@ -13,50 +15,38 @@ * permissions and limitations under the License. */ - /** +/** * ProductAdvertisingAPI * https://webservices.amazon.com/paapi5/documentation/index.html * */ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient')); - } else { - // Browser globals (root is window) - if (!root.ProductAdvertisingAPIv1) { - root.ProductAdvertisingAPIv1 = {}; - } - root.ProductAdvertisingAPIv1.SingleStringValuedAttribute = factory(root.ProductAdvertisingAPIv1.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - +import { ApiClient } from "../ApiClient"; +/** + * The SingleStringValuedAttribute model module. + * @module model/SingleStringValuedAttribute + * @version 1.0.0 + */ +/** + * Constructs a new SingleStringValuedAttribute. + * @alias module:model/SingleStringValuedAttribute + * @class + */ +export class SingleStringValuedAttribute { /** - * The SingleStringValuedAttribute model module. - * @module model/SingleStringValuedAttribute - * @version 1.0.0 + * @member {String} DisplayValue */ - + public DisplayValue?: string; /** - * Constructs a new SingleStringValuedAttribute. - * @alias module:model/SingleStringValuedAttribute - * @class + * @member {String} Label */ - var exports = function() { - var _this = this; - - - - - }; + public Label?: string; + /** + * @member {String} Locale + */ + public Locale?: string; /** * Constructs a SingleStringValuedAttribute from a plain JavaScript object, optionally creating a new instance. @@ -65,39 +55,20 @@ * @param {module:model/SingleStringValuedAttribute} obj Optional instance to populate. * @return {module:model/SingleStringValuedAttribute} The populated SingleStringValuedAttribute instance. */ - exports.constructFromObject = function(data, obj) { + public static constructFromObject(data: any, obj?: SingleStringValuedAttribute) { if (data) { - obj = obj || new exports(); + obj = obj || new SingleStringValuedAttribute(); if (data.hasOwnProperty('DisplayValue')) { - obj['DisplayValue'] = ApiClient.convertToType(data['DisplayValue'], 'String'); + obj.DisplayValue = ApiClient.convertToType(data['DisplayValue'], 'String'); } if (data.hasOwnProperty('Label')) { - obj['Label'] = ApiClient.convertToType(data['Label'], 'String'); + obj.Label = ApiClient.convertToType(data['Label'], 'String'); } if (data.hasOwnProperty('Locale')) { - obj['Locale'] = ApiClient.convertToType(data['Locale'], 'String'); + obj.Locale = ApiClient.convertToType(data['Locale'], 'String'); } } return obj; } - - /** - * @member {String} DisplayValue - */ - exports.prototype['DisplayValue'] = undefined; - /** - * @member {String} Label - */ - exports.prototype['Label'] = undefined; - /** - * @member {String} Locale - */ - exports.prototype['Locale'] = undefined; - - - - return exports; -})); - - +} diff --git a/src/model/SortBy.js b/src/model/SortBy.ts similarity index 97% rename from src/model/SortBy.js rename to src/model/SortBy.ts index d8839ce..1b2499e 100644 --- a/src/model/SortBy.js +++ b/src/model/SortBy.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/TechnicalInfo.js b/src/model/TechnicalInfo.ts similarity index 98% rename from src/model/TechnicalInfo.js rename to src/model/TechnicalInfo.ts index 4b0386b..82e6fd5 100644 --- a/src/model/TechnicalInfo.js +++ b/src/model/TechnicalInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/TradeInInfo.js b/src/model/TradeInInfo.ts similarity index 98% rename from src/model/TradeInInfo.js rename to src/model/TradeInInfo.ts index 2f00c08..db3b5a3 100644 --- a/src/model/TradeInInfo.js +++ b/src/model/TradeInInfo.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/TradeInPrice.js b/src/model/TradeInPrice.ts similarity index 98% rename from src/model/TradeInPrice.js rename to src/model/TradeInPrice.ts index 54f3ba7..ac9e497 100644 --- a/src/model/TradeInPrice.js +++ b/src/model/TradeInPrice.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/UnitBasedAttribute.js b/src/model/UnitBasedAttribute.ts similarity index 98% rename from src/model/UnitBasedAttribute.js rename to src/model/UnitBasedAttribute.ts index 9ee24a1..917e721 100644 --- a/src/model/UnitBasedAttribute.js +++ b/src/model/UnitBasedAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/VariationAttribute.js b/src/model/VariationAttribute.ts similarity index 97% rename from src/model/VariationAttribute.js rename to src/model/VariationAttribute.ts index ad9658a..3f43e65 100644 --- a/src/model/VariationAttribute.js +++ b/src/model/VariationAttribute.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/VariationDimension.js b/src/model/VariationDimension.ts similarity index 98% rename from src/model/VariationDimension.js rename to src/model/VariationDimension.ts index dd04468..261aedb 100644 --- a/src/model/VariationDimension.js +++ b/src/model/VariationDimension.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/VariationSummary.js b/src/model/VariationSummary.ts similarity index 98% rename from src/model/VariationSummary.js rename to src/model/VariationSummary.ts index 3b30b28..972cc31 100644 --- a/src/model/VariationSummary.js +++ b/src/model/VariationSummary.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/VariationsResult.js b/src/model/VariationsResult.ts similarity index 98% rename from src/model/VariationsResult.js rename to src/model/VariationsResult.ts index 4f0f158..81513f7 100644 --- a/src/model/VariationsResult.js +++ b/src/model/VariationsResult.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). diff --git a/src/model/WebsiteSalesRank.js b/src/model/WebsiteSalesRank.ts similarity index 98% rename from src/model/WebsiteSalesRank.js rename to src/model/WebsiteSalesRank.ts index f486f41..9b171b3 100644 --- a/src/model/WebsiteSalesRank.js +++ b/src/model/WebsiteSalesRank.ts @@ -1,4 +1,6 @@ /** + * Adapted to TypeScript by David A. Ball. (c) 2024. + * * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License").