Remove toJson method from JS client

Also regenerates the petstore samples.
This commit is contained in:
delenius 2016-03-01 07:41:31 -08:00
parent ab98f1a39d
commit 067d0a9318
18 changed files with 60 additions and 62 deletions

View File

@ -73,10 +73,6 @@
{{/vars}} {{/vars}}
{{/omitModelMethods}} {{/omitModelMethods}}
{{classname}}.prototype.toJson = function() {
return JSON.stringify(this);
}
{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}} {{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}}

View File

@ -34,6 +34,11 @@
* The default HTTP headers to be included for all API calls. * The default HTTP headers to be included for all API calls.
*/ */
this.defaultHeaders = {}; this.defaultHeaders = {};
/**
* The default HTTP timeout for all API calls.
*/
this.timeout = 60000;
}; };
ApiClient.prototype.paramToString = function paramToString(param) { ApiClient.prototype.paramToString = function paramToString(param) {
@ -234,6 +239,9 @@
// set header parameters // set header parameters
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
//set request timeout
request.timeout(this.timeout);
var contentType = this.jsonPreferredMime(contentTypes); var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) { if (contentType) {
request.type(contentType); request.type(contentType);

View File

@ -87,8 +87,8 @@
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma seperated strings * Multiple status values can be provided with comma separated strings
* @param {[String]} opts['status'] Status values that need to be considered for filter * @param {[String]} opts['status'] Status values that need to be considered for query
* data is of type: [Pet] * data is of type: [Pet]
*/ */
self.findPetsByStatus = function(opts) { self.findPetsByStatus = function(opts) {
@ -321,12 +321,12 @@
* @param {Integer} petId ID of pet that needs to be fetched * @param {Integer} petId ID of pet that needs to be fetched
* data is of type: 'String' * data is of type: 'String'
*/ */
self.getPetByIdWithByteArray = function(petId) { self.petPetIdtestingByteArraytrueGet = function(petId) {
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw "Missing the required parameter 'petId' when calling getPetByIdWithByteArray"; throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet";
} }

View File

@ -21,6 +21,40 @@
var self = this; var self = this;
/**
* Finds orders by status
* A single status value can be provided as a string
* @param {String} opts['status'] Status value that needs to be considered for query
* data is of type: [Order]
*/
self.findOrdersByStatus = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
var queryParams = {
'status': opts['status']
};
var headerParams = {
};
var formParams = {
};
var authNames = ['test_api_client_id', 'test_api_client_secret'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = [Order];
return this.apiClient.callApi(
'/store/findByStatus', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities

View File

@ -69,10 +69,6 @@
Category.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {

View File

@ -143,10 +143,6 @@
Order.prototype.toJson = function() {
return JSON.stringify(this);
}
var StatusEnum = { var StatusEnum = {
/** /**

View File

@ -153,10 +153,6 @@
Pet.prototype.toJson = function() {
return JSON.stringify(this);
}
var StatusEnum = { var StatusEnum = {
/** /**

View File

@ -69,10 +69,6 @@
Tag.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {

View File

@ -179,10 +179,6 @@
User.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {

View File

@ -22,12 +22,12 @@
this.basePath = 'http://petstore.swagger.io/v2'.replace(/\/+$/, ''); this.basePath = 'http://petstore.swagger.io/v2'.replace(/\/+$/, '');
this.authentications = { this.authentications = {
'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'}, 'petstore_auth': {type: 'oauth2'},
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'},
'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'},
'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'}, 'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'},
'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'},
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'},
'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'}, 'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'},
'petstore_auth': {type: 'oauth2'} 'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'}
}; };
/** /**

View File

@ -183,7 +183,7 @@
var formParams = { var formParams = {
}; };
var authNames = ['api_key', 'petstore_auth']; var authNames = ['petstore_auth', 'api_key'];
var contentTypes = []; var contentTypes = [];
var accepts = ['application/json', 'application/xml']; var accepts = ['application/json', 'application/xml'];
var returnType = Pet; var returnType = Pet;
@ -349,7 +349,7 @@
var formParams = { var formParams = {
}; };
var authNames = ['api_key', 'petstore_auth']; var authNames = ['petstore_auth', 'api_key'];
var contentTypes = []; var contentTypes = [];
var accepts = ['application/json', 'application/xml']; var accepts = ['application/json', 'application/xml'];
var returnType = 'String'; var returnType = 'String';

View File

@ -148,7 +148,7 @@
var formParams = { var formParams = {
}; };
var authNames = ['test_api_key_header', 'test_api_key_query']; var authNames = ['test_api_key_query', 'test_api_key_header'];
var contentTypes = []; var contentTypes = [];
var accepts = ['application/json', 'application/xml']; var accepts = ['application/json', 'application/xml'];
var returnType = Order; var returnType = Order;

View File

@ -1,23 +1,23 @@
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define(['./ApiClient', './model/User', './model/Category', './model/Pet', './model/Tag', './model/Order', './api/UserApi', './api/PetApi', './api/StoreApi'], factory); define(['./ApiClient', './model/Order', './model/User', './model/Category', './model/Tag', './model/Pet', './api/UserApi', './api/StoreApi', './api/PetApi'], factory);
} else if (typeof module === 'object' && module.exports) { } else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node. // CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('./ApiClient'), require('./model/User'), require('./model/Category'), require('./model/Pet'), require('./model/Tag'), require('./model/Order'), require('./api/UserApi'), require('./api/PetApi'), require('./api/StoreApi')); module.exports = factory(require('./ApiClient'), require('./model/Order'), require('./model/User'), require('./model/Category'), require('./model/Tag'), require('./model/Pet'), require('./api/UserApi'), require('./api/StoreApi'), require('./api/PetApi'));
} }
}(function(ApiClient, User, Category, Pet, Tag, Order, UserApi, PetApi, StoreApi) { }(function(ApiClient, Order, User, Category, Tag, Pet, UserApi, StoreApi, PetApi) {
'use strict'; 'use strict';
return { return {
ApiClient: ApiClient, ApiClient: ApiClient,
Order: Order,
User: User, User: User,
Category: Category, Category: Category,
Pet: Pet,
Tag: Tag, Tag: Tag,
Order: Order, Pet: Pet,
UserApi: UserApi, UserApi: UserApi,
PetApi: PetApi, StoreApi: StoreApi,
StoreApi: StoreApi PetApi: PetApi
}; };
})); }));

View File

@ -69,10 +69,6 @@
Category.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {

View File

@ -143,10 +143,6 @@
Order.prototype.toJson = function() {
return JSON.stringify(this);
}
var StatusEnum = { var StatusEnum = {
/** /**

View File

@ -153,10 +153,6 @@
Pet.prototype.toJson = function() {
return JSON.stringify(this);
}
var StatusEnum = { var StatusEnum = {
/** /**

View File

@ -69,10 +69,6 @@
Tag.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {

View File

@ -179,10 +179,6 @@
User.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {