forked from loafle/openapi-generator-original
better enum support for JS
This commit is contained in:
@@ -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 < 10. ID > 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user