Compare commits

..

No commits in common. "ab001fe532f7105475d5e9442efe8428218b9f32" and "2464f792f3947dcf4425520f2c052d2b782a3414" have entirely different histories.

3 changed files with 237 additions and 212 deletions

View File

@ -31,6 +31,24 @@
const PRODUCT_ADVERTISING_API = 'ProductAdvertisingAPI'; 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 * @module ApiClient
* @version 1.0.0 * @version 1.0.0
@ -565,5 +583,6 @@
} }
} }
}; };
} }

View File

@ -23,13 +23,6 @@
import { ApiClient } from "../ApiClient"; import { ApiClient } from "../ApiClient";
import { GetBrowseNodesRequest } from "../model/GetBrowseNodesRequest"; import { GetBrowseNodesRequest } from "../model/GetBrowseNodesRequest";
import { GetBrowseNodesResponse } from "../model/GetBrowseNodesResponse";
import { GetItemsRequest } from "../model/GetItemsRequest";
import { GetItemsResponse } from "../model/GetItemsResponse";
import { GetVariationsRequest } from "../model/GetVariationsRequest";
import { GetVariationsResponse } from "../model/GetVariationsResponse";
import { SearchItemsRequest } from "../model/SearchItemsRequest";
import { SearchItemsResponse } from "../model/SearchItemsResponse";
/** /**
* Default service. * Default service.
@ -93,7 +86,7 @@
*/ */
public getBrowseNodes(getBrowseNodesRequest: GetBrowseNodesRequest) { public getBrowseNodes(getBrowseNodesRequest: GetBrowseNodesRequest) {
return this.getBrowseNodesWithHttpInfo(getBrowseNodesRequest) return this.getBrowseNodesWithHttpInfo(getBrowseNodesRequest)
.then(function(response_and_data: any) { .then(function(response_and_data) {
return response_and_data.data; return response_and_data.data;
}); });
} }
@ -141,7 +134,7 @@
*/ */
public getItems(getItemsRequest: GetItemsRequest) { public getItems(getItemsRequest: GetItemsRequest) {
return this.getItemsWithHttpInfo(getItemsRequest) return this.getItemsWithHttpInfo(getItemsRequest)
.then(function(response_and_data: any) { .then(function(response_and_data) {
return response_and_data.data; return response_and_data.data;
}); });
} }
@ -189,7 +182,7 @@
*/ */
public getVariations(getVariationsRequest: GetVariationsRequest) { public getVariations(getVariationsRequest: GetVariationsRequest) {
return this.getVariationsWithHttpInfo(getVariationsRequest) return this.getVariationsWithHttpInfo(getVariationsRequest)
.then(function(response_and_data: any) { .then(function(response_and_data) {
return response_and_data.data; return response_and_data.data;
}); });
} }
@ -237,7 +230,7 @@
*/ */
public searchItems(searchItemsRequest: SearchItemsRequest) { public searchItems(searchItemsRequest: SearchItemsRequest) {
return this.searchItemsWithHttpInfo(searchItemsRequest) return this.searchItemsWithHttpInfo(searchItemsRequest)
.then(function(response_and_data: any) { .then(function(response_and_data) {
return response_and_data.data; return response_and_data.data;
}); });
} }

View File

