Update Dart petstore client (flutter) with OpenAPI v2 spec (#152)

* restore dart flutter samples from petstore oas2

* update dart-petstore (flutter) with OAS2
This commit is contained in:
William Cheng 2018-04-25 14:53:42 +08:00 committed by GitHub
parent 4924b4951c
commit f5f7546dcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 149 additions and 146 deletions

50
bin/dart-flutter-petstore.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
## Generate non-browserClient
#ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true -DbrowserClient=false"
#
## then options to generate the library for vm would be:
##ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm"
#java $JAVA_OPTS -jar $executable $ags
#
## Generate browserClient
#ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true"
#java $JAVA_OPTS -jar $executable $ags
# Generate non-browserClient and put it to the flutter sample app
ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/flutter_petstore/swagger -DhideGenerationTimestamp=true -DbrowserClient=false"
java $JAVA_OPTS -jar $executable $ags
# There is a proposal to allow importing different libraries depending on the environment:
# https://github.com/munificent/dep-interface-libraries
# When this is implemented there will only be one library.
# The current petstore test will then work for both: the browser library and the vm library.

View File

@ -64,7 +64,7 @@ try {
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/allParams}}
### Return type

View File

@ -4,7 +4,7 @@ This is a sample server Petstore server. You can find out more about Swagger at
This Dart package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0
- Build package: io.swagger.codegen.languages.DartClientCodegen
- Build package: org.openapitools.codegen.languages.DartClientCodegen
## Requirements
@ -47,10 +47,10 @@ import 'package:swagger/api.dart';
//swagger.api.Configuration.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 pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);
api_instance.addPet(pet);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
@ -59,7 +59,7 @@ try {
## Documentation for API Endpoints
All URIs are relative to *http://localhost/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:swagger/api.dart';
```
All URIs are relative to *http://localhost/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -20,12 +20,10 @@ Method | HTTP request | Description
# **addPet**
> addPet(body)
> addPet(pet)
Add a new pet to the store
### Example
```dart
import 'package:swagger/api.dart';
@ -33,10 +31,10 @@ import 'package:swagger/api.dart';
//swagger.api.Configuration.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 pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);
api_instance.addPet(pet);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
@ -46,7 +44,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -59,7 +57,7 @@ void (empty response body)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
- **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)
@ -68,8 +66,6 @@ void (empty response body)
Deletes a pet
### Example
```dart
import 'package:swagger/api.dart';
@ -105,7 +101,7 @@ void (empty response body)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
@ -247,12 +243,10 @@ 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(body)
> updatePet(pet)
Update an existing pet
### Example
```dart
import 'package:swagger/api.dart';
@ -260,10 +254,10 @@ import 'package:swagger/api.dart';
//swagger.api.Configuration.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 pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.updatePet(body);
api_instance.updatePet(pet);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
}
@ -273,7 +267,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -286,7 +280,7 @@ void (empty response body)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
- **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)
@ -295,8 +289,6 @@ void (empty response body)
Updates a pet in the store with form data
### Example
```dart
import 'package:swagger/api.dart';
@ -334,7 +326,7 @@ void (empty response body)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/xml, application/json
- **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)
@ -343,8 +335,6 @@ void (empty response body)
uploads an image
### Example
```dart
import 'package:swagger/api.dart';
@ -354,7 +344,7 @@ import 'package:swagger/api.dart';
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 = /path/to/file.txt; // MultipartFile | file to upload
var file = BINARY_DATA_HERE; // MultipartFile | file to upload
try {
var result = api_instance.uploadFile(petId, additionalMetadata, file);

View File

@ -5,7 +5,7 @@
import 'package:swagger/api.dart';
```
All URIs are relative to *http://localhost/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -53,7 +53,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
@ -144,21 +144,19 @@ 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(body)
> Order placeOrder(order)
Place an order for a pet
### Example
```dart
import 'package:swagger/api.dart';
var api_instance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
var order = new Order(); // Order | order placed for purchasing the pet
try {
var result = api_instance.placeOrder(body);
var result = api_instance.placeOrder(order);
print(result);
} catch (e) {
print("Exception when calling StoreApi->placeOrder: $e\n");
@ -169,7 +167,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type

View File

@ -5,7 +5,7 @@
import 'package:swagger/api.dart';
```
All URIs are relative to *http://localhost/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -20,7 +20,7 @@ Method | HTTP request | Description
# **createUser**
> createUser(body)
> createUser(user)
Create user
@ -31,10 +31,10 @@ This can only be done by the logged in user.
import 'package:swagger/api.dart';
var api_instance = new UserApi();
var body = new User(); // User | Created user object
var user = new User(); // User | Created user object
try {
api_instance.createUser(body);
api_instance.createUser(user);
} catch (e) {
print("Exception when calling UserApi->createUser: $e\n");
}
@ -44,7 +44,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
**user** | [**User**](User.md)| Created user object |
### Return type
@ -57,26 +57,24 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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(body)
> createUsersWithArrayInput(user)
Creates list of users with given input array
### Example
```dart
import 'package:swagger/api.dart';
var api_instance = new UserApi();
var body = [new List&lt;User&gt;()]; // List<User> | List of user object
var user = [new List&lt;User&gt;()]; // List<User> | List of user object
try {
api_instance.createUsersWithArrayInput(body);
api_instance.createUsersWithArrayInput(user);
} catch (e) {
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
}
@ -86,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
**user** | [**List&lt;User&gt;**](List.md)| List of user object |
### Return type
@ -99,26 +97,24 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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(body)
> createUsersWithListInput(user)
Creates list of users with given input array
### Example
```dart
import 'package:swagger/api.dart';
var api_instance = new UserApi();
var body = [new List&lt;User&gt;()]; // List<User> | List of user object
var user = [new List&lt;User&gt;()]; // List<User> | List of user object
try {
api_instance.createUsersWithListInput(body);
api_instance.createUsersWithListInput(user);
} catch (e) {
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
}
@ -128,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
**user** | [**List&lt;User&gt;**](List.md)| List of user object |
### Return type
@ -141,7 +137,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
@ -183,7 +179,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
@ -192,8 +188,6 @@ No authorization required
Get user by user name
### Example
```dart
import 'package:swagger/api.dart';
@ -235,8 +229,6 @@ No authorization required
Logs user into the system
### Example
```dart
import 'package:swagger/api.dart';
@ -280,8 +272,6 @@ No authorization required
Logs out current logged in user session
### Example
```dart
import 'package:swagger/api.dart';
@ -309,12 +299,12 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **updateUser**
> updateUser(username, body)
> updateUser(username, user)
Updated user
@ -326,10 +316,10 @@ import 'package:swagger/api.dart';
var api_instance = new UserApi();
var username = username_example; // String | name that need to be deleted
var body = new User(); // User | Updated user object
var user = new User(); // User | Updated user object
try {
api_instance.updateUser(username, body);
api_instance.updateUser(username, user);
} catch (e) {
print("Exception when calling UserApi->updateUser: $e\n");
}
@ -340,7 +330,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
**user** | [**User**](User.md)| Updated user object |
### Return type
@ -353,7 +343,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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

@ -10,12 +10,12 @@ class PetApi {
/// Add a new pet to the store
///
///
Future addPet(Pet body) async {
Object postBody = body;
Future addPet(Pet pet) async {
Object postBody = pet;
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(pet == null) {
throw new ApiException(400, "Missing required param: pet");
}
// create path and map variables
@ -34,12 +34,11 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'POST',
@ -86,12 +85,11 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'DELETE',
@ -128,7 +126,7 @@ class PetApi {
List<QueryParam> queryParams = [];
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status));
queryParams.addAll(_convertParametersForCollectionFormat("", "status", status));
List<String> contentTypes = [];
@ -138,12 +136,11 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -180,7 +177,7 @@ class PetApi {
List<QueryParam> queryParams = [];
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags));
queryParams.addAll(_convertParametersForCollectionFormat("", "tags", tags));
List<String> contentTypes = [];
@ -190,12 +187,11 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -241,12 +237,11 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -268,12 +263,12 @@ class PetApi {
/// Update an existing pet
///
///
Future updatePet(Pet body) async {
Object postBody = body;
Future updatePet(Pet pet) async {
Object postBody = pet;
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(pet == null) {
throw new ApiException(400, "Missing required param: pet");
}
// create path and map variables
@ -292,12 +287,11 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'PUT',
@ -343,24 +337,21 @@ class PetApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if (name != null) {
hasFields = true;
mp.fields['name'] = parameterToString(name);
}
if (status != null) {
hasFields = true;
mp.fields['status'] = parameterToString(status);
}
if(hasFields)
postBody = mp;
}
else {
if (name != null)
formParams['name'] = parameterToString(name);
if (status != null)
if (status != null)
formParams['status'] = parameterToString(status);
}
@ -408,25 +399,21 @@ if (status != null)
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if (additionalMetadata != null) {
hasFields = true;
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
}
if (file != null) {
hasFields = true;
mp.fields['file'] = file.field;
mp.files.add(file);
}
if(hasFields)
postBody = mp;
}
else {
if (additionalMetadata != null)
formParams['additionalMetadata'] = parameterToString(additionalMetadata);
}
var response = await apiClient.invokeAPI(path,

View File

@ -34,12 +34,11 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'DELETE',
@ -82,12 +81,11 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -133,12 +131,11 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -160,12 +157,12 @@ class StoreApi {
/// Place an order for a pet
///
///
Future<Order> placeOrder(Order body) async {
Object postBody = body;
Future<Order> placeOrder(Order order) async {
Object postBody = order;
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(order == null) {
throw new ApiException(400, "Missing required param: order");
}
// create path and map variables
@ -184,12 +181,11 @@ class StoreApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'POST',

View File

@ -10,12 +10,12 @@ class UserApi {
/// Create user
///
/// This can only be done by the logged in user.
Future createUser(User body) async {
Object postBody = body;
Future createUser(User user) async {
Object postBody = user;
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(user == null) {
throw new ApiException(400, "Missing required param: user");
}
// create path and map variables
@ -34,12 +34,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'POST',
@ -61,12 +60,12 @@ class UserApi {
/// Creates list of users with given input array
///
///
Future createUsersWithArrayInput(List<User> body) async {
Object postBody = body;
Future createUsersWithArrayInput(List<User> user) async {
Object postBody = user;
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(user == null) {
throw new ApiException(400, "Missing required param: user");
}
// create path and map variables
@ -85,12 +84,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'POST',
@ -112,12 +110,12 @@ class UserApi {
/// Creates list of users with given input array
///
///
Future createUsersWithListInput(List<User> body) async {
Object postBody = body;
Future createUsersWithListInput(List<User> user) async {
Object postBody = user;
// verify required params are set
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(user == null) {
throw new ApiException(400, "Missing required param: user");
}
// create path and map variables
@ -136,12 +134,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'POST',
@ -187,12 +184,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'DELETE',
@ -238,12 +234,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -294,12 +289,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -342,12 +336,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'GET',
@ -369,15 +362,15 @@ class UserApi {
/// Updated user
///
/// This can only be done by the logged in user.
Future updateUser(String username, User body) async {
Object postBody = body;
Future updateUser(String username, User user) async {
Object postBody = user;
// verify required params are set
if(username == null) {
throw new ApiException(400, "Missing required param: username");
}
if(body == null) {
throw new ApiException(400, "Missing required param: body");
if(user == null) {
throw new ApiException(400, "Missing required param: user");
}
// create path and map variables
@ -396,12 +389,11 @@ class UserApi {
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
}
var response = await apiClient.invokeAPI(path,
'PUT',

View File

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

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT