update sample for JS closure angular

This commit is contained in:
wing328 2016-04-16 18:11:40 +08:00
parent 7d0c963469
commit 1d5a0e5b33
4 changed files with 512 additions and 581 deletions

View File

@ -79,7 +79,7 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
@Override
public String getHelp() {
return "Generates a Javascript AngularJS client library annotated with Google Closure Compiler annotations" +
return "Generates a Javascript AngularJS client library (beta) annotated with Google Closure Compiler annotations" +
"(https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en)";
}

View File

@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is
* generated.
*
* This is a sample server Petstore server. You can find out more about Swagger at <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
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* Version: 1.0.0
* Generated at: 2016-02-02T00:45:38.616-07:00
* Generated at: 2016-04-16T18:02:07.029+08:00
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/
/**
@ -15,6 +15,7 @@
goog.provide('API.Client.PetApi');
goog.require('API.Client.ApiResponse');
goog.require('API.Client.Pet');
/**
@ -44,49 +45,14 @@ API.Client.PetApi = function($http, $httpParamSerializer, $injector) {
}
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 {!Pet} body Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.addPet = function(opt_body, opt_extraHttpRequestParams) {
API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet';
@ -95,181 +61,17 @@ API.Client.PetApi.prototype.addPet = function(opt_body, opt_extraHttpRequestPara
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling addPet');
}
/** @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 &lt; 10. ID &gt; 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,
data: body,
params: queryParameters,
headers: headerParams
};
@ -309,8 +111,209 @@ API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHtt
method: 'DELETE',
url: path,
json: true,
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 separated strings
* @param {!Array<!string>} 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(status, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet/findByStatus';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'status' is set
if (!status) {
throw new Error('Missing required parameter status when calling findPetsByStatus');
}
if (status !== undefined) {
queryParameters['status'] = 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
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param {!Array<!string>} 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(tags, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet/findByTags';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'tags' is set
if (!tags) {
throw new Error('Missing required parameter tags when calling findPetsByTags');
}
if (tags !== undefined) {
queryParameters['tags'] = 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 single pet
* @param {!number} petId ID of pet to return
* @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);
}
/**
* Update an existing pet
*
* @param {!Pet} body Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling updatePet');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* Updates a pet in the store with form data
*
* @param {!number} 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
};
@ -329,7 +332,7 @@ API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHtt
* @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}
* @return {!angular.$q.Promise<!API.Client.ApiResponse>}
*/
API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata, opt_file, opt_extraHttpRequestParams) {
/** @const {string} */
@ -359,83 +362,7 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata,
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 &#39;Find pet by ID&#39;
* Returns a pet when ID &lt; 10. ID &gt; 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,
data: this.httpParamSerializer_(formParams),
params: queryParameters,
headers: headerParams
};

View File

@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is
* generated.
*
* This is a sample server Petstore server. You can find out more about Swagger at &lt;a href=\&quot;http://swagger.io\&quot;&gt;http://swagger.io&lt;/a&gt; or on irc.freenode.net, #swagger. For this sample, you can use the api key \&quot;special-key\&quot; to test the authorization filters
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.
* Version: 1.0.0
* Generated at: 2016-02-02T00:45:38.616-07:00
* Generated at: 2016-04-16T18:02:07.029+08:00
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/
/**
@ -44,113 +44,6 @@ API.Client.StoreApi = function($http, $httpParamSerializer, $injector) {
}
API.Client.StoreApi.$inject = ['$http', '$httpParamSerializer', '$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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
/** @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);
}
/**
* 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} */
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);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;= 5 or &gt; 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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@ -177,9 +70,112 @@ API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpReque
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* 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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
/** @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 purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param {!number} orderId ID of pet that needs to be fetched
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.Order>}
*/
API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* Place an order for a pet
*
* @param {!Order} 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(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling placeOrder');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'POST',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};

View File

@ -3,9 +3,9 @@
* Do not edit this file by hand or your changes will be lost next time it is
* generated.
*
* This is a sample server Petstore server. You can find out more about Swagger at &lt;a href=\&quot;http://swagger.io\&quot;&gt;http://swagger.io&lt;/a&gt; or on irc.freenode.net, #swagger. For this sample, you can use the api key \&quot;special-key\&quot; to test the authorization filters
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.
* Version: 1.0.0
* Generated at: 2016-02-02T00:45:38.616-07:00
* Generated at: 2016-04-16T18:02:07.029+08:00
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/
/**
@ -47,11 +47,11 @@ API.Client.UserApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/**
* Create user
* This can only be done by the logged in user.
* @param {!User=} opt_body Created user object
* @param {!User} 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) {
API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user';
@ -60,15 +60,17 @@ API.Client.UserApi.prototype.createUser = function(opt_body, opt_extraHttpReques
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling createUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'POST',
url: path,
json: true,
data: opt_body,
params: queryParameters,
data: body,
params: queryParameters,
headers: headerParams
};
@ -82,11 +84,11 @@ API.Client.UserApi.prototype.createUser = function(opt_body, opt_extraHttpReques
/**
* Creates list of users with given input array
*
* @param {!Array<!API.Client.User>=} opt_body List of user object
* @param {!Array<!API.Client.User>} 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) {
API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/createWithArray';
@ -95,15 +97,17 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(opt_body, opt_
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling createUsersWithArrayInput');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'POST',
url: path,
json: true,
data: opt_body,
params: queryParameters,
data: body,
params: queryParameters,
headers: headerParams
};
@ -117,11 +121,11 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(opt_body, opt_
/**
* Creates list of users with given input array
*
* @param {!Array<!API.Client.User>=} opt_body List of user object
* @param {!Array<!API.Client.User>} 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) {
API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/createWithList';
@ -130,171 +134,17 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(opt_body, opt_e
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling createUsersWithListInput');
}
/** @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);
}
/**
* 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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
if (opt_username !== undefined) {
queryParameters['username'] = opt_username;
}
if (opt_password !== undefined) {
queryParameters['password'] = opt_password;
}
/** @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);
}
/**
* 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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
/** @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);
}
/**
* Get user by user name
*
* @param {!string} username The name that needs to be fetched. Use user1 for testing.
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.User>}
*/
API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* 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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling updateUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: opt_body,
params: queryParameters,
data: body,
params: queryParameters,
headers: headerParams
};
@ -331,9 +181,167 @@ API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpReques
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* Get user by user name
*
* @param {!string} username The name that needs to be fetched. Use user1 for testing.
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.User>}
*/
API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return this.http_(httpRequestParams);
}
/**
* Logs user into the system
*
* @param {!string} username The user name for login
* @param {!string} 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(username, password, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/login';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling loginUser');
}
// verify required parameter 'password' is set
if (!password) {
throw new Error('Missing required parameter password when calling loginUser');
}
if (username !== undefined) {
queryParameters['username'] = username;
}
if (password !== undefined) {
queryParameters['password'] = password;
}
/** @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);
}
/**
* 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} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
/** @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);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param {!string} username name that need to be deleted
* @param {!User} 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, body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling updateUser');
}
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling updateUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};