@ -21,229 +21,242 @@
* *
*/ */
import * as ProductAdvertisingAPIv1 from '../../src/index'; (function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.ProductAdvertisingAPIv1);
}
}(this, function(expect, ProductAdvertisingAPIv1) {
'use strict';
const DUMMY_ACCESS_KEY = 'DUMMY_ACCESS_KEY'; var instance;
const DUMMY_SECRET_KEY = 'DUMMY_SECRET_KEY'; var DUMMY_ACCESS_KEY = 'DUMMY_ACCESS_KEY';
const DUMMY_REGION = 'DUMMY_REGION'; var DUMMY_SECRET_KEY = 'DUMMY_SECRET_KEY';
const INVALID_SIGNATURE = 'InvalidSignature'; var DUMMY_REGION = 'DUMMY_REGION';
const UNRECOGNIZED_CLIENT = 'UnrecognizedClient'; var INVALID_SIGNATURE = 'InvalidSignature';
const HOST = 'webservices.amazon.com'; var UNRECOGNIZED_CLIENT = 'UnrecognizedClient';
const REGION = 'us-east-1'; var HOST = 'webservices.amazon.com';
var REGION = 'us-east-1';
let instance; beforeEach(function() {
instance = new ProductAdvertisingAPIv1.DefaultApi();
});
beforeEach(function() { var getProperty = function(object, getter, property) {
instance = new ProductAdvertisingAPIv1.DefaultApi(); // Use getter method if present; otherwise, get the property directly.
}); if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var getProperty = function(object, getter, property) { var setProperty = function(object, setter, property, value) {
// Use getter method if present; otherwise, get the property directly. // Use setter method if present; otherwise, set the property directly.
if (typeof object[getter] === 'function') if (typeof object[setter] === 'function')
return object[getter](); object[setter](value);
else else
return object[property]; object[property] = value;
} }
// var setProperty = function(object, setter, property, value) { describe('DefaultApi', function() {
// // Use setter method if present; otherwise, set the property directly. describe('getBrowseNodes', function() {
// if (typeof object[setter] === 'function') it('should throw error if GetBrowseNodesRequest is not provided', function(done) {
// object[setter](value); //var getBrowseNodesRequest = new ProductAdvertisingAPIv1.GetBrowseNodesRequest();
// else try {
// object[property] = value; instance.getBrowseNodes();
// } } catch (e) {
expect(e).to.be.a(Error);
expect(e.message).to.be('Missing the required parameter \'getBrowseNodesRequest\' when calling getBrowseNodes');
done();
}
});
// describe('DefaultApi', function() { it('PA-API 5.0 call should fail with InvalidSignature error when GetBrowseNodes request has invalid region', function(done) {
// describe('getBrowseNodes', function() { var getBrowseNodesRequest = new ProductAdvertisingAPIv1.GetBrowseNodesRequest();
// it('should throw error if GetBrowseNodesRequest is not provided', function(done) { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// //var getBrowseNodesRequest = new ProductAdvertisingAPIv1.GetBrowseNodesRequest(); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// try { defaultClient.secretKey = DUMMY_SECRET_KEY;
// instance.getBrowseNodes(); defaultClient.host = HOST;
// } catch (e) { defaultClient.region = DUMMY_REGION;
// expect(e).to.be.a(Error);
// expect(e.message).to.be('Missing the required parameter \'getBrowseNodesRequest\' when calling getBrowseNodes');
// done();
// }
// });
// it('PA-API 5.0 call should fail with InvalidSignature error when GetBrowseNodes request has invalid region', function(done) { instance.getBrowseNodes(getBrowseNodesRequest).then(
// var getBrowseNodesRequest = new ProductAdvertisingAPIv1.GetBrowseNodesRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE);
// defaultClient.host = HOST; done();
// defaultClient.region = DUMMY_REGION; }
);
});
// instance.getBrowseNodes(getBrowseNodesRequest).then( it('PA-API 5.0 call should fail with UnrecognizedClient error when GetBrowseNodes request has dummy credentials', function(done) {
// {}, var getBrowseNodesRequest = new ProductAdvertisingAPIv1.GetBrowseNodesRequest();
// function(error) { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// expect(error['status']).to.be(401); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE); defaultClient.secretKey = DUMMY_SECRET_KEY;
// done(); defaultClient.host = HOST;
// } defaultClient.region = REGION;
// );
// });
// it('PA-API 5.0 call should fail with UnrecognizedClient error when GetBrowseNodes request has dummy credentials', function(done) { instance.getBrowseNodes(getBrowseNodesRequest).then(
// var getBrowseNodesRequest = new ProductAdvertisingAPIv1.GetBrowseNodesRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT);
// defaultClient.host = HOST; done();
// defaultClient.region = REGION; }
);
});
});
// instance.getBrowseNodes(getBrowseNodesRequest).then( describe('getItems', function() {
// {}, it('should throw error if GetItemsRequest is not provided', function(done) {
// function(error) { try {
// expect(error['status']).to.be(401); instance.getItems();
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT); } catch (e) {
// done(); expect(e).to.be.a(Error);
// } expect(e.message).to.be('Missing the required parameter \'getItemsRequest\' when calling getItems');
// ); done();
// }); }
// }); });
// describe('getItems', function() { it('PA-API 5.0 call should fail with InvalidSignature error when GetItems request has invalid region', function(done) {
// it('should throw error if GetItemsRequest is not provided', function(done) { var getItemsRequest = new ProductAdvertisingAPIv1.GetItemsRequest();
// try { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// instance.getItems(); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// } catch (e) { defaultClient.secretKey = DUMMY_SECRET_KEY;
// expect(e).to.be.a(Error); defaultClient.host = HOST;
// expect(e.message).to.be('Missing the required parameter \'getItemsRequest\' when calling getItems'); defaultClient.region = DUMMY_REGION;
// done();
// }
// });
// it('PA-API 5.0 call should fail with InvalidSignature error when GetItems request has invalid region', function(done) { instance.getItems(getItemsRequest).then(
// var getItemsRequest = new ProductAdvertisingAPIv1.GetItemsRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE);
// defaultClient.host = HOST; done();
// defaultClient.region = DUMMY_REGION; }
);
});
// instance.getItems(getItemsRequest).then( it('PA-API 5.0 call should fail with UnrecognizedClient error when GetItems request has dummy credentials', function(done) {
// {}, var getItemsRequest = new ProductAdvertisingAPIv1.GetItemsRequest();
// function(error) { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// expect(error['status']).to.be(401); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE); defaultClient.secretKey = DUMMY_SECRET_KEY;
// done(); defaultClient.host = HOST;
// } defaultClient.region = REGION;
// );
// });
// it('PA-API 5.0 call should fail with UnrecognizedClient error when GetItems request has dummy credentials', function(done) { instance.getItems(getItemsRequest).then(
// var getItemsRequest = new ProductAdvertisingAPIv1.GetItemsRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT);
// defaultClient.host = HOST; done();
// defaultClient.region = REGION; }
);
});
});
// instance.getItems(getItemsRequest).then( describe('getVariations', function() {
// {}, it('should throw error if GetVariationsRequest is not provided', function(done) {
// function(error) { try {
// expect(error['status']).to.be(401); instance.getVariations();
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT); } catch (e) {
// done(); expect(e).to.be.a(Error);
// } expect(e.message).to.be('Missing the required parameter \'getVariationsRequest\' when calling getVariations');
// ); done();
// }); }
// }); });
// describe('getVariations', function() { it('PA-API 5.0 call should fail with InvalidSignature error when GetVariations request has invalid region', function(done) {
// it('should throw error if GetVariationsRequest is not provided', function(done) { var getVariationsRequest = new ProductAdvertisingAPIv1.GetVariationsRequest();
// try { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// instance.getVariations(); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// } catch (e) { defaultClient.secretKey = DUMMY_SECRET_KEY;
// expect(e).to.be.a(Error); defaultClient.host = HOST;
// expect(e.message).to.be('Missing the required parameter \'getVariationsRequest\' when calling getVariations'); defaultClient.region = DUMMY_REGION;
// done();
// }
// });
// it('PA-API 5.0 call should fail with InvalidSignature error when GetVariations request has invalid region', function(done) { instance.getVariations(getVariationsRequest).then(
// var getVariationsRequest = new ProductAdvertisingAPIv1.GetVariationsRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE);
// defaultClient.host = HOST; done();
// defaultClient.region = DUMMY_REGION; }
);
});
// instance.getVariations(getVariationsRequest).then( it('PA-API 5.0 call should fail with UnrecognizedClient error when GetVariations request has dummy credentials', function(done) {
// {}, var getVariationsRequest = new ProductAdvertisingAPIv1.GetVariationsRequest();
// function(error) { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// expect(error['status']).to.be(401); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE); defaultClient.secretKey = DUMMY_SECRET_KEY;
// done(); defaultClient.host = HOST;
// } defaultClient.region = REGION;
// );
// });
// it('PA-API 5.0 call should fail with UnrecognizedClient error when GetVariations request has dummy credentials', function(done) { instance.getVariations(getVariationsRequest).then(
// var getVariationsRequest = new ProductAdvertisingAPIv1.GetVariationsRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT);
// defaultClient.host = HOST; done();
// defaultClient.region = REGION; }
);
});
});
// instance.getVariations(getVariationsRequest).then( describe('searchItems', function() {
// {}, it('should throw error if SearchItemsRequest is not provided', function(done) {
// function(error) { try {
// expect(error['status']).to.be(401); instance.searchItems();
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT); } catch (e) {
// done(); expect(e).to.be.a(Error);
// } expect(e.message).to.be('Missing the required parameter \'searchItemsRequest\' when calling searchItems');
// ); done();
// }); }
// }); });
// describe('searchItems', function() { it('PA-API 5.0 call should fail with InvalidSignature error when SearchItems request has invalid region', function(done) {
// it('should throw error if SearchItemsRequest is not provided', function(done) { var searchItemsRequest = new ProductAdvertisingAPIv1.SearchItemsRequest();
// try { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// instance.searchItems(); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// } catch (e) { defaultClient.secretKey = DUMMY_SECRET_KEY;
// expect(e).to.be.a(Error); defaultClient.host = HOST;
// expect(e.message).to.be('Missing the required parameter \'searchItemsRequest\' when calling searchItems'); defaultClient.region = DUMMY_REGION;
// done();
// }
// });
// it('PA-API 5.0 call should fail with InvalidSignature error when SearchItems request has invalid region', function(done) { instance.searchItems(searchItemsRequest).then(
// var searchItemsRequest = new ProductAdvertisingAPIv1.SearchItemsRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE);
// defaultClient.host = HOST; done();
// defaultClient.region = DUMMY_REGION; }
);
});
// instance.searchItems(searchItemsRequest).then( it('PA-API 5.0 call should fail with UnrecognizedClient error when SearchItems request has dummy credentials', function(done) {
// {}, var searchItemsRequest = new ProductAdvertisingAPIv1.SearchItemsRequest();
// function(error) { var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance;
// expect(error['status']).to.be(401); defaultClient.accessKey = DUMMY_ACCESS_KEY;
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(INVALID_SIGNATURE); defaultClient.secretKey = DUMMY_SECRET_KEY;
// done(); defaultClient.host = HOST;
// } defaultClient.region = REGION;
// );
// });
// it('PA-API 5.0 call should fail with UnrecognizedClient error when SearchItems request has dummy credentials', function(done) { instance.searchItems(searchItemsRequest).then(
// var searchItemsRequest = new ProductAdvertisingAPIv1.SearchItemsRequest(); {},
// var defaultClient = ProductAdvertisingAPIv1.ApiClient.instance; function(error) {
// defaultClient.accessKey = DUMMY_ACCESS_KEY; expect(error['status']).to.be(401);
// defaultClient.secretKey = DUMMY_SECRET_KEY; expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT);
// defaultClient.host = HOST; done();
// defaultClient.region = REGION; }
);
});
});
});
// instance.searchItems(searchItemsRequest).then( }));
// {},
// function(error) {
// expect(error['status']).to.be(401);
// expect(JSON.parse(error['response']['text'])['Errors'][0]['Code']).to.be(UNRECOGNIZED_CLIENT);
// done();
// }
// );
// });
// });
// });