Update petstore sample for JS-promise client

This commit is contained in:
xhh
2016-05-06 18:02:32 +08:00
parent 3dbab1b893
commit 5acef6d634
40 changed files with 1014 additions and 444 deletions

View File

@@ -16,7 +16,7 @@ Method | HTTP request | Description
<a name="createUser"></a>
# **createUser**
> createUser(opts)
> createUser(body)
Create user
@@ -28,10 +28,9 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'body': new SwaggerPetstore.User() // User | Created user object
};
apiInstance.createUser(opts).then(function() {
var body = new SwaggerPetstore.User(); // User | Created user object
apiInstance.createUser(body).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@@ -43,7 +42,7 @@ apiInstance.createUser(opts).then(function() {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object | [optional]
**body** | [**User**](User.md)| Created user object |
### Return type
@@ -56,11 +55,11 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="createUsersWithArrayInput"></a>
# **createUsersWithArrayInput**
> createUsersWithArrayInput(opts)
> createUsersWithArrayInput(body)
Creates list of users with given input array
@@ -72,10 +71,9 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'body': [new SwaggerPetstore.User()] // [User] | List of user object
};
apiInstance.createUsersWithArrayInput(opts).then(function() {
var body = [new SwaggerPetstore.User()]; // [User] | List of user object
apiInstance.createUsersWithArrayInput(body).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@@ -87,7 +85,7 @@ apiInstance.createUsersWithArrayInput(opts).then(function() {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**[User]**](User.md)| List of user object | [optional]
**body** | [**[User]**](User.md)| List of user object |
### Return type
@@ -100,11 +98,11 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="createUsersWithListInput"></a>
# **createUsersWithListInput**
> createUsersWithListInput(opts)
> createUsersWithListInput(body)
Creates list of users with given input array
@@ -116,10 +114,9 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'body': [new SwaggerPetstore.User()] // [User] | List of user object
};
apiInstance.createUsersWithListInput(opts).then(function() {
var body = [new SwaggerPetstore.User()]; // [User] | List of user object
apiInstance.createUsersWithListInput(body).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@@ -131,7 +128,7 @@ apiInstance.createUsersWithListInput(opts).then(function() {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**[User]**](User.md)| List of user object | [optional]
**body** | [**[User]**](User.md)| List of user object |
### Return type
@@ -144,7 +141,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="deleteUser"></a>
# **deleteUser**
@@ -187,7 +184,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="getUserByName"></a>
# **getUserByName**
@@ -230,11 +227,11 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="loginUser"></a>
# **loginUser**
> &#39;String&#39; loginUser(opts)
> &#39;String&#39; loginUser(username, password)
Logs user into the system
@@ -246,11 +243,11 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'username': "username_example", // String | The user name for login
'password': "password_example" // String | The password for login in clear text
};
apiInstance.loginUser(opts).then(function(data) {
var username = "username_example"; // String | The user name for login
var password = "password_example"; // String | The password for login in clear text
apiInstance.loginUser(username, password).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@@ -262,8 +259,8 @@ apiInstance.loginUser(opts).then(function(data) {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login | [optional]
**password** | **String**| The password for login in clear text | [optional]
**username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text |
### Return type
@@ -276,7 +273,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="logoutUser"></a>
# **logoutUser**
@@ -313,11 +310,11 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="updateUser"></a>
# **updateUser**
> updateUser(username, opts)
> updateUser(username, body)
Updated user
@@ -331,10 +328,9 @@ var apiInstance = new SwaggerPetstore.UserApi();
var username = "username_example"; // String | name that need to be deleted
var opts = {
'body': new SwaggerPetstore.User() // User | Updated user object
};
apiInstance.updateUser(username, opts).then(function() {
var body = new SwaggerPetstore.User(); // User | Updated user object
apiInstance.updateUser(username, body).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@@ -347,7 +343,7 @@ apiInstance.updateUser(username, opts).then(function() {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object | [optional]
**body** | [**User**](User.md)| Updated user object |
### Return type
@@ -360,5 +356,5 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json