[JavaScript] Added *WithHttpInfo methods in 'usePromises' mode to provide a way to get access to HTTP response object (e.g. headers or status code) (#3654) (#4902)

This commit is contained in:
Vlad Frolov 2017-03-03 12:20:52 +02:00 committed by wing328
parent e23a24c138
commit 9516c81ebb
11 changed files with 450 additions and 101 deletions

View File

@ -412,7 +412,7 @@
} else { } else {
try { try {
var data = _this.deserialize(response, returnType); var data = _this.deserialize(response, returnType);
resolve(data); resolve({data, response});
} catch (err) { } catch (err) {
reject(err); reject(err);
} }

View File

@ -50,14 +50,14 @@
* @param {<&vendorExtensions.x-jsdoc-type>} opts.<paramName> <description><#defaultValue> (default to <.>)</defaultValue></required></allParams></hasOptionalParams><^usePromises> * @param {<&vendorExtensions.x-jsdoc-type>} opts.<paramName> <description><#defaultValue> (default to <.>)</defaultValue></required></allParams></hasOptionalParams><^usePromises>
* @param {module:<#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><&apiPackage>/</apiPackage><&classname>~<operationId>Callback} callback The callback function, accepting three arguments: error, data, response<#returnType> * @param {module:<#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><&apiPackage>/</apiPackage><&classname>~<operationId>Callback} callback The callback function, accepting three arguments: error, data, response<#returnType>
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises><#usePromises> * data is of type: {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises><#usePromises>
* @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with data of type {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises> * @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with an object containing data of type {@link <&vendorExtensions.x-jsdoc-type>} and HTTP response</returnType><^returnType>, with an object containing HTTP response</returnType></usePromises>
*/ */
</emitJSDoc> this.<operationId> = function(<vendorExtensions.x-codegen-argList>) {<#hasOptionalParams> </emitJSDoc> this.<operationId><#usePromises>WithHttpInfo</usePromises> = function(<vendorExtensions.x-codegen-argList>) {<#hasOptionalParams>
opts = opts || {};</hasOptionalParams> opts = opts || {};</hasOptionalParams>
var postBody = <#bodyParam><#required><paramName></required><^required>opts['<paramName>']</required></bodyParam><^bodyParam>null</bodyParam>; var postBody = <#bodyParam><#required><paramName></required><^required>opts['<paramName>']</required></bodyParam><^bodyParam>null</bodyParam>;
<#allParams><#required> <#allParams><#required>
// verify the required parameter '<paramName>' is set // verify the required parameter '<paramName>' is set
if (<paramName> == undefined || <paramName> == null) { if (<paramName> === undefined || <paramName> === null) {
throw new Error("Missing the required parameter '<paramName>' when calling <operationId>"); throw new Error("Missing the required parameter '<paramName>' when calling <operationId>");
} }
</required></allParams> </required></allParams>
@ -86,6 +86,26 @@
authNames, contentTypes, accepts, returnType<^usePromises>, callback</usePromises> authNames, contentTypes, accepts, returnType<^usePromises>, callback</usePromises>
); );
} }
<#usePromises>
<#emitJSDoc>
/**<#summary>
* <summary></summary><#notes>
* <notes></notes><#allParams><#required>
* @param {<&vendorExtensions.x-jsdoc-type>} <paramName> <description></required></allParams><#hasOptionalParams>
* @param {Object} opts Optional parameters<#allParams><^required>
* @param {<&vendorExtensions.x-jsdoc-type>} opts.<paramName> <description><#defaultValue> (default to <.>)</defaultValue></required></allParams></hasOptionalParams><^usePromises>
* @param {module:<#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><&apiPackage>/</apiPackage><&classname>~<operationId>Callback} callback The callback function, accepting three arguments: error, data, response<#returnType>
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises><#usePromises>
* @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with data of type {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises>
*/
</emitJSDoc> this.<operationId> = function(<vendorExtensions.x-codegen-argList>) {
return this.<operationId>WithHttpInfo(<vendorExtensions.x-codegen-argList>)
.then(function(response_and_data) {
return response_and_data.data;
});
}
</usePromises>
</operation></operations> }; </operation></operations> };
return exports; return exports;

View File

