update JS petstore samples

This commit is contained in:
wing328 2016-10-25 16:52:32 +08:00
parent 37bb66c436
commit aa46aca7cf
10 changed files with 62 additions and 55 deletions

View File

@ -87,7 +87,8 @@ var opts = {
'binary': "B", // String | None 'binary': "B", // String | None
'_date': new Date("2013-10-20"), // Date | None '_date': new Date("2013-10-20"), // Date | None
'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None 'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None
'password': "password_example" // String | None 'password': "password_example", // String | None
'callback': "callback_example" // String | None
}; };
apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts).then(function() { apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts).then(function() {
console.log('API called successfully.'); console.log('API called successfully.');
@ -114,6 +115,7 @@ Name | Type | Description | Notes
**_date** | **Date**| None | [optional] **_date** | **Date**| None | [optional]
**dateTime** | **Date**| None | [optional] **dateTime** | **Date**| None | [optional]
**password** | **String**| None | [optional] **password** | **String**| None | [optional]
**callback** | **String**| None | [optional]
### Return type ### Return type

View File

@ -65,8 +65,8 @@
*/ */
this.authentications = { this.authentications = {
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
'http_basic_test': {type: 'basic'} 'http_basic_test': {type: 'basic'},
'petstore_auth': {type: 'oauth2'}, 'petstore_auth': {type: 'oauth2'}
}; };
/** /**
* The default HTTP headers to be included for all API calls. * The default HTTP headers to be included for all API calls.
@ -368,7 +368,10 @@
var contentType = this.jsonPreferredMime(contentTypes); var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) { if (contentType) {
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
if(contentType != 'multipart/form-data') {
request.type(contentType); request.type(contentType);
}
} else if (!request.header['Content-Type']) { } else if (!request.header['Content-Type']) {
request.type('application/json'); request.type('application/json');
} }

View File

@ -67,7 +67,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling testClientModel"; throw new Error("Missing the required parameter 'body' when calling testClientModel");
} }
@ -110,6 +110,7 @@
* @param {Date} opts._date None * @param {Date} opts._date None
* @param {Date} opts.dateTime None * @param {Date} opts.dateTime None
* @param {String} opts.password None * @param {String} opts.password None
* @param {String} opts.callback None
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/ */
this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts) { this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts) {
@ -118,22 +119,22 @@
// verify the required parameter '_number' is set // verify the required parameter '_number' is set
if (_number == undefined || _number == null) { if (_number == undefined || _number == null) {
throw "Missing the required parameter '_number' when calling testEndpointParameters"; throw new Error("Missing the required parameter '_number' when calling testEndpointParameters");
} }
// verify the required parameter '_double' is set // verify the required parameter '_double' is set
if (_double == undefined || _double == null) { if (_double == undefined || _double == null) {
throw "Missing the required parameter '_double' when calling testEndpointParameters"; throw new Error("Missing the required parameter '_double' when calling testEndpointParameters");
} }
// verify the required parameter 'patternWithoutDelimiter' is set // verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) { if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) {
throw "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"; throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
} }
// verify the required parameter '_byte' is set // verify the required parameter '_byte' is set
if (_byte == undefined || _byte == null) { if (_byte == undefined || _byte == null) {
throw "Missing the required parameter '_byte' when calling testEndpointParameters"; throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters");
} }
@ -156,7 +157,8 @@
'binary': opts['binary'], 'binary': opts['binary'],
'date': opts['_date'], 'date': opts['_date'],
'dateTime': opts['dateTime'], 'dateTime': opts['dateTime'],
'password': opts['password'] 'password': opts['password'],
'callback': opts['callback']
}; };
var authNames = ['http_basic_test']; var authNames = ['http_basic_test'];

View File

@ -68,7 +68,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling addPet"; throw new Error("Missing the required parameter 'body' when calling addPet");
} }
@ -108,7 +108,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling deletePet"; throw new Error("Missing the required parameter 'petId' when calling deletePet");
} }
@ -147,7 +147,7 @@
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == undefined || status == null) { if (status == undefined || status == null) {
throw "Missing the required parameter 'status' when calling findPetsByStatus"; throw new Error("Missing the required parameter 'status' when calling findPetsByStatus");
} }
@ -185,7 +185,7 @@
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == undefined || tags == null) { if (tags == undefined || tags == null) {
throw "Missing the required parameter 'tags' when calling findPetsByTags"; throw new Error("Missing the required parameter 'tags' when calling findPetsByTags");
} }
@ -223,7 +223,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling getPetById"; throw new Error("Missing the required parameter 'petId' when calling getPetById");
} }
@ -261,7 +261,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling updatePet"; throw new Error("Missing the required parameter 'body' when calling updatePet");
} }
@ -302,7 +302,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling updatePetWithForm"; throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm");
} }
@ -346,7 +346,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling uploadFile"; throw new Error("Missing the required parameter 'petId' when calling uploadFile");
} }

View File

@ -68,7 +68,7 @@
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId == undefined || orderId == null) {
throw "Missing the required parameter 'orderId' when calling deleteOrder"; throw new Error("Missing the required parameter 'orderId' when calling deleteOrder");
} }
@ -137,7 +137,7 @@
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId == undefined || orderId == null) {
throw "Missing the required parameter 'orderId' when calling getOrderById"; throw new Error("Missing the required parameter 'orderId' when calling getOrderById");
} }
@ -175,7 +175,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling placeOrder"; throw new Error("Missing the required parameter 'body' when calling placeOrder");
} }

View File

