Merge pull request #2734 from achew22/javascript_closure_angular_types

Improve type checking for closure-angular
This commit is contained in:
wing328 2016-04-28 15:42:45 +08:00
commit b5e5ea6b6e
4 changed files with 324 additions and 284 deletions

View File

@ -47,8 +47,8 @@ goog.require('{{import}}');
/** @private {!angular.$http} */ /** @private {!angular.$http} */
this.http_ = $http; this.http_ = $http;
/** @private {!Object} */ /** @package {!Object} */
this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); this.httpParamSerializer = $injector.get('$httpParamSerializer');
} }
{{package}}.{{classname}}.$inject = ['$http', '$httpParamSerializer', '$injector']; {{package}}.{{classname}}.$inject = ['$http', '$httpParamSerializer', '$injector'];
{{#operation}} {{#operation}}
@ -69,7 +69,7 @@ goog.require('{{import}}');
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
{{#hasFormParams}} {{#hasFormParams}}
/** @type {!Object} */ /** @type {!Object} */
var formParams = {}; var formParams = {};
@ -108,7 +108,7 @@ goog.require('{{import}}');
json: {{#hasFormParams}}false{{/hasFormParams}}{{^hasFormParams}}true{{/hasFormParams}}, json: {{#hasFormParams}}false{{/hasFormParams}}{{^hasFormParams}}true{{/hasFormParams}},
{{#bodyParam}}data: {{^required}}opt_{{/required}}{{paramName}}, {{#bodyParam}}data: {{^required}}opt_{{/required}}{{paramName}},
{{/bodyParam}} {{/bodyParam}}
{{#hasFormParams}}data: this.httpParamSerializer_(formParams), {{#hasFormParams}}data: this.httpParamSerializer(formParams),
{{/hasFormParams}} {{/hasFormParams}}
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
@ -118,7 +118,7 @@ goog.require('{{import}}');
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
{{/operation}} {{/operation}}
{{/operations}} {{/operations}}

View File

@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is * Do not edit this file by hand or your changes will be lost next time it is
* generated. * generated.
* *
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* Version: 1.0.0 * Version: 1.0.0
* Generated at: 2016-04-16T18:02:07.029+08:00 * Generated at: 2016-04-28T06:15:51.482Z
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
@ -40,11 +40,50 @@ API.Client.PetApi = function($http, $httpParamSerializer, $injector) {
/** @private {!angular.$http} */ /** @private {!angular.$http} */
this.http_ = $http; this.http_ = $http;
/** @private {!Object} */ /** @package {!Object} */
this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); this.httpParamSerializer = $injector.get('$httpParamSerializer');
} }
API.Client.PetApi.$inject = ['$http', '$httpParamSerializer', '$injector']; API.Client.PetApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/**
* Update an existing pet
*
* @param {!Pet} body Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling updatePet');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/** /**
* Add a new pet to the store * Add a new pet to the store
* *
@ -60,7 +99,7 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams)
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'body' is set
if (!body) { if (!body) {
throw new Error('Missing required parameter body when calling addPet'); throw new Error('Missing required parameter body when calling addPet');
@ -71,6 +110,8 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams)
url: path, url: path,
json: true, json: true,
data: body, data: body,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -79,47 +120,7 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams)
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Deletes a pet
*
* @param {!number} petId Pet id to delete
* @param {!string=} opt_apiKey
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling deletePet');
}
headerParams['api_key'] = opt_apiKey;
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
} }
/** /**
@ -137,7 +138,7 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'status' is set // verify required parameter 'status' is set
if (!status) { if (!status) {
throw new Error('Missing required parameter status when calling findPetsByStatus'); throw new Error('Missing required parameter status when calling findPetsByStatus');
@ -151,6 +152,8 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq
method: 'GET', method: 'GET',
url: path, url: path,
json: true, json: true,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -159,7 +162,7 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -177,7 +180,7 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'tags' is set // verify required parameter 'tags' is set
if (!tags) { if (!tags) {
throw new Error('Missing required parameter tags when calling findPetsByTags'); throw new Error('Missing required parameter tags when calling findPetsByTags');
@ -191,6 +194,8 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest
method: 'GET', method: 'GET',
url: path, url: path,
json: true, json: true,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -199,7 +204,7 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -218,7 +223,7 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'petId' is set // verify required parameter 'petId' is set
if (!petId) { if (!petId) {
throw new Error('Missing required parameter petId when calling getPetById'); throw new Error('Missing required parameter petId when calling getPetById');
@ -228,6 +233,8 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar
method: 'GET', method: 'GET',
url: path, url: path,
json: true, json: true,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -236,44 +243,7 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Update an existing pet
*
* @param {!Pet} body Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling updatePet');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
} }
/** /**
@ -294,7 +264,7 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
/** @type {!Object} */ /** @type {!Object} */
var formParams = {}; var formParams = {};
@ -313,7 +283,9 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st
method: 'POST', method: 'POST',
url: path, url: path,
json: false, json: false,
data: this.httpParamSerializer_(formParams),
data: this.httpParamSerializer(formParams),
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -322,7 +294,49 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Deletes a pet
*
* @param {!number} petId Pet id to delete
* @param {!string=} opt_apiKey
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling deletePet');
}
headerParams['api_key'] = opt_apiKey;
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -343,7 +357,7 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata,
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
/** @type {!Object} */ /** @type {!Object} */
var formParams = {}; var formParams = {};
@ -362,7 +376,9 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata,
method: 'POST', method: 'POST',
url: path, url: path,
json: false, json: false,
data: this.httpParamSerializer_(formParams),
data: this.httpParamSerializer(formParams),
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -371,5 +387,5 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata,
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }

View File

@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is * Do not edit this file by hand or your changes will be lost next time it is
* generated. * generated.
* *
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* Version: 1.0.0 * Version: 1.0.0
* Generated at: 2016-04-16T18:02:07.029+08:00 * Generated at: 2016-04-28T06:15:51.482Z
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
@ -39,48 +39,11 @@ API.Client.StoreApi = function($http, $httpParamSerializer, $injector) {
/** @private {!angular.$http} */ /** @private {!angular.$http} */
this.http_ = $http; this.http_ = $http;
/** @private {!Object} */ /** @package {!Object} */
this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); this.httpParamSerializer = $injector.get('$httpParamSerializer');
} }
API.Client.StoreApi.$inject = ['$http', '$httpParamSerializer', '$injector']; API.Client.StoreApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/**
* Delete purchase order by ID
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @param {!string} orderId ID of the order that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/** /**
* 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
@ -95,12 +58,14 @@ API.Client.StoreApi.prototype.getInventory = function(opt_extraHttpRequestParams
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'GET', method: 'GET',
url: path, url: path,
json: true, json: true,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -109,44 +74,7 @@ API.Client.StoreApi.prototype.getInventory = function(opt_extraHttpRequestParams
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param {!number} orderId ID of pet that needs to be fetched
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.Order>}
*/
API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
} }
/** /**
@ -164,7 +92,7 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'body' is set
if (!body) { if (!body) {
throw new Error('Missing required parameter body when calling placeOrder'); throw new Error('Missing required parameter body when calling placeOrder');
@ -175,6 +103,8 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa
url: path, url: path,
json: true, json: true,
data: body, data: body,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -183,5 +113,83 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param {!number} orderId ID of pet that needs to be fetched
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.Order>}
*/
API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param {!string} orderId ID of the order that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
} }

