better enum support for JS

This commit is contained in:
wing328
2016-05-02 23:26:47 +08:00
parent 6e8a19bc5b
commit d35e30d578
34 changed files with 933 additions and 263 deletions

View File

@@ -0,0 +1,10 @@
# SwaggerPetstore.ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **Integer** | | [optional]
**type** | **String** | | [optional]
**message** | **String** | | [optional]

View File

@@ -0,0 +1,7 @@
# SwaggerPetstore.EnumClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

View File

@@ -0,0 +1,10 @@
# SwaggerPetstore.EnumTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enumString** | **String** | | [optional]
**enumInteger** | **Integer** | | [optional]
**enumNumber** | **Number** | | [optional]

View File

@@ -0,0 +1,82 @@
# SwaggerPetstore.FakeApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters
<a name="testEndpointParameters"></a>
# **testEndpointParameters**
> testEndpointParameters(_number, _double, _string, _byte, opts)
Fake endpoint for testing various parameters
Fake endpoint for testing various parameters
### Example
```javascript
var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.FakeApi();
var _number = 3.4; // Number | None
var _double = 1.2; // Number | None
var _string = "_string_example"; // String | None
var _byte = "B"; // String | None
var opts = {
'integer': 56, // Integer | None
'int32': 56, // Integer | None
'int64': 789, // Integer | None
'_float': 3.4, // Number | None
'binary': "B", // String | None
'_date': new Date("2013-10-20"), // Date | None
'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None
'password': "password_example" // String | None
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
apiInstance.testEndpointParameters(_number, _double, _string, _byte, opts, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**_number** | **Number**| None |
**_double** | **Number**| None |
**_string** | **String**| None |
**_byte** | **String**| None |
**integer** | **Integer**| None | [optional]
**int32** | **Integer**| None | [optional]
**int64** | **Integer**| None | [optional]
**_float** | **Number**| None | [optional]
**binary** | **String**| None | [optional]
**_date** | **Date**| None | [optional]
**dateTime** | **Date**| None | [optional]
**password** | **String**| None | [optional]
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json

View File

@@ -10,9 +10,11 @@ Name | Type | Description | Notes
**_float** | **Number** | | [optional]
**_double** | **Number** | | [optional]
**_string** | **String** | | [optional]
**_byte** | **String** | | [optional]
**_byte** | **String** | |
**binary** | **String** | | [optional]
**_date** | **Date** | | [optional]
**dateTime** | **String** | | [optional]
**_date** | **Date** | |
**dateTime** | **Date** | | [optional]
**uuid** | **String** | | [optional]
**password** | **String** | |

View File

@@ -5,5 +5,6 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **Integer** | |
**snakeCase** | **Integer** | | [optional]
**property** | **String** | | [optional]

View File

@@ -8,6 +8,6 @@ Name | Type | Description | Notes
**quantity** | **Integer** | | [optional]
**shipDate** | **Date** | | [optional]
**status** | **String** | Order Status | [optional]
**complete** | **Boolean** | | [optional]
**complete** | **Boolean** | | [optional] [default to false]

View File

@@ -16,7 +16,7 @@ Method | HTTP request | Description
<a name="addPet"></a>
# **addPet**
> addPet(opts)
> addPet(body)
Add a new pet to the store
@@ -33,9 +33,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new SwaggerPetstore.PetApi();
var opts = {
'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store
};
var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
var callback = function(error, data, response) {
if (error) {
@@ -44,14 +43,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
apiInstance.addPet(opts, callback);
apiInstance.addPet(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@@ -64,7 +63,7 @@ null (empty response body)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="deletePet"></a>
# **deletePet**
@@ -119,15 +118,15 @@ null (empty response body)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="findPetsByStatus"></a>
# **findPetsByStatus**
> [Pet] findPetsByStatus(opts)
> [Pet] findPetsByStatus(status)
Finds Pets by status
Multiple status values can be provided with comma seperated strings
Multiple status values can be provided with comma separated strings
### Example
```javascript
@@ -140,9 +139,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new SwaggerPetstore.PetApi();
var opts = {
'status': ["available"] // [String] | Status values that need to be considered for filter
};
var status = ["status_example"]; // [String] | Status values that need to be considered for filter
var callback = function(error, data, response) {
if (error) {
@@ -151,14 +149,14 @@ var callback = function(error, data, response) {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.findPetsByStatus(opts, callback);
apiInstance.findPetsByStatus(status, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**[String]**](String.md)| Status values that need to be considered for filter | [optional] [default to available]
**status** | [**[String]**](String.md)| Status values that need to be considered for filter |
### Return type
@@ -171,15 +169,15 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="findPetsByTags"></a>
# **findPetsByTags**
> [Pet] findPetsByTags(opts)
> [Pet] findPetsByTags(tags)
Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```javascript
@@ -192,9 +190,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new SwaggerPetstore.PetApi();
var opts = {
'tags': ["tags_example"] // [String] | Tags to filter by
};
var tags = ["tags_example"]; // [String] | Tags to filter by
var callback = function(error, data, response) {
if (error) {
@@ -203,14 +200,14 @@ var callback = function(error, data, response) {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.findPetsByTags(opts, callback);
apiInstance.findPetsByTags(tags, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**[String]**](String.md)| Tags to filter by | [optional]
**tags** | [**[String]**](String.md)| Tags to filter by |
### Return type
@@ -223,7 +220,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="getPetById"></a>
# **getPetById**
@@ -231,7 +228,7 @@ Name | Type | Description | Notes
Find pet by ID
Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
Returns a single pet
### Example
```javascript
@@ -244,13 +241,9 @@ api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: petstore_auth
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new SwaggerPetstore.PetApi();
var petId = 789; // Integer | ID of pet that needs to be fetched
var petId = 789; // Integer | ID of pet to return
var callback = function(error, data, response) {
@@ -267,7 +260,7 @@ apiInstance.getPetById(petId, callback);
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Integer**| ID of pet that needs to be fetched |
**petId** | **Integer**| ID of pet to return |
### Return type
@@ -275,16 +268,16 @@ Name | Type | Description | Notes
### Authorization
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="updatePet"></a>
# **updatePet**
> updatePet(opts)
> updatePet(body)
Update an existing pet
@@ -301,9 +294,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new SwaggerPetstore.PetApi();
var opts = {
'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store
};
var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
var callback = function(error, data, response) {
if (error) {
@@ -312,14 +304,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
apiInstance.updatePet(opts, callback);
apiInstance.updatePet(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@@ -332,7 +324,7 @@ null (empty response body)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="updatePetWithForm"></a>
# **updatePetWithForm**
@@ -353,7 +345,7 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new SwaggerPetstore.PetApi();
var petId = "petId_example"; // String | ID of pet that needs to be updated
var petId = 789; // Integer | ID of pet that needs to be updated
var opts = {
'name': "name_example", // String | Updated name of the pet
@@ -374,7 +366,7 @@ apiInstance.updatePetWithForm(petId, opts, callback);
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **String**| ID of pet that needs to be updated |
**petId** | **Integer**| ID of pet that needs to be updated |
**name** | **String**| Updated name of the pet | [optional]
**status** | **String**| Updated status of the pet | [optional]
@@ -389,11 +381,11 @@ null (empty response body)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="uploadFile"></a>
# **uploadFile**
> uploadFile(petId, opts)
> ApiResponse uploadFile(petId, opts)
uploads an image
@@ -421,7 +413,7 @@ var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.uploadFile(petId, opts, callback);
@@ -437,7 +429,7 @@ Name | Type | Description | Notes
### Return type
null (empty response body)
[**ApiResponse**](ApiResponse.md)
### Authorization
@@ -446,5 +438,5 @@ null (empty response body)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json, application/xml
- **Accept**: application/json

View File

@@ -54,7 +54,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="getInventory"></a>
# **getInventory**
@@ -101,7 +101,7 @@ This endpoint does not need any parameter.
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/json
<a name="getOrderById"></a>
# **getOrderById**
@@ -117,7 +117,7 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.StoreApi();
var orderId = "orderId_example"; // String | ID of pet that needs to be fetched
var orderId = 789; // Integer | ID of pet that needs to be fetched
var callback = function(error, data, response) {
@@ -134,7 +134,7 @@ apiInstance.getOrderById(orderId, callback);
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of pet that needs to be fetched |
**orderId** | **Integer**| ID of pet that needs to be fetched |
### Return type
@@ -147,11 +147,11 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json
<a name="placeOrder"></a>
# **placeOrder**
> Order placeOrder(opts)
> Order placeOrder(body)
Place an order for a pet
@@ -163,9 +163,8 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.StoreApi();
var opts = {
'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet
};
var body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet
var callback = function(error, data, response) {
if (error) {
@@ -174,14 +173,14 @@ var callback = function(error, data, response) {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.placeOrder(opts, callback);
apiInstance.placeOrder(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional]
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
@@ -194,5 +193,5 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json

View File

@@ -16,7 +16,7 @@ Method | HTTP request | Description
<a name="createUser"></a>
# **createUser**
> createUser(opts)
> createUser(body)
Create user
@@ -28,9 +28,8 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'body': new SwaggerPetstore.User() // User | Created user object
};
var body = new SwaggerPetstore.User(); // User | Created user object
var callback = function(error, data, response) {
if (error) {
@@ -39,14 +38,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
apiInstance.createUser(opts, callback);
apiInstance.createUser(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object | [optional]
**body** | [**User**](User.md)| Created user object |
### Return type
@@ -59,11 +58,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
@@ -75,9 +74,8 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'body': [new SwaggerPetstore.User()] // [User] | List of user object
};
var body = [new SwaggerPetstore.User()]; // [User] | List of user object
var callback = function(error, data, response) {
if (error) {
@@ -86,14 +84,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
apiInstance.createUsersWithArrayInput(opts, callback);
apiInstance.createUsersWithArrayInput(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**[User]**](User.md)| List of user object | [optional]
**body** | [**[User]**](User.md)| List of user object |
### Return type
@@ -106,11 +104,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
@@ -122,9 +120,8 @@ var SwaggerPetstore = require('swagger-petstore');
var apiInstance = new SwaggerPetstore.UserApi();
var opts = {
'body': [new SwaggerPetstore.User()] // [User] | List of user object
};
var body = [new SwaggerPetstore.User()]; // [User] | List of user object
var callback = function(error, data, response) {
if (error) {
@@ -133,14 +130,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
apiInstance.createUsersWithListInput(opts, callback);
apiInstance.createUsersWithListInput(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**[User]**](User.md)| List of user object | [optional]
**body** | [**[User]**](User.md)| List of user object |
### Return type
@@ -153,7 +150,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**
@@ -199,7 +196,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**
@@ -245,11 +242,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
@@ -261,10 +258,10 @@ 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
};
var username = "username_example"; // String | The user name for login
var password = "password_example"; // String | The password for login in clear text
var callback = function(error, data, response) {
if (error) {
@@ -273,15 +270,15 @@ var callback = function(error, data, response) {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.loginUser(opts, callback);
apiInstance.loginUser(username, password, callback);
```
### Parameters
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
@@ -294,7 +291,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**
@@ -334,11 +331,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
@@ -352,9 +349,8 @@ 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
};
var body = new SwaggerPetstore.User(); // User | Updated user object
var callback = function(error, data, response) {
if (error) {
@@ -363,7 +359,7 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
apiInstance.updateUser(username, opts, callback);
apiInstance.updateUser(username, body, callback);
```
### Parameters
@@ -371,7 +367,7 @@ apiInstance.updateUser(username, opts, callback);
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
@@ -384,5 +380,5 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
- **Accept**: application/xml, application/json