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.

This commit is contained in:
David Ball 2024-07-17 20:55:29 -04:00
parent a5e103825c
commit 839bab9679
99 changed files with 1941 additions and 2000 deletions

View File

@ -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.<String>}
*/
this.authentications = {
};
/**
* The default HTTP headers to be included for all API calls.
* @type {Array.<String>}
* @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 <code>param</code>.
*/
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.<br>
* JSON content type examples:<br>
* <ul>
* <li>application/json</li>
* <li>application/json; charset=UTF8</li>
* <li>APPLICATION/JSON</li>
* </ul>
* @param {String} contentType The MIME content type to check.
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
*/
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.<String>} 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} <code>true</code> if <code>param</code> 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:
* <ul>
* <li>remove nils</li>
* <li>keep files and arrays</li>
* <li>format to string with `paramToString` for other cases</li>
* </ul>
* @param {Object.<String, Object>} params The parameters as object properties.
* @returns {Object.<String, 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: <code>csv</code>
* @const
*/
CSV: ',',
/**
* Space-separated values. Value: <code>ssv</code>
* @const
*/
SSV: ' ',
/**
* Tab-separated values. Value: <code>tsv</code>
* @const
*/
TSV: '\t',
/**
* Pipe(|)-separated values. Value: <code>pipes</code>
* @const
*/
PIPES: '|',
/**
* Native array. Value: <code>multi</code>
* @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
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
*/
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.<String>|Object.<String, 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 <code>data<code> 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.<String, String>} pathParams A map of path parameters and their values.
* @param {Object.<String, Object>} queryParams A map of query parameters and their values.
* @param {Object.<String, Object>} collectionQueryParams A map of collection query parameters and their values.
* @param {Object.<String, Object>} headerParams A map of header parameters and their values.
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
* @param {Object} bodyParam The value to pass as the request body.
* @param {Array.<String>} authNames An array of authentication type names.
* @param {Array.<String>} contentTypes An array of request MIME types.
* @param {Array.<String>} 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.<String>|Object.<String, 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 <code>data<code> 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;
}));

588
src/ApiClient.ts Normal file
View File

@ -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: <code>csv</code>
* @const
*/
CSV = ',',
/**
* Space-separated values. Value: <code>ssv</code>
* @const
*/
SSV = ' ',
/**
* Tab-separated values. Value: <code>tsv</code>
* @const
*/
TSV = '\t',
/**
* Pipe(|)-separated values. Value: <code>pipes</code>
* @const
*/
PIPES = '|',
/**
* Native array. Value: <code>multi</code>
* @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.<String>}
*/
public authentications = {
};
/**
* The default HTTP headers to be included for all API calls.
* @type {Array.<String>}
* @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 <code>param</code>.
*/
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<string, any>) {
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.<br>
* JSON content type examples:<br>
* <ul>
* <li>application/json</li>
* <li>application/json; charset=UTF8</li>
* <li>APPLICATION/JSON</li>
* </ul>
* @param {String} contentType The MIME content type to check.
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
*/
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.<String>} 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} <code>true</code> if <code>param</code> 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:
* <ul>
* <li>remove nils</li>
* <li>keep files and arrays</li>
* <li>format to string with `paramToString` for other cases</li>
* </ul>
* @param {Object.<String, Object>} params The parameters as object properties.
* @returns {Object.<String, Object>} normalized parameters.
*/
public normalizeParams(params: Record<string, any>) {
var newParams: Record<string, any> = {};
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
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
*/
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.<String>|Object.<String, 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 <code>data<code> 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.<String, String>} pathParams A map of path parameters and their values.
* @param {Object.<String, Object>} queryParams A map of query parameters and their values.
* @param {Object.<String, Object>} collectionQueryParams A map of collection query parameters and their values.
* @param {Object.<String, Object>} headerParams A map of header parameters and their values.
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
* @param {Object} bodyParam The value to pass as the request body.
* @param {Array.<String>} authNames An array of authentication type names.
* @param {Array.<String>} contentTypes An array of request MIME types.
* @param {Array.<String>} 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<string, string>,
queryParams: Record<string, any>, collectionQueryParams: Record<string, any>, headerParams: Record<string, any>, formParams: Record<string, any>, 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.<String>|Object.<String, 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 <code>data<code> 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<any, any> = {};
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);
}
}
};
}

View File

@ -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;
}));

238
src/api/DefaultApi.ts Normal file
View File

@ -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;
});
}
};

View File

@ -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.<br>
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
* <p>
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
* <pre>
* 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.
* ...
* </pre>
* <em>*NOTE: For a top-level AMD script, use require(['index'], function(){...})
* and put the application logic within the callback function.</em>
* </p>
* <p>
* A non-AMD browser application (discouraged) might do something like this:
* <pre>
* 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.
* ...
* </pre>
* </p>
* @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;
}));

522
src/index.ts Normal file
View File

@ -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.<br>
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
* <p>
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
* <pre>
* 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.
* ...
* </pre>
* <em>*NOTE: For a top-level AMD script, use require(['index'], function(){...})
* and put the application logic within the callback function.</em>
* </p>
* <p>
* A non-AMD browser application (discouraged) might do something like this:
* <pre>
* 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.
* ...
* </pre>
* </p>
* @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
};

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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 <code>ByLineInfo</code>.
* @alias module:model/ByLineInfo
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>ByLineInfo</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> 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 <code>ByLineInfo</code> 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.<module:model/Contributor>} Contributors
*/
exports.prototype['Contributors'] = undefined;
/**
* @member {module:model/SingleStringValuedAttribute} Manufacturer
*/
exports.prototype['Manufacturer'] = undefined;
return exports;
}));

