[core] Initial FeatureSet structures and definitions Add default feature set to DefaultCodegen Initial FeatureSet definitions for: * ada * android * apache2 * asciidoc * aspnetcore * avro * bash * c * clojure * cpp-pistache-server * cpp-qt5-client * cpp-qt5-qhttpengine-server * cpp-restbed-server * cpp-restsdk * cpp-tizen * csharp * csharp-nancyfx * csharp-netcore * cwiki * dart * eiffel * elixir * elm * erlang * flash * fsharp-functions * go Client/Server * graphql-nodejs-express-server * graphql-schema * groovy * haskell * haskell-http-client * java * jmeter * kotlin * kotlin vertx * kotlin-server * kotlin-spring * lua * mysql * nim * nodejs * nodejs-express * objc * ocaml * openapi * openapi-yaml * perl * php * php-laravel * php-lumen * php-silex * php-slim * php-symfony * php-ze-ph * powershell * protobuf * protobuf-schema * python * python-aiohttp * python-blueplanet * python-experimental * r * ror * ruby * ruby * ruby-sinatra * rust * scala-akka * scala-finch * scala-gatling * scala-http-client * scala-lagom * scala-play * scalatra * scalaz * spring * static docs * swift * typescript
11 KiB
openapi.api.PetApi
Load the API package
import 'package:openapi/api.dart';
All URIs are relative to http://petstore.swagger.io/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 |
addPet
addPet(body)
Add a new pet to the store
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var body = Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Pet object that needs to be added to the store |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
deletePet
deletePet(petId, apiKey)
Deletes a pet
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var petId = 789; // int | Pet id to delete
var apiKey = apiKey_example; // String |
try {
api_instance.deletePet(petId, apiKey);
} catch (e) {
print("Exception when calling PetApi->deletePet: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | int | Pet id to delete | [default to null] |
apiKey | String | [optional] [default to null] |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
findPetsByStatus
List findPetsByStatus(status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var status = []; // List<String> | Status values that need to be considered for filter
try {
var result = api_instance.findPetsByStatus(status);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByStatus: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | List<String> | Status values that need to be considered for filter | [default to []] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
findPetsByTags
List findPetsByTags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var tags = []; // List<String> | Tags to filter by
try {
var result = api_instance.findPetsByTags(tags);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByTags: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
tags | List<String> | Tags to filter by | [default to []] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getPetById
Pet getPetById(petId)
Find pet by ID
Returns a single pet
Example
import 'package:openapi/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
var api_instance = PetApi();
var petId = 789; // int | ID of pet to return
try {
var result = api_instance.getPetById(petId);
print(result);
} catch (e) {
print("Exception when calling PetApi->getPetById: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | int | ID of pet to return | [default to null] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
updatePet
updatePet(body)
Update an existing pet
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var body = Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.updatePet(body);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Pet object that needs to be added to the store |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
updatePetWithForm
updatePetWithForm(petId, name, status)
Updates a pet in the store with form data
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var petId = 789; // int | ID of pet that needs to be updated
var name = name_example; // String | Updated name of the pet
var status = status_example; // String | Updated status of the pet
try {
api_instance.updatePetWithForm(petId, name, status);
} catch (e) {
print("Exception when calling PetApi->updatePetWithForm: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | int | ID of pet that needs to be updated | [default to null] |
name | String | Updated name of the pet | [optional] [default to null] |
status | String | Updated status of the pet | [optional] [default to null] |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
uploadFile
ApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
Example
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var petId = 789; // int | ID of pet to update
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
var file = BINARY_DATA_HERE; // MultipartFile | file to upload
try {
var result = api_instance.uploadFile(petId, additionalMetadata, file);
print(result);
} catch (e) {
print("Exception when calling PetApi->uploadFile: $e\n");
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | int | ID of pet to update | [default to null] |
additionalMetadata | String | Additional data to pass to server | [optional] [default to null] |
file | MultipartFile | file to upload | [optional] [default to null] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]