forked from loafle/openapi-generator-original
Update petstore sample for JS-promise client
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,10 +33,9 @@ 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
|
||||
};
|
||||
apiInstance.addPet(opts).then(function() {
|
||||
var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
apiInstance.addPet(body).then(function() {
|
||||
console.log('API called successfully.');
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
@@ -48,7 +47,7 @@ apiInstance.addPet(opts).then(function() {
|
||||
|
||||
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
|
||||
|
||||
@@ -61,7 +60,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**
|
||||
@@ -113,15 +112,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
|
||||
@@ -134,10 +133,9 @@ 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
|
||||
};
|
||||
apiInstance.findPetsByStatus(opts).then(function(data) {
|
||||
var status = ["status_example"]; // [String] | Status values that need to be considered for filter
|
||||
|
||||
apiInstance.findPetsByStatus(status).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
@@ -149,7 +147,7 @@ apiInstance.findPetsByStatus(opts).then(function(data) {
|
||||
|
||||
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
|
||||
|
||||
@@ -162,15 +160,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
|
||||
@@ -183,10 +181,9 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var opts = {
|
||||
'tags': ["tags_example"] // [String] | Tags to filter by
|
||||
};
|
||||
apiInstance.findPetsByTags(opts).then(function(data) {
|
||||
var tags = ["tags_example"]; // [String] | Tags to filter by
|
||||
|
||||
apiInstance.findPetsByTags(tags).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
@@ -198,7 +195,7 @@ apiInstance.findPetsByTags(opts).then(function(data) {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**[String]**](String.md)| Tags to filter by | [optional]
|
||||
**tags** | [**[String]**](String.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -211,7 +208,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**
|
||||
@@ -219,7 +216,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
|
||||
@@ -232,13 +229,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
|
||||
|
||||
apiInstance.getPetById(petId).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
@@ -252,7 +245,7 @@ apiInstance.getPetById(petId).then(function(data) {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Integer**| ID of pet that needs to be fetched |
|
||||
**petId** | **Integer**| ID of pet to return |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -260,16 +253,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
|
||||
|
||||
@@ -286,10 +279,9 @@ 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
|
||||
};
|
||||
apiInstance.updatePet(opts).then(function() {
|
||||
var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
apiInstance.updatePet(body).then(function() {
|
||||
console.log('API called successfully.');
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
@@ -301,7 +293,7 @@ apiInstance.updatePet(opts).then(function() {
|
||||
|
||||
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
|
||||
|
||||
@@ -314,7 +306,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**
|
||||
@@ -335,7 +327,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
|
||||
@@ -353,7 +345,7 @@ apiInstance.updatePetWithForm(petId, opts).then(function() {
|
||||
|
||||
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]
|
||||
|
||||
@@ -368,11 +360,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
|
||||
|
||||
@@ -395,8 +387,8 @@ var opts = {
|
||||
'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server
|
||||
'file': "/path/to/file.txt" // File | file to upload
|
||||
};
|
||||
apiInstance.uploadFile(petId, opts).then(function() {
|
||||
console.log('API called successfully.');
|
||||
apiInstance.uploadFile(petId, opts).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
@@ -413,7 +405,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -422,5 +414,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