forked from loafle/openapi-generator-original
472 lines
18 KiB
JavaScript
472 lines
18 KiB
JavaScript
/**
|
|
* @fileoverview AUTOMATICALLY GENERATED service for API.Client.UserApi.
|
|
* 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 <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
|
* Version: 1.0.0
|
|
* Generated at: 2016-01-27T23:51:03.092-07:00
|
|
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
|
|
*/
|
|
/**
|
|
* @license Apache 2.0
|
|
* http://www.apache.org/licenses/LICENSE-2.0.html
|
|
*/
|
|
|
|
goog.provide('API.Client.UserApi');
|
|
|
|
goog.require('API.Client.User');
|
|
|
|
/**
|
|
* @constructor
|
|
* @param {!angular.$http} $http
|
|
* @param {!angular.$injector} $injector
|
|
* @struct
|
|
*/
|
|
API.Client.UserApi = function($http, $injector) {
|
|
/** @private {!string} */
|
|
this.basePath_ = $injector.has('UserApiBasePath') ?
|
|
/** @type {!string} */ ($injector.get('UserApiBasePath')) :
|
|
'http://petstore.swagger.io/v2';
|
|
|
|
/** @private {!Object<string, string>} */
|
|
this.defaultHeaders_ = $injector.has('UserApiDefaultHeaders') ?
|
|
/** @type {!Object<string, string>} */ (
|
|
$injector.get('UserApiDefaultHeaders')) :
|
|
{};
|
|
|
|
/** @private {!angular.$http} */
|
|
this.http_ = $http;
|
|
}
|
|
API.Client.UserApi.$inject = ['$http', '$injector'];
|
|
|
|
/**
|
|
* Create user
|
|
* This can only be done by the logged in user.
|
|
* @param {!User=} opt_body Created user object
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise}
|
|
*/
|
|
API.Client.UserApi.prototype.createUser = function(opt_body, opt_extraHttpRequestParams) {
|
|
/** @const {!string} */
|
|
var path = this.basePath_ + '/user';
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
data: body,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('POST') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Creates list of users with given input array
|
|
*
|
|
* @param {!Array<!API.Client.User>=} opt_body List of user object
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise}
|
|
*/
|
|
API.Client.UserApi.prototype.createUsersWithArrayInput = function(opt_body, opt_extraHttpRequestParams) {
|
|
/** @const {!string} */
|
|
var path = this.basePath_ + '/user/createWithArray';
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
data: body,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('POST') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Creates list of users with given input array
|
|
*
|
|
* @param {!Array<!API.Client.User>=} opt_body List of user object
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise}
|
|
*/
|
|
API.Client.UserApi.prototype.createUsersWithListInput = function(opt_body, opt_extraHttpRequestParams) {
|
|
/** @const {!string} */
|
|
var path = this.basePath_ + '/user/createWithList';
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
data: body,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('POST') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Logs user into the system
|
|
*
|
|
* @param {!string=} opt_username The user name for login
|
|
* @param {!string=} opt_password The password for login in clear text
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise<!string>}
|
|
*/
|
|
API.Client.UserApi.prototype.loginUser = function(opt_username, opt_password, opt_extraHttpRequestParams) {
|
|
/** @const {!string} */
|
|
var path = this.basePath_ + '/user/login';
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var queryParameters = {};
|
|
if (opt_username !== undefined) {
|
|
queryParameters['username'] = String(opt_username);
|
|
}
|
|
if (opt_password !== undefined) {
|
|
queryParameters['password'] = String(opt_password);
|
|
}
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('GET') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Logs out current logged in user session
|
|
*
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise}
|
|
*/
|
|
API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) {
|
|
/** @const {!string} */
|
|
var path = this.basePath_ + '/user/logout';
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('GET') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('GET') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Updated user
|
|
* This can only be done by the logged in user.
|
|
* @param {!string} username name that need to be deleted
|
|
* @param {!User=} opt_body Updated user object
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise}
|
|
*/
|
|
API.Client.UserApi.prototype.updateUser = function(username, opt_body, opt_extraHttpRequestParams) {
|
|
/** @const {!string} */
|
|
var path = this.basePath_ + '/user/{username}'
|
|
.replace('{' + 'username' + '}', String(username));
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
data: body,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('PUT') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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<string,string>} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object<string,string>} */
|
|
var headerParams = angular.copy(this.defaultHeaders_);
|
|
|
|
/** @type {!angular.$http.Config} */
|
|
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
|
url: path,
|
|
json: true,
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
});
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
// If an opt_extraHttpRequestParams object is passed in, override values
|
|
// set the generated config with the passed in values.
|
|
httpRequestConfig = angular.merge(httpRequestConfig, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
// This whole block is to work around a limitation in closure compiler. It
|
|
// would be better to call the $http service directly as a function, but that
|
|
// isn't permitted since it has methods attached to it. Manually confirmed to
|
|
// compile down to just a single method even with only SIMPLE optimization on.
|
|
// https://github.com/google/closure-compiler/blob/90769b826df65eabfb0211517b0d6d85c0c1c60b/contrib/externs/angular-1.4.js#L1393
|
|
switch ('DELETE') {
|
|
case 'GET':
|
|
return this.http_.get(path, httpRequestConfig);
|
|
case 'HEAD':
|
|
return this.http_.head(path, httpRequestConfig);
|
|
case 'POST':
|
|
return this.http_.post(path, {}, httpRequestConfig);
|
|
case 'PUT':
|
|
return this.http_.put(path, {}, httpRequestConfig);
|
|
case 'DELETE':
|
|
return this.http_.delete(path, httpRequestConfig);
|
|
case 'PATCH':
|
|
return this.http_.patch(path, {}, httpRequestConfig);
|
|
}
|
|
}
|