View File

@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is * Do not edit this file by hand or your changes will be lost next time it is
* generated. * generated.
* *
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters. * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* Version: 1.0.0 * Version: 1.0.0
* Generated at: 2016-04-16T18:02:07.029+08:00 * Generated at: 2016-04-28T06:15:51.482Z
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
@ -39,8 +39,8 @@ API.Client.UserApi = function($http, $httpParamSerializer, $injector) {
/** @private {!angular.$http} */ /** @private {!angular.$http} */
this.http_ = $http; this.http_ = $http;
/** @private {!Object} */ /** @package {!Object} */
this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); this.httpParamSerializer = $injector.get('$httpParamSerializer');
} }
API.Client.UserApi.$inject = ['$http', '$httpParamSerializer', '$injector']; API.Client.UserApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
@ -59,7 +59,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'body' is set
if (!body) { if (!body) {
throw new Error('Missing required parameter body when calling createUser'); throw new Error('Missing required parameter body when calling createUser');
@ -70,6 +70,8 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
url: path, url: path,
json: true, json: true,
data: body, data: body,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -78,7 +80,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -96,7 +98,7 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'body' is set
if (!body) { if (!body) {
throw new Error('Missing required parameter body when calling createUsersWithArrayInput'); throw new Error('Missing required parameter body when calling createUsersWithArrayInput');
@ -107,6 +109,8 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
url: path, url: path,
json: true, json: true,
data: body, data: body,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -115,7 +119,7 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -133,7 +137,7 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'body' is set
if (!body) { if (!body) {
throw new Error('Missing required parameter body when calling createUsersWithListInput'); throw new Error('Missing required parameter body when calling createUsersWithListInput');
@ -144,6 +148,8 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
url: path, url: path,
json: true, json: true,
data: body, data: body,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -152,81 +158,7 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param {!string} username The name that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling deleteUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* Get user by user name
*
* @param {!string} username The name that needs to be fetched. Use user1 for testing.
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.User>}
*/
API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
} }
/** /**
@ -245,7 +177,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set // verify required parameter 'username' is set
if (!username) { if (!username) {
throw new Error('Missing required parameter username when calling loginUser'); throw new Error('Missing required parameter username when calling loginUser');
@ -267,6 +199,8 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
method: 'GET', method: 'GET',
url: path, url: path,
json: true, json: true,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -275,7 +209,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -292,12 +226,14 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) {
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'GET', method: 'GET',
url: path, url: path,
json: true, json: true,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -306,7 +242,46 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Get user by user name
*
* @param {!string} username The name that needs to be fetched. Use user1 for testing.
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.User>}
*/
API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
} }
/** /**
@ -326,7 +301,7 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
var queryParameters = {}; var queryParameters = {};
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set // verify required parameter 'username' is set
if (!username) { if (!username) {
throw new Error('Missing required parameter username when calling updateUser'); throw new Error('Missing required parameter username when calling updateUser');
@ -341,6 +316,8 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
url: path, url: path,
json: true, json: true,
data: body, data: body,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -349,5 +326,44 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
} }
return this.http_(httpRequestParams); return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param {!string} username The name that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling deleteUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
} }