forked from loafle/openapi-generator-original
update js es6 samples
This commit is contained in:
@@ -7,45 +7,32 @@
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/ApiResponse', 'model/Pet'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/ApiResponse'), require('../model/Pet'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
|
||||
import ApiClient from "../ApiClient";
|
||||
import ApiResponse from '../model/ApiResponse';
|
||||
import Pet from '../model/Pet';
|
||||
|
||||
/**
|
||||
* Pet service.
|
||||
* @module api/PetApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
export default class PetApi {
|
||||
|
||||
/**
|
||||
* Constructs a new PetApi.
|
||||
* @alias module:api/PetApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use,
|
||||
* default to {@link module:ApiClient#instance} if unspecified.
|
||||
*/
|
||||
constructor(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
}
|
||||
root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.ApiResponse, root.SwaggerPetstore.Pet);
|
||||
}
|
||||
}(this, function(ApiClient, ApiResponse, Pet) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Pet service.
|
||||
* @module api/PetApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new PetApi.
|
||||
* @alias module:api/PetApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use,
|
||||
* default to {@link module:ApiClient#instance} if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
|
||||
/**
|
||||
@@ -62,8 +49,8 @@
|
||||
* @param {module:model/Pet} body Pet object that needs to be added to the store
|
||||
* @param {module:api/PetApi~addPetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.addPet = function(body, callback) {
|
||||
var postBody = body;
|
||||
addPet(body, callback) {
|
||||
let postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
@@ -71,19 +58,19 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['application/json', 'application/xml'];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = ['application/json', 'application/xml'];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet', 'POST',
|
||||
@@ -108,9 +95,9 @@
|
||||
* @param {String} opts.apiKey
|
||||
* @param {module:api/PetApi~deletePetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.deletePet = function(petId, opts, callback) {
|
||||
deletePet(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
let postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
@@ -118,21 +105,21 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
'api_key': opts['apiKey']
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = [];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}', 'DELETE',
|
||||
@@ -156,8 +143,8 @@
|
||||
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link Array.<module:model/Pet>}
|
||||
*/
|
||||
this.findPetsByStatus = function(status, callback) {
|
||||
var postBody = null;
|
||||
findPetsByStatus(status, callback) {
|
||||
let postBody = null;
|
||||
|
||||
// verify the required parameter 'status' is set
|
||||
if (status === undefined || status === null) {
|
||||
@@ -165,20 +152,20 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
'status': this.apiClient.buildCollectionParam(status, 'csv')
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = [Pet];
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = [];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = [Pet];
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/findByStatus', 'GET',
|
||||
@@ -202,8 +189,8 @@
|
||||
* @param {module:api/PetApi~findPetsByTagsCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link Array.<module:model/Pet>}
|
||||
*/
|
||||
this.findPetsByTags = function(tags, callback) {
|
||||
var postBody = null;
|
||||
findPetsByTags(tags, callback) {
|
||||
let postBody = null;
|
||||
|
||||
// verify the required parameter 'tags' is set
|
||||
if (tags === undefined || tags === null) {
|
||||
@@ -211,20 +198,20 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
'tags': this.apiClient.buildCollectionParam(tags, 'csv')
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = [Pet];
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = [];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = [Pet];
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/findByTags', 'GET',
|
||||
@@ -248,8 +235,8 @@
|
||||
* @param {module:api/PetApi~getPetByIdCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/Pet}
|
||||
*/
|
||||
this.getPetById = function(petId, callback) {
|
||||
var postBody = null;
|
||||
getPetById(petId, callback) {
|
||||
let postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
@@ -257,20 +244,20 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['api_key'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = Pet;
|
||||
let authNames = ['api_key'];
|
||||
let contentTypes = [];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = Pet;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}', 'GET',
|
||||
@@ -293,8 +280,8 @@
|
||||
* @param {module:model/Pet} body Pet object that needs to be added to the store
|
||||
* @param {module:api/PetApi~updatePetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.updatePet = function(body, callback) {
|
||||
var postBody = body;
|
||||
updatePet(body, callback) {
|
||||
let postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
@@ -302,19 +289,19 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['application/json', 'application/xml'];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = ['application/json', 'application/xml'];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet', 'PUT',
|
||||
@@ -340,9 +327,9 @@
|
||||
* @param {String} opts.status Updated status of the pet
|
||||
* @param {module:api/PetApi~updatePetWithFormCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.updatePetWithForm = function(petId, opts, callback) {
|
||||
updatePetWithForm(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
let postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
@@ -350,22 +337,22 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
'name': opts['name'],
|
||||
'status': opts['status']
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['application/x-www-form-urlencoded'];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = ['application/x-www-form-urlencoded'];
|
||||
let accepts = ['application/xml', 'application/json'];
|
||||
let returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}', 'POST',
|
||||
@@ -392,9 +379,9 @@
|
||||
* @param {module:api/PetApi~uploadFileCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/ApiResponse}
|
||||
*/
|
||||
this.uploadFile = function(petId, opts, callback) {
|
||||
uploadFile(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
let postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
@@ -402,22 +389,22 @@
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
let pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
let queryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
let headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
let formParams = {
|
||||
'additionalMetadata': opts['additionalMetadata'],
|
||||
'file': opts['file']
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['multipart/form-data'];
|
||||
var accepts = ['application/json'];
|
||||
var returnType = ApiResponse;
|
||||
let authNames = ['petstore_auth'];
|
||||
let contentTypes = ['multipart/form-data'];
|
||||
let accepts = ['application/json'];
|
||||
let returnType = ApiResponse;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}/uploadImage', 'POST',
|
||||
@@ -425,7 +412,6 @@
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user