@ -406,7 +406,7 @@
} else { } else {
try { try {
var data = _this.deserialize(response, returnType); var data = _this.deserialize(response, returnType);
resolve(data); resolve({data, response});
} catch (err) { } catch (err) {
reject(err); reject(err);
} }

View File

@ -50,13 +50,13 @@
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model * To test \&quot;client\&quot; model
* @param {module:model/Client} body client model * @param {module:model/Client} body client model
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Client} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Client} and HTTP response
*/ */
this.testClientModel = function(body) { this.testClientModelWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testClientModel"); throw new Error("Missing the required parameter 'body' when calling testClientModel");
} }
@ -82,6 +82,19 @@
); );
} }
/**
* To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model
* @param {module:model/Client} body client model
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Client}
*/
this.testClientModel = function(body) {
return this.testClientModelWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -101,29 +114,29 @@
* @param {Date} opts.dateTime None * @param {Date} opts.dateTime None
* @param {String} opts.password None * @param {String} opts.password None
* @param {String} opts.callback None * @param {String} opts.callback None
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts) { this.testEndpointParametersWithHttpInfo = function(_number, _double, patternWithoutDelimiter, _byte, opts) {
opts = opts || {}; opts = opts || {};
var postBody = null; var postBody = null;
// verify the required parameter '_number' is set // verify the required parameter '_number' is set
if (_number == undefined || _number == null) { if (_number === undefined || _number === null) {
throw new Error("Missing the required parameter '_number' when calling testEndpointParameters"); throw new Error("Missing the required parameter '_number' when calling testEndpointParameters");
} }
// verify the required parameter '_double' is set // verify the required parameter '_double' is set
if (_double == undefined || _double == null) { if (_double === undefined || _double === null) {
throw new Error("Missing the required parameter '_double' when calling testEndpointParameters"); throw new Error("Missing the required parameter '_double' when calling testEndpointParameters");
} }
// verify the required parameter 'patternWithoutDelimiter' is set // verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) { if (patternWithoutDelimiter === undefined || patternWithoutDelimiter === null) {
throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
} }
// verify the required parameter '_byte' is set // verify the required parameter '_byte' is set
if (_byte == undefined || _byte == null) { if (_byte === undefined || _byte === null) {
throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters"); throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters");
} }
@ -163,6 +176,33 @@
); );
} }
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* @param {Number} _number None
* @param {Number} _double None
* @param {String} patternWithoutDelimiter None
* @param {String} _byte None
* @param {Object} opts Optional parameters
* @param {Number} opts.integer None
* @param {Number} opts.int32 None
* @param {Number} opts.int64 None
* @param {Number} opts._float None
* @param {String} opts._string None
* @param {String} opts.binary None
* @param {Date} opts._date None
* @param {Date} opts.dateTime None
* @param {String} opts.password None
* @param {String} opts.callback None
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts) {
return this.testEndpointParametersWithHttpInfo(_number, _double, patternWithoutDelimiter, _byte, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* To test enum parameters * To test enum parameters
@ -176,9 +216,9 @@
* @param {module:model/String} opts.enumQueryString Query parameter enum test (string) (default to -efg) * @param {module:model/String} opts.enumQueryString Query parameter enum test (string) (default to -efg)
* @param {Number} opts.enumQueryInteger Query parameter enum test (double) * @param {Number} opts.enumQueryInteger Query parameter enum test (double)
* @param {Number} opts.enumQueryDouble Query parameter enum test (double) * @param {Number} opts.enumQueryDouble Query parameter enum test (double)
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.testEnumParameters = function(opts) { this.testEnumParametersWithHttpInfo = function(opts) {
opts = opts || {}; opts = opts || {};
var postBody = null; var postBody = null;
@ -211,6 +251,27 @@
authNames, contentTypes, accepts, returnType authNames, contentTypes, accepts, returnType
); );
} }
/**
* To test enum parameters
* To test enum parameters
* @param {Object} opts Optional parameters
* @param {Array.<module:model/String>} opts.enumFormStringArray Form parameter enum test (string array)
* @param {module:model/String} opts.enumFormString Form parameter enum test (string) (default to -efg)
* @param {Array.<module:model/String>} opts.enumHeaderStringArray Header parameter enum test (string array)
* @param {module:model/String} opts.enumHeaderString Header parameter enum test (string) (default to -efg)
* @param {Array.<module:model/String>} opts.enumQueryStringArray Query parameter enum test (string array)
* @param {module:model/String} opts.enumQueryString Query parameter enum test (string) (default to -efg)
* @param {Number} opts.enumQueryInteger Query parameter enum test (double)
* @param {Number} opts.enumQueryDouble Query parameter enum test (double)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.testEnumParameters = function(opts) {
return this.testEnumParametersWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}; };
return exports; return exports;

View File

@ -50,13 +50,13 @@
* Add a new pet to the store * Add a new pet to the store
* *
* @param {module:model/Pet} body Pet object that needs to be added to the store * @param {module:model/Pet} body Pet object that needs to be added to the store
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.addPet = function(body) { this.addPetWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling addPet"); throw new Error("Missing the required parameter 'body' when calling addPet");
} }
@ -82,6 +82,19 @@
); );
} }
/**
* Add a new pet to the store
*
* @param {module:model/Pet} body Pet object that needs to be added to the store
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.addPet = function(body) {
return this.addPetWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Deletes a pet * Deletes a pet
@ -89,14 +102,14 @@
* @param {Number} petId Pet id to delete * @param {Number} petId Pet id to delete
* @param {Object} opts Optional parameters * @param {Object} opts Optional parameters
* @param {String} opts.apiKey * @param {String} opts.apiKey
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.deletePet = function(petId, opts) { this.deletePetWithHttpInfo = function(petId, opts) {
opts = opts || {}; opts = opts || {};
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling deletePet"); throw new Error("Missing the required parameter 'petId' when calling deletePet");
} }
@ -124,18 +137,33 @@
); );
} }
/**
* Deletes a pet
*
* @param {Number} petId Pet id to delete
* @param {Object} opts Optional parameters
* @param {String} opts.apiKey
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deletePet = function(petId, opts) {
return this.deletePetWithHttpInfo(petId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
* @param {Array.<module:model/String>} status Status values that need to be considered for filter * @param {Array.<module:model/String>} status Status values that need to be considered for filter
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/Pet>} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/Pet>} and HTTP response
*/ */
this.findPetsByStatus = function(status) { this.findPetsByStatusWithHttpInfo = function(status) {
var postBody = null; var postBody = null;
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == undefined || status == null) { if (status === undefined || status === null) {
throw new Error("Missing the required parameter 'status' when calling findPetsByStatus"); throw new Error("Missing the required parameter 'status' when calling findPetsByStatus");
} }
@ -162,18 +190,31 @@
); );
} }
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param {Array.<module:model/String>} status Status values that need to be considered for filter
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/Pet>}
*/
this.findPetsByStatus = function(status) {
return this.findPetsByStatusWithHttpInfo(status)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Finds Pets by tags * Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param {Array.<String>} tags Tags to filter by * @param {Array.<String>} tags Tags to filter by
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/Pet>} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/Pet>} and HTTP response
*/ */
this.findPetsByTags = function(tags) { this.findPetsByTagsWithHttpInfo = function(tags) {
var postBody = null; var postBody = null;
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == undefined || tags == null) { if (tags === undefined || tags === null) {
throw new Error("Missing the required parameter 'tags' when calling findPetsByTags"); throw new Error("Missing the required parameter 'tags' when calling findPetsByTags");
} }
@ -200,18 +241,31 @@
); );
} }
/**
* 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
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/Pet>}
*/
this.findPetsByTags = function(tags) {
return this.findPetsByTagsWithHttpInfo(tags)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Find pet by ID * Find pet by ID
* Returns a single pet * Returns a single pet
* @param {Number} petId ID of pet to return * @param {Number} petId ID of pet to return
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Pet} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Pet} and HTTP response
*/ */
this.getPetById = function(petId) { this.getPetByIdWithHttpInfo = function(petId) {
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling getPetById"); throw new Error("Missing the required parameter 'petId' when calling getPetById");
} }
@ -238,18 +292,31 @@
); );
} }
/**
* Find pet by ID
* Returns a single pet
* @param {Number} petId ID of pet to return
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Pet}
*/
this.getPetById = function(petId) {
return this.getPetByIdWithHttpInfo(petId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Update an existing pet * Update an existing pet
* *
* @param {module:model/Pet} body Pet object that needs to be added to the store * @param {module:model/Pet} body Pet object that needs to be added to the store
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.updatePet = function(body) { this.updatePetWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling updatePet"); throw new Error("Missing the required parameter 'body' when calling updatePet");
} }
@ -275,6 +342,19 @@
); );
} }
/**
* Update an existing pet
*
* @param {module:model/Pet} body Pet object that needs to be added to the store
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.updatePet = function(body) {
return this.updatePetWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
@ -283,14 +363,14 @@
* @param {Object} opts Optional parameters * @param {Object} opts Optional parameters
* @param {String} opts.name Updated name of the pet * @param {String} opts.name Updated name of the pet
* @param {String} opts.status Updated status of the pet * @param {String} opts.status Updated status of the pet
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.updatePetWithForm = function(petId, opts) { this.updatePetWithFormWithHttpInfo = function(petId, opts) {
opts = opts || {}; opts = opts || {};
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm"); throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm");
} }
@ -319,6 +399,22 @@
); );
} }
/**
* Updates a pet in the store with form data
*
* @param {Number} petId ID of pet that needs to be updated
* @param {Object} opts Optional parameters
* @param {String} opts.name Updated name of the pet
* @param {String} opts.status Updated status of the pet
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.updatePetWithForm = function(petId, opts) {
return this.updatePetWithFormWithHttpInfo(petId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* uploads an image * uploads an image
@ -327,14 +423,14 @@
* @param {Object} opts Optional parameters * @param {Object} opts Optional parameters
* @param {String} opts.additionalMetadata Additional data to pass to server * @param {String} opts.additionalMetadata Additional data to pass to server
* @param {File} opts.file file to upload * @param {File} opts.file file to upload
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiResponse} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiResponse} and HTTP response
*/ */
this.uploadFile = function(petId, opts) { this.uploadFileWithHttpInfo = function(petId, opts) {
opts = opts || {}; opts = opts || {};
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling uploadFile"); throw new Error("Missing the required parameter 'petId' when calling uploadFile");
} }
@ -362,6 +458,22 @@
authNames, contentTypes, accepts, returnType authNames, contentTypes, accepts, returnType
); );
} }
/**
* uploads an image
*
* @param {Number} petId ID of pet to update
* @param {Object} opts Optional parameters
* @param {String} opts.additionalMetadata Additional data to pass to server
* @param {File} opts.file file to upload
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiResponse}
*/
this.uploadFile = function(petId, opts) {
return this.uploadFileWithHttpInfo(petId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}; };
return exports; return exports;

