Improve type checking for closure-angular

Closure angular now has more accurate type checking enabled.
This commit is contained in:
Andrew Z Allen
2016-04-28 06:16:43 +00:00
parent f1ba6f5598
commit 8a330e9dad
4 changed files with 324 additions and 284 deletions
@@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is
* 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
* 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
*/
/**
@@ -39,8 +39,8 @@ API.Client.UserApi = function($http, $httpParamSerializer, $injector) {
/** @private {!angular.$http} */
this.http_ = $http;
/** @private {!Object} */
this.httpParamSerializer_ = $injector.get('$httpParamSerializer');
/** @package {!Object} */
this.httpParamSerializer = $injector.get('$httpParamSerializer');
}
API.Client.UserApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
@@ -59,7 +59,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling createUser');
@@ -70,7 +70,9 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@@ -78,7 +80,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
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 = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling createUsersWithArrayInput');
@@ -107,7 +109,9 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@@ -115,7 +119,7 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
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 = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling createUsersWithListInput');
@@ -144,7 +148,9 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@@ -152,81 +158,7 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return 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);
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
@@ -245,7 +177,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling loginUser');
@@ -267,7 +199,9 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@@ -275,7 +209,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
@@ -292,13 +226,15 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) {
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
var headerParams = angular.extend({}, this.defaultHeaders_);
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@@ -306,7 +242,46 @@ API.Client.UserApi.prototype.logoutUser = function(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 = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling updateUser');
@@ -341,7 +316,9 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@@ -349,5 +326,44 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
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);
}