@ -68,7 +68,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling createUser"; throw new Error("Missing the required parameter 'body' when calling createUser");
} }
@ -105,7 +105,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling createUsersWithArrayInput"; throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput");
} }
@ -142,7 +142,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling createUsersWithListInput"; throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput");
} }
@ -179,7 +179,7 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling deleteUser"; throw new Error("Missing the required parameter 'username' when calling deleteUser");
} }
@ -217,7 +217,7 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling getUserByName"; throw new Error("Missing the required parameter 'username' when calling getUserByName");
} }
@ -256,12 +256,12 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling loginUser"; throw new Error("Missing the required parameter 'username' when calling loginUser");
} }
// verify the required parameter 'password' is set // verify the required parameter 'password' is set
if (password == undefined || password == null) { if (password == undefined || password == null) {
throw "Missing the required parameter 'password' when calling loginUser"; throw new Error("Missing the required parameter 'password' when calling loginUser");
} }
@ -332,12 +332,12 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling updateUser"; throw new Error("Missing the required parameter 'username' when calling updateUser");
} }
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling updateUser"; throw new Error("Missing the required parameter 'body' when calling updateUser");
} }

View File

@ -75,7 +75,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling testClientModel"; throw new Error("Missing the required parameter 'body' when calling testClientModel");
} }
@ -134,22 +134,22 @@
// verify the required parameter '_number' is set // verify the required parameter '_number' is set
if (_number == undefined || _number == null) { if (_number == undefined || _number == null) {
throw "Missing the required parameter '_number' when calling testEndpointParameters"; throw new Error("Missing the required parameter '_number' when calling testEndpointParameters");
} }
// verify the required parameter '_double' is set // verify the required parameter '_double' is set
if (_double == undefined || _double == null) { if (_double == undefined || _double == null) {
throw "Missing the required parameter '_double' when calling testEndpointParameters"; throw new Error("Missing the required parameter '_double' when calling testEndpointParameters");
} }
// verify the required parameter 'patternWithoutDelimiter' is set // verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) { if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) {
throw "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"; throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
} }
// verify the required parameter '_byte' is set // verify the required parameter '_byte' is set
if (_byte == undefined || _byte == null) { if (_byte == undefined || _byte == null) {
throw "Missing the required parameter '_byte' when calling testEndpointParameters"; throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters");
} }

View File

@ -75,7 +75,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling addPet"; throw new Error("Missing the required parameter 'body' when calling addPet");
} }
@ -122,7 +122,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling deletePet"; throw new Error("Missing the required parameter 'petId' when calling deletePet");
} }
@ -169,7 +169,7 @@
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == undefined || status == null) { if (status == undefined || status == null) {
throw "Missing the required parameter 'status' when calling findPetsByStatus"; throw new Error("Missing the required parameter 'status' when calling findPetsByStatus");
} }
@ -215,7 +215,7 @@
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == undefined || tags == null) { if (tags == undefined || tags == null) {
throw "Missing the required parameter 'tags' when calling findPetsByTags"; throw new Error("Missing the required parameter 'tags' when calling findPetsByTags");
} }
@ -261,7 +261,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling getPetById"; throw new Error("Missing the required parameter 'petId' when calling getPetById");
} }
@ -306,7 +306,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling updatePet"; throw new Error("Missing the required parameter 'body' when calling updatePet");
} }
@ -354,7 +354,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling updatePetWithForm"; throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm");
} }
@ -406,7 +406,7 @@
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId == undefined || petId == null) {
throw "Missing the required parameter 'petId' when calling uploadFile"; throw new Error("Missing the required parameter 'petId' when calling uploadFile");
} }

View File

@ -75,7 +75,7 @@
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId == undefined || orderId == null) {
throw "Missing the required parameter 'orderId' when calling deleteOrder"; throw new Error("Missing the required parameter 'orderId' when calling deleteOrder");
} }
@ -160,7 +160,7 @@
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId == undefined || orderId == null) {
throw "Missing the required parameter 'orderId' when calling getOrderById"; throw new Error("Missing the required parameter 'orderId' when calling getOrderById");
} }
@ -206,7 +206,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling placeOrder"; throw new Error("Missing the required parameter 'body' when calling placeOrder");
} }

View File

@ -75,7 +75,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling createUser"; throw new Error("Missing the required parameter 'body' when calling createUser");
} }
@ -119,7 +119,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling createUsersWithArrayInput"; throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput");
} }
@ -163,7 +163,7 @@
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling createUsersWithListInput"; throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput");
} }
@ -207,7 +207,7 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling deleteUser"; throw new Error("Missing the required parameter 'username' when calling deleteUser");
} }
@ -253,7 +253,7 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling getUserByName"; throw new Error("Missing the required parameter 'username' when calling getUserByName");
} }
@ -300,12 +300,12 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling loginUser"; throw new Error("Missing the required parameter 'username' when calling loginUser");
} }
// verify the required parameter 'password' is set // verify the required parameter 'password' is set
if (password == undefined || password == null) { if (password == undefined || password == null) {
throw "Missing the required parameter 'password' when calling loginUser"; throw new Error("Missing the required parameter 'password' when calling loginUser");
} }
@ -390,12 +390,12 @@
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username == undefined || username == null) {
throw "Missing the required parameter 'username' when calling updateUser"; throw new Error("Missing the required parameter 'username' when calling updateUser");
} }
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling updateUser"; throw new Error("Missing the required parameter 'body' when calling updateUser");
} }