mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Add sample output from Javascript Closure Angular
This commit is contained in:
parent
8ea7cbc79d
commit
af6926bd6f
@ -0,0 +1,19 @@
|
||||
goog.provide('API.Client.Category');
|
||||
|
||||
/**
|
||||
* @record
|
||||
*/
|
||||
API.Client.Category = function() {}
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Category.prototype.id;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Category.prototype.name;
|
||||
|
@ -0,0 +1,50 @@
|
||||
goog.provide('API.Client.Order');
|
||||
|
||||
/**
|
||||
* @record
|
||||
*/
|
||||
API.Client.Order = function() {}
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Order.prototype.id;
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Order.prototype.petId;
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Order.prototype.quantity;
|
||||
|
||||
/**
|
||||
* @type {!Date}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Order.prototype.shipDate;
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Order.prototype.status;
|
||||
|
||||
/**
|
||||
* @type {!boolean}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Order.prototype.complete;
|
||||
|
||||
/** @enum {string} */
|
||||
API.Client.Order.StatusEnum = {
|
||||
placed: 'placed',
|
||||
approved: 'approved',
|
||||
delivered: 'delivered',
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
goog.provide('API.Client.Pet');
|
||||
|
||||
/**
|
||||
* @record
|
||||
*/
|
||||
API.Client.Pet = function() {}
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Pet.prototype.id;
|
||||
|
||||
/**
|
||||
* @type {!API.Client.Category}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Pet.prototype.category;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Pet.prototype.name;
|
||||
|
||||
/**
|
||||
* @type {!Array<!string>}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Pet.prototype.photoUrls;
|
||||
|
||||
/**
|
||||
* @type {!Array<!API.Client.Tag>}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Pet.prototype.tags;
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Pet.prototype.status;
|
||||
|
||||
/** @enum {string} */
|
||||
API.Client.Pet.StatusEnum = {
|
||||
available: 'available',
|
||||
pending: 'pending',
|
||||
sold: 'sold',
|
||||
}
|
@ -0,0 +1,632 @@
|
||||
/**
|
||||
* @fileoverview AUTOMATICALLY GENERATED service for API.Client.PetApi.
|
||||
* 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:29:24.021-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.PetApi');
|
||||
|
||||
goog.require('API.Client.Pet');
|
||||
goog.require('API.Client.binary');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {!angular.$http} $http
|
||||
* @param {!angular.$injector} $injector
|
||||
* @struct
|
||||
*/
|
||||
API.Client.PetApi = function($http, $injector) {
|
||||
/** @private {!string} */
|
||||
this.basePath_ = $injector.has('PetApiBasePath') ?
|
||||
/** @type {!string} */ ($injector.get('PetApiBasePath')) :
|
||||
'http://petstore.swagger.io/v2';
|
||||
|
||||
/** @private {!Object<string, string>} */
|
||||
this.defaultHeaders_ = $injector.has('PetApiDefaultHeaders') ?
|
||||
/** @type {!Object<string, string>} */ (
|
||||
$injector.get('PetApiDefaultHeaders')) :
|
||||
{};
|
||||
|
||||
/** @private {!angular.$http} */
|
||||
this.http_ = $http;
|
||||
}
|
||||
API.Client.PetApi.$inject = ['$http', '$injector'];
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param {!Pet=} opt_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(opt_body, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet';
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param {!Pet=} opt_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.addPet = function(opt_body, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet';
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma seperated strings
|
||||
* @param {!Array<!string>=} opt_status Status values that need to be considered for filter
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise<!Array<!API.Client.Pet>>}
|
||||
*/
|
||||
API.Client.PetApi.prototype.findPetsByStatus = function(opt_status, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet/findByStatus';
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var queryParameters = {};
|
||||
if (opt_status !== undefined) {
|
||||
queryParameters['status'] = String(opt_status);
|
||||
}
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param {!Array<!string>=} opt_tags Tags to filter by
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise<!Array<!API.Client.Pet>>}
|
||||
*/
|
||||
API.Client.PetApi.prototype.findPetsByTags = function(opt_tags, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet/findByTags';
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var queryParameters = {};
|
||||
if (opt_tags !== undefined) {
|
||||
queryParameters['tags'] = String(opt_tags);
|
||||
}
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {!number} petId 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.Pet>}
|
||||
*/
|
||||
API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet/{petId}'
|
||||
.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
* @param {!string} petId ID of pet that needs to be updated
|
||||
* @param {!string=} opt_name Updated name of the pet
|
||||
* @param {!string=} opt_status Updated status of the pet
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise}
|
||||
*/
|
||||
API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_status, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet/{petId}'
|
||||
.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var queryParameters = {};
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var headerParams = angular.copy(this.defaultHeaders_);
|
||||
|
||||
/** @type {!FormData} */
|
||||
var formParams = new FormData();
|
||||
if (opt_name !== undefined) {
|
||||
var name_ = /** @type {?} */ (opt_name);
|
||||
if (name_ instanceof Blob) {
|
||||
formParams.append('name', name_);
|
||||
} else if (typeof name_ === 'string') {
|
||||
formParams.append('name', name_);
|
||||
} else {
|
||||
throw new Error('Forms parameter opt_name is required to be a string or a Blob (https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)');
|
||||
}
|
||||
}
|
||||
if (opt_status !== undefined) {
|
||||
var status_ = /** @type {?} */ (opt_status);
|
||||
if (status_ instanceof Blob) {
|
||||
formParams.append('status', status_);
|
||||
} else if (typeof status_ === 'string') {
|
||||
formParams.append('status', status_);
|
||||
} else {
|
||||
throw new Error('Forms parameter opt_status is required to be a string or a Blob (https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)');
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {!angular.$http.Config} */
|
||||
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
||||
url: path,
|
||||
json: false,
|
||||
data: formParams,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<string,string>} */
|
||||
var queryParameters = {};
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var headerParams = angular.copy(this.defaultHeaders_);
|
||||
if (opt_apiKey !== undefined) {
|
||||
headerParams['api_key'] = opt_apiKey;
|
||||
}
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param {!number} petId ID of pet to update
|
||||
* @param {!string=} opt_additionalMetadata Additional data to pass to server
|
||||
* @param {!Object=} opt_file file to upload
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise}
|
||||
*/
|
||||
API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata, opt_file, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet/{petId}/uploadImage'
|
||||
.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var queryParameters = {};
|
||||
|
||||
/** @type {!Object<string,string>} */
|
||||
var headerParams = angular.copy(this.defaultHeaders_);
|
||||
|
||||
/** @type {!FormData} */
|
||||
var formParams = new FormData();
|
||||
if (opt_additionalMetadata !== undefined) {
|
||||
var additionalMetadata_ = /** @type {?} */ (opt_additionalMetadata);
|
||||
if (additionalMetadata_ instanceof Blob) {
|
||||
formParams.append('additionalMetadata', additionalMetadata_);
|
||||
} else if (typeof additionalMetadata_ === 'string') {
|
||||
formParams.append('additionalMetadata', additionalMetadata_);
|
||||
} else {
|
||||
throw new Error('Forms parameter opt_additionalMetadata is required to be a string or a Blob (https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)');
|
||||
}
|
||||
}
|
||||
if (opt_file !== undefined) {
|
||||
var file_ = /** @type {?} */ (opt_file);
|
||||
if (file_ instanceof Blob) {
|
||||
formParams.append('file', file_);
|
||||
} else if (typeof file_ === 'string') {
|
||||
formParams.append('file', file_);
|
||||
} else {
|
||||
throw new Error('Forms parameter opt_file is required to be a string or a Blob (https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)');
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {!angular.$http.Config} */
|
||||
var httpRequestConfig = /** @type {!angular.$http.Config} */ ({
|
||||
url: path,
|
||||
json: false,
|
||||
data: formParams,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {!number} petId 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.binary>}
|
||||
*/
|
||||
API.Client.PetApi.prototype.getPetByIdWithByteArray = function(petId, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet/{petId}?testing_byte_array=true'
|
||||
.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param {!API.Client.binary=} opt_body Pet object in the form of byte array
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise}
|
||||
*/
|
||||
API.Client.PetApi.prototype.addPetUsingByteArray = function(opt_body, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/pet?testing_byte_array=true';
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
@ -0,0 +1,251 @@
|
||||
/**
|
||||
* @fileoverview AUTOMATICALLY GENERATED service for API.Client.StoreApi.
|
||||
* 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:29:24.021-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.StoreApi');
|
||||
|
||||
goog.require('API.Client.Order');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {!angular.$http} $http
|
||||
* @param {!angular.$injector} $injector
|
||||
* @struct
|
||||
*/
|
||||
API.Client.StoreApi = function($http, $injector) {
|
||||
/** @private {!string} */
|
||||
this.basePath_ = $injector.has('StoreApiBasePath') ?
|
||||
/** @type {!string} */ ($injector.get('StoreApiBasePath')) :
|
||||
'http://petstore.swagger.io/v2';
|
||||
|
||||
/** @private {!Object<string, string>} */
|
||||
this.defaultHeaders_ = $injector.has('StoreApiDefaultHeaders') ?
|
||||
/** @type {!Object<string, string>} */ (
|
||||
$injector.get('StoreApiDefaultHeaders')) :
|
||||
{};
|
||||
|
||||
/** @private {!angular.$http} */
|
||||
this.http_ = $http;
|
||||
}
|
||||
API.Client.StoreApi.$inject = ['$http', '$injector'];
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise<!Object<!string, number>>}
|
||||
*/
|
||||
API.Client.StoreApi.prototype.getInventory = function(opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/store/inventory';
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param {!Order=} opt_body order placed for purchasing the pet
|
||||
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
||||
* @return {!angular.$q.Promise<!API.Client.Order>}
|
||||
*/
|
||||
API.Client.StoreApi.prototype.placeOrder = function(opt_body, opt_extraHttpRequestParams) {
|
||||
/** @const {!string} */
|
||||
var path = this.basePath_ + '/store/order';
|
||||
|
||||
/** @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param {!string} 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<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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<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);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
goog.provide('API.Client.Tag');
|
||||
|
||||
/**
|
||||
* @record
|
||||
*/
|
||||
API.Client.Tag = function() {}
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Tag.prototype.id;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.Tag.prototype.name;
|
||||
|
@ -0,0 +1,56 @@
|
||||
goog.provide('API.Client.User');
|
||||
|
||||
/**
|
||||
* @record
|
||||
*/
|
||||
API.Client.User = function() {}
|
||||
|
||||
/**
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.id;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.username;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.firstName;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.lastName;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.email;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.password;
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.phone;
|
||||
|
||||
/**
|
||||
* User Status
|
||||
* @type {!number}
|
||||
* @export
|
||||
*/
|
||||
API.Client.User.prototype.userStatus;
|
||||
|
@ -0,0 +1,472 @@
|
||||
/**
|
||||
* @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:29:24.021-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');
|
||||
goog.require('java.util.List');
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user