View File

@ -50,13 +50,13 @@
* Delete purchase order by ID * Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param {String} orderId ID of the order that needs to be deleted * @param {String} orderId ID of the order that needs to be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.deleteOrder = function(orderId) { this.deleteOrderWithHttpInfo = function(orderId) {
var postBody = null; var postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId === undefined || orderId === null) {
throw new Error("Missing the required parameter 'orderId' when calling deleteOrder"); throw new Error("Missing the required parameter 'orderId' when calling deleteOrder");
} }
@ -83,13 +83,26 @@
); );
} }
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param {String} orderId ID of the order that needs to be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteOrder = function(orderId) {
return this.deleteOrderWithHttpInfo(orderId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object.<String, {'String': 'Number'}>} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object.<String, {'String': 'Number'}>} and HTTP response
*/ */
this.getInventory = function() { this.getInventoryWithHttpInfo = function() {
var postBody = null; var postBody = null;
@ -114,18 +127,30 @@
); );
} }
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object.<String, {'String': 'Number'}>}
*/
this.getInventory = function() {
return this.getInventoryWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Find purchase order by ID * Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions * 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 {Number} orderId ID of pet that needs to be fetched
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Order} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Order} and HTTP response
*/ */
this.getOrderById = function(orderId) { this.getOrderByIdWithHttpInfo = function(orderId) {
var postBody = null; var postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId === undefined || orderId === null) {
throw new Error("Missing the required parameter 'orderId' when calling getOrderById"); throw new Error("Missing the required parameter 'orderId' when calling getOrderById");
} }
@ -152,18 +177,31 @@
); );
} }
/**
* 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
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Order}
*/
this.getOrderById = function(orderId) {
return this.getOrderByIdWithHttpInfo(orderId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Place an order for a pet * Place an order for a pet
* *
* @param {module:model/Order} body order placed for purchasing the pet * @param {module:model/Order} body order placed for purchasing the pet
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Order} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Order} and HTTP response
*/ */
this.placeOrder = function(body) { this.placeOrderWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling placeOrder"); throw new Error("Missing the required parameter 'body' when calling placeOrder");
} }
@ -188,6 +226,19 @@
authNames, contentTypes, accepts, returnType authNames, contentTypes, accepts, returnType
); );
} }
/**
* Place an order for a pet
*
* @param {module:model/Order} body order placed for purchasing the pet
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Order}
*/
this.placeOrder = function(body) {
return this.placeOrderWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}; };
return exports; return exports;

