From f2ffb7f91110db81d9f4eae3d47e53cc1179b732 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Wed, 7 Aug 2019 10:12:07 +0200 Subject: [PATCH 1/4] dart2: Use the correct classname in test generation At present test generation has a stray hard-coded reference to the pet store Pet() class, which should reflect the actual classname under test. --- .../src/main/resources/dart2/model_test.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache index 89300fed75d5..b766bf143e78 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -5,7 +5,7 @@ import 'package:test/test.dart'; // tests for {{classname}} void main() { - var instance = new Pet(); + var instance = new {{classname}}(); group('test {{classname}}', () { {{#vars}} From 6123c58598f0809f494fbf99badef5ac8d3c1562 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Wed, 7 Aug 2019 10:13:35 +0200 Subject: [PATCH 2/4] dart2: Call toDouble() in generated code for double types At present the generated code does not correctly handle transitioning to double when dealing with non-integer types in JSON deserialization. This ends up with dart raising an unhandled type mismatch exception: Unhandled exception: type 'int' is not a subtype of type 'double' where ... Using the .toDouble() conversion when a double type is expected fixes this up by making the typing explicit. --- .../src/main/resources/dart2/class.mustache | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache index 5c2c2e8d8cf5..90feaf7d8d03 100644 --- a/modules/openapi-generator/src/main/resources/dart2/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -49,7 +49,12 @@ class {{classname}} { {{name}} = (json['{{baseName}}'] as Map).cast(); {{/isMapContainer}} {{^isMapContainer}} + {{#isDouble}} + {{name}} = json['{{baseName}}'].toDouble(); + {{/isDouble}} + {{^isDouble}} {{name}} = json['{{baseName}}']; + {{/isDouble}} {{/isMapContainer}} {{/isListContainer}} {{/complexType}} From 838359f08b2c8cbfb52345abad2042e6eb16f29c Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Wed, 7 Aug 2019 10:26:50 +0200 Subject: [PATCH 3/4] dart2: Drop use of deprecated 'new' keyword in generated code The use of the 'new' keyword in dart2 is deprecated and should be avoided, as per the official guidance of the dart2 authors: https://dart.dev/guides/language/effective-dart/usage#dont-use-new --- .../src/main/resources/dart2/README.mustache | 4 ++-- .../src/main/resources/dart2/api.mustache | 8 ++++---- .../src/main/resources/dart2/api_doc.mustache | 4 ++-- .../src/main/resources/dart2/api_test.mustache | 2 +- .../src/main/resources/dart2/class.mustache | 8 ++++---- .../src/main/resources/dart2/model_test.mustache | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/README.mustache b/modules/openapi-generator/src/main/resources/dart2/README.mustache index 83c7a21222c7..eab8ee0ea7ac 100644 --- a/modules/openapi-generator/src/main/resources/dart2/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/README.mustache @@ -74,9 +74,9 @@ import 'package:{{pubName}}/api.dart'; {{/authMethods}} {{/hasAuthMethods}} -var api_instance = new {{classname}}(); +var api_instance = {{classname}}(); {{#allParams}} -var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}{{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index 394ae1073a0b..9ecac421b67d 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -19,7 +19,7 @@ class {{classname}} { {{#allParams}} {{#required}} if({{paramName}} == null) { - throw new ApiException(400, "Missing required param: {{paramName}}"); + throw ApiException(400, "Missing required param: {{paramName}}"); } {{/required}} {{/allParams}} @@ -51,7 +51,7 @@ class {{classname}} { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); {{#formParams}} {{^isFile}} if ({{paramName}} != null) { @@ -89,7 +89,7 @@ class {{classname}} { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { {{#isListContainer}} {{#returnType}} @@ -99,7 +99,7 @@ class {{classname}} { {{^isListContainer}} {{#isMapContainer}} {{#returnType}} - return new {{{returnType}}}.from(apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}')); + return {{{returnType}}}.from(apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}')); {{/returnType}}; {{/isMapContainer}} {{^isMapContainer}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache index 773ee0d562e1..7ef24590d167 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache @@ -45,9 +45,9 @@ import 'package:{{pubName}}/api.dart'; {{/authMethods}} {{/hasAuthMethods}} -var api_instance = new {{classname}}(); +var api_instance = {{classname}}(); {{#allParams}} -var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}{{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { diff --git a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache index 951aaf86d85c..07459b09938b 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_test.mustache @@ -5,7 +5,7 @@ import 'package:test/test.dart'; /// tests for {{classname}} void main() { - var instance = new {{classname}}(); + var instance = {{classname}}(); group('tests for {{classname}}', () { {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache index 90feaf7d8d03..9f9af4e51a78 100644 --- a/modules/openapi-generator/src/main/resources/dart2/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -36,7 +36,7 @@ class {{classname}} { {{name}} = {{complexType}}.mapFromJson(json['{{baseName}}']); {{/isMapContainer}} {{^isMapContainer}} - {{name}} = new {{complexType}}.fromJson(json['{{baseName}}']); + {{name}} = {{complexType}}.fromJson(json['{{baseName}}']); {{/isMapContainer}} {{/isListContainer}} {{/complexType}} @@ -86,13 +86,13 @@ class {{classname}} { } static List<{{classname}}> listFromJson(List json) { - return json == null ? new List<{{classname}}>() : json.map((value) => new {{classname}}.fromJson(value)).toList(); + return json == null ? List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new {{classname}}.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = {{classname}}.fromJson(value)); } return map; } diff --git a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache index b766bf143e78..49f403ef6955 100644 --- a/modules/openapi-generator/src/main/resources/dart2/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/model_test.mustache @@ -5,7 +5,7 @@ import 'package:test/test.dart'; // tests for {{classname}} void main() { - var instance = new {{classname}}(); + var instance = {{classname}}(); group('test {{classname}}', () { {{#vars}} From 6b5770fe2cd9a66f424cf41d99aca8d08684b20f Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Wed, 7 Aug 2019 11:06:51 +0200 Subject: [PATCH 4/4] dart2: Regenerate samples for mustache template changes --- .../openapi/.openapi-generator/VERSION | 2 +- .../dart/flutter_petstore/openapi/.travis.yml | 2 +- .../dart/flutter_petstore/openapi/README.md | 16 ++- .../openapi/docs/InlineObject.md | 16 +++ .../openapi/docs/InlineObject1.md | 16 +++ .../flutter_petstore/openapi/docs/PetApi.md | 56 +++++---- .../flutter_petstore/openapi/docs/StoreApi.md | 22 ++-- .../flutter_petstore/openapi/docs/UserApi.md | 92 +++++++++----- .../flutter_petstore/openapi/lib/api.dart | 4 +- .../openapi/lib/api/pet_api.dart | 93 +++++++------- .../openapi/lib/api/store_api.dart | 46 +++---- .../openapi/lib/api/user_api.dart | 118 +++++++++--------- .../openapi/lib/api_client.dart | 59 ++++----- .../openapi/lib/api_exception.dart | 8 +- .../openapi/lib/api_helper.dart | 6 +- .../openapi/lib/auth/api_key_auth.dart | 10 +- .../openapi/lib/auth/http_basic_auth.dart | 12 +- .../openapi/lib/auth/oauth.dart | 13 +- .../openapi/lib/model/api_response.dart | 29 +++-- .../openapi/lib/model/category.dart | 24 ++-- .../openapi/lib/model/inline_object.dart | 50 ++++++++ .../openapi/lib/model/inline_object1.dart | 50 ++++++++ .../openapi/lib/model/order.dart | 42 ++++--- .../openapi/lib/model/pet.dart | 42 ++++--- .../openapi/lib/model/tag.dart | 24 ++-- .../openapi/lib/model/user.dart | 54 ++++---- .../flutter_petstore/openapi/pubspec.yaml | 2 + .../openapi/test/api_response_test.dart | 2 +- .../openapi/test/category_test.dart | 2 +- .../openapi/test/inline_object1_test.dart | 24 ++++ .../openapi/test/inline_object_test.dart | 24 ++++ .../openapi/test/order_test.dart | 2 +- .../openapi/test/pet_api_test.dart | 8 +- .../openapi/test/pet_test.dart | 2 +- .../openapi/test/store_api_test.dart | 4 +- .../openapi/test/tag_test.dart | 2 +- .../openapi/test/user_api_test.dart | 10 +- .../openapi/test/user_test.dart | 2 +- .../openapi/.openapi-generator/VERSION | 2 +- .../dart2/flutter_petstore/openapi/README.md | 4 +- .../flutter_petstore/openapi/docs/PetApi.md | 20 +-- .../flutter_petstore/openapi/docs/StoreApi.md | 10 +- .../flutter_petstore/openapi/docs/UserApi.md | 28 ++--- .../openapi/lib/api/pet_api.dart | 48 +++---- .../openapi/lib/api/store_api.dart | 24 ++-- .../openapi/lib/api/user_api.dart | 50 ++++---- .../openapi/lib/model/api_response.dart | 6 +- .../openapi/lib/model/category.dart | 6 +- .../openapi/lib/model/order.dart | 6 +- .../openapi/lib/model/pet.dart | 8 +- .../openapi/lib/model/tag.dart | 6 +- .../openapi/lib/model/user.dart | 6 +- .../openapi/test/api_response_test.dart | 2 +- .../openapi/test/category_test.dart | 2 +- .../openapi/test/order_test.dart | 2 +- .../openapi/test/pet_api_test.dart | 2 +- .../openapi/test/pet_test.dart | 2 +- .../openapi/test/store_api_test.dart | 2 +- .../openapi/test/tag_test.dart | 2 +- .../openapi/test/user_api_test.dart | 2 +- .../openapi/test/user_test.dart | 2 +- .../.openapi-generator/VERSION | 2 +- .../dart2/openapi-browser-client/README.md | 4 +- .../openapi-browser-client/docs/PetApi.md | 20 +-- .../openapi-browser-client/docs/StoreApi.md | 10 +- .../openapi-browser-client/docs/UserApi.md | 28 ++--- .../lib/api/pet_api.dart | 48 +++---- .../lib/api/store_api.dart | 24 ++-- .../lib/api/user_api.dart | 50 ++++---- .../lib/model/api_response.dart | 6 +- .../lib/model/category.dart | 6 +- .../lib/model/order.dart | 6 +- .../openapi-browser-client/lib/model/pet.dart | 8 +- .../openapi-browser-client/lib/model/tag.dart | 6 +- .../lib/model/user.dart | 6 +- .../test/api_response_test.dart | 2 +- .../test/category_test.dart | 2 +- .../test/order_test.dart | 2 +- .../test/pet_api_test.dart | 2 +- .../openapi-browser-client/test/pet_test.dart | 2 +- .../test/store_api_test.dart | 2 +- .../openapi-browser-client/test/tag_test.dart | 2 +- .../test/user_api_test.dart | 2 +- .../test/user_test.dart | 2 +- .../dart2/openapi/.openapi-generator/VERSION | 2 +- .../client/petstore/dart2/openapi/README.md | 4 +- .../petstore/dart2/openapi/docs/PetApi.md | 20 +-- .../petstore/dart2/openapi/docs/StoreApi.md | 10 +- .../petstore/dart2/openapi/docs/UserApi.md | 28 ++--- .../dart2/openapi/lib/api/pet_api.dart | 48 +++---- .../dart2/openapi/lib/api/store_api.dart | 24 ++-- .../dart2/openapi/lib/api/user_api.dart | 50 ++++---- .../dart2/openapi/lib/model/api_response.dart | 6 +- .../dart2/openapi/lib/model/category.dart | 6 +- .../dart2/openapi/lib/model/order.dart | 6 +- .../petstore/dart2/openapi/lib/model/pet.dart | 8 +- .../petstore/dart2/openapi/lib/model/tag.dart | 6 +- .../dart2/openapi/lib/model/user.dart | 6 +- .../dart2/openapi/test/api_response_test.dart | 2 +- .../dart2/openapi/test/category_test.dart | 2 +- .../dart2/openapi/test/order_test.dart | 2 +- .../dart2/openapi/test/pet_api_test.dart | 2 +- .../petstore/dart2/openapi/test/pet_test.dart | 2 +- .../dart2/openapi/test/store_api_test.dart | 2 +- .../petstore/dart2/openapi/test/tag_test.dart | 2 +- .../dart2/openapi/test/user_api_test.dart | 2 +- .../dart2/openapi/test/user_test.dart | 2 +- 107 files changed, 984 insertions(+), 732 deletions(-) create mode 100644 samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject.md create mode 100644 samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject1.md create mode 100644 samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object.dart create mode 100644 samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object1.dart create mode 100644 samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object1_test.dart create mode 100644 samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object_test.dart diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION index 06b5019af3f4..83a328a9227e 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION +++ b/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.1-SNAPSHOT \ No newline at end of file +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/.travis.yml b/samples/client/petstore/dart/flutter_petstore/openapi/.travis.yml index 82b19541fa43..d0758bc9f0d6 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/.travis.yml +++ b/samples/client/petstore/dart/flutter_petstore/openapi/.travis.yml @@ -3,7 +3,7 @@ language: dart dart: # Install a specific stable release -- "1.24.3" +- "2.2.0" install: - pub get diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/README.md b/samples/client/petstore/dart/flutter_petstore/openapi/README.md index 8520a219f887..ae7f6ea5e876 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/README.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/README.md @@ -44,13 +44,13 @@ Please follow the [installation procedure](#installation--usage) and then run th import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + api_instance.addPet(pet); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -89,6 +89,8 @@ Class | Method | HTTP request | Description - [ApiResponse](docs//ApiResponse.md) - [Category](docs//Category.md) + - [InlineObject](docs//InlineObject.md) + - [InlineObject1](docs//InlineObject1.md) - [Order](docs//Order.md) - [Pet](docs//Pet.md) - [Tag](docs//Tag.md) @@ -104,6 +106,12 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header +## auth_cookie + +- **Type**: API key +- **API key parameter name**: AUTH_KEY +- **Location**: + ## petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject.md new file mode 100644 index 000000000000..1789b30bb816 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Updated name of the pet | [optional] [default to null] +**status** | **String** | Updated status of the pet | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject1.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject1.md new file mode 100644 index 000000000000..a5c2c120129c --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/InlineObject1.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject1 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] [default to null] +**file** | [**MultipartFile**](File.md) | file to upload | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md index 5780e7f38022..2d01917ec270 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **addPet** -> addPet(body) +> addPet(pet) Add a new pet to the store @@ -28,13 +28,13 @@ Add a new pet to the store ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + api_instance.addPet(pet); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -44,7 +44,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -70,9 +70,9 @@ Deletes a pet ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | @@ -116,9 +116,9 @@ Multiple status values can be provided with comma separated strings ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var status = []; // List | Status values that need to be considered for filter try { @@ -151,7 +151,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **findPetsByTags** -> List findPetsByTags(tags) +> List findPetsByTags(tags, maxCount) Finds Pets by tags @@ -161,13 +161,14 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var tags = []; // List | Tags to filter by +var maxCount = 56; // int | Maximum number of items to return try { - var result = api_instance.findPetsByTags(tags); + var result = api_instance.findPetsByTags(tags, maxCount); print(result); } catch (e) { print("Exception when calling PetApi->findPetsByTags: $e\n"); @@ -179,6 +180,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **maxCount** | **int**| Maximum number of items to return | [optional] [default to null] ### Return type @@ -206,11 +208,11 @@ Returns a single pet ```dart import 'package:openapi/api.dart'; // TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to return try { @@ -243,7 +245,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updatePet** -> updatePet(body) +> updatePet(pet) Update an existing pet @@ -251,13 +253,13 @@ Update an existing pet ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(body); + api_instance.updatePet(pet); } catch (e) { print("Exception when calling PetApi->updatePet: $e\n"); } @@ -267,7 +269,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -293,9 +295,9 @@ Updates a pet in the store with form data ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet @@ -339,9 +341,9 @@ uploads an image ```dart import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server var file = BINARY_DATA_HERE; // MultipartFile | file to upload diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md index df76647f11ae..4a501766d3cd 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md @@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { @@ -68,11 +68,11 @@ Returns a map of status codes to quantities ```dart import 'package:openapi/api.dart'; // TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); try { var result = api_instance.getInventory(); @@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = 789; // int | ID of pet that needs to be fetched try { @@ -144,7 +144,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **placeOrder** -> Order placeOrder(body) +> Order placeOrder(order) Place an order for a pet @@ -152,11 +152,11 @@ Place an order for a pet ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet +var api_instance = StoreApi(); +var order = Order(); // Order | order placed for purchasing the pet try { - var result = api_instance.placeOrder(body); + var result = api_instance.placeOrder(order); print(result); } catch (e) { print("Exception when calling StoreApi->placeOrder: $e\n"); @@ -167,7 +167,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -179,7 +179,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md index 5e0605c6ea08..4a9e433e25f8 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(body) +> createUser(user) Create user @@ -29,12 +29,16 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: auth_cookie +//defaultApiClient.getAuthentication('auth_cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('auth_cookie').apiKeyPrefix = 'Bearer'; -var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var api_instance = UserApi(); +var user = User(); // User | Created user object try { - api_instance.createUser(body); + api_instance.createUser(user); } catch (e) { print("Exception when calling UserApi->createUser: $e\n"); } @@ -44,7 +48,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -52,29 +56,33 @@ void (empty response body) ### Authorization -No authorization required +[auth_cookie](../README.md#auth_cookie) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **createUsersWithArrayInput** -> createUsersWithArrayInput(body) +> createUsersWithArrayInput(user) Creates list of users with given input array ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: auth_cookie +//defaultApiClient.getAuthentication('auth_cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('auth_cookie').apiKeyPrefix = 'Bearer'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var user = [List<User>()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(body); + api_instance.createUsersWithArrayInput(user); } catch (e) { print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); } @@ -84,7 +92,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -92,29 +100,33 @@ void (empty response body) ### Authorization -No authorization required +[auth_cookie](../README.md#auth_cookie) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **createUsersWithListInput** -> createUsersWithListInput(body) +> createUsersWithListInput(user) Creates list of users with given input array ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: auth_cookie +//defaultApiClient.getAuthentication('auth_cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('auth_cookie').apiKeyPrefix = 'Bearer'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var user = [List<User>()]; // List | List of user object try { - api_instance.createUsersWithListInput(body); + api_instance.createUsersWithListInput(user); } catch (e) { print("Exception when calling UserApi->createUsersWithListInput: $e\n"); } @@ -124,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -132,11 +144,11 @@ void (empty response body) ### Authorization -No authorization required +[auth_cookie](../README.md#auth_cookie) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -151,8 +163,12 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: auth_cookie +//defaultApiClient.getAuthentication('auth_cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('auth_cookie').apiKeyPrefix = 'Bearer'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be deleted try { @@ -174,7 +190,7 @@ void (empty response body) ### Authorization -No authorization required +[auth_cookie](../README.md#auth_cookie) ### HTTP request headers @@ -192,7 +208,7 @@ Get user by user name ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. try { @@ -233,7 +249,7 @@ Logs user into the system ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The user name for login var password = password_example; // String | The password for login in clear text @@ -275,8 +291,12 @@ Logs out current logged in user session ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: auth_cookie +//defaultApiClient.getAuthentication('auth_cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('auth_cookie').apiKeyPrefix = 'Bearer'; -var api_instance = new UserApi(); +var api_instance = UserApi(); try { api_instance.logoutUser(); @@ -294,7 +314,7 @@ void (empty response body) ### Authorization -No authorization required +[auth_cookie](../README.md#auth_cookie) ### HTTP request headers @@ -304,7 +324,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updateUser** -> updateUser(username, body) +> updateUser(username, user) Updated user @@ -313,13 +333,17 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: auth_cookie +//defaultApiClient.getAuthentication('auth_cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('auth_cookie').apiKeyPrefix = 'Bearer'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var user = User(); // User | Updated user object try { - api_instance.updateUser(username, body); + api_instance.updateUser(username, user); } catch (e) { print("Exception when calling UserApi->updateUser: $e\n"); } @@ -330,7 +354,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | [default to null] - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -338,11 +362,11 @@ void (empty response body) ### Authorization -No authorization required +[auth_cookie](../README.md#auth_cookie) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart index 9a64a5342b4a..675ff37a46b8 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart @@ -18,10 +18,12 @@ part 'api/user_api.dart'; part 'model/api_response.dart'; part 'model/category.dart'; +part 'model/inline_object.dart'; +part 'model/inline_object1.dart'; part 'model/order.dart'; part 'model/pet.dart'; part 'model/tag.dart'; part 'model/user.dart'; -ApiClient defaultApiClient = new ApiClient(); +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart index 6ffc146490b8..1210fa617a19 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart @@ -10,12 +10,12 @@ class PetApi { /// Add a new pet to the store /// /// - Future addPet(Pet body) async { - Object postBody = body; + Future addPet(Pet pet) async { + Object postBody = pet; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(pet == null) { + throw ApiException(400, "Missing required param: pet"); } // create path and map variables @@ -28,12 +28,12 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -60,11 +60,11 @@ class PetApi { /// /// Future deletePet(int petId, { String apiKey }) async { - Object postBody = null; + Object postBody; // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -78,12 +78,12 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -100,7 +100,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -110,11 +110,11 @@ class PetApi { /// /// Multiple status values can be provided with comma separated strings Future> findPetsByStatus(List status) async { - Object postBody = null; + Object postBody; // verify required params are set if(status == null) { - throw new ApiException(400, "Missing required param: status"); + throw ApiException(400, "Missing required param: status"); } // create path and map variables @@ -128,12 +128,12 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -150,7 +150,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -160,12 +160,12 @@ class PetApi { /// Finds Pets by tags /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future> findPetsByTags(List tags) async { - Object postBody = null; + Future> findPetsByTags(List tags, { int maxCount }) async { + Object postBody; // verify required params are set if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + throw ApiException(400, "Missing required param: tags"); } // create path and map variables @@ -176,15 +176,18 @@ class PetApi { Map headerParams = {}; Map formParams = {}; queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + if(maxCount != null) { + queryParams.addAll(_convertParametersForCollectionFormat("", "maxCount", maxCount)); + } List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -201,7 +204,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -212,11 +215,11 @@ class PetApi { /// /// Returns a single pet Future getPetById(int petId) async { - Object postBody = null; + Object postBody; // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -229,12 +232,12 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -251,7 +254,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; } else { @@ -261,12 +264,12 @@ class PetApi { /// Update an existing pet /// /// - Future updatePet(Pet body) async { - Object postBody = body; + Future updatePet(Pet pet) async { + Object postBody = pet; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(pet == null) { + throw ApiException(400, "Missing required param: pet"); } // create path and map variables @@ -279,12 +282,12 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +304,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -311,11 +314,11 @@ class PetApi { /// /// Future updatePetWithForm(int petId, { String name, String status }) async { - Object postBody = null; + Object postBody; // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -328,12 +331,12 @@ class PetApi { List contentTypes = ["application/x-www-form-urlencoded"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (name != null) { hasFields = true; mp.fields['name'] = parameterToString(name); @@ -362,7 +365,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -372,11 +375,11 @@ class PetApi { /// /// Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { - Object postBody = null; + Object postBody; // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -389,12 +392,12 @@ class PetApi { List contentTypes = ["multipart/form-data"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (additionalMetadata != null) { hasFields = true; mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); @@ -422,7 +425,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; } else { diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart index 7475aa4d9901..f21b5ce98a61 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart @@ -11,11 +11,11 @@ class StoreApi { /// /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors Future deleteOrder(String orderId) async { - Object postBody = null; + Object postBody; // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -28,12 +28,12 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = []; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -60,7 +60,7 @@ class StoreApi { /// /// Returns a map of status codes to quantities Future> getInventory() async { - Object postBody = null; + Object postBody; // verify required params are set @@ -74,12 +74,12 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -96,9 +96,9 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { - return new Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); ; } else { return null; @@ -108,11 +108,11 @@ class StoreApi { /// /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions Future getOrderById(int orderId) async { - Object postBody = null; + Object postBody; // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -125,12 +125,12 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = []; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -147,7 +147,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { @@ -157,12 +157,12 @@ class StoreApi { /// Place an order for a pet /// /// - Future placeOrder(Order body) async { - Object postBody = body; + Future placeOrder(Order order) async { + Object postBody = order; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(order == null) { + throw ApiException(400, "Missing required param: order"); } // create path and map variables @@ -173,14 +173,14 @@ class StoreApi { Map headerParams = {}; Map formParams = {}; - List contentTypes = []; + List contentTypes = ["application/json"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = []; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart index 8f00081a8c4c..f7d7e41f8df2 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart @@ -10,12 +10,12 @@ class UserApi { /// Create user /// /// This can only be done by the logged in user. - Future createUser(User body) async { - Object postBody = body; + Future createUser(User user) async { + Object postBody = user; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw ApiException(400, "Missing required param: user"); } // create path and map variables @@ -26,14 +26,14 @@ class UserApi { Map headerParams = {}; Map formParams = {}; - List contentTypes = []; + List contentTypes = ["application/json"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + List authNames = ["auth_cookie"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -59,12 +59,12 @@ class UserApi { /// Creates list of users with given input array /// /// - Future createUsersWithArrayInput(List body) async { - Object postBody = body; + Future createUsersWithArrayInput(List user) async { + Object postBody = user; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw ApiException(400, "Missing required param: user"); } // create path and map variables @@ -75,14 +75,14 @@ class UserApi { Map headerParams = {}; Map formParams = {}; - List contentTypes = []; + List contentTypes = ["application/json"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + List authNames = ["auth_cookie"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -99,7 +99,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -108,12 +108,12 @@ class UserApi { /// Creates list of users with given input array /// /// - Future createUsersWithListInput(List body) async { - Object postBody = body; + Future createUsersWithListInput(List user) async { + Object postBody = user; // verify required params are set - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw ApiException(400, "Missing required param: user"); } // create path and map variables @@ -124,14 +124,14 @@ class UserApi { Map headerParams = {}; Map formParams = {}; - List contentTypes = []; + List contentTypes = ["application/json"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + List authNames = ["auth_cookie"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -148,7 +148,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -158,11 +158,11 @@ class UserApi { /// /// This can only be done by the logged in user. Future deleteUser(String username) async { - Object postBody = null; + Object postBody; // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -175,12 +175,12 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + List authNames = ["auth_cookie"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -207,11 +207,11 @@ class UserApi { /// /// Future getUserByName(String username) async { - Object postBody = null; + Object postBody; // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -224,12 +224,12 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = []; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -246,7 +246,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; } else { @@ -257,14 +257,14 @@ class UserApi { /// /// Future loginUser(String username, String password) async { - Object postBody = null; + Object postBody; // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(password == null) { - throw new ApiException(400, "Missing required param: password"); + throw ApiException(400, "Missing required param: password"); } // create path and map variables @@ -279,12 +279,12 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; List authNames = []; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } else { @@ -312,7 +312,7 @@ class UserApi { /// /// Future logoutUser() async { - Object postBody = null; + Object postBody; // verify required params are set @@ -326,12 +326,12 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + List authNames = ["auth_cookie"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -348,7 +348,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -357,15 +357,15 @@ class UserApi { /// Updated user /// /// This can only be done by the logged in user. - Future updateUser(String username, User body) async { - Object postBody = body; + Future updateUser(String username, User user) async { + Object postBody = user; // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } - if(body == null) { - throw new ApiException(400, "Missing required param: body"); + if(user == null) { + throw ApiException(400, "Missing required param: user"); } // create path and map variables @@ -376,14 +376,14 @@ class UserApi { Map headerParams = {}; Map formParams = {}; - List contentTypes = []; + List contentTypes = ["application/json"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; + String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + List authNames = ["auth_cookie"]; if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -400,7 +400,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart index b99ddeeccb19..e35c37c020c7 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart @@ -10,18 +10,19 @@ class QueryParam { class ApiClient { String basePath; - var client = new Client(); + var client = Client(); Map _defaultHeaderMap = {}; Map _authentications = {}; - final _RegList = new RegExp(r'^List<(.*)>$'); - final _RegMap = new RegExp(r'^Map$'); + final _regList = RegExp(r'^List<(.*)>$'); + final _regMap = RegExp(r'^Map$'); - ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) { + ApiClient({this.basePath = "http://petstore.swagger.io/v2"}) { // Setup authentications (key: authentication name, value: authentication). - _authentications['api_key'] = new ApiKeyAuth("header", "api_key"); - _authentications['petstore_auth'] = new OAuth(); + _authentications['api_key'] = ApiKeyAuth("header", "api_key"); + _authentications['auth_cookie'] = ApiKeyAuth("query", "AUTH_KEY"); + _authentications['petstore_auth'] = OAuth(); } void addDefaultHeader(String key, String value) { @@ -40,36 +41,40 @@ class ApiClient { case 'double': return value is double ? value : double.parse('$value'); case 'ApiResponse': - return new ApiResponse.fromJson(value); + return ApiResponse.fromJson(value); case 'Category': - return new Category.fromJson(value); + return Category.fromJson(value); + case 'InlineObject': + return InlineObject.fromJson(value); + case 'InlineObject1': + return InlineObject1.fromJson(value); case 'Order': - return new Order.fromJson(value); + return Order.fromJson(value); case 'Pet': - return new Pet.fromJson(value); + return Pet.fromJson(value); case 'Tag': - return new Tag.fromJson(value); + return Tag.fromJson(value); case 'User': - return new User.fromJson(value); + return User.fromJson(value); default: { Match match; if (value is List && - (match = _RegList.firstMatch(targetType)) != null) { + (match = _regList.firstMatch(targetType)) != null) { var newTargetType = match[1]; return value.map((v) => _deserialize(v, newTargetType)).toList(); } else if (value is Map && - (match = _RegMap.firstMatch(targetType)) != null) { + (match = _regMap.firstMatch(targetType)) != null) { var newTargetType = match[1]; - return new Map.fromIterables(value.keys, + return Map.fromIterables(value.keys, value.values.map((v) => _deserialize(v, newTargetType))); } } } - } catch (e, stack) { - throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); + } on Exception catch (e, stack) { + throw ApiException.withInner(500, 'Exception during deserialization.', e, stack); } - throw new ApiException(500, 'Could not find a suitable class for deserialization'); + throw ApiException(500, 'Could not find a suitable class for deserialization'); } dynamic deserialize(String json, String targetType) { @@ -78,7 +83,7 @@ class ApiClient { if (targetType == 'String') return json; - var decodedJson = JSON.decode(json); + var decodedJson = jsonDecode(json); return _deserialize(decodedJson, targetType); } @@ -87,7 +92,7 @@ class ApiClient { if (obj == null) { serialized = ''; } else { - serialized = JSON.encode(obj); + serialized = json.encode(obj); } return serialized; } @@ -119,7 +124,7 @@ class ApiClient { headerParams['Content-Type'] = contentType; if(body is MultipartRequest) { - var request = new MultipartRequest(method, Uri.parse(url)); + var request = MultipartRequest(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); request.headers.addAll(body.headers); @@ -148,16 +153,14 @@ class ApiClient { void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { authNames.forEach((authName) { Authentication auth = _authentications[authName]; - if (auth == null) throw new ArgumentError("Authentication undefined: " + authName); + if (auth == null) throw ArgumentError("Authentication undefined: " + authName); auth.applyToParams(queryParams, headerParams); }); } - void setAccessToken(String accessToken) { - _authentications.forEach((key, auth) { - if (auth is OAuth) { - auth.setAccessToken(accessToken); - } - }); + T getAuthentication(String name) { + var authentication = _authentications[name]; + + return authentication is T ? authentication : null; } } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart index f188fd125a4d..668abe2c96bc 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart @@ -2,9 +2,9 @@ part of openapi.api; class ApiException implements Exception { int code = 0; - String message = null; - Exception innerException = null; - StackTrace stackTrace = null; + String message; + Exception innerException; + StackTrace stackTrace; ApiException(this.code, this.message); @@ -17,7 +17,7 @@ class ApiException implements Exception { return "ApiException $code: $message"; } - return "ApiException $code: $message (Inner exception: ${innerException})\n\n" + + return "ApiException $code: $message (Inner exception: $innerException)\n\n" + stackTrace.toString(); } } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart index 9c1497017e80..c57b111ca87d 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart @@ -11,7 +11,7 @@ Iterable _convertParametersForCollectionFormat( if (name == null || name.isEmpty || value == null) return params; if (value is! List) { - params.add(new QueryParam(name, parameterToString(value))); + params.add(QueryParam(name, parameterToString(value))); return params; } @@ -23,12 +23,12 @@ Iterable _convertParametersForCollectionFormat( : collectionFormat; // default: csv if (collectionFormat == "multi") { - return values.map((v) => new QueryParam(name, parameterToString(v))); + return values.map((v) => QueryParam(name, parameterToString(v))); } String delimiter = _delimiters[collectionFormat] ?? ","; - params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); + params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); return params; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart index f9617f7ae4da..8384f0516ce2 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart @@ -4,22 +4,24 @@ class ApiKeyAuth implements Authentication { final String location; final String paramName; - String apiKey; + String _apiKey; String apiKeyPrefix; + set apiKey(String key) => _apiKey = key; + ApiKeyAuth(this.location, this.paramName); @override void applyToParams(List queryParams, Map headerParams) { String value; if (apiKeyPrefix != null) { - value = '$apiKeyPrefix $apiKey'; + value = '$apiKeyPrefix $_apiKey'; } else { - value = apiKey; + value = _apiKey; } if (location == 'query' && value != null) { - queryParams.add(new QueryParam(paramName, value)); + queryParams.add(QueryParam(paramName, value)); } else if (location == 'header' && value != null) { headerParams[paramName] = value; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart index 4e77ddcf6e68..da931fa2634c 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart @@ -2,13 +2,15 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; - String password; + String _username; + String _password; @override void applyToParams(List queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str)); + String str = (_username == null ? "" : _username) + ":" + (_password == null ? "" : _password); + headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str)); } -} \ No newline at end of file + set username(String username) => _username = username; + set password(String password) => _password = password; +} diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart index 13bfd799743b..230471e44fc6 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart @@ -1,19 +1,16 @@ part of openapi.api; class OAuth implements Authentication { - String accessToken; + String _accessToken; - OAuth({this.accessToken}) { - } + OAuth({String accessToken}) : _accessToken = accessToken; @override void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams["Authorization"] = "Bearer " + accessToken; + if (_accessToken != null) { + headerParams["Authorization"] = "Bearer $_accessToken"; } } - void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } + set accessToken(String accessToken) => _accessToken = accessToken; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart index f2fddde347ae..be01c2de8195 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart @@ -19,36 +19,39 @@ class ApiResponse { if (json['code'] == null) { code = null; } else { - code = json['code']; + code = json['code']; } if (json['type'] == null) { type = null; } else { - type = json['type']; + type = json['type']; } if (json['message'] == null) { message = null; } else { - message = json['message']; + message = json['message']; } } Map toJson() { - return { - 'code': code, - 'type': type, - 'message': message - }; + Map json = {}; + if (code != null) + json['code'] = code; + if (type != null) + json['type'] = type; + if (message != null) + json['message'] = message; + return json; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => ApiResponse.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new ApiResponse.fromJson(value)); + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart index 1750c6a0acb1..696468a16191 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart @@ -17,30 +17,32 @@ class Category { if (json['id'] == null) { id = null; } else { - id = json['id']; + id = json['id']; } if (json['name'] == null) { name = null; } else { - name = json['name']; + name = json['name']; } } Map toJson() { - return { - 'id': id, - 'name': name - }; + Map json = {}; + if (id != null) + json['id'] = id; + if (name != null) + json['name'] = name; + return json; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Category.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Category.fromJson(value)); + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object.dart new file mode 100644 index 000000000000..e2a59c2ca40f --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object.dart @@ -0,0 +1,50 @@ +part of openapi.api; + +class InlineObject { + /* Updated name of the pet */ + String name = null; + /* Updated status of the pet */ + String status = null; + InlineObject(); + + @override + String toString() { + return 'InlineObject[name=$name, status=$status, ]'; + } + + InlineObject.fromJson(Map json) { + if (json == null) return; + if (json['name'] == null) { + name = null; + } else { + name = json['name']; + } + if (json['status'] == null) { + status = null; + } else { + status = json['status']; + } + } + + Map toJson() { + Map json = {}; + if (name != null) + json['name'] = name; + if (status != null) + json['status'] = status; + return json; + } + + static List listFromJson(List json) { + return json == null ? List() : json.map((value) => InlineObject.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = InlineObject.fromJson(value)); + } + return map; + } +} + diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object1.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object1.dart new file mode 100644 index 000000000000..eba9610c5567 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/inline_object1.dart @@ -0,0 +1,50 @@ +part of openapi.api; + +class InlineObject1 { + /* Additional data to pass to server */ + String additionalMetadata = null; + /* file to upload */ + MultipartFile file = null; + InlineObject1(); + + @override + String toString() { + return 'InlineObject1[additionalMetadata=$additionalMetadata, file=$file, ]'; + } + + InlineObject1.fromJson(Map json) { + if (json == null) return; + if (json['additionalMetadata'] == null) { + additionalMetadata = null; + } else { + additionalMetadata = json['additionalMetadata']; + } + if (json['file'] == null) { + file = null; + } else { + file = File.fromJson(json['file']); + } + } + + Map toJson() { + Map json = {}; + if (additionalMetadata != null) + json['additionalMetadata'] = additionalMetadata; + if (file != null) + json['file'] = file; + return json; + } + + static List listFromJson(List json) { + return json == null ? List() : json.map((value) => InlineObject1.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = InlineObject1.fromJson(value)); + } + return map; + } +} + diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart index 51d15f730415..be5a12e1ed19 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart @@ -26,17 +26,17 @@ class Order { if (json['id'] == null) { id = null; } else { - id = json['id']; + id = json['id']; } if (json['petId'] == null) { petId = null; } else { - petId = json['petId']; + petId = json['petId']; } if (json['quantity'] == null) { quantity = null; } else { - quantity = json['quantity']; + quantity = json['quantity']; } if (json['shipDate'] == null) { shipDate = null; @@ -46,34 +46,40 @@ class Order { if (json['status'] == null) { status = null; } else { - status = json['status']; + status = json['status']; } if (json['complete'] == null) { complete = null; } else { - complete = json['complete']; + complete = json['complete']; } } Map toJson() { - return { - 'id': id, - 'petId': petId, - 'quantity': quantity, - 'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(), - 'status': status, - 'complete': complete - }; + Map json = {}; + if (id != null) + json['id'] = id; + if (petId != null) + json['petId'] = petId; + if (quantity != null) + json['quantity'] = quantity; + if (shipDate != null) + json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String(); + if (status != null) + json['status'] = status; + if (complete != null) + json['complete'] = complete; + return json; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Order.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Order.fromJson(value)); + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart index c64406368d87..4f19829878aa 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart @@ -26,22 +26,22 @@ class Pet { if (json['id'] == null) { id = null; } else { - id = json['id']; + id = json['id']; } if (json['category'] == null) { category = null; } else { - category = new Category.fromJson(json['category']); + category = Category.fromJson(json['category']); } if (json['name'] == null) { name = null; } else { - name = json['name']; + name = json['name']; } if (json['photoUrls'] == null) { photoUrls = null; } else { - photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList(); + photoUrls = (json['photoUrls'] as List).cast(); } if (json['tags'] == null) { tags = null; @@ -51,29 +51,35 @@ class Pet { if (json['status'] == null) { status = null; } else { - status = json['status']; + status = json['status']; } } Map toJson() { - return { - 'id': id, - 'category': category, - 'name': name, - 'photoUrls': photoUrls, - 'tags': tags, - 'status': status - }; + Map json = {}; + if (id != null) + json['id'] = id; + if (category != null) + json['category'] = category; + if (name != null) + json['name'] = name; + if (photoUrls != null) + json['photoUrls'] = photoUrls; + if (tags != null) + json['tags'] = tags; + if (status != null) + json['status'] = status; + return json; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Pet.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Pet.fromJson(value)); + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart index 980c6e016302..a3485e5d3c63 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart @@ -17,30 +17,32 @@ class Tag { if (json['id'] == null) { id = null; } else { - id = json['id']; + id = json['id']; } if (json['name'] == null) { name = null; } else { - name = json['name']; + name = json['name']; } } Map toJson() { - return { - 'id': id, - 'name': name - }; + Map json = {}; + if (id != null) + json['id'] = id; + if (name != null) + json['name'] = name; + return json; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Tag.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Tag.fromJson(value)); + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart index 1555eb0a3ef5..48f061d969b1 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart @@ -29,66 +29,74 @@ class User { if (json['id'] == null) { id = null; } else { - id = json['id']; + id = json['id']; } if (json['username'] == null) { username = null; } else { - username = json['username']; + username = json['username']; } if (json['firstName'] == null) { firstName = null; } else { - firstName = json['firstName']; + firstName = json['firstName']; } if (json['lastName'] == null) { lastName = null; } else { - lastName = json['lastName']; + lastName = json['lastName']; } if (json['email'] == null) { email = null; } else { - email = json['email']; + email = json['email']; } if (json['password'] == null) { password = null; } else { - password = json['password']; + password = json['password']; } if (json['phone'] == null) { phone = null; } else { - phone = json['phone']; + phone = json['phone']; } if (json['userStatus'] == null) { userStatus = null; } else { - userStatus = json['userStatus']; + userStatus = json['userStatus']; } } Map toJson() { - return { - 'id': id, - 'username': username, - 'firstName': firstName, - 'lastName': lastName, - 'email': email, - 'password': password, - 'phone': phone, - 'userStatus': userStatus - }; + Map json = {}; + if (id != null) + json['id'] = id; + if (username != null) + json['username'] = username; + if (firstName != null) + json['firstName'] = firstName; + if (lastName != null) + json['lastName'] = lastName; + if (email != null) + json['email'] = email; + if (password != null) + json['password'] = password; + if (phone != null) + json['phone'] = phone; + if (userStatus != null) + json['userStatus'] = userStatus; + return json; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => User.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new User.fromJson(value)); + static Map mapFromJson(Map json) { + var map = Map(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) => map[key] = User.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/pubspec.yaml b/samples/client/petstore/dart/flutter_petstore/openapi/pubspec.yaml index b63f835e89b3..391fa5edec02 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/pubspec.yaml +++ b/samples/client/petstore/dart/flutter_petstore/openapi/pubspec.yaml @@ -1,6 +1,8 @@ name: openapi version: 1.0.0 description: OpenAPI API client +environment: + sdk: '>=2.0.0 <3.0.0' dependencies: http: '>=0.11.1 <0.13.0' dev_dependencies: diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/api_response_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/api_response_test.dart index ba2202d24c49..afd92edde06e 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/api_response_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/api_response_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for ApiResponse void main() { - var instance = new ApiResponse(); + var instance = ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/category_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/category_test.dart index 0dcaa8b7977e..ed39fa7ed8a2 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/category_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/category_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Category(); + var instance = Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object1_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object1_test.dart new file mode 100644 index 000000000000..c13702bedf31 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object1_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject1 +void main() { + var instance = InlineObject1(); + + group('test InlineObject1', () { + // Additional data to pass to server + // String additionalMetadata (default value: null) + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // MultipartFile file (default value: null) + test('to test the property `file`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object_test.dart new file mode 100644 index 000000000000..14f10960f9de --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/inline_object_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject +void main() { + var instance = InlineObject(); + + group('test InlineObject', () { + // Updated name of the pet + // String name (default value: null) + test('to test the property `name`', () async { + // TODO + }); + + // Updated status of the pet + // String status (default value: null) + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/order_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/order_test.dart index aa9dcc69c4f9..6102e1e5d089 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/order_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/order_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Order(); + var instance = Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_api_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_api_test.dart index fa95dccad3cd..959cf932c73d 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_api_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_api_test.dart @@ -4,12 +4,12 @@ import 'package:test/test.dart'; /// tests for PetApi void main() { - var instance = new PetApi(); + var instance = PetApi(); group('tests for PetApi', () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet pet) async test('test addPet', () async { // TODO }); @@ -34,7 +34,7 @@ void main() { // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // - //Future> findPetsByTags(List tags) async + //Future> findPetsByTags(List tags, { int maxCount }) async test('test findPetsByTags', () async { // TODO }); @@ -50,7 +50,7 @@ void main() { // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet pet) async test('test updatePet', () async { // TODO }); diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_test.dart index cfd94b9e36c3..83480bd785e7 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/pet_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Pet void main() { - var instance = new Pet(); + var instance = Pet(); group('test Pet', () { // int id (default value: null) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/store_api_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/store_api_test.dart index 496d051e8334..d23843bf903e 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/store_api_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/store_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for StoreApi void main() { - var instance = new StoreApi(); + var instance = StoreApi(); group('tests for StoreApi', () { // Delete purchase order by ID @@ -36,7 +36,7 @@ void main() { // Place an order for a pet // - //Future placeOrder(Order body) async + //Future placeOrder(Order order) async test('test placeOrder', () async { // TODO }); diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/tag_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/tag_test.dart index 58477c9e7582..3333ea6d3104 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/tag_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/tag_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Tag(); + var instance = Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/user_api_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/user_api_test.dart index f040b01bf435..1cf5f4ced73d 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/user_api_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/user_api_test.dart @@ -4,28 +4,28 @@ import 'package:test/test.dart'; /// tests for UserApi void main() { - var instance = new UserApi(); + var instance = UserApi(); group('tests for UserApi', () { // Create user // // This can only be done by the logged in user. // - //Future createUser(User body) async + //Future createUser(User user) async test('test createUser', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(List user) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(List user) async test('test createUsersWithListInput', () async { // TODO }); @@ -64,7 +64,7 @@ void main() { // // This can only be done by the logged in user. // - //Future updateUser(String username, User body) async + //Future updateUser(String username, User user) async test('test updateUser', () async { // TODO }); diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/test/user_test.dart b/samples/client/petstore/dart/flutter_petstore/openapi/test/user_test.dart index ae6096d0f51a..35e8eed37568 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/test/user_test.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/test/user_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for User void main() { - var instance = new User(); + var instance = User(); group('test User', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION index 06b5019af3f4..83a328a9227e 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.1-SNAPSHOT \ No newline at end of file +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/README.md b/samples/client/petstore/dart2/flutter_petstore/openapi/README.md index 45fe0858b2dd..e78e0e3e6978 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/README.md +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/README.md @@ -46,8 +46,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.addPet(body); diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/PetApi.md index 3ec1113828c6..7b5de3894a91 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/docs/PetApi.md +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/PetApi.md @@ -30,8 +30,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.addPet(body); @@ -72,7 +72,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | @@ -118,7 +118,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var status = []; // List | Status values that need to be considered for filter try { @@ -163,7 +163,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var tags = []; // List | Tags to filter by try { @@ -210,7 +210,7 @@ import 'package:openapi/api.dart'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to return try { @@ -253,8 +253,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.updatePet(body); @@ -295,7 +295,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet @@ -341,7 +341,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server var file = BINARY_DATA_HERE; // MultipartFile | file to upload diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/docs/StoreApi.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/StoreApi.md index f3a5e0aba874..1cc37e2a47ab 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/docs/StoreApi.md +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/StoreApi.md @@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { @@ -72,7 +72,7 @@ import 'package:openapi/api.dart'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); try { var result = api_instance.getInventory(); @@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = 789; // int | ID of pet that needs to be fetched try { @@ -152,8 +152,8 @@ Place an order for a pet ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet +var api_instance = StoreApi(); +var body = Order(); // Order | order placed for purchasing the pet try { var result = api_instance.placeOrder(body); diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/docs/UserApi.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/UserApi.md index 5e0605c6ea08..1ee5f6fced69 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/docs/UserApi.md +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/UserApi.md @@ -30,8 +30,8 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var api_instance = UserApi(); +var body = User(); // User | Created user object try { api_instance.createUser(body); @@ -70,8 +70,8 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var body = [List<User>()]; // List | List of user object try { api_instance.createUsersWithArrayInput(body); @@ -84,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -110,8 +110,8 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var body = [List<User>()]; // List | List of user object try { api_instance.createUsersWithListInput(body); @@ -124,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -152,7 +152,7 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be deleted try { @@ -192,7 +192,7 @@ Get user by user name ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. try { @@ -233,7 +233,7 @@ Logs user into the system ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The user name for login var password = password_example; // String | The password for login in clear text @@ -276,7 +276,7 @@ Logs out current logged in user session ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); try { api_instance.logoutUser(); @@ -314,9 +314,9 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var body = User(); // User | Updated user object try { api_instance.updateUser(username, body); diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart index 9670db26fefc..35416e655ede 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart @@ -15,7 +15,7 @@ class PetApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -33,7 +33,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -64,7 +64,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -83,7 +83,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -100,7 +100,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -114,7 +114,7 @@ class PetApi { // verify required params are set if(status == null) { - throw new ApiException(400, "Missing required param: status"); + throw ApiException(400, "Missing required param: status"); } // create path and map variables @@ -133,7 +133,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -150,7 +150,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -165,7 +165,7 @@ class PetApi { // verify required params are set if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + throw ApiException(400, "Missing required param: tags"); } // create path and map variables @@ -184,7 +184,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -201,7 +201,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -216,7 +216,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -234,7 +234,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -251,7 +251,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; } else { @@ -266,7 +266,7 @@ class PetApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -284,7 +284,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -315,7 +315,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -333,7 +333,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (name != null) { hasFields = true; mp.fields['name'] = parameterToString(name); @@ -362,7 +362,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -376,7 +376,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -394,7 +394,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (additionalMetadata != null) { hasFields = true; mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); @@ -422,7 +422,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; } else { diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart index 1296576d4a00..59e59725ec63 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart @@ -15,7 +15,7 @@ class StoreApi { // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -33,7 +33,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -79,7 +79,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -96,9 +96,9 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { - return new Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); ; } else { return null; @@ -112,7 +112,7 @@ class StoreApi { // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -130,7 +130,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -147,7 +147,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { @@ -162,7 +162,7 @@ class StoreApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -180,7 +180,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart index 4ad3021a1fa1..475f0655b958 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart @@ -15,7 +15,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -33,7 +33,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -64,7 +64,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -82,7 +82,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -99,7 +99,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -113,7 +113,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -131,7 +131,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -148,7 +148,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -162,7 +162,7 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -180,7 +180,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -211,7 +211,7 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -229,7 +229,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -246,7 +246,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; } else { @@ -261,10 +261,10 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(password == null) { - throw new ApiException(400, "Missing required param: password"); + throw ApiException(400, "Missing required param: password"); } // create path and map variables @@ -284,7 +284,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } else { @@ -331,7 +331,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -348,7 +348,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -362,10 +362,10 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -383,7 +383,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -400,7 +400,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart index 3d37ea215773..be01c2de8195 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart @@ -45,13 +45,13 @@ class ApiResponse { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => ApiResponse.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new ApiResponse.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart index 32a7c1e81aad..696468a16191 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart @@ -36,13 +36,13 @@ class Category { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Category.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Category.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart index c3966e6f9f23..be5a12e1ed19 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart @@ -73,13 +73,13 @@ class Order { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Order.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Order.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart index d8bdd2ef4076..4f19829878aa 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart @@ -31,7 +31,7 @@ class Pet { if (json['category'] == null) { category = null; } else { - category = new Category.fromJson(json['category']); + category = Category.fromJson(json['category']); } if (json['name'] == null) { name = null; @@ -73,13 +73,13 @@ class Pet { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Pet.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Pet.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart index ca53c8ae890f..a3485e5d3c63 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart @@ -36,13 +36,13 @@ class Tag { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Tag.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Tag.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart index 1c5ef51fbaa4..48f061d969b1 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart @@ -90,13 +90,13 @@ class User { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => User.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new User.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = User.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/api_response_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/api_response_test.dart index ebf142904e9f..afd92edde06e 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/api_response_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/api_response_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for ApiResponse void main() { - var instance = new Pet(); + var instance = ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/category_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/category_test.dart index c5cea4b5bc3b..ed39fa7ed8a2 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/category_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/category_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Pet(); + var instance = Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/order_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/order_test.dart index 9982020d8cf7..6102e1e5d089 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/order_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/order_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Pet(); + var instance = Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_api_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_api_test.dart index fa95dccad3cd..409b7962536c 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_api_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for PetApi void main() { - var instance = new PetApi(); + var instance = PetApi(); group('tests for PetApi', () { // Add a new pet to the store diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_test.dart index cfd94b9e36c3..83480bd785e7 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/pet_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Pet void main() { - var instance = new Pet(); + var instance = Pet(); group('test Pet', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/store_api_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/store_api_test.dart index 496d051e8334..e2c7ab94b179 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/store_api_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/store_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for StoreApi void main() { - var instance = new StoreApi(); + var instance = StoreApi(); group('tests for StoreApi', () { // Delete purchase order by ID diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/tag_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/tag_test.dart index 6ee16c51bbac..3333ea6d3104 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/tag_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/tag_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Pet(); + var instance = Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_api_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_api_test.dart index f040b01bf435..5d124a611170 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_api_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for UserApi void main() { - var instance = new UserApi(); + var instance = UserApi(); group('tests for UserApi', () { // Create user diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_test.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_test.dart index 5a6340c4f4b7..35e8eed37568 100644 --- a/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_test.dart +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/test/user_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for User void main() { - var instance = new Pet(); + var instance = User(); group('test User', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION b/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION index 06b5019af3f4..83a328a9227e 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION +++ b/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.1-SNAPSHOT \ No newline at end of file +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi-browser-client/README.md b/samples/client/petstore/dart2/openapi-browser-client/README.md index 45fe0858b2dd..e78e0e3e6978 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/README.md +++ b/samples/client/petstore/dart2/openapi-browser-client/README.md @@ -46,8 +46,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.addPet(body); diff --git a/samples/client/petstore/dart2/openapi-browser-client/docs/PetApi.md b/samples/client/petstore/dart2/openapi-browser-client/docs/PetApi.md index 3ec1113828c6..7b5de3894a91 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/docs/PetApi.md +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/PetApi.md @@ -30,8 +30,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.addPet(body); @@ -72,7 +72,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | @@ -118,7 +118,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var status = []; // List | Status values that need to be considered for filter try { @@ -163,7 +163,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var tags = []; // List | Tags to filter by try { @@ -210,7 +210,7 @@ import 'package:openapi/api.dart'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to return try { @@ -253,8 +253,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.updatePet(body); @@ -295,7 +295,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet @@ -341,7 +341,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server var file = BINARY_DATA_HERE; // MultipartFile | file to upload diff --git a/samples/client/petstore/dart2/openapi-browser-client/docs/StoreApi.md b/samples/client/petstore/dart2/openapi-browser-client/docs/StoreApi.md index f3a5e0aba874..1cc37e2a47ab 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/docs/StoreApi.md +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/StoreApi.md @@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { @@ -72,7 +72,7 @@ import 'package:openapi/api.dart'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); try { var result = api_instance.getInventory(); @@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = 789; // int | ID of pet that needs to be fetched try { @@ -152,8 +152,8 @@ Place an order for a pet ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet +var api_instance = StoreApi(); +var body = Order(); // Order | order placed for purchasing the pet try { var result = api_instance.placeOrder(body); diff --git a/samples/client/petstore/dart2/openapi-browser-client/docs/UserApi.md b/samples/client/petstore/dart2/openapi-browser-client/docs/UserApi.md index 5e0605c6ea08..1ee5f6fced69 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/docs/UserApi.md +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/UserApi.md @@ -30,8 +30,8 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var api_instance = UserApi(); +var body = User(); // User | Created user object try { api_instance.createUser(body); @@ -70,8 +70,8 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var body = [List<User>()]; // List | List of user object try { api_instance.createUsersWithArrayInput(body); @@ -84,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -110,8 +110,8 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var body = [List<User>()]; // List | List of user object try { api_instance.createUsersWithListInput(body); @@ -124,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -152,7 +152,7 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be deleted try { @@ -192,7 +192,7 @@ Get user by user name ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. try { @@ -233,7 +233,7 @@ Logs user into the system ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The user name for login var password = password_example; // String | The password for login in clear text @@ -276,7 +276,7 @@ Logs out current logged in user session ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); try { api_instance.logoutUser(); @@ -314,9 +314,9 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var body = User(); // User | Updated user object try { api_instance.updateUser(username, body); diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart index 9670db26fefc..35416e655ede 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart @@ -15,7 +15,7 @@ class PetApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -33,7 +33,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -64,7 +64,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -83,7 +83,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -100,7 +100,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -114,7 +114,7 @@ class PetApi { // verify required params are set if(status == null) { - throw new ApiException(400, "Missing required param: status"); + throw ApiException(400, "Missing required param: status"); } // create path and map variables @@ -133,7 +133,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -150,7 +150,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -165,7 +165,7 @@ class PetApi { // verify required params are set if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + throw ApiException(400, "Missing required param: tags"); } // create path and map variables @@ -184,7 +184,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -201,7 +201,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -216,7 +216,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -234,7 +234,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -251,7 +251,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; } else { @@ -266,7 +266,7 @@ class PetApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -284,7 +284,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -315,7 +315,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -333,7 +333,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (name != null) { hasFields = true; mp.fields['name'] = parameterToString(name); @@ -362,7 +362,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -376,7 +376,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -394,7 +394,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (additionalMetadata != null) { hasFields = true; mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); @@ -422,7 +422,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; } else { diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart index 1296576d4a00..59e59725ec63 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart @@ -15,7 +15,7 @@ class StoreApi { // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -33,7 +33,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -79,7 +79,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -96,9 +96,9 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { - return new Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); ; } else { return null; @@ -112,7 +112,7 @@ class StoreApi { // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -130,7 +130,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -147,7 +147,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { @@ -162,7 +162,7 @@ class StoreApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -180,7 +180,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart index 4ad3021a1fa1..475f0655b958 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart @@ -15,7 +15,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -33,7 +33,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -64,7 +64,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -82,7 +82,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -99,7 +99,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -113,7 +113,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -131,7 +131,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -148,7 +148,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -162,7 +162,7 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -180,7 +180,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -211,7 +211,7 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -229,7 +229,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -246,7 +246,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; } else { @@ -261,10 +261,10 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(password == null) { - throw new ApiException(400, "Missing required param: password"); + throw ApiException(400, "Missing required param: password"); } // create path and map variables @@ -284,7 +284,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } else { @@ -331,7 +331,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -348,7 +348,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -362,10 +362,10 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -383,7 +383,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -400,7 +400,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart index 3d37ea215773..be01c2de8195 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart @@ -45,13 +45,13 @@ class ApiResponse { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => ApiResponse.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new ApiResponse.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart index 32a7c1e81aad..696468a16191 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart @@ -36,13 +36,13 @@ class Category { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Category.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Category.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart index c3966e6f9f23..be5a12e1ed19 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart @@ -73,13 +73,13 @@ class Order { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Order.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Order.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart index d8bdd2ef4076..4f19829878aa 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart @@ -31,7 +31,7 @@ class Pet { if (json['category'] == null) { category = null; } else { - category = new Category.fromJson(json['category']); + category = Category.fromJson(json['category']); } if (json['name'] == null) { name = null; @@ -73,13 +73,13 @@ class Pet { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Pet.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Pet.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart index ca53c8ae890f..a3485e5d3c63 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart @@ -36,13 +36,13 @@ class Tag { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Tag.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Tag.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart index 1c5ef51fbaa4..48f061d969b1 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart @@ -90,13 +90,13 @@ class User { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => User.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new User.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = User.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/api_response_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/api_response_test.dart index ebf142904e9f..afd92edde06e 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/api_response_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/api_response_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for ApiResponse void main() { - var instance = new Pet(); + var instance = ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/category_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/category_test.dart index c5cea4b5bc3b..ed39fa7ed8a2 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/category_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/category_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Pet(); + var instance = Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/order_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/order_test.dart index 9982020d8cf7..6102e1e5d089 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/order_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/order_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Pet(); + var instance = Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/pet_api_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/pet_api_test.dart index fa95dccad3cd..409b7962536c 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/pet_api_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/pet_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for PetApi void main() { - var instance = new PetApi(); + var instance = PetApi(); group('tests for PetApi', () { // Add a new pet to the store diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/pet_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/pet_test.dart index cfd94b9e36c3..83480bd785e7 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/pet_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/pet_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Pet void main() { - var instance = new Pet(); + var instance = Pet(); group('test Pet', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/store_api_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/store_api_test.dart index 496d051e8334..e2c7ab94b179 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/store_api_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/store_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for StoreApi void main() { - var instance = new StoreApi(); + var instance = StoreApi(); group('tests for StoreApi', () { // Delete purchase order by ID diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/tag_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/tag_test.dart index 6ee16c51bbac..3333ea6d3104 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/tag_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/tag_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Pet(); + var instance = Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/user_api_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/user_api_test.dart index f040b01bf435..5d124a611170 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/user_api_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/user_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for UserApi void main() { - var instance = new UserApi(); + var instance = UserApi(); group('tests for UserApi', () { // Create user diff --git a/samples/client/petstore/dart2/openapi-browser-client/test/user_test.dart b/samples/client/petstore/dart2/openapi-browser-client/test/user_test.dart index 5a6340c4f4b7..35e8eed37568 100644 --- a/samples/client/petstore/dart2/openapi-browser-client/test/user_test.dart +++ b/samples/client/petstore/dart2/openapi-browser-client/test/user_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for User void main() { - var instance = new Pet(); + var instance = User(); group('test User', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION index 06b5019af3f4..83a328a9227e 100644 --- a/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION +++ b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.1-SNAPSHOT \ No newline at end of file +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi/README.md b/samples/client/petstore/dart2/openapi/README.md index 45fe0858b2dd..e78e0e3e6978 100644 --- a/samples/client/petstore/dart2/openapi/README.md +++ b/samples/client/petstore/dart2/openapi/README.md @@ -46,8 +46,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.addPet(body); diff --git a/samples/client/petstore/dart2/openapi/docs/PetApi.md b/samples/client/petstore/dart2/openapi/docs/PetApi.md index 3ec1113828c6..7b5de3894a91 100644 --- a/samples/client/petstore/dart2/openapi/docs/PetApi.md +++ b/samples/client/petstore/dart2/openapi/docs/PetApi.md @@ -30,8 +30,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.addPet(body); @@ -72,7 +72,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | @@ -118,7 +118,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var status = []; // List | Status values that need to be considered for filter try { @@ -163,7 +163,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var tags = []; // List | Tags to filter by try { @@ -210,7 +210,7 @@ import 'package:openapi/api.dart'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to return try { @@ -253,8 +253,8 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = PetApi(); +var body = Pet(); // Pet | Pet object that needs to be added to the store try { api_instance.updatePet(body); @@ -295,7 +295,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet @@ -341,7 +341,7 @@ import 'package:openapi/api.dart'; // TODO Configure OAuth2 access token for authorization: petstore_auth //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; -var api_instance = new PetApi(); +var api_instance = PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server var file = BINARY_DATA_HERE; // MultipartFile | file to upload diff --git a/samples/client/petstore/dart2/openapi/docs/StoreApi.md b/samples/client/petstore/dart2/openapi/docs/StoreApi.md index f3a5e0aba874..1cc37e2a47ab 100644 --- a/samples/client/petstore/dart2/openapi/docs/StoreApi.md +++ b/samples/client/petstore/dart2/openapi/docs/StoreApi.md @@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { @@ -72,7 +72,7 @@ import 'package:openapi/api.dart'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); try { var result = api_instance.getInventory(); @@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); +var api_instance = StoreApi(); var orderId = 789; // int | ID of pet that needs to be fetched try { @@ -152,8 +152,8 @@ Place an order for a pet ```dart import 'package:openapi/api.dart'; -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet +var api_instance = StoreApi(); +var body = Order(); // Order | order placed for purchasing the pet try { var result = api_instance.placeOrder(body); diff --git a/samples/client/petstore/dart2/openapi/docs/UserApi.md b/samples/client/petstore/dart2/openapi/docs/UserApi.md index 5e0605c6ea08..1ee5f6fced69 100644 --- a/samples/client/petstore/dart2/openapi/docs/UserApi.md +++ b/samples/client/petstore/dart2/openapi/docs/UserApi.md @@ -30,8 +30,8 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var api_instance = UserApi(); +var body = User(); // User | Created user object try { api_instance.createUser(body); @@ -70,8 +70,8 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var body = [List<User>()]; // List | List of user object try { api_instance.createUsersWithArrayInput(body); @@ -84,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -110,8 +110,8 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var api_instance = UserApi(); +var body = [List<User>()]; // List | List of user object try { api_instance.createUsersWithListInput(body); @@ -124,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -152,7 +152,7 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be deleted try { @@ -192,7 +192,7 @@ Get user by user name ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. try { @@ -233,7 +233,7 @@ Logs user into the system ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | The user name for login var password = password_example; // String | The password for login in clear text @@ -276,7 +276,7 @@ Logs out current logged in user session ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); try { api_instance.logoutUser(); @@ -314,9 +314,9 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = new UserApi(); +var api_instance = UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var body = User(); // User | Updated user object try { api_instance.updateUser(username, body); diff --git a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart index 9670db26fefc..35416e655ede 100644 --- a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart +++ b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart @@ -15,7 +15,7 @@ class PetApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -33,7 +33,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -64,7 +64,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -83,7 +83,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -100,7 +100,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -114,7 +114,7 @@ class PetApi { // verify required params are set if(status == null) { - throw new ApiException(400, "Missing required param: status"); + throw ApiException(400, "Missing required param: status"); } // create path and map variables @@ -133,7 +133,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -150,7 +150,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -165,7 +165,7 @@ class PetApi { // verify required params are set if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + throw ApiException(400, "Missing required param: tags"); } // create path and map variables @@ -184,7 +184,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -201,7 +201,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List).map((item) => item as Pet).toList(); } else { @@ -216,7 +216,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -234,7 +234,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -251,7 +251,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; } else { @@ -266,7 +266,7 @@ class PetApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -284,7 +284,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -315,7 +315,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -333,7 +333,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (name != null) { hasFields = true; mp.fields['name'] = parameterToString(name); @@ -362,7 +362,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -376,7 +376,7 @@ class PetApi { // verify required params are set if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + throw ApiException(400, "Missing required param: petId"); } // create path and map variables @@ -394,7 +394,7 @@ class PetApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if (additionalMetadata != null) { hasFields = true; mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); @@ -422,7 +422,7 @@ class PetApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; } else { diff --git a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart index 1296576d4a00..59e59725ec63 100644 --- a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart +++ b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart @@ -15,7 +15,7 @@ class StoreApi { // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -33,7 +33,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -79,7 +79,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -96,9 +96,9 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { - return new Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); ; } else { return null; @@ -112,7 +112,7 @@ class StoreApi { // verify required params are set if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + throw ApiException(400, "Missing required param: orderId"); } // create path and map variables @@ -130,7 +130,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -147,7 +147,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { @@ -162,7 +162,7 @@ class StoreApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -180,7 +180,7 @@ class StoreApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class StoreApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; } else { diff --git a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart index 4ad3021a1fa1..475f0655b958 100644 --- a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart +++ b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart @@ -15,7 +15,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -33,7 +33,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -50,7 +50,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -64,7 +64,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -82,7 +82,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -99,7 +99,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -113,7 +113,7 @@ class UserApi { // verify required params are set if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -131,7 +131,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -148,7 +148,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -162,7 +162,7 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -180,7 +180,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -197,7 +197,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -211,7 +211,7 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } // create path and map variables @@ -229,7 +229,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -246,7 +246,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; } else { @@ -261,10 +261,10 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(password == null) { - throw new ApiException(400, "Missing required param: password"); + throw ApiException(400, "Missing required param: password"); } // create path and map variables @@ -284,7 +284,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -301,7 +301,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; } else { @@ -331,7 +331,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -348,7 +348,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; @@ -362,10 +362,10 @@ class UserApi { // verify required params are set if(username == null) { - throw new ApiException(400, "Missing required param: username"); + throw ApiException(400, "Missing required param: username"); } if(body == null) { - throw new ApiException(400, "Missing required param: body"); + throw ApiException(400, "Missing required param: body"); } // create path and map variables @@ -383,7 +383,7 @@ class UserApi { if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); + MultipartRequest mp = MultipartRequest(null, null); if(hasFields) postBody = mp; } @@ -400,7 +400,7 @@ class UserApi { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); + throw ApiException(response.statusCode, _decodeBodyBytes(response)); } else if(response.body != null) { } else { return; diff --git a/samples/client/petstore/dart2/openapi/lib/model/api_response.dart b/samples/client/petstore/dart2/openapi/lib/model/api_response.dart index 3d37ea215773..be01c2de8195 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/api_response.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/api_response.dart @@ -45,13 +45,13 @@ class ApiResponse { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => ApiResponse.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new ApiResponse.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi/lib/model/category.dart b/samples/client/petstore/dart2/openapi/lib/model/category.dart index 32a7c1e81aad..696468a16191 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/category.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/category.dart @@ -36,13 +36,13 @@ class Category { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Category.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Category.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi/lib/model/order.dart b/samples/client/petstore/dart2/openapi/lib/model/order.dart index c3966e6f9f23..be5a12e1ed19 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/order.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/order.dart @@ -73,13 +73,13 @@ class Order { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Order.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Order.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi/lib/model/pet.dart b/samples/client/petstore/dart2/openapi/lib/model/pet.dart index d8bdd2ef4076..4f19829878aa 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/pet.dart @@ -31,7 +31,7 @@ class Pet { if (json['category'] == null) { category = null; } else { - category = new Category.fromJson(json['category']); + category = Category.fromJson(json['category']); } if (json['name'] == null) { name = null; @@ -73,13 +73,13 @@ class Pet { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Pet.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Pet.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi/lib/model/tag.dart b/samples/client/petstore/dart2/openapi/lib/model/tag.dart index ca53c8ae890f..a3485e5d3c63 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/tag.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/tag.dart @@ -36,13 +36,13 @@ class Tag { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => Tag.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new Tag.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi/lib/model/user.dart b/samples/client/petstore/dart2/openapi/lib/model/user.dart index 1c5ef51fbaa4..48f061d969b1 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/user.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/user.dart @@ -90,13 +90,13 @@ class User { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null ? List() : json.map((value) => User.fromJson(value)).toList(); } static Map mapFromJson(Map json) { - var map = new Map(); + var map = Map(); if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) => map[key] = new User.fromJson(value)); + json.forEach((String key, dynamic value) => map[key] = User.fromJson(value)); } return map; } diff --git a/samples/client/petstore/dart2/openapi/test/api_response_test.dart b/samples/client/petstore/dart2/openapi/test/api_response_test.dart index ebf142904e9f..afd92edde06e 100644 --- a/samples/client/petstore/dart2/openapi/test/api_response_test.dart +++ b/samples/client/petstore/dart2/openapi/test/api_response_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for ApiResponse void main() { - var instance = new Pet(); + var instance = ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart2/openapi/test/category_test.dart b/samples/client/petstore/dart2/openapi/test/category_test.dart index c5cea4b5bc3b..ed39fa7ed8a2 100644 --- a/samples/client/petstore/dart2/openapi/test/category_test.dart +++ b/samples/client/petstore/dart2/openapi/test/category_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Pet(); + var instance = Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi/test/order_test.dart b/samples/client/petstore/dart2/openapi/test/order_test.dart index 9982020d8cf7..6102e1e5d089 100644 --- a/samples/client/petstore/dart2/openapi/test/order_test.dart +++ b/samples/client/petstore/dart2/openapi/test/order_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Pet(); + var instance = Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi/test/pet_api_test.dart b/samples/client/petstore/dart2/openapi/test/pet_api_test.dart index fa95dccad3cd..409b7962536c 100644 --- a/samples/client/petstore/dart2/openapi/test/pet_api_test.dart +++ b/samples/client/petstore/dart2/openapi/test/pet_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for PetApi void main() { - var instance = new PetApi(); + var instance = PetApi(); group('tests for PetApi', () { // Add a new pet to the store diff --git a/samples/client/petstore/dart2/openapi/test/pet_test.dart b/samples/client/petstore/dart2/openapi/test/pet_test.dart index cfd94b9e36c3..83480bd785e7 100644 --- a/samples/client/petstore/dart2/openapi/test/pet_test.dart +++ b/samples/client/petstore/dart2/openapi/test/pet_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Pet void main() { - var instance = new Pet(); + var instance = Pet(); group('test Pet', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi/test/store_api_test.dart b/samples/client/petstore/dart2/openapi/test/store_api_test.dart index 496d051e8334..e2c7ab94b179 100644 --- a/samples/client/petstore/dart2/openapi/test/store_api_test.dart +++ b/samples/client/petstore/dart2/openapi/test/store_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for StoreApi void main() { - var instance = new StoreApi(); + var instance = StoreApi(); group('tests for StoreApi', () { // Delete purchase order by ID diff --git a/samples/client/petstore/dart2/openapi/test/tag_test.dart b/samples/client/petstore/dart2/openapi/test/tag_test.dart index 6ee16c51bbac..3333ea6d3104 100644 --- a/samples/client/petstore/dart2/openapi/test/tag_test.dart +++ b/samples/client/petstore/dart2/openapi/test/tag_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Pet(); + var instance = Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi/test/user_api_test.dart b/samples/client/petstore/dart2/openapi/test/user_api_test.dart index f040b01bf435..5d124a611170 100644 --- a/samples/client/petstore/dart2/openapi/test/user_api_test.dart +++ b/samples/client/petstore/dart2/openapi/test/user_api_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; /// tests for UserApi void main() { - var instance = new UserApi(); + var instance = UserApi(); group('tests for UserApi', () { // Create user diff --git a/samples/client/petstore/dart2/openapi/test/user_test.dart b/samples/client/petstore/dart2/openapi/test/user_test.dart index 5a6340c4f4b7..35e8eed37568 100644 --- a/samples/client/petstore/dart2/openapi/test/user_test.dart +++ b/samples/client/petstore/dart2/openapi/test/user_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for User void main() { - var instance = new Pet(); + var instance = User(); group('test User', () { // int id (default value: null)