[Dart] test Dart petstore clients in drone.io (#3717)

* test dart 1x in drone

* update dart image

* trigger build failure

* Revert "trigger build failure"

This reverts commit d565f348ba120d9111b7ad2c6f7e3ad077197a26.

* add dart 2 test

* update build runner version

* test dart2

* only test dart jaguar

* remove pubspec.lock

* better wording

* use pub run test

* revert changes in build_runner

* update test in pom.xml

* update samples

* add dart scripts to ensure up-to-date
This commit is contained in:
William Cheng 2019-08-21 18:19:38 +08:00 committed by GitHub
parent 94eb6860aa
commit bb5cd4c42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 959 additions and 1092 deletions

View File

@ -2,6 +2,13 @@ kind: pipeline
name: default
steps:
# test Dart 2.x petstore client
- name: dart2x-test
image: google/dart
commands:
- (cd samples/client/petstore/dart-jaguar/openapi && pub get && pub run build_runner build --delete-conflicting-outputs)
- (cd samples/client/petstore/dart-jaguar/flutter_petstore/openapi && pub get && pub run build_runner build --delete-conflicting-outputs)
- (cd samples/client/petstore/dart2/openapi && pub get && pub run test)
# test Java 11 HTTP client
- name: java11-test
image: hirokimatsumoto/alpine-openjdk-11

View File

@ -59,6 +59,9 @@ declare -a scripts=(
"./bin/apex-petstore.sh"
"./bin/perl-petstore-all.sh"
"./bin/dart-jaguar-petstore.sh"
"./bin/dart-flutter-petstore.sh"
"./bin/dart-petstore.sh"
"./bin/dart2-petstore.sh"
#"./bin/elm-petstore-all.sh"
"./bin/meta-codegen.sh"
# OTHERS

View File

@ -3,7 +3,7 @@
language: dart
dart:
# Install a specific stable release
- "2.2.0"
- "1.24.3"
install:
- pub get

View File

@ -44,13 +44,13 @@ Please follow the [installation procedure](#installation--usage) and then run th
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var pet = Pet(); // Pet | Pet object that needs to be added to the store
var api_instance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(pet);
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
@ -89,8 +89,6 @@ Class | Method | HTTP request | Description
- [ApiResponse](docs//ApiResponse.md)
- [Category](docs//Category.md)
- [InlineObject](docs//InlineObject.md)
- [InlineObject1](docs//InlineObject1.md)
- [Order](docs//Order.md)
- [Pet](docs//Pet.md)
- [Tag](docs//Tag.md)
@ -106,12 +104,6 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key
- **Location**: HTTP header
## auth_cookie
- **Type**: API key
- **API key parameter name**: AUTH_KEY
- **Location**:
## petstore_auth
- **Type**: OAuth

View File

@ -20,7 +20,7 @@ Method | HTTP request | Description
# **addPet**
> addPet(pet)
> addPet(body)
Add a new pet to the store
@ -28,13 +28,13 @@ Add a new pet to the store
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var pet = Pet(); // Pet | Pet object that needs to be added to the store
var api_instance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(pet);
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
@ -44,7 +44,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -70,9 +70,9 @@ Deletes a pet
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var api_instance = new PetApi();
var petId = 789; // int | Pet id to delete
var apiKey = apiKey_example; // String |
@ -116,9 +116,9 @@ Multiple status values can be provided with comma separated strings
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var api_instance = new PetApi();
var status = []; // List<String> | Status values that need to be considered for filter
try {
@ -161,9 +161,9 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var api_instance = new PetApi();
var tags = []; // List<String> | Tags to filter by
try {
@ -206,11 +206,11 @@ Returns a single pet
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer";
var api_instance = PetApi();
var api_instance = new PetApi();
var petId = 789; // int | ID of pet to return
try {
@ -243,7 +243,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **updatePet**
> updatePet(pet)
> updatePet(body)
Update an existing pet
@ -251,13 +251,13 @@ Update an existing pet
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var pet = Pet(); // Pet | Pet object that needs to be added to the store
var api_instance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.updatePet(pet);
api_instance.updatePet(body);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
}
@ -267,7 +267,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -293,9 +293,9 @@ Updates a pet in the store with form data
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var api_instance = new 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
@ -339,9 +339,9 @@ uploads an image
```dart
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
var api_instance = PetApi();
var api_instance = new 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

View File

@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
```dart
import 'package:openapi/api.dart';
var api_instance = StoreApi();
var api_instance = new StoreApi();
var orderId = orderId_example; // String | ID of the order that needs to be deleted
try {
@ -68,11 +68,11 @@ Returns a map of status codes to quantities
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer";
var api_instance = StoreApi();
var api_instance = new StoreApi();
try {
var result = api_instance.getInventory();
@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
```dart
import 'package:openapi/api.dart';
var api_instance = StoreApi();
var api_instance = new StoreApi();
var orderId = 789; // int | ID of pet that needs to be fetched
try {
@ -144,7 +144,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **placeOrder**
> Order placeOrder(order)
> Order placeOrder(body)
Place an order for a pet
@ -152,11 +152,11 @@ Place an order for a pet
```dart
import 'package:openapi/api.dart';
var api_instance = StoreApi();
var order = Order(); // Order | order placed for purchasing the pet
var api_instance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
try {
var result = api_instance.placeOrder(order);
var result = api_instance.placeOrder(body);
print(result);
} catch (e) {
print("Exception when calling StoreApi->placeOrder: $e\n");
@ -167,7 +167,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
@ -179,7 +179,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -20,7 +20,7 @@ Method | HTTP request | Description
# **createUser**
> createUser(user)
> createUser(body)
Create user
@ -29,16 +29,12 @@ This can only be done by the logged in user.
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: auth_cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKeyPrefix = 'Bearer';
var api_instance = UserApi();
var user = User(); // User | Created user object
var api_instance = new UserApi();
var body = new User(); // User | Created user object
try {
api_instance.createUser(user);
api_instance.createUser(body);
} catch (e) {
print("Exception when calling UserApi->createUser: $e\n");
}
@ -48,7 +44,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md)| Created user object |
**body** | [**User**](User.md)| Created user object |
### Return type
@ -56,33 +52,29 @@ void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createUsersWithArrayInput**
> createUsersWithArrayInput(user)
> createUsersWithArrayInput(body)
Creates list of users with given input array
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: auth_cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKeyPrefix = 'Bearer';
var api_instance = UserApi();
var user = [List&lt;User&gt;()]; // List<User> | List of user object
var api_instance = new UserApi();
var body = [new List&lt;User&gt;()]; // List<User> | List of user object
try {
api_instance.createUsersWithArrayInput(user);
api_instance.createUsersWithArrayInput(body);
} catch (e) {
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
}
@ -92,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List&lt;User&gt;**](User.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -100,33 +92,29 @@ void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createUsersWithListInput**
> createUsersWithListInput(user)
> createUsersWithListInput(body)
Creates list of users with given input array
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: auth_cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKeyPrefix = 'Bearer';
var api_instance = UserApi();
var user = [List&lt;User&gt;()]; // List<User> | List of user object
var api_instance = new UserApi();
var body = [new List&lt;User&gt;()]; // List<User> | List of user object
try {
api_instance.createUsersWithListInput(user);
api_instance.createUsersWithListInput(body);
} catch (e) {
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
}
@ -136,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List&lt;User&gt;**](User.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -144,11 +132,11 @@ void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -163,12 +151,8 @@ This can only be done by the logged in user.
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: auth_cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKeyPrefix = 'Bearer';
var api_instance = UserApi();
var api_instance = new UserApi();
var username = username_example; // String | The name that needs to be deleted
try {
@ -190,7 +174,7 @@ void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
No authorization required
### HTTP request headers
@ -208,7 +192,7 @@ Get user by user name
```dart
import 'package:openapi/api.dart';
var api_instance = UserApi();
var api_instance = new UserApi();
var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
try {
@ -249,7 +233,7 @@ Logs user into the system
```dart
import 'package:openapi/api.dart';
var api_instance = UserApi();
var api_instance = new UserApi();
var username = username_example; // String | The user name for login
var password = password_example; // String | The password for login in clear text
@ -291,12 +275,8 @@ Logs out current logged in user session
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: auth_cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKeyPrefix = 'Bearer';
var api_instance = UserApi();
var api_instance = new UserApi();
try {
api_instance.logoutUser();
@ -314,7 +294,7 @@ void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
No authorization required
### HTTP request headers
@ -324,7 +304,7 @@ void (empty response body)
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **updateUser**
> updateUser(username, user)
> updateUser(username, body)
Updated user
@ -333,17 +313,13 @@ This can only be done by the logged in user.
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: auth_cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('auth_cookie').apiKeyPrefix = 'Bearer';
var api_instance = UserApi();
var api_instance = new UserApi();
var username = username_example; // String | name that need to be deleted
var user = User(); // User | Updated user object
var body = new User(); // User | Updated user object
try {
api_instance.updateUser(username, user);
api_instance.updateUser(username, body);
} catch (e) {
print("Exception when calling UserApi->updateUser: $e\n");
}
@ -354,7 +330,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted | [default to null]
**user** | [**User**](User.md)| Updated user object |
**body** | [**User**](User.md)| Updated user object |
### Return type
@ -362,11 +338,11 @@ void (empty response body)
### Authorization
[auth_cookie](../README.md#auth_cookie)
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -18,12 +18,10 @@ part 'api/user_api.dart';
part 'model/api_response.dart';
part 'model/category.dart';
part 'model/inline_object.dart';
part 'model/inline_object1.dart';
part 'model/order.dart';
part 'model/pet.dart';
part 'model/tag.dart';
part 'model/user.dart';
ApiClient defaultApiClient = ApiClient();
ApiClient defaultApiClient = new ApiClient();

View File

@ -10,12 +10,12 @@ class PetApi {
/// Add a new pet to the store
///
///
Future addPet(Pet pet) async {
Object postBody = pet;
Future addPet(Pet body) async {
Object postBody = body;
// verify required params are set
if(pet == null) {
throw ApiException(400, "Missing required param: pet");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -28,12 +28,12 @@ class PetApi {
List<String> contentTypes = ["application/json","application/xml"];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -50,7 +50,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -60,11 +60,11 @@ class PetApi {
///
///
Future deletePet(int petId, { String apiKey }) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(petId == null) {
throw ApiException(400, "Missing required param: petId");
throw new ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -78,12 +78,12 @@ class PetApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -100,7 +100,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -110,11 +110,11 @@ class PetApi {
///
/// Multiple status values can be provided with comma separated strings
Future<List<Pet>> findPetsByStatus(List<String> status) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(status == null) {
throw ApiException(400, "Missing required param: status");
throw new ApiException(400, "Missing required param: status");
}
// create path and map variables
@ -128,12 +128,12 @@ class PetApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -150,7 +150,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
} else {
@ -161,11 +161,11 @@ class PetApi {
///
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Future<List<Pet>> findPetsByTags(List<String> tags) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(tags == null) {
throw ApiException(400, "Missing required param: tags");
throw new ApiException(400, "Missing required param: tags");
}
// create path and map variables
@ -179,12 +179,12 @@ class PetApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -201,7 +201,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
} else {
@ -212,11 +212,11 @@ class PetApi {
///
/// Returns a single pet
Future<Pet> getPetById(int petId) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(petId == null) {
throw ApiException(400, "Missing required param: petId");
throw new ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -229,12 +229,12 @@ class PetApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["api_key"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -251,7 +251,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
} else {
@ -261,12 +261,12 @@ class PetApi {
/// Update an existing pet
///
///
Future updatePet(Pet pet) async {
Object postBody = pet;
Future updatePet(Pet body) async {
Object postBody = body;
// verify required params are set
if(pet == null) {
throw ApiException(400, "Missing required param: pet");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -279,12 +279,12 @@ class PetApi {
List<String> contentTypes = ["application/json","application/xml"];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -301,7 +301,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -311,11 +311,11 @@ class PetApi {
///
///
Future updatePetWithForm(int petId, { String name, String status }) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(petId == null) {
throw ApiException(400, "Missing required param: petId");
throw new ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -328,12 +328,12 @@ class PetApi {
List<String> contentTypes = ["application/x-www-form-urlencoded"];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if (name != null) {
hasFields = true;
mp.fields['name'] = parameterToString(name);
@ -362,7 +362,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -372,11 +372,11 @@ class PetApi {
///
///
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(petId == null) {
throw ApiException(400, "Missing required param: petId");
throw new ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -389,12 +389,12 @@ class PetApi {
List<String> contentTypes = ["multipart/form-data"];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if (additionalMetadata != null) {
hasFields = true;
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
@ -422,7 +422,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
} else {

View File

@ -11,11 +11,11 @@ class StoreApi {
///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future deleteOrder(String orderId) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(orderId == null) {
throw ApiException(400, "Missing required param: orderId");
throw new ApiException(400, "Missing required param: orderId");
}
// create path and map variables
@ -28,12 +28,12 @@ class StoreApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -50,7 +50,7 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -60,7 +60,7 @@ class StoreApi {
///
/// Returns a map of status codes to quantities
Future<Map<String, int>> getInventory() async {
Object postBody;
Object postBody = null;
// verify required params are set
@ -74,12 +74,12 @@ class StoreApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["api_key"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -96,9 +96,9 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
return new Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
;
} else {
return null;
@ -108,11 +108,11 @@ class StoreApi {
///
/// For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
Future<Order> getOrderById(int orderId) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(orderId == null) {
throw ApiException(400, "Missing required param: orderId");
throw new ApiException(400, "Missing required param: orderId");
}
// create path and map variables
@ -125,12 +125,12 @@ class StoreApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -147,7 +147,7 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
} else {
@ -157,12 +157,12 @@ class StoreApi {
/// Place an order for a pet
///
///
Future<Order> placeOrder(Order order) async {
Object postBody = order;
Future<Order> placeOrder(Order body) async {
Object postBody = body;
// verify required params are set
if(order == null) {
throw ApiException(400, "Missing required param: order");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -173,14 +173,14 @@ class StoreApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json"];
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -197,7 +197,7 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
} else {

View File

@ -10,12 +10,12 @@ class UserApi {
/// Create user
///
/// This can only be done by the logged in user.
Future createUser(User user) async {
Object postBody = user;
Future createUser(User body) async {
Object postBody = body;
// verify required params are set
if(user == null) {
throw ApiException(400, "Missing required param: user");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -26,14 +26,14 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json"];
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["auth_cookie"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -50,7 +50,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -59,12 +59,12 @@ class UserApi {
/// Creates list of users with given input array
///
///
Future createUsersWithArrayInput(List<User> user) async {
Object postBody = user;
Future createUsersWithArrayInput(List<User> body) async {
Object postBody = body;
// verify required params are set
if(user == null) {
throw ApiException(400, "Missing required param: user");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -75,14 +75,14 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json"];
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["auth_cookie"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -99,7 +99,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -108,12 +108,12 @@ class UserApi {
/// Creates list of users with given input array
///
///
Future createUsersWithListInput(List<User> user) async {
Object postBody = user;
Future createUsersWithListInput(List<User> body) async {
Object postBody = body;
// verify required params are set
if(user == null) {
throw ApiException(400, "Missing required param: user");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -124,14 +124,14 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json"];
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["auth_cookie"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -148,7 +148,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -158,11 +158,11 @@ class UserApi {
///
/// This can only be done by the logged in user.
Future deleteUser(String username) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(username == null) {
throw ApiException(400, "Missing required param: username");
throw new ApiException(400, "Missing required param: username");
}
// create path and map variables
@ -175,12 +175,12 @@ class UserApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["auth_cookie"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -197,7 +197,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -207,11 +207,11 @@ class UserApi {
///
///
Future<User> getUserByName(String username) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(username == null) {
throw ApiException(400, "Missing required param: username");
throw new ApiException(400, "Missing required param: username");
}
// create path and map variables
@ -224,12 +224,12 @@ class UserApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -246,7 +246,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
} else {
@ -257,14 +257,14 @@ class UserApi {
///
///
Future<String> loginUser(String username, String password) async {
Object postBody;
Object postBody = null;
// verify required params are set
if(username == null) {
throw ApiException(400, "Missing required param: username");
throw new ApiException(400, "Missing required param: username");
}
if(password == null) {
throw ApiException(400, "Missing required param: password");
throw new ApiException(400, "Missing required param: password");
}
// create path and map variables
@ -279,12 +279,12 @@ class UserApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -301,7 +301,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
} else {
@ -312,7 +312,7 @@ class UserApi {
///
///
Future logoutUser() async {
Object postBody;
Object postBody = null;
// verify required params are set
@ -326,12 +326,12 @@ class UserApi {
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["auth_cookie"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -348,7 +348,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -357,15 +357,15 @@ class UserApi {
/// Updated user
///
/// This can only be done by the logged in user.
Future updateUser(String username, User user) async {
Object postBody = user;
Future updateUser(String username, User body) async {
Object postBody = body;
// verify required params are set
if(username == null) {
throw ApiException(400, "Missing required param: username");
throw new ApiException(400, "Missing required param: username");
}
if(user == null) {
throw ApiException(400, "Missing required param: user");
if(body == null) {
throw new ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -376,14 +376,14 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json"];
List<String> contentTypes = [];
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["auth_cookie"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = [];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = MultipartRequest(null, null);
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -400,7 +400,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;

View File

@ -10,19 +10,18 @@ class QueryParam {
class ApiClient {
String basePath;
var client = Client();
var client = new Client();
Map<String, String> _defaultHeaderMap = {};
Map<String, Authentication> _authentications = {};
final _regList = RegExp(r'^List<(.*)>$');
final _regMap = RegExp(r'^Map<String,(.*)>$');
final _RegList = new RegExp(r'^List<(.*)>$');
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
ApiClient({this.basePath = "http://petstore.swagger.io/v2"}) {
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
// Setup authentications (key: authentication name, value: authentication).
_authentications['api_key'] = ApiKeyAuth("header", "api_key");
_authentications['auth_cookie'] = ApiKeyAuth("query", "AUTH_KEY");
_authentications['petstore_auth'] = OAuth();
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
_authentications['petstore_auth'] = new OAuth();
}
void addDefaultHeader(String key, String value) {
@ -41,40 +40,36 @@ class ApiClient {
case 'double':
return value is double ? value : double.parse('$value');
case 'ApiResponse':
return ApiResponse.fromJson(value);
return new ApiResponse.fromJson(value);
case 'Category':
return Category.fromJson(value);
case 'InlineObject':
return InlineObject.fromJson(value);
case 'InlineObject1':
return InlineObject1.fromJson(value);
return new Category.fromJson(value);
case 'Order':
return Order.fromJson(value);
return new Order.fromJson(value);
case 'Pet':
return Pet.fromJson(value);
return new Pet.fromJson(value);
case 'Tag':
return Tag.fromJson(value);
return new Tag.fromJson(value);
case 'User':
return User.fromJson(value);
return new User.fromJson(value);
default:
{
Match match;
if (value is List &&
(match = _regList.firstMatch(targetType)) != null) {
(match = _RegList.firstMatch(targetType)) != null) {
var newTargetType = match[1];
return value.map((v) => _deserialize(v, newTargetType)).toList();
} else if (value is Map &&
(match = _regMap.firstMatch(targetType)) != null) {
(match = _RegMap.firstMatch(targetType)) != null) {
var newTargetType = match[1];
return Map.fromIterables(value.keys,
return new Map.fromIterables(value.keys,
value.values.map((v) => _deserialize(v, newTargetType)));
}
}
}
} on Exception catch (e, stack) {
throw ApiException.withInner(500, 'Exception during deserialization.', e, stack);
} catch (e, stack) {
throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack);
}
throw ApiException(500, 'Could not find a suitable class for deserialization');
throw new ApiException(500, 'Could not find a suitable class for deserialization');
}
dynamic deserialize(String json, String targetType) {
@ -83,7 +78,7 @@ class ApiClient {
if (targetType == 'String') return json;
var decodedJson = jsonDecode(json);
var decodedJson = JSON.decode(json);
return _deserialize(decodedJson, targetType);
}
@ -92,7 +87,7 @@ class ApiClient {
if (obj == null) {
serialized = '';
} else {
serialized = json.encode(obj);
serialized = JSON.encode(obj);
}
return serialized;
}
@ -124,7 +119,7 @@ class ApiClient {
headerParams['Content-Type'] = contentType;
if(body is MultipartRequest) {
var request = MultipartRequest(method, Uri.parse(url));
var request = new MultipartRequest(method, Uri.parse(url));
request.fields.addAll(body.fields);
request.files.addAll(body.files);
request.headers.addAll(body.headers);
@ -153,14 +148,16 @@ class ApiClient {
void _updateParamsForAuth(List<String> authNames, List<QueryParam> queryParams, Map<String, String> headerParams) {
authNames.forEach((authName) {
Authentication auth = _authentications[authName];
if (auth == null) throw ArgumentError("Authentication undefined: " + authName);
if (auth == null) throw new ArgumentError("Authentication undefined: " + authName);
auth.applyToParams(queryParams, headerParams);
});
}
T getAuthentication<T extends Authentication>(String name) {
var authentication = _authentications[name];
return authentication is T ? authentication : null;
void setAccessToken(String accessToken) {
_authentications.forEach((key, auth) {
if (auth is OAuth) {
auth.setAccessToken(accessToken);
}
});
}
}

View File

@ -2,9 +2,9 @@ part of openapi.api;
class ApiException implements Exception {
int code = 0;
String message;
Exception innerException;
StackTrace stackTrace;
String message = null;
Exception innerException = null;
StackTrace stackTrace = null;
ApiException(this.code, this.message);
@ -17,7 +17,7 @@ class ApiException implements Exception {
return "ApiException $code: $message";
}
return "ApiException $code: $message (Inner exception: $innerException)\n\n" +
return "ApiException $code: $message (Inner exception: ${innerException})\n\n" +
stackTrace.toString();
}
}

View File

@ -11,7 +11,7 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
if (name == null || name.isEmpty || value == null) return params;
if (value is! List) {
params.add(QueryParam(name, parameterToString(value)));
params.add(new QueryParam(name, parameterToString(value)));
return params;
}
@ -23,12 +23,12 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
: collectionFormat; // default: csv
if (collectionFormat == "multi") {
return values.map((v) => QueryParam(name, parameterToString(v)));
return values.map((v) => new QueryParam(name, parameterToString(v)));
}
String delimiter = _delimiters[collectionFormat] ?? ",";
params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter)));
params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter)));
return params;
}

View File

@ -4,24 +4,22 @@ class ApiKeyAuth implements Authentication {
final String location;
final String paramName;
String _apiKey;
String apiKey;
String apiKeyPrefix;
set apiKey(String key) => _apiKey = key;
ApiKeyAuth(this.location, this.paramName);
@override
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
String value;
if (apiKeyPrefix != null) {
value = '$apiKeyPrefix $_apiKey';
value = '$apiKeyPrefix $apiKey';
} else {
value = _apiKey;
value = apiKey;
}
if (location == 'query' && value != null) {
queryParams.add(QueryParam(paramName, value));
queryParams.add(new QueryParam(paramName, value));
} else if (location == 'header' && value != null) {
headerParams[paramName] = value;
}

View File

@ -2,15 +2,13 @@ part of openapi.api;
class HttpBasicAuth implements Authentication {
String _username;
String _password;
String username;
String password;
@override
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
String str = (_username == null ? "" : _username) + ":" + (_password == null ? "" : _password);
headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str));
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str));
}
set username(String username) => _username = username;
set password(String password) => _password = password;
}
}

View File

@ -1,16 +1,19 @@
part of openapi.api;
class OAuth implements Authentication {
String _accessToken;
String accessToken;
OAuth({String accessToken}) : _accessToken = accessToken;
OAuth({this.accessToken}) {
}
@override
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
if (_accessToken != null) {
headerParams["Authorization"] = "Bearer $_accessToken";
if (accessToken != null) {
headerParams["Authorization"] = "Bearer " + accessToken;
}
}
set accessToken(String accessToken) => _accessToken = accessToken;
void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
}

View File

@ -19,39 +19,36 @@ class ApiResponse {
if (json['code'] == null) {
code = null;
} else {
code = json['code'];
code = json['code'];
}
if (json['type'] == null) {
type = null;
} else {
type = json['type'];
type = json['type'];
}
if (json['message'] == null) {
message = null;
} else {
message = json['message'];
message = json['message'];
}
}
Map<String, dynamic> toJson() {
Map <String, dynamic> json = {};
if (code != null)
json['code'] = code;
if (type != null)
json['type'] = type;
if (message != null)
json['message'] = message;
return json;
return {
'code': code,
'type': type,
'message': message
};
}
static List<ApiResponse> listFromJson(List<dynamic> json) {
return json == null ? List<ApiResponse>() : json.map((value) => ApiResponse.fromJson(value)).toList();
return json == null ? new List<ApiResponse>() : json.map((value) => new ApiResponse.fromJson(value)).toList();
}
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, ApiResponse>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value));
static Map<String, ApiResponse> mapFromJson(Map<String, Map<String, dynamic>> json) {
var map = new Map<String, ApiResponse>();
if (json != null && json.length > 0) {
json.forEach((String key, Map<String, dynamic> value) => map[key] = new ApiResponse.fromJson(value));
}
return map;
}

View File

@ -17,32 +17,30 @@ class Category {
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
name = json['name'];
}
}
Map<String, dynamic> toJson() {
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (name != null)
json['name'] = name;
return json;
return {
'id': id,
'name': name
};
}
static List<Category> listFromJson(List<dynamic> json) {
return json == null ? List<Category>() : json.map((value) => Category.fromJson(value)).toList();
return json == null ? new List<Category>() : json.map((value) => new Category.fromJson(value)).toList();
}
static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Category>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value));
static Map<String, Category> mapFromJson(Map<String, Map<String, dynamic>> json) {
var map = new Map<String, Category>();
if (json != null && json.length > 0) {
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Category.fromJson(value));
}
return map;
}

View File

@ -26,17 +26,17 @@ class Order {
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
id = json['id'];
}
if (json['petId'] == null) {
petId = null;
} else {
petId = json['petId'];
petId = json['petId'];
}
if (json['quantity'] == null) {
quantity = null;
} else {
quantity = json['quantity'];
quantity = json['quantity'];
}
if (json['shipDate'] == null) {
shipDate = null;
@ -46,40 +46,34 @@ class Order {
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
status = json['status'];
}
if (json['complete'] == null) {
complete = null;
} else {
complete = json['complete'];
complete = json['complete'];
}
}
Map<String, dynamic> toJson() {
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (petId != null)
json['petId'] = petId;
if (quantity != null)
json['quantity'] = quantity;
if (shipDate != null)
json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String();
if (status != null)
json['status'] = status;
if (complete != null)
json['complete'] = complete;
return json;
return {
'id': id,
'petId': petId,
'quantity': quantity,
'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(),
'status': status,
'complete': complete
};
}
static List<Order> listFromJson(List<dynamic> json) {
return json == null ? List<Order>() : json.map((value) => Order.fromJson(value)).toList();
return json == null ? new List<Order>() : json.map((value) => new Order.fromJson(value)).toList();
}
static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Order>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value));
static Map<String, Order> mapFromJson(Map<String, Map<String, dynamic>> json) {
var map = new Map<String, Order>();
if (json != null && json.length > 0) {
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Order.fromJson(value));
}
return map;
}

View File

@ -26,22 +26,22 @@ class Pet {
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
id = json['id'];
}
if (json['category'] == null) {
category = null;
} else {
category = Category.fromJson(json['category']);
category = new Category.fromJson(json['category']);
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
name = json['name'];
}
if (json['photoUrls'] == null) {
photoUrls = null;
} else {
photoUrls = (json['photoUrls'] as List).cast<String>();
photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList();
}
if (json['tags'] == null) {
tags = null;
@ -51,35 +51,29 @@ class Pet {
if (json['status'] == null) {
status = null;
} else {
status = json['status'];
status = json['status'];
}
}
Map<String, dynamic> toJson() {
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (category != null)
json['category'] = category;
if (name != null)
json['name'] = name;
if (photoUrls != null)
json['photoUrls'] = photoUrls;
if (tags != null)
json['tags'] = tags;
if (status != null)
json['status'] = status;
return json;
return {
'id': id,
'category': category,
'name': name,
'photoUrls': photoUrls,
'tags': tags,
'status': status
};
}
static List<Pet> listFromJson(List<dynamic> json) {
return json == null ? List<Pet>() : json.map((value) => Pet.fromJson(value)).toList();
return json == null ? new List<Pet>() : json.map((value) => new Pet.fromJson(value)).toList();
}
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Pet>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value));
static Map<String, Pet> mapFromJson(Map<String, Map<String, dynamic>> json) {
var map = new Map<String, Pet>();
if (json != null && json.length > 0) {
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Pet.fromJson(value));
}
return map;
}

View File

@ -17,32 +17,30 @@ class Tag {
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
id = json['id'];
}
if (json['name'] == null) {
name = null;
} else {
name = json['name'];
name = json['name'];
}
}
Map<String, dynamic> toJson() {
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (name != null)
json['name'] = name;
return json;
return {
'id': id,
'name': name
};
}
static List<Tag> listFromJson(List<dynamic> json) {
return json == null ? List<Tag>() : json.map((value) => Tag.fromJson(value)).toList();
return json == null ? new List<Tag>() : json.map((value) => new Tag.fromJson(value)).toList();
}
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Tag>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value));
static Map<String, Tag> mapFromJson(Map<String, Map<String, dynamic>> json) {
var map = new Map<String, Tag>();
if (json != null && json.length > 0) {
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Tag.fromJson(value));
}
return map;
}

View File

@ -29,74 +29,66 @@ class User {
if (json['id'] == null) {
id = null;
} else {
id = json['id'];
id = json['id'];
}
if (json['username'] == null) {
username = null;
} else {
username = json['username'];
username = json['username'];
}
if (json['firstName'] == null) {
firstName = null;
} else {
firstName = json['firstName'];
firstName = json['firstName'];
}
if (json['lastName'] == null) {
lastName = null;
} else {
lastName = json['lastName'];
lastName = json['lastName'];
}
if (json['email'] == null) {
email = null;
} else {
email = json['email'];
email = json['email'];
}
if (json['password'] == null) {
password = null;
} else {
password = json['password'];
password = json['password'];
}
if (json['phone'] == null) {
phone = null;
} else {
phone = json['phone'];
phone = json['phone'];
}
if (json['userStatus'] == null) {
userStatus = null;
} else {
userStatus = json['userStatus'];
userStatus = json['userStatus'];
}
}
Map<String, dynamic> toJson() {
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (username != null)
json['username'] = username;
if (firstName != null)
json['firstName'] = firstName;
if (lastName != null)
json['lastName'] = lastName;
if (email != null)
json['email'] = email;
if (password != null)
json['password'] = password;
if (phone != null)
json['phone'] = phone;
if (userStatus != null)
json['userStatus'] = userStatus;
return json;
return {
'id': id,
'username': username,
'firstName': firstName,
'lastName': lastName,
'email': email,
'password': password,
'phone': phone,
'userStatus': userStatus
};
}
static List<User> listFromJson(List<dynamic> json) {
return json == null ? List<User>() : json.map((value) => User.fromJson(value)).toList();
return json == null ? new List<User>() : json.map((value) => new User.fromJson(value)).toList();
}
static Map<String, User> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, User>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = User.fromJson(value));
static Map<String, User> mapFromJson(Map<String, Map<String, dynamic>> json) {
var map = new Map<String, User>();
if (json != null && json.length > 0) {
json.forEach((String key, Map<String, dynamic> value) => map[key] = new User.fromJson(value));
}
return map;
}

View File

@ -1,9 +1,7 @@
name: openapi
version: 1.0.0
description: OpenAPI API client
environment:
sdk: '>=2.0.0 <3.0.0'
dependencies:
http: '>=0.12.0 <0.13.0'
http: '>=0.11.1 <0.13.0'
dev_dependencies:
test: ^1.3.0

View File

@ -1 +1 @@
4.0.0-SNAPSHOT
4.1.1-SNAPSHOT

View File

@ -0,0 +1,11 @@
# https://docs.travis-ci.com/user/languages/dart/
#
language: dart
dart:
# Install a specific stable release
- "2.2.0"
install:
- pub get
script:
- pub run test

View File

@ -46,8 +46,8 @@ 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 = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
var api_instance = PetApi();
var body = Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);

View File

@ -30,8 +30,8 @@ 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 = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
var api_instance = PetApi();
var body = Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);
@ -72,7 +72,7 @@ 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 = new PetApi();
var api_instance = PetApi();
var petId = 789; // int | Pet id to delete
var apiKey = apiKey_example; // String |
@ -118,7 +118,7 @@ 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 = new PetApi();
var api_instance = PetApi();
var status = []; // List<String> | Status values that need to be considered for filter
try {
@ -163,7 +163,7 @@ 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 = new PetApi();
var api_instance = PetApi();
var tags = []; // List<String> | Tags to filter by
try {
@ -210,7 +210,7 @@ import 'package:openapi/api.dart';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
var api_instance = new PetApi();
var api_instance = PetApi();
var petId = 789; // int | ID of pet to return
try {
@ -253,8 +253,8 @@ 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 = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
var api_instance = PetApi();
var body = Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.updatePet(body);
@ -295,7 +295,7 @@ 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 = new PetApi();
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
@ -341,7 +341,7 @@ 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 = new PetApi();
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

View File

@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
```dart
import 'package:openapi/api.dart';
var api_instance = new StoreApi();
var api_instance = StoreApi();
var orderId = orderId_example; // String | ID of the order that needs to be deleted
try {
@ -72,7 +72,7 @@ import 'package:openapi/api.dart';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
var api_instance = new StoreApi();
var api_instance = StoreApi();
try {
var result = api_instance.getInventory();
@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
```dart
import 'package:openapi/api.dart';
var api_instance = new StoreApi();
var api_instance = StoreApi();
var orderId = 789; // int | ID of pet that needs to be fetched
try {
@ -152,8 +152,8 @@ Place an order for a pet
```dart
import 'package:openapi/api.dart';
var api_instance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
var api_instance = StoreApi();
var body = Order(); // Order | order placed for purchasing the pet
try {
var result = api_instance.placeOrder(body);

View File

@ -30,8 +30,8 @@ This can only be done by the logged in user.
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var body = new User(); // User | Created user object
var api_instance = UserApi();
var body = User(); // User | Created user object
try {
api_instance.createUser(body);
@ -70,8 +70,8 @@ Creates list of users with given input array
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var body = [new List&lt;User&gt;()]; // List<User> | List of user object
var api_instance = UserApi();
var body = [List&lt;User&gt;()]; // List<User> | List of user object
try {
api_instance.createUsersWithArrayInput(body);
@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -110,8 +110,8 @@ Creates list of users with given input array
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var body = [new List&lt;User&gt;()]; // List<User> | List of user object
var api_instance = UserApi();
var body = [List&lt;User&gt;()]; // List<User> | List of user object
try {
api_instance.createUsersWithListInput(body);
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -152,7 +152,7 @@ This can only be done by the logged in user.
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var api_instance = UserApi();
var username = username_example; // String | The name that needs to be deleted
try {
@ -192,7 +192,7 @@ Get user by user name
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var api_instance = UserApi();
var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
try {
@ -233,7 +233,7 @@ Logs user into the system
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var api_instance = UserApi();
var username = username_example; // String | The user name for login
var password = password_example; // String | The password for login in clear text
@ -276,7 +276,7 @@ Logs out current logged in user session
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var api_instance = UserApi();
try {
api_instance.logoutUser();
@ -314,9 +314,9 @@ This can only be done by the logged in user.
```dart
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var api_instance = UserApi();
var username = username_example; // String | name that need to be deleted
var body = new User(); // User | Updated user object
var body = User(); // User | Updated user object
try {
api_instance.updateUser(username, body);

View File

@ -15,7 +15,7 @@ class PetApi {
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -33,7 +33,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -50,7 +50,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -64,7 +64,7 @@ class PetApi {
// verify required params are set
if(petId == null) {
throw new ApiException(400, "Missing required param: petId");
throw ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -83,7 +83,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -100,7 +100,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -114,7 +114,7 @@ class PetApi {
// verify required params are set
if(status == null) {
throw new ApiException(400, "Missing required param: status");
throw ApiException(400, "Missing required param: status");
}
// create path and map variables
@ -133,7 +133,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -150,7 +150,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
} else {
@ -165,7 +165,7 @@ class PetApi {
// verify required params are set
if(tags == null) {
throw new ApiException(400, "Missing required param: tags");
throw ApiException(400, "Missing required param: tags");
}
// create path and map variables
@ -184,7 +184,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -201,7 +201,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
} else {
@ -216,7 +216,7 @@ class PetApi {
// verify required params are set
if(petId == null) {
throw new ApiException(400, "Missing required param: petId");
throw ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -234,7 +234,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -251,7 +251,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
} else {
@ -266,7 +266,7 @@ class PetApi {
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -284,7 +284,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -301,7 +301,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -315,7 +315,7 @@ class PetApi {
// verify required params are set
if(petId == null) {
throw new ApiException(400, "Missing required param: petId");
throw ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -333,7 +333,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if (name != null) {
hasFields = true;
mp.fields['name'] = parameterToString(name);
@ -362,7 +362,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -376,7 +376,7 @@ class PetApi {
// verify required params are set
if(petId == null) {
throw new ApiException(400, "Missing required param: petId");
throw ApiException(400, "Missing required param: petId");
}
// create path and map variables
@ -394,7 +394,7 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if (additionalMetadata != null) {
hasFields = true;
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
@ -422,7 +422,7 @@ class PetApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
} else {

View File

@ -15,7 +15,7 @@ class StoreApi {
// verify required params are set
if(orderId == null) {
throw new ApiException(400, "Missing required param: orderId");
throw ApiException(400, "Missing required param: orderId");
}
// create path and map variables
@ -33,7 +33,7 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -50,7 +50,7 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -79,7 +79,7 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -96,9 +96,9 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return new Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
return Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
;
} else {
return null;
@ -112,7 +112,7 @@ class StoreApi {
// verify required params are set
if(orderId == null) {
throw new ApiException(400, "Missing required param: orderId");
throw ApiException(400, "Missing required param: orderId");
}
// create path and map variables
@ -130,7 +130,7 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -147,7 +147,7 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
} else {
@ -162,7 +162,7 @@ class StoreApi {
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -180,7 +180,7 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -197,7 +197,7 @@ class StoreApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
} else {

View File

@ -15,7 +15,7 @@ class UserApi {
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -33,7 +33,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -50,7 +50,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -64,7 +64,7 @@ class UserApi {
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -82,7 +82,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -99,7 +99,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -113,7 +113,7 @@ class UserApi {
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -131,7 +131,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -148,7 +148,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -162,7 +162,7 @@ class UserApi {
// verify required params are set
if(username == null) {
throw new ApiException(400, "Missing required param: username");
throw ApiException(400, "Missing required param: username");
}
// create path and map variables
@ -180,7 +180,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -197,7 +197,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -211,7 +211,7 @@ class UserApi {
// verify required params are set
if(username == null) {
throw new ApiException(400, "Missing required param: username");
throw ApiException(400, "Missing required param: username");
}
// create path and map variables
@ -229,7 +229,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -246,7 +246,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
} else {
@ -261,10 +261,10 @@ class UserApi {
// verify required params are set
if(username == null) {
throw new ApiException(400, "Missing required param: username");
throw ApiException(400, "Missing required param: username");
}
if(password == null) {
throw new ApiException(400, "Missing required param: password");
throw ApiException(400, "Missing required param: password");
}
// create path and map variables
@ -284,7 +284,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -301,7 +301,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
} else {
@ -331,7 +331,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -348,7 +348,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;
@ -362,10 +362,10 @@ class UserApi {
// verify required params are set
if(username == null) {
throw new ApiException(400, "Missing required param: username");
throw ApiException(400, "Missing required param: username");
}
if(body == null) {
throw new ApiException(400, "Missing required param: body");
throw ApiException(400, "Missing required param: body");
}
// create path and map variables
@ -383,7 +383,7 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
MultipartRequest mp = MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
@ -400,7 +400,7 @@ class UserApi {
authNames);
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, _decodeBodyBytes(response));
} else if(response.body != null) {
} else {
return;

View File

@ -18,7 +18,7 @@ class ApiClient {
final _regList = RegExp(r'^List<(.*)>$');
final _regMap = RegExp(r'^Map<String,(.*)>$');
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
ApiClient({this.basePath = "http://petstore.swagger.io/v2"}) {
// Setup authentications (key: authentication name, value: authentication).
_authentications['api_key'] = ApiKeyAuth("header", "api_key");
_authentications['petstore_auth'] = OAuth();

View File

@ -34,21 +34,24 @@ class ApiResponse {
}
Map<String, dynamic> toJson() {
return {
'code': code,
'type': type,
'message': message
};
Map <String, dynamic> json = {};
if (code != null)
json['code'] = code;
if (type != null)
json['type'] = type;
if (message != null)
json['message'] = message;
return json;
}
static List<ApiResponse> listFromJson(List<dynamic> json) {
return json == null ? new List<ApiResponse>() : json.map((value) => new ApiResponse.fromJson(value)).toList();
return json == null ? List<ApiResponse>() : json.map((value) => ApiResponse.fromJson(value)).toList();
}
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, ApiResponse>();
var map = Map<String, ApiResponse>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new ApiResponse.fromJson(value));
json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value));
}
return map;
}

View File

@ -27,20 +27,22 @@ class Category {
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name
};
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (name != null)
json['name'] = name;
return json;
}
static List<Category> listFromJson(List<dynamic> json) {
return json == null ? new List<Category>() : json.map((value) => new Category.fromJson(value)).toList();
return json == null ? List<Category>() : json.map((value) => Category.fromJson(value)).toList();
}
static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Category>();
var map = Map<String, Category>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Category.fromJson(value));
json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value));
}
return map;
}

View File

@ -56,24 +56,30 @@ class Order {
}
Map<String, dynamic> toJson() {
return {
'id': id,
'petId': petId,
'quantity': quantity,
'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(),
'status': status,
'complete': complete
};
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (petId != null)
json['petId'] = petId;
if (quantity != null)
json['quantity'] = quantity;
if (shipDate != null)
json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String();
if (status != null)
json['status'] = status;
if (complete != null)
json['complete'] = complete;
return json;
}
static List<Order> listFromJson(List<dynamic> json) {
return json == null ? new List<Order>() : json.map((value) => new Order.fromJson(value)).toList();
return json == null ? List<Order>() : json.map((value) => Order.fromJson(value)).toList();
}
static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Order>();
var map = Map<String, Order>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Order.fromJson(value));
json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value));
}
return map;
}

View File

@ -31,7 +31,7 @@ class Pet {
if (json['category'] == null) {
category = null;
} else {
category = new Category.fromJson(json['category']);
category = Category.fromJson(json['category']);
}
if (json['name'] == null) {
name = null;
@ -56,24 +56,30 @@ class Pet {
}
Map<String, dynamic> toJson() {
return {
'id': id,
'category': category,
'name': name,
'photoUrls': photoUrls,
'tags': tags,
'status': status
};
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (category != null)
json['category'] = category;
if (name != null)
json['name'] = name;
if (photoUrls != null)
json['photoUrls'] = photoUrls;
if (tags != null)
json['tags'] = tags;
if (status != null)
json['status'] = status;
return json;
}
static List<Pet> listFromJson(List<dynamic> json) {
return json == null ? new List<Pet>() : json.map((value) => new Pet.fromJson(value)).toList();
return json == null ? List<Pet>() : json.map((value) => Pet.fromJson(value)).toList();
}
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Pet>();
var map = Map<String, Pet>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Pet.fromJson(value));
json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value));
}
return map;
}

View File

@ -27,20 +27,22 @@ class Tag {
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name
};
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (name != null)
json['name'] = name;
return json;
}
static List<Tag> listFromJson(List<dynamic> json) {
return json == null ? new List<Tag>() : json.map((value) => new Tag.fromJson(value)).toList();
return json == null ? List<Tag>() : json.map((value) => Tag.fromJson(value)).toList();
}
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Tag>();
var map = Map<String, Tag>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Tag.fromJson(value));
json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value));
}
return map;
}

View File

@ -69,26 +69,34 @@ class User {
}
Map<String, dynamic> toJson() {
return {
'id': id,
'username': username,
'firstName': firstName,
'lastName': lastName,
'email': email,
'password': password,
'phone': phone,
'userStatus': userStatus
};
Map <String, dynamic> json = {};
if (id != null)
json['id'] = id;
if (username != null)
json['username'] = username;
if (firstName != null)
json['firstName'] = firstName;
if (lastName != null)
json['lastName'] = lastName;
if (email != null)
json['email'] = email;
if (password != null)
json['password'] = password;
if (phone != null)
json['phone'] = phone;
if (userStatus != null)
json['userStatus'] = userStatus;
return json;
}
static List<User> listFromJson(List<dynamic> json) {
return json == null ? new List<User>() : json.map((value) => new User.fromJson(value)).toList();
return json == null ? List<User>() : json.map((value) => User.fromJson(value)).toList();
}
static Map<String, User> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, User>();
var map = Map<String, User>();
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new User.fromJson(value));
json.forEach((String key, dynamic value) => map[key] = User.fromJson(value));
}
return map;
}

View File

@ -4,4 +4,6 @@ description: OpenAPI API client
environment:
sdk: '>=2.0.0 <3.0.0'
dependencies:
http: '>=0.11.1 <0.12.0'
http: '>=0.12.0 <0.13.0'
dev_dependencies:
test: ^1.3.0

View File

@ -0,0 +1,27 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for ApiResponse
void main() {
var instance = ApiResponse();
group('test ApiResponse', () {
// int code (default value: null)
test('to test the property `code`', () async {
// TODO
});
// String type (default value: null)
test('to test the property `type`', () async {
// TODO
});
// String message (default value: null)
test('to test the property `message`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,22 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for Category
void main() {
var instance = Category();
group('test Category', () {
// int id (default value: null)
test('to test the property `id`', () async {
// TODO
});
// String name (default value: null)
test('to test the property `name`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,43 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for Order
void main() {
var instance = Order();
group('test Order', () {
// int id (default value: null)
test('to test the property `id`', () async {
// TODO
});
// int petId (default value: null)
test('to test the property `petId`', () async {
// TODO
});
// int quantity (default value: null)
test('to test the property `quantity`', () async {
// TODO
});
// DateTime shipDate (default value: null)
test('to test the property `shipDate`', () async {
// TODO
});
// Order Status
// String status (default value: null)
test('to test the property `status`', () async {
// TODO
});
// bool complete (default value: false)
test('to test the property `complete`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,73 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
/// tests for PetApi
void main() {
var instance = PetApi();
group('tests for PetApi', () {
// Add a new pet to the store
//
//Future addPet(Pet body) async
test('test addPet', () async {
// TODO
});
// Deletes a pet
//
//Future deletePet(int petId, { String apiKey }) async
test('test deletePet', () async {
// TODO
});
// Finds Pets by status
//
// Multiple status values can be provided with comma separated strings
//
//Future<List<Pet>> findPetsByStatus(List<String> status) async
test('test findPetsByStatus', () async {
// TODO
});
// Finds Pets by tags
//
// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
//
//Future<List<Pet>> findPetsByTags(List<String> tags) async
test('test findPetsByTags', () async {
// TODO
});
// Find pet by ID
//
// Returns a single pet
//
//Future<Pet> getPetById(int petId) async
test('test getPetById', () async {
// TODO
});
// Update an existing pet
//
//Future updatePet(Pet body) async
test('test updatePet', () async {
// TODO
});
// Updates a pet in the store with form data
//
//Future updatePetWithForm(int petId, { String name, String status }) async
test('test updatePetWithForm', () async {
// TODO
});
// uploads an image
//
//Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async
test('test uploadFile', () async {
// TODO
});
});
}

View File

@ -0,0 +1,43 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for Pet
void main() {
var instance = Pet();
group('test Pet', () {
// int id (default value: null)
test('to test the property `id`', () async {
// TODO
});
// Category category (default value: null)
test('to test the property `category`', () async {
// TODO
});
// String name (default value: null)
test('to test the property `name`', () async {
// TODO
});
// List<String> photoUrls (default value: [])
test('to test the property `photoUrls`', () async {
// TODO
});
// List<Tag> tags (default value: [])
test('to test the property `tags`', () async {
// TODO
});
// pet status in the store
// String status (default value: null)
test('to test the property `status`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,45 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
/// tests for StoreApi
void main() {
var instance = StoreApi();
group('tests for StoreApi', () {
// Delete purchase order by ID
//
// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
//
//Future deleteOrder(String orderId) async
test('test deleteOrder', () async {
// TODO
});
// Returns pet inventories by status
//
// Returns a map of status codes to quantities
//
//Future<Map<String, int>> getInventory() async
test('test getInventory', () async {
// TODO
});
// Find purchase order by ID
//
// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
//
//Future<Order> getOrderById(int orderId) async
test('test getOrderById', () async {
// TODO
});
// Place an order for a pet
//
//Future<Order> placeOrder(Order body) async
test('test placeOrder', () async {
// TODO
});
});
}

View File

@ -0,0 +1,22 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for Tag
void main() {
var instance = Tag();
group('test Tag', () {
// int id (default value: null)
test('to test the property `id`', () async {
// TODO
});
// String name (default value: null)
test('to test the property `name`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,73 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
/// tests for UserApi
void main() {
var instance = UserApi();
group('tests for UserApi', () {
// Create user
//
// This can only be done by the logged in user.
//
//Future createUser(User body) async
test('test createUser', () async {
// TODO
});
// Creates list of users with given input array
//
//Future createUsersWithArrayInput(List<User> body) async
test('test createUsersWithArrayInput', () async {
// TODO
});
// Creates list of users with given input array
//
//Future createUsersWithListInput(List<User> body) async
test('test createUsersWithListInput', () async {
// TODO
});
// Delete user
//
// This can only be done by the logged in user.
//
//Future deleteUser(String username) async
test('test deleteUser', () async {
// TODO
});
// Get user by user name
//
//Future<User> getUserByName(String username) async
test('test getUserByName', () async {
// TODO
});
// Logs user into the system
//
//Future<String> loginUser(String username, String password) async
test('test loginUser', () async {
// TODO
});
// Logs out current logged in user session
//
//Future logoutUser() async
test('test logoutUser', () async {
// TODO
});
// Updated user
//
// This can only be done by the logged in user.
//
//Future updateUser(String username, User body) async
test('test updateUser', () async {
// TODO
});
});
}

View File

@ -0,0 +1,53 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for User
void main() {
var instance = User();
group('test User', () {
// int id (default value: null)
test('to test the property `id`', () async {
// TODO
});
// String username (default value: null)
test('to test the property `username`', () async {
// TODO
});
// String firstName (default value: null)
test('to test the property `firstName`', () async {
// TODO
});
// String lastName (default value: null)
test('to test the property `lastName`', () async {
// TODO
});
// String email (default value: null)
test('to test the property `email`', () async {
// TODO
});
// String password (default value: null)
test('to test the property `password`', () async {
// TODO
});
// String phone (default value: null)
test('to test the property `phone`', () async {
// TODO
});
// User Status
// int userStatus (default value: null)
test('to test the property `userStatus`', () async {
// TODO
});
});
}

View File

@ -1 +1 @@
4.0.1-SNAPSHOT
4.1.1-SNAPSHOT

View File

@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type

View File

@ -1 +1 @@
4.0.1-SNAPSHOT
4.1.1-SNAPSHOT

View File

@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type

View File

@ -62,7 +62,6 @@
<executable>pub</executable>
<arguments>
<argument>run</argument>
<argument>build_runner</argument>
<argument>test</argument>
</arguments>
</configuration>

View File

@ -1,516 +0,0 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.32.4"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
bazel_worker:
dependency: transitive
description:
name: bazel_worker
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.12"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.7+3"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+2"
build_modules:
dependency: transitive
description:
name: build_modules
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2+3"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.1+1"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+4"
build_test:
dependency: "direct dev"
description:
name: build_test
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.3+1"
build_web_compilers:
dependency: "direct dev"
description:
name: build_web_compilers
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2+2"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "5.5.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3+2"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.5"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.8"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+1"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3+3"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+17"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
json_rpc_2:
dependency: transitive
description:
name: json_rpc_2
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+2"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.6+2"
multi_server_socket:
dependency: transitive
description:
name: multi_server_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
openapi:
dependency: "direct main"
description:
path: "../openapi"
relative: true
source: path
version: "1.0.0"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
plugin:
dependency: transitive
description:
name: plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.6"
protobuf:
dependency: transitive
description:
name: protobuf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.2"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0+1"
scratch_space:
dependency: transitive
description:
name: scratch_space
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3+1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3+3"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.8"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2+4"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.7"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.14+1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
test:
dependency: "direct main"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
utf:
dependency: transitive
description:
name: utf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+5"
vm_service_client:
dependency: transitive
description:
name: vm_service_client
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.6"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+10"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.9"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.15"
sdks:
dart: ">=2.0.0 <3.0.0"