View File

@ -50,13 +50,13 @@
* Create user * Create user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param {module:model/User} body Created user object * @param {module:model/User} body Created user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.createUser = function(body) { this.createUserWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUser"); throw new Error("Missing the required parameter 'body' when calling createUser");
} }
@ -82,18 +82,31 @@
); );
} }
/**
* Create user
* This can only be done by the logged in user.
* @param {module:model/User} body Created user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.createUser = function(body) {
return this.createUserWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
* @param {Array.<module:model/User>} body List of user object * @param {Array.<module:model/User>} body List of user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.createUsersWithArrayInput = function(body) { this.createUsersWithArrayInputWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput"); throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput");
} }
@ -119,18 +132,31 @@
); );
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
* @param {Array.<module:model/User>} body List of user object * @param {Array.<module:model/User>} body List of user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/ */
this.createUsersWithListInput = function(body) { this.createUsersWithArrayInput = function(body) {
return this.createUsersWithArrayInputWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Creates list of users with given input array
*
* @param {Array.<module:model/User>} body List of user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.createUsersWithListInputWithHttpInfo = function(body) {
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput"); throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput");
} }
@ -156,18 +182,31 @@
); );
} }
/**
* Creates list of users with given input array
*
* @param {Array.<module:model/User>} body List of user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.createUsersWithListInput = function(body) {
return this.createUsersWithListInputWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Delete user * Delete user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param {String} username The name that needs to be deleted * @param {String} username The name that needs to be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.deleteUser = function(username) { this.deleteUserWithHttpInfo = function(username) {
var postBody = null; var postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling deleteUser"); throw new Error("Missing the required parameter 'username' when calling deleteUser");
} }
@ -194,18 +233,31 @@
); );
} }
/**
* Delete user
* This can only be done by the logged in user.
* @param {String} username The name that needs to be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteUser = function(username) {
return this.deleteUserWithHttpInfo(username)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Get user by user name * Get user by user name
* *
* @param {String} username The name that needs to be fetched. Use user1 for testing. * @param {String} username The name that needs to be fetched. Use user1 for testing.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/User} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/User} and HTTP response
*/ */
this.getUserByName = function(username) { this.getUserByNameWithHttpInfo = function(username) {
var postBody = null; var postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling getUserByName"); throw new Error("Missing the required parameter 'username' when calling getUserByName");
} }
@ -232,24 +284,37 @@
); );
} }
/**
* Get user by user name
*
* @param {String} username The name that needs to be fetched. Use user1 for testing.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/User}
*/
this.getUserByName = function(username) {
return this.getUserByNameWithHttpInfo(username)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Logs user into the system * Logs user into the system
* *
* @param {String} username The user name for login * @param {String} username The user name for login
* @param {String} password The password for login in clear text * @param {String} password The password for login in clear text
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link 'String'} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link 'String'} and HTTP response
*/ */
this.loginUser = function(username, password) { this.loginUserWithHttpInfo = function(username, password) {
var postBody = null; var postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling loginUser"); throw new Error("Missing the required parameter 'username' when calling loginUser");
} }
// verify the required parameter 'password' is set // verify the required parameter 'password' is set
if (password == undefined || password == null) { if (password === undefined || password === null) {
throw new Error("Missing the required parameter 'password' when calling loginUser"); throw new Error("Missing the required parameter 'password' when calling loginUser");
} }
@ -277,13 +342,27 @@
); );
} }
/**
* Logs user into the system
*
* @param {String} username The user name for login
* @param {String} password The password for login in clear text
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link 'String'}
*/
this.loginUser = function(username, password) {
return this.loginUserWithHttpInfo(username, password)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.logoutUser = function() { this.logoutUserWithHttpInfo = function() {
var postBody = null; var postBody = null;
@ -308,24 +387,36 @@
); );
} }
/**
* Logs out current logged in user session
*
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.logoutUser = function() {
return this.logoutUserWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Updated user * Updated user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param {String} username name that need to be deleted * @param {String} username name that need to be deleted
* @param {module:model/User} body Updated user object * @param {module:model/User} body Updated user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/ */
this.updateUser = function(username, body) { this.updateUserWithHttpInfo = function(username, body) {
var postBody = body; var postBody = body;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling updateUser"); throw new Error("Missing the required parameter 'username' when calling updateUser");
} }
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling updateUser"); throw new Error("Missing the required parameter 'body' when calling updateUser");
} }
@ -351,6 +442,20 @@
authNames, contentTypes, accepts, returnType authNames, contentTypes, accepts, returnType
); );
} }
/**
* Updated user
* This can only be done by the logged in user.
* @param {String} username name that need to be deleted
* @param {module:model/User} body Updated user object
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.updateUser = function(username, body) {
return this.updateUserWithHttpInfo(username, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}; };
return exports; return exports;

View File

@ -64,7 +64,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testClientModel"); throw new Error("Missing the required parameter 'body' when calling testClientModel");
} }
@ -123,22 +123,22 @@
var postBody = null; var postBody = null;
// verify the required parameter '_number' is set // verify the required parameter '_number' is set
if (_number == undefined || _number == null) { if (_number === undefined || _number === null) {
throw new Error("Missing the required parameter '_number' when calling testEndpointParameters"); throw new Error("Missing the required parameter '_number' when calling testEndpointParameters");
} }
// verify the required parameter '_double' is set // verify the required parameter '_double' is set
if (_double == undefined || _double == null) { if (_double === undefined || _double === null) {
throw new Error("Missing the required parameter '_double' when calling testEndpointParameters"); throw new Error("Missing the required parameter '_double' when calling testEndpointParameters");
} }
// verify the required parameter 'patternWithoutDelimiter' is set // verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) { if (patternWithoutDelimiter === undefined || patternWithoutDelimiter === null) {
throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
} }
// verify the required parameter '_byte' is set // verify the required parameter '_byte' is set
if (_byte == undefined || _byte == null) { if (_byte === undefined || _byte === null) {
throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters"); throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters");
} }

View File

@ -63,7 +63,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling addPet"); throw new Error("Missing the required parameter 'body' when calling addPet");
} }
@ -110,7 +110,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling deletePet"); throw new Error("Missing the required parameter 'petId' when calling deletePet");
} }
@ -157,7 +157,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == undefined || status == null) { if (status === undefined || status === null) {
throw new Error("Missing the required parameter 'status' when calling findPetsByStatus"); throw new Error("Missing the required parameter 'status' when calling findPetsByStatus");
} }
@ -203,7 +203,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == undefined || tags == null) { if (tags === undefined || tags === null) {
throw new Error("Missing the required parameter 'tags' when calling findPetsByTags"); throw new Error("Missing the required parameter 'tags' when calling findPetsByTags");
} }
@ -249,7 +249,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling getPetById"); throw new Error("Missing the required parameter 'petId' when calling getPetById");
} }
@ -294,7 +294,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling updatePet"); throw new Error("Missing the required parameter 'body' when calling updatePet");
} }
@ -342,7 +342,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm"); throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm");
} }
@ -394,7 +394,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == undefined || petId == null) { if (petId === undefined || petId === null) {
throw new Error("Missing the required parameter 'petId' when calling uploadFile"); throw new Error("Missing the required parameter 'petId' when calling uploadFile");
} }

View File

@ -63,7 +63,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId === undefined || orderId === null) {
throw new Error("Missing the required parameter 'orderId' when calling deleteOrder"); throw new Error("Missing the required parameter 'orderId' when calling deleteOrder");
} }
@ -148,7 +148,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) { if (orderId === undefined || orderId === null) {
throw new Error("Missing the required parameter 'orderId' when calling getOrderById"); throw new Error("Missing the required parameter 'orderId' when calling getOrderById");
} }
@ -194,7 +194,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling placeOrder"); throw new Error("Missing the required parameter 'body' when calling placeOrder");
} }

View File

@ -63,7 +63,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUser"); throw new Error("Missing the required parameter 'body' when calling createUser");
} }
@ -107,7 +107,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput"); throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput");
} }
@ -151,7 +151,7 @@
var postBody = body; var postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput"); throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput");
} }
@ -195,7 +195,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling deleteUser"); throw new Error("Missing the required parameter 'username' when calling deleteUser");
} }
@ -241,7 +241,7 @@
var postBody = null; var postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling getUserByName"); throw new Error("Missing the required parameter 'username' when calling getUserByName");
} }
@ -288,12 +288,12 @@
var postBody = null; var postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling loginUser"); throw new Error("Missing the required parameter 'username' when calling loginUser");
} }
// verify the required parameter 'password' is set // verify the required parameter 'password' is set
if (password == undefined || password == null) { if (password === undefined || password === null) {
throw new Error("Missing the required parameter 'password' when calling loginUser"); throw new Error("Missing the required parameter 'password' when calling loginUser");
} }
@ -378,12 +378,12 @@
var postBody = body; var postBody = body;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == undefined || username == null) { if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling updateUser"); throw new Error("Missing the required parameter 'username' when calling updateUser");
} }
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == undefined || body == null) { if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling updateUser"); throw new Error("Missing the required parameter 'body' when calling updateUser");
} }