forked from loafle/openapi-generator-original
449 lines
13 KiB
JavaScript
449 lines
13 KiB
JavaScript
/**
|
|
* @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-02-02T00:45:38.616-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');
|
|
|
|
/**
|
|
* @constructor
|
|
* @param {!angular.$http} $http
|
|
* @param {!Object} $httpParamSerializer
|
|
* @param {!angular.$injector} $injector
|
|
* @struct
|
|
*/
|
|
API.Client.PetApi = function($http, $httpParamSerializer, $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;
|
|
|
|
/** @private {!Object} */
|
|
this.httpParamSerializer_ = $injector.get('$httpParamSerializer');
|
|
}
|
|
API.Client.PetApi.$inject = ['$http', '$httpParamSerializer', '$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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
/** @type {!Object} */
|
|
var httpRequestParams = {
|
|
method: 'PUT',
|
|
url: path,
|
|
json: true,
|
|
data: opt_body,
|
|
|
|
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
};
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
return this.http_(httpRequestParams);
|
|
}
|
|
|
|
/**
|
|
* 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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
/** @type {!Object} */
|
|
var httpRequestParams = {
|
|
method: 'POST',
|
|
url: path,
|
|
json: true,
|
|
data: opt_body,
|
|
|
|
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
};
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
return this.http_(httpRequestParams);
|
|
}
|
|
|
|
/**
|
|
* 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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
if (opt_status !== undefined) {
|
|
queryParameters['status'] = opt_status;
|
|
}
|
|
|
|
/** @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);
|
|
}
|
|
|
|
/**
|
|
* 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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
if (opt_tags !== undefined) {
|
|
queryParameters['tags'] = opt_tags;
|
|
}
|
|
|
|
/** @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);
|
|
}
|
|
|
|
/**
|
|
* 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} */
|
|
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 getPetById');
|
|
}
|
|
/** @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);
|
|
}
|
|
|
|
/**
|
|
* 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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
/** @type {!Object} */
|
|
var formParams = {};
|
|
|
|
// verify required parameter 'petId' is set
|
|
if (!petId) {
|
|
throw new Error('Missing required parameter petId when calling updatePetWithForm');
|
|
}
|
|
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
|
|
formParams['name'] = opt_name;
|
|
|
|
formParams['status'] = opt_status;
|
|
|
|
/** @type {!Object} */
|
|
var httpRequestParams = {
|
|
method: 'POST',
|
|
url: path,
|
|
json: false,
|
|
|
|
data: this.httpParamSerializer_(formParams),
|
|
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
};
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
return 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);
|
|
}
|
|
|
|
/**
|
|
* 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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
/** @type {!Object} */
|
|
var formParams = {};
|
|
|
|
// verify required parameter 'petId' is set
|
|
if (!petId) {
|
|
throw new Error('Missing required parameter petId when calling uploadFile');
|
|
}
|
|
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
|
|
formParams['additionalMetadata'] = opt_additionalMetadata;
|
|
|
|
formParams['file'] = opt_file;
|
|
|
|
/** @type {!Object} */
|
|
var httpRequestParams = {
|
|
method: 'POST',
|
|
url: path,
|
|
json: false,
|
|
|
|
data: this.httpParamSerializer_(formParams),
|
|
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
};
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
return this.http_(httpRequestParams);
|
|
}
|
|
|
|
/**
|
|
* 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<!string>}
|
|
*/
|
|
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} */
|
|
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 getPetByIdWithByteArray');
|
|
}
|
|
/** @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);
|
|
}
|
|
|
|
/**
|
|
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
|
*
|
|
* @param {!string=} 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} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders);
|
|
/** @type {!Object} */
|
|
var httpRequestParams = {
|
|
method: 'POST',
|
|
url: path,
|
|
json: true,
|
|
data: opt_body,
|
|
|
|
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
};
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
return this.http_(httpRequestParams);
|
|
}
|