forked from loafle/openapi-generator-original
Fix Dart2 default template (#3790)
* fix dart2 default template * update dart samples
This commit is contained in:
@@ -29,18 +29,18 @@ fi
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
|
||||||
# Generate non-browserClient
|
# Generate non-browserClient
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
||||||
|
|
||||||
# then options to generate the library for vm would be:
|
# then options to generate the library for vm would be:
|
||||||
#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@"
|
#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@"
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
# Generate browserClient
|
# Generate browserClient
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@"
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
# Generate non-browserClient and put it to the flutter sample app
|
# 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 -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
# There is a proposal to allow importing different libraries depending on the environment:
|
# There is a proposal to allow importing different libraries depending on the environment:
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ sidebar_label: dart-jaguar
|
|||||||
|pubDescription|Description in generated pubspec| |null|
|
|pubDescription|Description in generated pubspec| |null|
|
||||||
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|
||||||
|sourceFolder|Source folder for generated code| |null|
|
|sourceFolder|Source folder for generated code| |null|
|
||||||
|supportDart2|Support Dart 2.x| |true|
|
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
|
||||||
|nullableFields|Is the null fields should be in the JSON payload| |null|
|
|nullableFields|Is the null fields should be in the JSON payload| |null|
|
||||||
|serialization|Choose serialization format JSON or PROTO is supported| |null|
|
|serialization|Choose serialization format JSON or PROTO is supported| |null|
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ sidebar_label: dart
|
|||||||
|pubDescription|Description in generated pubspec| |null|
|
|pubDescription|Description in generated pubspec| |null|
|
||||||
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|
||||||
|sourceFolder|Source folder for generated code| |null|
|
|sourceFolder|Source folder for generated code| |null|
|
||||||
|supportDart2|Support Dart 2.x| |true|
|
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
outputFolder = "generated-code/dart";
|
outputFolder = "generated-code/dart";
|
||||||
modelTemplateFiles.put("model.mustache", ".dart");
|
modelTemplateFiles.put("model.mustache", ".dart");
|
||||||
apiTemplateFiles.put("api.mustache", ".dart");
|
apiTemplateFiles.put("api.mustache", ".dart");
|
||||||
embeddedTemplateDir = templateDir = "dart";
|
embeddedTemplateDir = templateDir = "dart2";
|
||||||
apiPackage = "lib.api";
|
apiPackage = "lib.api";
|
||||||
modelPackage = "lib.model";
|
modelPackage = "lib.model";
|
||||||
modelDocTemplateFiles.put("object_doc.mustache", ".md");
|
modelDocTemplateFiles.put("object_doc.mustache", ".md");
|
||||||
@@ -124,7 +124,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
cliOptions.add(new CliOption(PUB_DESCRIPTION, "Description in generated pubspec"));
|
cliOptions.add(new CliOption(PUB_DESCRIPTION, "Description in generated pubspec"));
|
||||||
cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums"));
|
cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums"));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code"));
|
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code"));
|
||||||
cliOptions.add(CliOption.newBoolean(SUPPORT_DART2, "Support Dart 2.x").defaultValue(Boolean.TRUE.toString()));
|
cliOptions.add(CliOption.newBoolean(SUPPORT_DART2, "Support Dart 2.x (Dart 1.x support has been deprecated)").defaultValue(Boolean.TRUE.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,7 +139,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHelp() {
|
public String getHelp() {
|
||||||
return "Generates a Dart (1.x or 2.x) client library.";
|
return "Generates a Dart (1.x (deprecated) or 2.x) client library.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
language: dart
|
language: dart
|
||||||
dart:
|
dart:
|
||||||
# Install a specific stable release
|
# Install a specific stable release
|
||||||
- "2.2.0"
|
- "1.24.3"
|
||||||
install:
|
install:
|
||||||
- pub get
|
- pub get
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ Please follow the [installation procedure](#installation--usage) and then run th
|
|||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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 body = Pet(); // Pet | Pet object that needs to be added to the store
|
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.addPet(body);
|
api_instance.addPet(body);
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ Add a new pet to the store
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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 body = Pet(); // Pet | Pet object that needs to be added to the store
|
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.addPet(body);
|
api_instance.addPet(body);
|
||||||
@@ -70,9 +70,9 @@ Deletes a pet
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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 petId = 789; // int | Pet id to delete
|
||||||
var apiKey = apiKey_example; // String |
|
var apiKey = apiKey_example; // String |
|
||||||
|
|
||||||
@@ -116,9 +116,9 @@ Multiple status values can be provided with comma separated strings
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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
|
var status = []; // List<String> | Status values that need to be considered for filter
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -161,9 +161,9 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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
|
var tags = []; // List<String> | Tags to filter by
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -206,11 +206,11 @@ Returns a single pet
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure API key authorization: api_key
|
// 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
|
// 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
|
var petId = 789; // int | ID of pet to return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -251,10 +251,10 @@ Update an existing pet
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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 body = Pet(); // Pet | Pet object that needs to be added to the store
|
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.updatePet(body);
|
api_instance.updatePet(body);
|
||||||
@@ -293,9 +293,9 @@ Updates a pet in the store with form data
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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 petId = 789; // int | ID of pet that needs to be updated
|
||||||
var name = name_example; // String | Updated name of the pet
|
var name = name_example; // String | Updated name of the pet
|
||||||
var status = status_example; // String | Updated status of the pet
|
var status = status_example; // String | Updated status of the pet
|
||||||
@@ -339,9 +339,9 @@ uploads an image
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
// 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 petId = 789; // int | ID of pet to update
|
||||||
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
|
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
|
||||||
var file = BINARY_DATA_HERE; // MultipartFile | file to upload
|
var file = BINARY_DATA_HERE; // MultipartFile | file to upload
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.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
|
var orderId = orderId_example; // String | ID of the order that needs to be deleted
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -68,11 +68,11 @@ Returns a map of status codes to quantities
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
// TODO Configure API key authorization: api_key
|
// 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
|
// 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 {
|
try {
|
||||||
var result = api_instance.getInventory();
|
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
|
```dart
|
||||||
import 'package:openapi/api.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
|
var orderId = 789; // int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -152,8 +152,8 @@ Place an order for a pet
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
var api_instance = new StoreApi();
|
||||||
var body = Order(); // Order | order placed for purchasing the pet
|
var body = new Order(); // Order | order placed for purchasing the pet
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var result = api_instance.placeOrder(body);
|
var result = api_instance.placeOrder(body);
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ This can only be done by the logged in user.
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
var api_instance = UserApi();
|
var api_instance = new UserApi();
|
||||||
var body = User(); // User | Created user object
|
var body = new User(); // User | Created user object
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.createUser(body);
|
api_instance.createUser(body);
|
||||||
@@ -70,8 +70,8 @@ Creates list of users with given input array
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
var api_instance = UserApi();
|
var api_instance = new UserApi();
|
||||||
var body = [List<User>()]; // List<User> | List of user object
|
var body = [new List<User>()]; // List<User> | List of user object
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.createUsersWithArrayInput(body);
|
api_instance.createUsersWithArrayInput(body);
|
||||||
@@ -110,8 +110,8 @@ Creates list of users with given input array
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
var api_instance = UserApi();
|
var api_instance = new UserApi();
|
||||||
var body = [List<User>()]; // List<User> | List of user object
|
var body = [new List<User>()]; // List<User> | List of user object
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.createUsersWithListInput(body);
|
api_instance.createUsersWithListInput(body);
|
||||||
@@ -152,7 +152,7 @@ This can only be done by the logged in user.
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.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 deleted
|
var username = username_example; // String | The name that needs to be deleted
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -192,7 +192,7 @@ Get user by user name
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.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.
|
var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -233,7 +233,7 @@ Logs user into the system
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.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 username = username_example; // String | The user name for login
|
||||||
var password = password_example; // String | The password for login in clear text
|
var password = password_example; // String | The password for login in clear text
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ Logs out current logged in user session
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
var api_instance = UserApi();
|
var api_instance = new UserApi();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.logoutUser();
|
api_instance.logoutUser();
|
||||||
@@ -314,9 +314,9 @@ This can only be done by the logged in user.
|
|||||||
```dart
|
```dart
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
var api_instance = UserApi();
|
var api_instance = new UserApi();
|
||||||
var username = username_example; // String | name that need to be deleted
|
var username = username_example; // String | name that need to be deleted
|
||||||
var body = User(); // User | Updated user object
|
var body = new User(); // User | Updated user object
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api_instance.updateUser(username, body);
|
api_instance.updateUser(username, body);
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ part 'model/tag.dart';
|
|||||||
part 'model/user.dart';
|
part 'model/user.dart';
|
||||||
|
|
||||||
|
|
||||||
ApiClient defaultApiClient = ApiClient();
|
ApiClient defaultApiClient = new ApiClient();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PetApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -28,12 +28,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -60,11 +60,11 @@ class PetApi {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future deletePet(int petId, { String apiKey }) async {
|
Future deletePet(int petId, { String apiKey }) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null) {
|
if(petId == null) {
|
||||||
throw ApiException(400, "Missing required param: petId");
|
throw new ApiException(400, "Missing required param: petId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -78,12 +78,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -110,11 +110,11 @@ class PetApi {
|
|||||||
///
|
///
|
||||||
/// Multiple status values can be provided with comma separated strings
|
/// Multiple status values can be provided with comma separated strings
|
||||||
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(status == null) {
|
if(status == null) {
|
||||||
throw ApiException(400, "Missing required param: status");
|
throw new ApiException(400, "Missing required param: status");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -128,12 +128,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
||||||
} else {
|
} else {
|
||||||
@@ -161,11 +161,11 @@ class PetApi {
|
|||||||
///
|
///
|
||||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
Future<List<Pet>> findPetsByTags(List<String> tags) async {
|
Future<List<Pet>> findPetsByTags(List<String> tags) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(tags == null) {
|
if(tags == null) {
|
||||||
throw ApiException(400, "Missing required param: tags");
|
throw new ApiException(400, "Missing required param: tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -179,12 +179,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
||||||
} else {
|
} else {
|
||||||
@@ -212,11 +212,11 @@ class PetApi {
|
|||||||
///
|
///
|
||||||
/// Returns a single pet
|
/// Returns a single pet
|
||||||
Future<Pet> getPetById(int petId) async {
|
Future<Pet> getPetById(int petId) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null) {
|
if(petId == null) {
|
||||||
throw ApiException(400, "Missing required param: petId");
|
throw new ApiException(400, "Missing required param: petId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -229,12 +229,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
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"];
|
List<String> authNames = ["api_key"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
|
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
|
||||||
} else {
|
} else {
|
||||||
@@ -266,7 +266,7 @@ class PetApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -279,12 +279,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -311,11 +311,11 @@ class PetApi {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future updatePetWithForm(int petId, { String name, String status }) async {
|
Future updatePetWithForm(int petId, { String name, String status }) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null) {
|
if(petId == null) {
|
||||||
throw ApiException(400, "Missing required param: petId");
|
throw new ApiException(400, "Missing required param: petId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -328,12 +328,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
hasFields = true;
|
hasFields = true;
|
||||||
mp.fields['name'] = parameterToString(name);
|
mp.fields['name'] = parameterToString(name);
|
||||||
@@ -362,7 +362,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -372,11 +372,11 @@ class PetApi {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null) {
|
if(petId == null) {
|
||||||
throw ApiException(400, "Missing required param: petId");
|
throw new ApiException(400, "Missing required param: petId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -389,12 +389,12 @@ class PetApi {
|
|||||||
|
|
||||||
List<String> contentTypes = ["multipart/form-data"];
|
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"];
|
List<String> authNames = ["petstore_auth"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if (additionalMetadata != null) {
|
if (additionalMetadata != null) {
|
||||||
hasFields = true;
|
hasFields = true;
|
||||||
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
|
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
|
||||||
@@ -422,7 +422,7 @@ class PetApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
|
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ class StoreApi {
|
|||||||
///
|
///
|
||||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
Future deleteOrder(String orderId) async {
|
Future deleteOrder(String orderId) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(orderId == null) {
|
if(orderId == null) {
|
||||||
throw ApiException(400, "Missing required param: orderId");
|
throw new ApiException(400, "Missing required param: orderId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -28,12 +28,12 @@ class StoreApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ class StoreApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -60,7 +60,7 @@ class StoreApi {
|
|||||||
///
|
///
|
||||||
/// Returns a map of status codes to quantities
|
/// Returns a map of status codes to quantities
|
||||||
Future<Map<String, int>> getInventory() async {
|
Future<Map<String, int>> getInventory() async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
|
|
||||||
@@ -74,12 +74,12 @@ class StoreApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
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"];
|
List<String> authNames = ["api_key"];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -96,9 +96,9 @@ class StoreApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} 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 {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -108,11 +108,11 @@ class StoreApi {
|
|||||||
///
|
///
|
||||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
Future<Order> getOrderById(int orderId) async {
|
Future<Order> getOrderById(int orderId) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(orderId == null) {
|
if(orderId == null) {
|
||||||
throw ApiException(400, "Missing required param: orderId");
|
throw new ApiException(400, "Missing required param: orderId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -125,12 +125,12 @@ class StoreApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ class StoreApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
||||||
} else {
|
} else {
|
||||||
@@ -162,7 +162,7 @@ class StoreApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -175,12 +175,12 @@ class StoreApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ class StoreApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class UserApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -28,12 +28,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -64,7 +64,7 @@ class UserApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -77,12 +77,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -113,7 +113,7 @@ class UserApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -126,12 +126,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -158,11 +158,11 @@ class UserApi {
|
|||||||
///
|
///
|
||||||
/// This can only be done by the logged in user.
|
/// This can only be done by the logged in user.
|
||||||
Future deleteUser(String username) async {
|
Future deleteUser(String username) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null) {
|
if(username == null) {
|
||||||
throw ApiException(400, "Missing required param: username");
|
throw new ApiException(400, "Missing required param: username");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -175,12 +175,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -207,11 +207,11 @@ class UserApi {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future<User> getUserByName(String username) async {
|
Future<User> getUserByName(String username) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null) {
|
if(username == null) {
|
||||||
throw ApiException(400, "Missing required param: username");
|
throw new ApiException(400, "Missing required param: username");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -224,12 +224,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
|
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
|
||||||
} else {
|
} else {
|
||||||
@@ -257,14 +257,14 @@ class UserApi {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future<String> loginUser(String username, String password) async {
|
Future<String> loginUser(String username, String password) async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null) {
|
if(username == null) {
|
||||||
throw ApiException(400, "Missing required param: username");
|
throw new ApiException(400, "Missing required param: username");
|
||||||
}
|
}
|
||||||
if(password == null) {
|
if(password == null) {
|
||||||
throw ApiException(400, "Missing required param: password");
|
throw new ApiException(400, "Missing required param: password");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -279,12 +279,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
|
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
|
||||||
} else {
|
} else {
|
||||||
@@ -312,7 +312,7 @@ class UserApi {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future logoutUser() async {
|
Future logoutUser() async {
|
||||||
Object postBody;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
|
|
||||||
@@ -326,12 +326,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -362,10 +362,10 @@ class UserApi {
|
|||||||
|
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null) {
|
if(username == null) {
|
||||||
throw ApiException(400, "Missing required param: username");
|
throw new ApiException(400, "Missing required param: username");
|
||||||
}
|
}
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
throw ApiException(400, "Missing required param: body");
|
throw new ApiException(400, "Missing required param: body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -378,12 +378,12 @@ class UserApi {
|
|||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
bool hasFields = false;
|
bool hasFields = false;
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
MultipartRequest mp = new MultipartRequest(null, null);
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
@@ -400,7 +400,7 @@ class UserApi {
|
|||||||
authNames);
|
authNames);
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
throw new ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ class QueryParam {
|
|||||||
class ApiClient {
|
class ApiClient {
|
||||||
|
|
||||||
String basePath;
|
String basePath;
|
||||||
var client = Client();
|
var client = new Client();
|
||||||
|
|
||||||
Map<String, String> _defaultHeaderMap = {};
|
Map<String, String> _defaultHeaderMap = {};
|
||||||
Map<String, Authentication> _authentications = {};
|
Map<String, Authentication> _authentications = {};
|
||||||
|
|
||||||
final _regList = RegExp(r'^List<(.*)>$');
|
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||||
final _regMap = RegExp(r'^Map<String,(.*)>$');
|
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).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
_authentications['api_key'] = ApiKeyAuth("header", "api_key");
|
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||||
_authentications['petstore_auth'] = OAuth();
|
_authentications['petstore_auth'] = new OAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDefaultHeader(String key, String value) {
|
void addDefaultHeader(String key, String value) {
|
||||||
@@ -40,36 +40,36 @@ class ApiClient {
|
|||||||
case 'double':
|
case 'double':
|
||||||
return value is double ? value : double.parse('$value');
|
return value is double ? value : double.parse('$value');
|
||||||
case 'ApiResponse':
|
case 'ApiResponse':
|
||||||
return ApiResponse.fromJson(value);
|
return new ApiResponse.fromJson(value);
|
||||||
case 'Category':
|
case 'Category':
|
||||||
return Category.fromJson(value);
|
return new Category.fromJson(value);
|
||||||
case 'Order':
|
case 'Order':
|
||||||
return Order.fromJson(value);
|
return new Order.fromJson(value);
|
||||||
case 'Pet':
|
case 'Pet':
|
||||||
return Pet.fromJson(value);
|
return new Pet.fromJson(value);
|
||||||
case 'Tag':
|
case 'Tag':
|
||||||
return Tag.fromJson(value);
|
return new Tag.fromJson(value);
|
||||||
case 'User':
|
case 'User':
|
||||||
return User.fromJson(value);
|
return new User.fromJson(value);
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Match match;
|
Match match;
|
||||||
if (value is List &&
|
if (value is List &&
|
||||||
(match = _regList.firstMatch(targetType)) != null) {
|
(match = _RegList.firstMatch(targetType)) != null) {
|
||||||
var newTargetType = match[1];
|
var newTargetType = match[1];
|
||||||
return value.map((v) => _deserialize(v, newTargetType)).toList();
|
return value.map((v) => _deserialize(v, newTargetType)).toList();
|
||||||
} else if (value is Map &&
|
} else if (value is Map &&
|
||||||
(match = _regMap.firstMatch(targetType)) != null) {
|
(match = _RegMap.firstMatch(targetType)) != null) {
|
||||||
var newTargetType = match[1];
|
var newTargetType = match[1];
|
||||||
return Map.fromIterables(value.keys,
|
return new Map.fromIterables(value.keys,
|
||||||
value.values.map((v) => _deserialize(v, newTargetType)));
|
value.values.map((v) => _deserialize(v, newTargetType)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on Exception catch (e, stack) {
|
} catch (e, stack) {
|
||||||
throw ApiException.withInner(500, 'Exception during deserialization.', 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) {
|
dynamic deserialize(String json, String targetType) {
|
||||||
@@ -78,7 +78,7 @@ class ApiClient {
|
|||||||
|
|
||||||
if (targetType == 'String') return json;
|
if (targetType == 'String') return json;
|
||||||
|
|
||||||
var decodedJson = jsonDecode(json);
|
var decodedJson = JSON.decode(json);
|
||||||
return _deserialize(decodedJson, targetType);
|
return _deserialize(decodedJson, targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ class ApiClient {
|
|||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
serialized = '';
|
serialized = '';
|
||||||
} else {
|
} else {
|
||||||
serialized = json.encode(obj);
|
serialized = JSON.encode(obj);
|
||||||
}
|
}
|
||||||
return serialized;
|
return serialized;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ class ApiClient {
|
|||||||
headerParams['Content-Type'] = contentType;
|
headerParams['Content-Type'] = contentType;
|
||||||
|
|
||||||
if(body is MultipartRequest) {
|
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.fields.addAll(body.fields);
|
||||||
request.files.addAll(body.files);
|
request.files.addAll(body.files);
|
||||||
request.headers.addAll(body.headers);
|
request.headers.addAll(body.headers);
|
||||||
@@ -148,14 +148,16 @@ class ApiClient {
|
|||||||
void _updateParamsForAuth(List<String> authNames, List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void _updateParamsForAuth(List<String> authNames, List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
authNames.forEach((authName) {
|
authNames.forEach((authName) {
|
||||||
Authentication auth = _authentications[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);
|
auth.applyToParams(queryParams, headerParams);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
T getAuthentication<T extends Authentication>(String name) {
|
void setAccessToken(String accessToken) {
|
||||||
var authentication = _authentications[name];
|
_authentications.forEach((key, auth) {
|
||||||
|
if (auth is OAuth) {
|
||||||
return authentication is T ? authentication : null;
|
auth.setAccessToken(accessToken);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ part of openapi.api;
|
|||||||
|
|
||||||
class ApiException implements Exception {
|
class ApiException implements Exception {
|
||||||
int code = 0;
|
int code = 0;
|
||||||
String message;
|
String message = null;
|
||||||
Exception innerException;
|
Exception innerException = null;
|
||||||
StackTrace stackTrace;
|
StackTrace stackTrace = null;
|
||||||
|
|
||||||
ApiException(this.code, this.message);
|
ApiException(this.code, this.message);
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ class ApiException implements Exception {
|
|||||||
return "ApiException $code: $message";
|
return "ApiException $code: $message";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "ApiException $code: $message (Inner exception: $innerException)\n\n" +
|
return "ApiException $code: $message (Inner exception: ${innerException})\n\n" +
|
||||||
stackTrace.toString();
|
stackTrace.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
|||||||
if (name == null || name.isEmpty || value == null) return params;
|
if (name == null || name.isEmpty || value == null) return params;
|
||||||
|
|
||||||
if (value is! List) {
|
if (value is! List) {
|
||||||
params.add(QueryParam(name, parameterToString(value)));
|
params.add(new QueryParam(name, parameterToString(value)));
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
|||||||
: collectionFormat; // default: csv
|
: collectionFormat; // default: csv
|
||||||
|
|
||||||
if (collectionFormat == "multi") {
|
if (collectionFormat == "multi") {
|
||||||
return values.map((v) => QueryParam(name, parameterToString(v)));
|
return values.map((v) => new QueryParam(name, parameterToString(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
String delimiter = _delimiters[collectionFormat] ?? ",";
|
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;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,24 +4,22 @@ class ApiKeyAuth implements Authentication {
|
|||||||
|
|
||||||
final String location;
|
final String location;
|
||||||
final String paramName;
|
final String paramName;
|
||||||
String _apiKey;
|
String apiKey;
|
||||||
String apiKeyPrefix;
|
String apiKeyPrefix;
|
||||||
|
|
||||||
set apiKey(String key) => _apiKey = key;
|
|
||||||
|
|
||||||
ApiKeyAuth(this.location, this.paramName);
|
ApiKeyAuth(this.location, this.paramName);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
String value;
|
String value;
|
||||||
if (apiKeyPrefix != null) {
|
if (apiKeyPrefix != null) {
|
||||||
value = '$apiKeyPrefix $_apiKey';
|
value = '$apiKeyPrefix $apiKey';
|
||||||
} else {
|
} else {
|
||||||
value = _apiKey;
|
value = apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location == 'query' && value != null) {
|
if (location == 'query' && value != null) {
|
||||||
queryParams.add(QueryParam(paramName, value));
|
queryParams.add(new QueryParam(paramName, value));
|
||||||
} else if (location == 'header' && value != null) {
|
} else if (location == 'header' && value != null) {
|
||||||
headerParams[paramName] = value;
|
headerParams[paramName] = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,13 @@ part of openapi.api;
|
|||||||
|
|
||||||
class HttpBasicAuth implements Authentication {
|
class HttpBasicAuth implements Authentication {
|
||||||
|
|
||||||
String _username;
|
String username;
|
||||||
String _password;
|
String password;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
String str = (_username == null ? "" : _username) + ":" + (_password == null ? "" : _password);
|
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||||
headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str));
|
headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
set username(String username) => _username = username;
|
}
|
||||||
set password(String password) => _password = password;
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
part of openapi.api;
|
part of openapi.api;
|
||||||
|
|
||||||
class OAuth implements Authentication {
|
class OAuth implements Authentication {
|
||||||
String _accessToken;
|
String accessToken;
|
||||||
|
|
||||||
OAuth({String accessToken}) : _accessToken = accessToken;
|
OAuth({this.accessToken}) {
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||||
if (_accessToken != null) {
|
if (accessToken != null) {
|
||||||
headerParams["Authorization"] = "Bearer $_accessToken";
|
headerParams["Authorization"] = "Bearer " + accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set accessToken(String accessToken) => _accessToken = accessToken;
|
void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,30 +16,39 @@ class ApiResponse {
|
|||||||
|
|
||||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
code = json['code'];
|
if (json['code'] == null) {
|
||||||
type = json['type'];
|
code = null;
|
||||||
message = json['message'];
|
} else {
|
||||||
|
code = json['code'];
|
||||||
|
}
|
||||||
|
if (json['type'] == null) {
|
||||||
|
type = null;
|
||||||
|
} else {
|
||||||
|
type = json['type'];
|
||||||
|
}
|
||||||
|
if (json['message'] == null) {
|
||||||
|
message = null;
|
||||||
|
} else {
|
||||||
|
message = json['message'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map <String, dynamic> json = {};
|
return {
|
||||||
if (code != null)
|
'code': code,
|
||||||
json['code'] = code;
|
'type': type,
|
||||||
if (type != null)
|
'message': message
|
||||||
json['type'] = type;
|
};
|
||||||
if (message != null)
|
|
||||||
json['message'] = message;
|
|
||||||
return json;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<ApiResponse> listFromJson(List<dynamic> json) {
|
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) {
|
static Map<String, ApiResponse> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
var map = Map<String, ApiResponse>();
|
var map = new Map<String, ApiResponse>();
|
||||||
if (json != null && json.isNotEmpty) {
|
if (json != null && json.length > 0) {
|
||||||
json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value));
|
json.forEach((String key, Map<String, dynamic> value) => map[key] = new ApiResponse.fromJson(value));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,27 +14,33 @@ class Category {
|
|||||||
|
|
||||||
Category.fromJson(Map<String, dynamic> json) {
|
Category.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id = json['id'];
|
if (json['id'] == null) {
|
||||||
name = json['name'];
|
id = null;
|
||||||
|
} else {
|
||||||
|
id = json['id'];
|
||||||
|
}
|
||||||
|
if (json['name'] == null) {
|
||||||
|
name = null;
|
||||||
|
} else {
|
||||||
|
name = json['name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map <String, dynamic> json = {};
|
return {
|
||||||
if (id != null)
|
'id': id,
|
||||||
json['id'] = id;
|
'name': name
|
||||||
if (name != null)
|
};
|
||||||
json['name'] = name;
|
|
||||||
return json;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Category> listFromJson(List<dynamic> json) {
|
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) {
|
static Map<String, Category> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
var map = Map<String, Category>();
|
var map = new Map<String, Category>();
|
||||||
if (json != null && json.isNotEmpty) {
|
if (json != null && json.length > 0) {
|
||||||
json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value));
|
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Category.fromJson(value));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,41 +23,57 @@ class Order {
|
|||||||
|
|
||||||
Order.fromJson(Map<String, dynamic> json) {
|
Order.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id = json['id'];
|
if (json['id'] == null) {
|
||||||
petId = json['petId'];
|
id = null;
|
||||||
quantity = json['quantity'];
|
} else {
|
||||||
shipDate = (json['shipDate'] == null) ?
|
id = json['id'];
|
||||||
null :
|
}
|
||||||
DateTime.parse(json['shipDate']);
|
if (json['petId'] == null) {
|
||||||
status = json['status'];
|
petId = null;
|
||||||
complete = json['complete'];
|
} else {
|
||||||
|
petId = json['petId'];
|
||||||
|
}
|
||||||
|
if (json['quantity'] == null) {
|
||||||
|
quantity = null;
|
||||||
|
} else {
|
||||||
|
quantity = json['quantity'];
|
||||||
|
}
|
||||||
|
if (json['shipDate'] == null) {
|
||||||
|
shipDate = null;
|
||||||
|
} else {
|
||||||
|
shipDate = DateTime.parse(json['shipDate']);
|
||||||
|
}
|
||||||
|
if (json['status'] == null) {
|
||||||
|
status = null;
|
||||||
|
} else {
|
||||||
|
status = json['status'];
|
||||||
|
}
|
||||||
|
if (json['complete'] == null) {
|
||||||
|
complete = null;
|
||||||
|
} else {
|
||||||
|
complete = json['complete'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map <String, dynamic> json = {};
|
return {
|
||||||
if (id != null)
|
'id': id,
|
||||||
json['id'] = id;
|
'petId': petId,
|
||||||
if (petId != null)
|
'quantity': quantity,
|
||||||
json['petId'] = petId;
|
'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(),
|
||||||
if (quantity != null)
|
'status': status,
|
||||||
json['quantity'] = quantity;
|
'complete': complete
|
||||||
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) {
|
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) {
|
static Map<String, Order> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
var map = Map<String, Order>();
|
var map = new Map<String, Order>();
|
||||||
if (json != null && json.isNotEmpty) {
|
if (json != null && json.length > 0) {
|
||||||
json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value));
|
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Order.fromJson(value));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,45 +23,57 @@ class Pet {
|
|||||||
|
|
||||||
Pet.fromJson(Map<String, dynamic> json) {
|
Pet.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id = json['id'];
|
if (json['id'] == null) {
|
||||||
category = (json['category'] == null) ?
|
id = null;
|
||||||
null :
|
} else {
|
||||||
Category.fromJson(json['category']);
|
id = json['id'];
|
||||||
name = json['name'];
|
}
|
||||||
photoUrls = (json['photoUrls'] == null) ?
|
if (json['category'] == null) {
|
||||||
null :
|
category = null;
|
||||||
(json['photoUrls'] as List).cast<String>();
|
} else {
|
||||||
tags = (json['tags'] == null) ?
|
category = new Category.fromJson(json['category']);
|
||||||
null :
|
}
|
||||||
Tag.listFromJson(json['tags']);
|
if (json['name'] == null) {
|
||||||
status = json['status'];
|
name = null;
|
||||||
|
} else {
|
||||||
|
name = json['name'];
|
||||||
|
}
|
||||||
|
if (json['photoUrls'] == null) {
|
||||||
|
photoUrls = null;
|
||||||
|
} else {
|
||||||
|
photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList();
|
||||||
|
}
|
||||||
|
if (json['tags'] == null) {
|
||||||
|
tags = null;
|
||||||
|
} else {
|
||||||
|
tags = Tag.listFromJson(json['tags']);
|
||||||
|
}
|
||||||
|
if (json['status'] == null) {
|
||||||
|
status = null;
|
||||||
|
} else {
|
||||||
|
status = json['status'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map <String, dynamic> json = {};
|
return {
|
||||||
if (id != null)
|
'id': id,
|
||||||
json['id'] = id;
|
'category': category,
|
||||||
if (category != null)
|
'name': name,
|
||||||
json['category'] = category;
|
'photoUrls': photoUrls,
|
||||||
if (name != null)
|
'tags': tags,
|
||||||
json['name'] = name;
|
'status': status
|
||||||
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) {
|
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) {
|
static Map<String, Pet> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
var map = Map<String, Pet>();
|
var map = new Map<String, Pet>();
|
||||||
if (json != null && json.isNotEmpty) {
|
if (json != null && json.length > 0) {
|
||||||
json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value));
|
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Pet.fromJson(value));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,27 +14,33 @@ class Tag {
|
|||||||
|
|
||||||
Tag.fromJson(Map<String, dynamic> json) {
|
Tag.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id = json['id'];
|
if (json['id'] == null) {
|
||||||
name = json['name'];
|
id = null;
|
||||||
|
} else {
|
||||||
|
id = json['id'];
|
||||||
|
}
|
||||||
|
if (json['name'] == null) {
|
||||||
|
name = null;
|
||||||
|
} else {
|
||||||
|
name = json['name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map <String, dynamic> json = {};
|
return {
|
||||||
if (id != null)
|
'id': id,
|
||||||
json['id'] = id;
|
'name': name
|
||||||
if (name != null)
|
};
|
||||||
json['name'] = name;
|
|
||||||
return json;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Tag> listFromJson(List<dynamic> json) {
|
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) {
|
static Map<String, Tag> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
var map = Map<String, Tag>();
|
var map = new Map<String, Tag>();
|
||||||
if (json != null && json.isNotEmpty) {
|
if (json != null && json.length > 0) {
|
||||||
json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value));
|
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Tag.fromJson(value));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,45 +26,69 @@ class User {
|
|||||||
|
|
||||||
User.fromJson(Map<String, dynamic> json) {
|
User.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id = json['id'];
|
if (json['id'] == null) {
|
||||||
username = json['username'];
|
id = null;
|
||||||
firstName = json['firstName'];
|
} else {
|
||||||
lastName = json['lastName'];
|
id = json['id'];
|
||||||
email = json['email'];
|
}
|
||||||
password = json['password'];
|
if (json['username'] == null) {
|
||||||
phone = json['phone'];
|
username = null;
|
||||||
userStatus = json['userStatus'];
|
} else {
|
||||||
|
username = json['username'];
|
||||||
|
}
|
||||||
|
if (json['firstName'] == null) {
|
||||||
|
firstName = null;
|
||||||
|
} else {
|
||||||
|
firstName = json['firstName'];
|
||||||
|
}
|
||||||
|
if (json['lastName'] == null) {
|
||||||
|
lastName = null;
|
||||||
|
} else {
|
||||||
|
lastName = json['lastName'];
|
||||||
|
}
|
||||||
|
if (json['email'] == null) {
|
||||||
|
email = null;
|
||||||
|
} else {
|
||||||
|
email = json['email'];
|
||||||
|
}
|
||||||
|
if (json['password'] == null) {
|
||||||
|
password = null;
|
||||||
|
} else {
|
||||||
|
password = json['password'];
|
||||||
|
}
|
||||||
|
if (json['phone'] == null) {
|
||||||
|
phone = null;
|
||||||
|
} else {
|
||||||
|
phone = json['phone'];
|
||||||
|
}
|
||||||
|
if (json['userStatus'] == null) {
|
||||||
|
userStatus = null;
|
||||||
|
} else {
|
||||||
|
userStatus = json['userStatus'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map <String, dynamic> json = {};
|
return {
|
||||||
if (id != null)
|
'id': id,
|
||||||
json['id'] = id;
|
'username': username,
|
||||||
if (username != null)
|
'firstName': firstName,
|
||||||
json['username'] = username;
|
'lastName': lastName,
|
||||||
if (firstName != null)
|
'email': email,
|
||||||
json['firstName'] = firstName;
|
'password': password,
|
||||||
if (lastName != null)
|
'phone': phone,
|
||||||
json['lastName'] = lastName;
|
'userStatus': userStatus
|
||||||
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) {
|
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) {
|
static Map<String, User> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
var map = Map<String, User>();
|
var map = new Map<String, User>();
|
||||||
if (json != null && json.isNotEmpty) {
|
if (json != null && json.length > 0) {
|
||||||
json.forEach((String key, dynamic value) => map[key] = User.fromJson(value));
|
json.forEach((String key, Map<String, dynamic> value) => map[key] = new User.fromJson(value));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
name: openapi
|
name: openapi
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
description: OpenAPI API client
|
description: OpenAPI API client
|
||||||
environment:
|
|
||||||
sdk: '>=2.0.0 <3.0.0'
|
|
||||||
dependencies:
|
dependencies:
|
||||||
http: '>=0.12.0 <0.13.0'
|
http: '>=0.11.1 <0.13.0'
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.3.0
|
test: ^1.3.0
|
||||||
|
|||||||
@@ -43,5 +43,16 @@ class ApiResponse {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ApiResponse-objects as value to a dart map
|
||||||
|
static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<ApiResponse>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = ApiResponse.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,16 @@ class Category {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Category-objects as value to a dart map
|
||||||
|
static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Category>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Category.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,5 +61,16 @@ class Order {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Order-objects as value to a dart map
|
||||||
|
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Order>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Order.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,5 +65,16 @@ class Pet {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Pet-objects as value to a dart map
|
||||||
|
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Pet>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Pet.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,16 @@ class Tag {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Tag-objects as value to a dart map
|
||||||
|
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Tag>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Tag.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,5 +68,16 @@ class User {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of User-objects as value to a dart map
|
||||||
|
static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<User>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = User.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,5 +43,16 @@ class ApiResponse {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ApiResponse-objects as value to a dart map
|
||||||
|
static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<ApiResponse>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = ApiResponse.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,16 @@ class Category {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Category-objects as value to a dart map
|
||||||
|
static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Category>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Category.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,5 +61,16 @@ class Order {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Order-objects as value to a dart map
|
||||||
|
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Order>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Order.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,5 +65,16 @@ class Pet {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Pet-objects as value to a dart map
|
||||||
|
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Pet>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Pet.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,16 @@ class Tag {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Tag-objects as value to a dart map
|
||||||
|
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Tag>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Tag.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,5 +68,16 @@ class User {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of User-objects as value to a dart map
|
||||||
|
static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<User>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = User.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,5 +43,16 @@ class ApiResponse {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ApiResponse-objects as value to a dart map
|
||||||
|
static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<ApiResponse>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = ApiResponse.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,16 @@ class Category {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Category-objects as value to a dart map
|
||||||
|
static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Category>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Category.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,5 +61,16 @@ class Order {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Order-objects as value to a dart map
|
||||||
|
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Order>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Order.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,5 +65,16 @@ class Pet {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Pet-objects as value to a dart map
|
||||||
|
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Pet>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Pet.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,16 @@ class Tag {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of Tag-objects as value to a dart map
|
||||||
|
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<Tag>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = Tag.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,5 +68,16 @@ class User {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of User-objects as value to a dart map
|
||||||
|
static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json) {
|
||||||
|
var map = Map<String, List<User>>();
|
||||||
|
if (json != null && json.isNotEmpty) {
|
||||||
|
json.forEach((String key, dynamic value) {
|
||||||
|
map[key] = User.listFromJson(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user