* Combine javascript and javascript-apollo generator functionality * Combine javascript and javascript-apollo templates * update configs * deprecate javascript-apollo generator * bonus magic string deletion ✨ * update samples * update generator docs * fix: include .babelrc in apollo generation * update samples * update samples * rename javascript-apollo to javascript-apollo-deprecated * fix javascript apollo library template Apollo library now uses the partial_model_generic template file from the ES6 library, as it includes many fixes and improvements (including handling models with ill-named attributes) * update samples * Create javascript-apollo-deprecated.md * Updated javascript generator template's gitignore Updates .gitignore with that from https://github.com/github/gitignore/blob/main/Node.gitignore Main reason for the update is to ignore the 'dist' folder with compiled files by default. * javascript generator: merge api_test template files The only difference is that Apollo is not designed for browser, so having a "if(browser)" check is useless, but doesn't hurt. * update docs * cleanup * avoid possible config clash * update javascript-apollo sample * update javascript-es6 sample I kept the pom.xml from before * update javascript-promise-es6 sample kept pom.xml * update samples
12 KiB
OpenApiPetstore.PetApi
All URIs are relative to http://petstore.swagger.io:80/v2
Method | HTTP request | Description |
---|---|---|
addPet | POST /pet | Add a new pet to the store |
deletePet | DELETE /pet/{petId} | Deletes a pet |
findPetsByStatus | GET /pet/findByStatus | Finds Pets by status |
findPetsByTags | GET /pet/findByTags | Finds Pets by tags |
getPetById | GET /pet/{petId} | Find pet by ID |
updatePet | PUT /pet | Update an existing pet |
updatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
uploadFile | POST /pet/{petId}/uploadImage | uploads an image |
uploadFileWithRequiredFile | POST /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) |
addPet
addPet(pet)
Add a new pet to the store
Example
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 OpenApiPetstore.PetApi();
let pet = new OpenApiPetstore.Pet(); // Pet | Pet object that needs to be added to the store
apiInstance.addPet(pet, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
pet | Pet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
deletePet
deletePet(petId, opts)
Deletes a pet
Example
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 OpenApiPetstore.PetApi();
let petId = 789; // Number | Pet id to delete
let opts = {
'apiKey': "apiKey_example" // String |
};
apiInstance.deletePet(petId, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Number | Pet id to delete | |
apiKey | String | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
findPetsByStatus
[Pet] findPetsByStatus(status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
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 OpenApiPetstore.PetApi();
let status = ["'available'"]; // [String] | Status values that need to be considered for filter
apiInstance.findPetsByStatus(status, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | [String] | Status values that need to be considered for filter |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
findPetsByTags
[Pet] findPetsByTags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
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 OpenApiPetstore.PetApi();
let tags = ["null"]; // [String] | Tags to filter by
apiInstance.findPetsByTags(tags, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
tags | [String] | Tags to filter by |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
getPetById
Pet getPetById(petId)
Find pet by ID
Returns a single pet
Example
import OpenApiPetstore from 'open_api_petstore';
let defaultClient = OpenApiPetstore.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
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 OpenApiPetstore.PetApi();
let petId = 789; // Number | ID of pet to return
apiInstance.getPetById(petId, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Number | ID of pet to return |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
updatePet
updatePet(pet)
Update an existing pet
Example
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 OpenApiPetstore.PetApi();
let pet = new OpenApiPetstore.Pet(); // Pet | Pet object that needs to be added to the store
apiInstance.updatePet(pet, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
pet | Pet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
updatePetWithForm
updatePetWithForm(petId, opts)
Updates a pet in the store with form data
Example
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 OpenApiPetstore.PetApi();
let petId = 789; // Number | ID of pet that needs to be updated
let opts = {
'name': "name_example", // String | Updated name of the pet
'status': "status_example" // String | Updated status of the pet
};
apiInstance.updatePetWithForm(petId, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Number | ID of pet that needs to be updated | |
name | String | Updated name of the pet | [optional] |
status | String | Updated status of the pet | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
uploadFile
ApiResponse uploadFile(petId, opts)
uploads an image
Example
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 OpenApiPetstore.PetApi();
let petId = 789; // Number | ID of pet to update
let opts = {
'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server
'file': "/path/to/file" // File | file to upload
};
apiInstance.uploadFile(petId, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Number | ID of pet to update | |
additionalMetadata | String | Additional data to pass to server | [optional] |
file | File | file to upload | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
uploadFileWithRequiredFile
ApiResponse uploadFileWithRequiredFile(petId, requiredFile, opts)
uploads an image (required)
Example
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 OpenApiPetstore.PetApi();
let petId = 789; // Number | ID of pet to update
let requiredFile = "/path/to/file"; // File | file to upload
let opts = {
'additionalMetadata': "additionalMetadata_example" // String | Additional data to pass to server
};
apiInstance.uploadFileWithRequiredFile(petId, requiredFile, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Number | ID of pet to update | |
requiredFile | File | file to upload | |
additionalMetadata | String | Additional data to pass to server | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json