75
src/model/ByLineInfo.ts Normal file
View File

@ -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 <code>ByLineInfo</code>.
* @alias module:model/ByLineInfo
* @class
*/
export class ByLineInfo {
/**
* @member {module:model/SingleStringValuedAttribute} Brand
*/
public Brand?: SingleStringValuedAttribute;
/**
* @member {Array.<module:model/Contributor>} Contributors
*/
public Contributors?: Contributor[];
/**
* @member {module:model/SingleStringValuedAttribute} Manufacturer
*/
public Manufacturer?: SingleStringValuedAttribute;
/**
* Constructs a <code>ByLineInfo</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> 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 <code>ByLineInfo</code> 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;
}
};

View File

@ -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 <code>Classifications</code>.
* @alias module:model/Classifications
* @class
*/
var exports = function() {
var _this = this;
};
export class Classifications {
/**
* @member {module:model/SingleStringValuedAttribute} Binding
*/
public Binding?: SingleStringValuedAttribute;
/**
* @member {module:model/SingleStringValuedAttribute} ProductGroup
*/
public ProductGroup?: SingleStringValuedAttribute;
/**
* Constructs a <code>Classifications</code> 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 <code>Classifications</code> 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;
}));
};

View File

@ -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 <code>Condition</code> 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 <code>Condition</code> value.
*/
exports.constructFromObject = function(object) {
return object;
}
return exports;
}));

89
src/model/Condition.ts Normal file
View File

@ -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 <code>Condition</code> 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 <code>Condition</code> value.
*/
public static constructFromObject = function(object: Condition|ConditionValue|string) { return object; }
};

View File

@ -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").

View File

@ -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").

View File

@ -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 <code>Contributor</code>.
* @alias module:model/Contributor
* @class
*/
var exports = function() {
var _this = this;
};
export class Contributor {
/**
* @member {String} Locale
*/
public Locale?: string;
/**
* @member {String} Name
*/
public Name?: string;
/**
* @member {String} Role
*/
public Role?: string;
/**
* @member {String} RoleType
*/
public RoleType?: string;
/**
* Constructs a <code>Contributor</code> 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 <code>Contributor</code> 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;
}));
}

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").
@ -45,6 +47,8 @@
* @version 1.0.0
*/
import { ApiClient } from '../ApiClient';
/**
* Constructs a new <code>OfferPrice</code>.
* @alias module:model/OfferPrice

View File

@ -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").

View File

@ -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").

View File

@ -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 <code>OfferSavings</code>.
* @alias module:model/OfferSavings
* @class
*/
var exports = function() {
var _this = this;
};
export class OfferSavings {
/**
* @member {Number} Amount
*/
public Amount?: number;
/**
* @member {String} Currency
*/
public Currency?: string;
/**
* @member {String} DisplayAmount
*/
public DisplayAmount?: string;
/**
* @member {Number} Percentage
*/
public Percentage?: number;
/**
* @member {Number} PricePerUnit
*/
public PricePerUnit?: number;
/**
* Constructs a <code>OfferSavings</code> 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 <code>OfferSavings</code> 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;
}));
};

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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 <code>PriceType</code> 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 <code>PriceType</code> value.
*/
exports.constructFromObject = function(object) {
return object;
}
return exports;
}));

81
src/model/PriceType.ts Normal file
View File

@ -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 <code>PriceType</code> 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 <code>PriceType</code> value.
*/
public static constructFromObject(object: PriceType|PriceTypeValue|string) {
return object;
}
};

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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,25 +21,7 @@
*
*/
(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.
@ -50,13 +34,19 @@
* @alias module:model/SingleBooleanValuedAttribute
* @class
*/
var exports = function() {
var _this = this;
};
export class SingleBooleanValuedAttribute {
/**
* @member {Boolean} DisplayValue
*/
public DisplayValue?: boolean;
/**
* @member {String} Label
*/
public Label?: string;
/**
* @member {String} Locale
*/
public Locale?: string;
/**
* Constructs a <code>SingleBooleanValuedAttribute</code> 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 <code>SingleBooleanValuedAttribute</code> 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;
}));
}

View File

@ -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,25 +21,7 @@
*
*/
(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.
@ -50,13 +34,19 @@
* @alias module:model/SingleIntegerValuedAttribute
* @class
*/
var exports = function() {
var _this = this;
};
export class SingleIntegerValuedAttribute {
/**
* @member {Number} DisplayValue
*/
public DisplayValue?: number;
/**
* @member {String} Label
*/
public Label?: string;
/**
* @member {String} Locale
*/
public Locale?: string;
/**
* Constructs a <code>SingleIntegerValuedAttribute</code> 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 <code>SingleIntegerValuedAttribute</code> 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;
}));
}

View File

@ -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,25 +21,7 @@
*
*/
(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.
@ -50,13 +34,19 @@
* @alias module:model/SingleStringValuedAttribute
* @class
*/
var exports = function() {
var _this = this;
};
export class SingleStringValuedAttribute {
/**
* @member {String} DisplayValue
*/
public DisplayValue?: string;
/**
* @member {String} Label
*/
public Label?: string;
/**
* @member {String} Locale
*/
public Locale?: string;
/**
* Constructs a <code>SingleStringValuedAttribute</code> 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 <code>SingleStringValuedAttribute</code> 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;
}));
}

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").

View File

@ -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").