forked from loafle/openapi-generator-original
Add option modelPropertyNaming to javascript generator (#299)
* Add option modelPropertyNaming to javascript generator Fixes 6530 * Update Petstore sample
This commit is contained in:
committed by
William Cheng
parent
7126074f49
commit
24104dac35
@@ -1,4 +1,4 @@
|
||||
# SwaggerPetstore.PetApi
|
||||
# OpenApiPetstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
@@ -16,26 +16,22 @@ Method | HTTP request | Description
|
||||
|
||||
<a name="addPet"></a>
|
||||
# **addPet**
|
||||
> addPet(body)
|
||||
> addPet(pet)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
apiInstance.addPet(body).then(() => {
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let pet = new OpenApiPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
apiInstance.addPet(pet).then(() => {
|
||||
console.log('API called successfully.');
|
||||
}, (error) => {
|
||||
console.error(error);
|
||||
@@ -47,7 +43,7 @@ apiInstance.addPet(body).then(() => {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -60,7 +56,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deletePet"></a>
|
||||
# **deletePet**
|
||||
@@ -68,22 +64,18 @@ null (empty response body)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let petId = 789; // Number | Pet id to delete
|
||||
|
||||
let opts = {
|
||||
let opts = {
|
||||
'apiKey': "apiKey_example" // String |
|
||||
};
|
||||
apiInstance.deletePet(petId, opts).then(() => {
|
||||
@@ -112,7 +104,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="findPetsByStatus"></a>
|
||||
# **findPetsByStatus**
|
||||
@@ -124,17 +116,15 @@ Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let status = ["status_example"]; // [String] | Status values that need to be considered for filter
|
||||
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let status = ["'available'"]; // [String] | Status values that need to be considered for filter
|
||||
apiInstance.findPetsByStatus(status).then((data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, (error) => {
|
||||
@@ -172,17 +162,15 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let tags = ["tags_example"]; // [String] | Tags to filter by
|
||||
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let tags = ["inner_example"]; // [String] | Tags to filter by
|
||||
apiInstance.findPetsByTags(tags).then((data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, (error) => {
|
||||
@@ -220,8 +208,8 @@ Returns a single pet
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
let api_key = defaultClient.authentications['api_key'];
|
||||
@@ -229,10 +217,8 @@ 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';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let petId = 789; // Number | ID of pet to return
|
||||
|
||||
apiInstance.getPetById(petId).then((data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, (error) => {
|
||||
@@ -262,26 +248,22 @@ Name | Type | Description | Notes
|
||||
|
||||
<a name="updatePet"></a>
|
||||
# **updatePet**
|
||||
> updatePet(body)
|
||||
> updatePet(pet)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
apiInstance.updatePet(body).then(() => {
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let pet = new OpenApiPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
apiInstance.updatePet(pet).then(() => {
|
||||
console.log('API called successfully.');
|
||||
}, (error) => {
|
||||
console.error(error);
|
||||
@@ -293,7 +275,7 @@ apiInstance.updatePet(body).then(() => {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -306,7 +288,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="updatePetWithForm"></a>
|
||||
# **updatePetWithForm**
|
||||
@@ -314,22 +296,18 @@ null (empty response body)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let petId = 789; // Number | ID of pet that needs to be updated
|
||||
|
||||
let opts = {
|
||||
let opts = {
|
||||
'name': "name_example", // String | Updated name of the pet
|
||||
'status': "status_example" // String | Updated status of the pet
|
||||
};
|
||||
@@ -360,7 +338,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="uploadFile"></a>
|
||||
# **uploadFile**
|
||||
@@ -368,24 +346,20 @@ null (empty response body)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import SwaggerPetstore from 'swagger_petstore';
|
||||
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
import OpenApiPetstore from 'open_api_petstore';
|
||||
let defaultClient = OpenApiPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
let petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
let apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
let apiInstance = new OpenApiPetstore.PetApi();
|
||||
let petId = 789; // Number | ID of pet to update
|
||||
|
||||
let opts = {
|
||||
let opts = {
|
||||
'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server
|
||||
'file': "/path/to/file.txt" // File | file to upload
|
||||
'file': "/path/to/file" // File | file to upload
|
||||
};
|
||||
apiInstance.uploadFile(petId, opts).then((data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
|
||||
Reference in New Issue
Block a user