From 751ffad8dbfd2806d0a0201d8c4da32cba22b23d Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Mon, 7 Dec 2020 14:38:39 +0100 Subject: [PATCH] [dart] Cleanup and OAS3 support (#8085) * [dart] Cleanup and regnerate old/wrong tests and docs * docs path seems to be doc now in all dart generators * generated tests are very old and use wrong classes * [dart-dio] Improve formatting * [dart][dart-dio] Restructure tests to same layout * remove duplicate/old openapi sample for which there is no generation config * generate to `petstore_client_lib` for both generators * run generated tests as integration tests for dart2 even if empty - this makes it easier to find compile errors * [dart] Improve gitignore handling for Dart generators * globally ignore all dart related files that should not be commited * remove old ignores that are no longer valid * [dart][dart-dio] Add OAS3 generation and integration tests Dart2 doesn't compile, needs fixes. * [dart] Do not attempt to deserialize binary content from JSON fields Not sure if that case is ever relevant but for now there doesn't seem to be a better option. * [dart] Fix integration tests for OAS3 petstore Some POST operations now return 200 with content. * [dart] Generate Petstore Fake API but don't add to integration tests yet Explicitly not adding the new integration tests to the master POM. They do not work but having them allows for quickly iterating on open issues without breaking existing basic OAS2/OAS3 petstore examples. Instead they should be run manually until everything is fixed. --- .gitignore | 14 +- .../dart-dio-petstore-client-lib-fake.yaml | 6 + ...=> dart-dio-petstore-client-lib-oas2.yaml} | 2 +- bin/configs/dart-dio-petstore-client-lib.yaml | 6 + .../dart-petstore-client-lib-fake.yaml | 6 + ...aml => dart-petstore-client-lib-oas2.yaml} | 0 bin/configs/dart-petstore-client-lib.yaml | 6 + .../main/resources/dart-dio/class.mustache | 4 +- .../main/resources/dart-dio/model.mustache | 4 +- .../src/main/resources/dart2/class.mustache | 5 + pom.xml | 6 +- .../{ => petstore_client_lib}/.gitignore | 3 - .../.openapi-generator-ignore | 0 .../.openapi-generator/FILES | 1 + .../.openapi-generator/VERSION | 0 .../{ => petstore_client_lib}/README.md | 0 .../analysis_options.yaml | 0 .../doc/ApiResponse.md | 0 .../{ => petstore_client_lib}/doc/Category.md | 0 .../{ => petstore_client_lib}/doc/Order.md | 0 .../{ => petstore_client_lib}/doc/Pet.md | 0 .../{ => petstore_client_lib}/doc/PetApi.md | 0 .../{ => petstore_client_lib}/doc/StoreApi.md | 0 .../{ => petstore_client_lib}/doc/Tag.md | 0 .../{ => petstore_client_lib}/doc/User.md | 0 .../{ => petstore_client_lib}/doc/UserApi.md | 0 .../{ => petstore_client_lib}/lib/api.dart | 0 .../lib/api/pet_api.dart | 0 .../lib/api/store_api.dart | 0 .../lib/api/user_api.dart | 0 .../lib/api_util.dart | 0 .../lib/auth/api_key_auth.dart | 0 .../lib/auth/auth.dart | 0 .../lib/auth/basic_auth.dart | 0 .../lib/auth/oauth.dart | 0 .../lib/model/api_response.dart | 8 +- .../lib/model/category.dart | 6 +- .../lib/model/order.dart | 18 +- .../lib/model/pet.dart | 22 +- .../lib/model/tag.dart | 6 +- .../lib/model/user.dart | 18 +- .../lib/serializers.dart | 0 .../dart-dio/petstore_client_lib/pom.xml | 88 ++ .../{ => petstore_client_lib}/pubspec.yaml | 0 .../test/api_response_test.dart | 0 .../test/category_test.dart | 0 .../test/order_test.dart | 0 .../test/pet_api_test.dart | 0 .../test/pet_test.dart | 0 .../test/store_api_test.dart | 0 .../test/tag_test.dart | 0 .../test/user_api_test.dart | 0 .../test/user_test.dart | 0 .../flutter_petstore/openapi/docs/PetApi.md | 379 ----- .../flutter_petstore/openapi/docs/StoreApi.md | 186 --- .../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 | 16 +- .../openapi/test/store_api_test.dart | 8 +- .../openapi/test/tag_test.dart | 2 +- .../openapi/test/user_api_test.dart | 16 +- .../openapi/test/user_test.dart | 2 +- .../openapi/docs/Pet.md | 20 - .../openapi/docs/PetApi.md | 379 ----- .../openapi/docs/UserApi.md | 349 ----- .../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 | 16 +- .../openapi/test/store_api_test.dart | 8 +- .../openapi/test/tag_test.dart | 2 +- .../openapi/test/user_api_test.dart | 16 +- .../openapi/test/user_test.dart | 2 +- .../dart-jaguar/openapi/docs/Order.md | 20 - .../petstore/dart-jaguar/openapi/docs/Pet.md | 20 - .../dart-jaguar/openapi/docs/PetApi.md | 379 ----- .../dart-jaguar/openapi/docs/StoreApi.md | 186 --- .../petstore/dart-jaguar/openapi/docs/User.md | 22 - .../openapi/test/pet_api_test.dart | 16 +- .../openapi/test/store_api_test.dart | 8 +- .../openapi/test/user_api_test.dart | 16 +- .../openapi_proto/docs/ApiResponse.md | 17 - .../openapi_proto/docs/StoreApi.md | 186 --- .../dart-jaguar/openapi_proto/docs/User.md | 22 - .../dart-jaguar/openapi_proto/docs/UserApi.md | 349 ----- .../openapi_proto/test/api_response_test.dart | 2 +- .../openapi_proto/test/category_test.dart | 2 +- .../openapi_proto/test/order_test.dart | 2 +- .../openapi_proto/test/pet_api_test.dart | 16 +- .../openapi_proto/test/store_api_test.dart | 8 +- .../openapi_proto/test/tag_test.dart | 2 +- .../openapi_proto/test/user_api_test.dart | 16 +- .../openapi_proto/test/user_test.dart | 2 +- .../petstore/dart2/openapi/doc/ApiResponse.md | 17 - .../petstore/dart2/openapi/doc/Category.md | 16 - .../client/petstore/dart2/openapi/doc/Pet.md | 20 - .../client/petstore/dart2/openapi/doc/User.md | 22 - .../dart2/openapi/docs/ApiResponse.md | 17 - .../petstore/dart2/openapi/docs/Category.md | 16 - .../petstore/dart2/openapi/docs/Order.md | 20 - .../client/petstore/dart2/openapi/docs/Pet.md | 20 - .../petstore/dart2/openapi/docs/User.md | 22 - .../petstore/dart2/openapi/docs/UserApi.md | 349 ----- .../petstore/dart2/openapi/lib/api.dart | 28 - .../dart2/openapi/lib/api/pet_api.dart | 496 ------ .../dart2/openapi/lib/api/store_api.dart | 239 --- .../dart2/openapi/lib/api/user_api.dart | 473 ------ .../dart2/openapi/lib/api_client.dart | 167 -- .../dart2/openapi/lib/api_exception.dart | 23 - .../dart2/openapi/lib/api_helper.dart | 56 - .../dart2/openapi/lib/auth/api_key_auth.dart | 29 - .../openapi/lib/auth/authentication.dart | 7 - .../openapi/lib/auth/http_basic_auth.dart | 16 - .../openapi/lib/auth/http_bearer_auth.dart | 25 - .../dart2/openapi/lib/auth/oauth.dart | 16 - .../dart2/openapi/lib/model/api_response.dart | 58 - .../dart2/openapi/lib/model/category.dart | 53 - .../dart2/openapi/lib/model/order.dart | 76 - .../petstore/dart2/openapi/lib/model/pet.dart | 80 - .../petstore/dart2/openapi/lib/model/tag.dart | 51 - .../dart2/openapi/lib/model/user.dart | 83 - .../petstore/dart2/openapi/pubspec.yaml | 12 - .../client/petstore/dart2/petstore/pom.xml | 4 +- .../petstore_client_lib/docs/ApiResponse.md | 17 - .../petstore_client_lib/docs/Category.md | 16 - .../dart2/petstore_client_lib/docs/Order.md | 20 - .../dart2/petstore_client_lib/docs/Pet.md | 20 - .../dart2/petstore_client_lib/docs/Tag.md | 16 - .../dart2/petstore_client_lib/docs/User.md | 22 - .../dart2/petstore_client_lib/pom.xml | 73 + .../test/api_response_test.dart | 8 +- .../test/category_test.dart | 6 +- .../petstore_client_lib/test/order_test.dart | 12 +- .../test/pet_api_test.dart | 27 +- .../petstore_client_lib/test/pet_test.dart | 14 +- .../test/store_api_test.dart | 19 +- .../petstore_client_lib/test/tag_test.dart | 6 +- .../test/user_api_test.dart | 27 +- .../petstore_client_lib/test/user_test.dart | 18 +- .../dart-dio/petstore_client_lib/.gitignore | 37 + .../.openapi-generator-ignore | 3 - .../.openapi-generator/FILES | 33 + .../.openapi-generator/VERSION | 0 .../dart-dio/petstore_client_lib/README.md | 118 ++ .../petstore_client_lib/analysis_options.yaml | 1 + .../petstore_client_lib/doc}/ApiResponse.md | 0 .../petstore_client_lib/doc}/Category.md | 0 .../petstore_client_lib/doc/InlineObject.md | 16 + .../petstore_client_lib/doc/InlineObject1.md | 16 + .../petstore_client_lib/doc}/Order.md | 0 .../dart-dio/petstore_client_lib/doc}/Pet.md | 4 +- .../petstore_client_lib}/doc/PetApi.md | 66 +- .../petstore_client_lib}/doc/StoreApi.md | 26 +- .../dart-dio/petstore_client_lib/doc}/Tag.md | 0 .../dart-dio/petstore_client_lib/doc}/User.md | 0 .../petstore_client_lib/doc}/UserApi.md | 92 +- .../dart-dio/petstore_client_lib/lib/api.dart | 81 + .../petstore_client_lib/lib/api/pet_api.dart | 406 +++++ .../lib/api/store_api.dart | 201 +++ .../petstore_client_lib/lib/api/user_api.dart | 340 ++++ .../petstore_client_lib/lib/api_util.dart | 14 + .../lib/auth/api_key_auth.dart | 27 + .../petstore_client_lib/lib/auth/auth.dart | 23 + .../lib/auth/basic_auth.dart | 31 + .../petstore_client_lib/lib/auth/oauth.dart | 20 + .../lib/model/api_response.dart | 27 + .../lib/model/category.dart | 23 + .../lib/model/inline_object.dart | 23 + .../lib/model/inline_object1.dart | 24 + .../petstore_client_lib/lib/model/order.dart | 62 + .../petstore_client_lib/lib/model/pet.dart | 64 + .../petstore_client_lib/lib/model/tag.dart | 23 + .../petstore_client_lib/lib/model/user.dart | 47 + .../petstore_client_lib/lib/serializers.dart | 65 + .../dart-dio/petstore_client_lib}/pom.xml | 4 +- .../dart-dio/petstore_client_lib/pubspec.yaml | 14 + .../test/api_response_test.dart | 6 +- .../test/category_test.dart | 6 +- .../test/inline_object1_test.dart | 24 + .../test/inline_object_test.dart | 24 + .../petstore_client_lib}/test/order_test.dart | 6 +- .../test/pet_api_test.dart | 21 +- .../petstore_client_lib}/test/pet_test.dart | 10 +- .../test/store_api_test.dart | 13 +- .../petstore_client_lib}/test/tag_test.dart | 6 +- .../test/user_api_test.dart | 21 +- .../petstore_client_lib}/test/user_test.dart | 6 +- .../petstore_client_lib_fake/.gitignore | 37 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 123 ++ .../.openapi-generator/VERSION | 1 + .../petstore_client_lib_fake/README.md | 196 +++ .../analysis_options.yaml | 1 + .../doc/AdditionalPropertiesClass.md | 16 + .../petstore_client_lib_fake/doc/Animal.md | 16 + .../doc/AnotherFakeApi.md | 57 + .../doc}/ApiResponse.md | 0 .../doc/ArrayOfArrayOfNumberOnly.md | 15 + .../doc/ArrayOfNumberOnly.md} | 5 +- .../petstore_client_lib_fake/doc/ArrayTest.md | 17 + .../doc/Capitalization.md | 20 + .../petstore_client_lib_fake/doc/Cat.md | 17 + .../petstore_client_lib_fake/doc/CatAllOf.md} | 5 +- .../petstore_client_lib_fake/doc}/Category.md | 2 +- .../doc/ClassModel.md | 15 + .../petstore_client_lib_fake/doc/Client.md | 15 + .../doc/DefaultApi.md | 51 + .../petstore_client_lib_fake/doc/Dog.md | 17 + .../petstore_client_lib_fake/doc/DogAllOf.md | 15 + .../doc/EnumArrays.md | 16 + .../petstore_client_lib_fake/doc/EnumClass.md | 14 + .../petstore_client_lib_fake/doc/EnumTest.md | 22 + .../petstore_client_lib_fake/doc/FakeApi.md | 725 +++++++++ .../doc/FakeClassnameTags123Api.md | 61 + .../petstore_client_lib_fake/doc/File.md | 15 + .../doc/FileSchemaTestClass.md | 16 + .../petstore_client_lib_fake/doc/Foo.md | 15 + .../doc/FormatTest.md | 30 + .../doc/HasOnlyReadOnly.md | 16 + .../doc/HealthCheckResult.md | 15 + .../doc/InlineObject.md | 16 + .../doc/InlineObject1.md | 16 + .../doc/InlineObject2.md | 16 + .../doc/InlineObject3.md | 28 + .../doc/InlineObject4.md | 16 + .../doc/InlineObject5.md | 16 + .../doc/InlineResponseDefault.md | 15 + .../petstore_client_lib_fake/doc/List.md | 15 + .../petstore_client_lib_fake/doc/MapTest.md | 18 + ...dPropertiesAndAdditionalPropertiesClass.md | 17 + .../doc/Model200Response.md | 16 + .../doc/ModelReturn.md | 15 + .../petstore_client_lib_fake/doc/Name.md | 18 + .../doc/NullableClass.md | 26 + .../doc/NumberOnly.md | 15 + .../petstore_client_lib_fake/doc}/Order.md | 0 .../doc/OuterComposite.md | 17 + .../petstore_client_lib_fake/doc/OuterEnum.md | 14 + .../doc/OuterEnumDefaultValue.md | 14 + .../doc/OuterEnumInteger.md | 14 + .../doc/OuterEnumIntegerDefaultValue.md | 14 + .../petstore_client_lib_fake/doc}/Pet.md | 4 +- .../petstore_client_lib_fake/doc}/PetApi.md | 106 +- .../doc/ReadOnlyFirst.md | 16 + .../doc/SpecialModelName.md | 15 + .../petstore_client_lib_fake/doc}/StoreApi.md | 28 +- .../petstore_client_lib_fake/doc}/Tag.md | 0 .../petstore_client_lib_fake/doc}/User.md | 0 .../petstore_client_lib_fake/doc}/UserApi.md | 58 +- .../petstore_client_lib_fake/lib/api.dart | 121 ++ .../lib/api/another_fake_api.dart | 68 + .../lib/api/default_api.dart | 65 + .../lib/api/fake_api.dart | 703 +++++++++ .../lib/api/fake_classname_tags123_api.dart | 68 + .../lib/api/pet_api.dart | 435 ++++++ .../lib/api/store_api.dart | 201 +++ .../lib/api/user_api.dart | 340 ++++ .../lib/api_util.dart | 14 + .../lib/auth/api_key_auth.dart | 27 + .../lib/auth/auth.dart | 23 + .../lib/auth/basic_auth.dart | 31 + .../lib/auth/oauth.dart | 20 + .../model/additional_properties_class.dart | 24 + .../lib/model/animal.dart | 23 + .../lib/model/api_response.dart | 27 + .../model/array_of_array_of_number_only.dart | 20 + .../lib/model/array_of_number_only.dart | 20 + .../lib/model/array_test.dart | 29 + .../lib/model/capitalization.dart | 39 + .../lib/model/cat.dart | 29 + .../lib/model/cat_all_of.dart | 19 + .../lib/model/category.dart | 23 + .../lib/model/class_model.dart | 19 + .../lib/model/client.dart | 19 + .../lib/model/dog.dart | 29 + .../lib/model/dog_all_of.dart | 19 + .../lib/model/enum_arrays.dart | 58 + .../lib/model/enum_class.dart | 31 + .../lib/model/enum_test.dart | 128 ++ .../lib/model/file.dart | 19 + .../lib/model/file_schema_test_class.dart | 25 + .../lib/model/foo.dart | 19 + .../lib/model/format_test.dart | 81 + .../lib/model/has_only_read_only.dart | 23 + .../lib/model/health_check_result.dart | 19 + .../lib/model/inline_object.dart | 23 + .../lib/model/inline_object1.dart | 24 + .../lib/model/inline_object2.dart | 65 + .../lib/model/inline_object3.dart | 72 + .../lib/model/inline_object4.dart | 23 + .../lib/model/inline_object5.dart | 24 + .../lib/model/inline_response_default.dart | 20 + .../lib/model/list.dart | 19 + .../lib/model/map_test.dart | 49 + ...rties_and_additional_properties_class.dart | 29 + .../lib/model/model200_response.dart | 23 + .../lib/model/model_return.dart | 19 + .../lib/model/name.dart | 31 + .../lib/model/nullable_class.dart | 65 + .../lib/model/number_only.dart | 19 + .../lib/model/order.dart | 62 + .../lib/model/outer_composite.dart | 27 + .../lib/model/outer_enum.dart | 31 + .../lib/model/outer_enum_default_value.dart | 31 + .../lib/model/outer_enum_integer.dart | 31 + .../outer_enum_integer_default_value.dart | 31 + .../lib/model/pet.dart | 64 + .../lib/model/read_only_first.dart | 23 + .../lib/model/special_model_name.dart | 19 + .../lib/model/tag.dart | 23 + .../lib/model/user.dart | 47 + .../lib/serializers.dart | 270 ++++ .../dart-dio/petstore_client_lib_fake/pom.xml | 88 ++ .../petstore_client_lib_fake/pubspec.yaml | 14 + .../additional_properties_class_test.dart | 22 + .../test/animal_test.dart | 22 + .../test/another_fake_api_test.dart | 21 + .../test/api_response_test.dart | 27 + .../array_of_array_of_number_only_test.dart | 17 + .../test/array_of_number_only_test.dart | 17 + .../test/array_test_test.dart | 27 + .../test/capitalization_test.dart | 43 + .../test/cat_all_of_test.dart | 17 + .../test/cat_test.dart | 27 + .../test/category_test.dart | 22 + .../test/class_model_test.dart | 17 + .../test/client_test.dart | 17 + .../test/default_api_test.dart | 17 + .../test/dog_all_of_test.dart | 17 + .../test/dog_test.dart | 27 + .../test/enum_arrays_test.dart | 22 + .../test/enum_class_test.dart | 11 + .../test/enum_test_test.dart | 52 + .../test/fake_api_test.dart | 123 ++ .../test/fake_classname_tags123_api_test.dart | 21 + .../test/file_schema_test_class_test.dart | 22 + .../test/file_test.dart | 18 + .../test/foo_test.dart | 17 + .../test/format_test_test.dart | 94 ++ .../test/has_only_read_only_test.dart | 22 + .../test/health_check_result_test.dart | 17 + .../test/inline_object1_test.dart | 24 + .../test/inline_object2_test.dart | 24 + .../test/inline_object3_test.dart | 96 ++ .../test/inline_object4_test.dart | 24 + .../test/inline_object5_test.dart | 24 + .../test/inline_object_test.dart | 24 + .../test/inline_response_default_test.dart | 17 + .../test/list_test.dart | 17 + .../test/map_test_test.dart | 32 + ..._and_additional_properties_class_test.dart | 27 + .../test/model200_response_test.dart | 22 + .../test/model_return_test.dart | 17 + .../test/name_test.dart | 32 + .../test/nullable_class_test.dart | 72 + .../test/number_only_test.dart | 17 + .../test/order_test.dart | 43 + .../test/outer_composite_test.dart | 27 + .../test/outer_enum_default_value_test.dart | 11 + ...outer_enum_integer_default_value_test.dart | 11 + .../test/outer_enum_integer_test.dart | 11 + .../test/outer_enum_test.dart | 11 + .../test/pet_api_test.dart | 81 + .../test/pet_test.dart | 43 + .../test/read_only_first_test.dart | 22 + .../test/special_model_name_test.dart | 17 + .../test/store_api_test.dart | 46 + .../test/tag_test.dart | 22 + .../test/user_api_test.dart | 74 + .../test/user_test.dart | 53 + .../petstore/dart2/petstore/.analysis_options | 2 + .../client/petstore/dart2/petstore/README.md | 37 + .../client/petstore/dart2/petstore/pom.xml | 73 + .../petstore/dart2/petstore/pubspec.yaml | 13 + .../dart2/petstore/test/fake_client.dart | 133 ++ .../petstore/test/file_upload_response.json | 1 + .../petstore/test/inventory_response.json | 1 + .../dart2/petstore/test/order_model_test.dart | 9 + .../petstore/test/pet_faked_client_test.dart | 242 +++ .../dart2/petstore/test/pet_test.dart | 106 ++ .../dart2/petstore/test/random_id.dart | 7 + .../test/store_faked_client_test.dart | 89 ++ .../dart2/petstore/test/store_test.dart | 44 + .../petstore/test/user_faked_client_test.dart | 176 +++ .../dart2/petstore/test/user_test.dart | 80 + .../dart2/petstore_client_lib}/.gitignore | 0 .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 4 + .../.openapi-generator/VERSION | 1 + .../dart2/petstore_client_lib}/.travis.yml | 3 + .../dart2/petstore_client_lib}/README.md | 11 +- .../petstore_client_lib/doc/ApiResponse.md | 17 + .../petstore_client_lib/doc}/Category.md | 4 +- .../petstore_client_lib/doc/InlineObject.md | 16 + .../petstore_client_lib/doc/InlineObject1.md | 16 + .../dart2/petstore_client_lib/doc}/Order.md | 10 +- .../dart2/petstore_client_lib/doc/Pet.md | 20 + .../dart2/petstore_client_lib/doc}/PetApi.md | 110 +- .../petstore_client_lib/doc}/StoreApi.md | 38 +- .../dart2/petstore_client_lib/doc}/Tag.md | 4 +- .../dart2/petstore_client_lib/doc/User.md | 22 + .../dart2/petstore_client_lib}/doc/UserApi.md | 132 +- .../dart2/petstore_client_lib}/git_push.sh | 0 .../dart2/petstore_client_lib/lib/api.dart | 48 + .../petstore_client_lib/lib/api/pet_api.dart | 645 ++++++++ .../lib/api/store_api.dart | 289 ++++ .../petstore_client_lib/lib/api/user_api.dart | 556 +++++++ .../petstore_client_lib/lib/api_client.dart | 218 +++ .../lib/api_exception.dart | 31 + .../petstore_client_lib/lib/api_helper.dart | 71 + .../lib/auth/api_key_auth.dart | 35 + .../lib/auth/authentication.dart | 15 + .../lib/auth/http_basic_auth.dart | 21 + .../lib/auth/http_bearer_auth.dart | 38 + .../petstore_client_lib/lib/auth/oauth.dart | 23 + .../lib/model/api_response.dart | 92 ++ .../lib/model/category.dart | 82 + .../lib/model/inline_object.dart | 82 + .../lib/model/inline_object1.dart | 82 + .../petstore_client_lib/lib/model/order.dart | 201 +++ .../petstore_client_lib/lib/model/pet.dart | 201 +++ .../petstore_client_lib/lib/model/tag.dart | 82 + .../petstore_client_lib/lib/model/user.dart | 142 ++ .../dart2/petstore_client_lib/pom.xml | 73 + .../dart2/petstore_client_lib/pubspec.yaml | 18 + .../test/api_response_test.dart | 27 + .../test/category_test.dart | 22 + .../test/inline_object1_test.dart | 24 + .../test/inline_object_test.dart | 24 + .../petstore_client_lib/test/order_test.dart | 43 + .../test/pet_api_test.dart | 82 + .../petstore_client_lib/test/pet_test.dart | 43 + .../test/store_api_test.dart | 54 + .../petstore_client_lib/test/tag_test.dart | 22 + .../test/user_api_test.dart | 82 + .../petstore_client_lib/test/user_test.dart | 53 + .../dart2/petstore_client_lib_fake/.gitignore | 27 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 126 ++ .../.openapi-generator/VERSION | 1 + .../petstore_client_lib_fake/.travis.yml | 14 + .../dart2/petstore_client_lib_fake/README.md | 195 +++ .../doc/AdditionalPropertiesClass.md | 16 + .../petstore_client_lib_fake/doc/Animal.md | 16 + .../doc/AnotherFakeApi.md | 57 + .../doc/ApiResponse.md | 17 + .../doc/ArrayOfArrayOfNumberOnly.md | 15 + .../doc/ArrayOfNumberOnly.md | 15 + .../petstore_client_lib_fake/doc/ArrayTest.md | 17 + .../doc/Capitalization.md | 20 + .../dart2/petstore_client_lib_fake/doc/Cat.md | 17 + .../petstore_client_lib_fake/doc/CatAllOf.md | 15 + .../petstore_client_lib_fake/doc}/Category.md | 4 +- .../doc/ClassModel.md | 15 + .../petstore_client_lib_fake/doc/Client.md | 15 + .../doc/DefaultApi.md | 51 + .../dart2/petstore_client_lib_fake/doc/Dog.md | 17 + .../petstore_client_lib_fake/doc/DogAllOf.md | 15 + .../doc/EnumArrays.md | 16 + .../petstore_client_lib_fake/doc/EnumClass.md | 14 + .../petstore_client_lib_fake/doc/EnumTest.md | 22 + .../petstore_client_lib_fake/doc/FakeApi.md | 725 +++++++++ .../doc/FakeClassnameTags123Api.md | 61 + .../petstore_client_lib_fake/doc/File.md | 15 + .../doc/FileSchemaTestClass.md} | 7 +- .../dart2/petstore_client_lib_fake/doc/Foo.md | 15 + .../doc/FormatTest.md | 30 + .../doc/HasOnlyReadOnly.md | 16 + .../doc/HealthCheckResult.md | 15 + .../doc/InlineObject.md | 16 + .../doc/InlineObject1.md | 16 + .../doc/InlineObject2.md | 16 + .../doc/InlineObject3.md | 28 + .../doc/InlineObject4.md | 16 + .../doc/InlineObject5.md | 16 + .../doc/InlineResponseDefault.md | 15 + .../petstore_client_lib_fake/doc/List.md | 15 + .../petstore_client_lib_fake/doc/MapTest.md | 18 + ...dPropertiesAndAdditionalPropertiesClass.md | 17 + .../doc/Model200Response.md | 16 + .../doc/ModelReturn.md | 15 + .../petstore_client_lib_fake/doc/Name.md | 18 + .../doc/NullableClass.md | 26 + .../doc/NumberOnly.md | 15 + .../petstore_client_lib_fake}/doc/Order.md | 10 +- .../doc/OuterComposite.md | 17 + .../petstore_client_lib_fake/doc/OuterEnum.md | 14 + .../doc/OuterEnumDefaultValue.md | 14 + .../doc/OuterEnumInteger.md | 14 + .../doc/OuterEnumIntegerDefaultValue.md | 14 + .../dart2/petstore_client_lib_fake/doc/Pet.md | 20 + .../petstore_client_lib_fake/doc}/PetApi.md | 184 ++- .../doc/ReadOnlyFirst.md | 16 + .../doc/SpecialModelName.md | 15 + .../petstore_client_lib_fake/doc}/StoreApi.md | 52 +- .../petstore_client_lib_fake}/doc/Tag.md | 4 +- .../petstore_client_lib_fake/doc/User.md | 22 + .../petstore_client_lib_fake/doc}/UserApi.md | 98 +- .../petstore_client_lib_fake/git_push.sh | 58 + .../petstore_client_lib_fake/lib/api.dart | 93 ++ .../lib/api/another_fake_api.dart | 91 ++ .../lib/api/default_api.dart | 69 + .../lib/api/fake_api.dart | 1374 +++++++++++++++++ .../lib/api/fake_classname_tags123_api.dart | 91 ++ .../lib/api/pet_api.dart | 729 +++++++++ .../lib/api/store_api.dart | 289 ++++ .../lib/api/user_api.dart | 556 +++++++ .../lib/api_client.dart | 303 ++++ .../lib/api_exception.dart | 31 + .../lib/api_helper.dart | 86 ++ .../lib/auth/api_key_auth.dart | 35 + .../lib/auth/authentication.dart | 15 + .../lib/auth/http_basic_auth.dart | 21 + .../lib/auth/http_bearer_auth.dart | 38 + .../lib/auth/oauth.dart | 23 + .../model/additional_properties_class.dart | 86 ++ .../lib/model/animal.dart | 82 + .../lib/model/api_response.dart | 92 ++ .../model/array_of_array_of_number_only.dart | 76 + .../lib/model/array_of_number_only.dart | 74 + .../lib/model/array_test.dart | 102 ++ .../lib/model/capitalization.dart | 122 ++ .../lib/model/cat.dart | 92 ++ .../lib/model/cat_all_of.dart | 72 + .../lib/model/category.dart | 82 + .../lib/model/class_model.dart | 72 + .../lib/model/client.dart | 72 + .../lib/model/dog.dart | 92 ++ .../lib/model/dog_all_of.dart | 72 + .../lib/model/enum_arrays.dart | 230 +++ .../lib/model/enum_class.dart | 87 ++ .../lib/model/enum_test.dart | 444 ++++++ .../lib/model/file.dart | 72 + .../lib/model/file_schema_test_class.dart | 82 + .../lib/model/foo.dart | 72 + .../lib/model/format_test.dart | 238 +++ .../lib/model/has_only_read_only.dart | 82 + .../lib/model/health_check_result.dart | 72 + .../lib/model/inline_object.dart | 82 + .../lib/model/inline_object1.dart | 82 + .../lib/model/inline_object2.dart | 233 +++ .../lib/model/inline_object3.dart | 217 +++ .../lib/model/inline_object4.dart | 82 + .../lib/model/inline_object5.dart | 82 + .../lib/model/inline_response_default.dart | 72 + .../lib/model/list.dart | 72 + .../lib/model/map_test.dart | 184 +++ ...rties_and_additional_properties_class.dart | 96 ++ .../lib/model/model200_response.dart | 82 + .../lib/model/model_return.dart | 72 + .../lib/model/name.dart | 102 ++ .../lib/model/nullable_class.dart | 194 +++ .../lib/model/number_only.dart | 74 + .../lib/model/order.dart | 201 +++ .../lib/model/outer_composite.dart | 94 ++ .../lib/model/outer_enum.dart | 87 ++ .../lib/model/outer_enum_default_value.dart | 87 ++ .../lib/model/outer_enum_integer.dart | 87 ++ .../outer_enum_integer_default_value.dart | 87 ++ .../lib/model/pet.dart | 201 +++ .../lib/model/read_only_first.dart | 82 + .../lib/model/special_model_name.dart | 72 + .../lib/model/tag.dart | 82 + .../lib/model/user.dart | 142 ++ .../dart2/petstore_client_lib_fake/pom.xml | 73 + .../petstore_client_lib_fake/pubspec.yaml | 18 + .../additional_properties_class_test.dart | 22 + .../test/animal_test.dart | 22 + .../test/another_fake_api_test.dart | 29 + .../test/api_response_test.dart | 27 + .../array_of_array_of_number_only_test.dart | 17 + .../test/array_of_number_only_test.dart | 17 + .../test/array_test_test.dart | 27 + .../test/capitalization_test.dart | 43 + .../test/cat_all_of_test.dart | 17 + .../test/cat_test.dart | 27 + .../test/category_test.dart | 22 + .../test/class_model_test.dart | 17 + .../test/client_test.dart | 17 + .../test/default_api_test.dart | 25 + .../test/dog_all_of_test.dart | 17 + .../test/dog_test.dart | 27 + .../test/enum_arrays_test.dart | 22 + .../test/enum_class_test.dart | 11 + .../test/enum_test_test.dart | 52 + .../test/fake_api_test.dart | 131 ++ .../test/fake_classname_tags123_api_test.dart | 29 + .../test/file_schema_test_class_test.dart | 22 + .../test/file_test.dart | 18 + .../test/foo_test.dart | 17 + .../test/format_test_test.dart | 94 ++ .../test/has_only_read_only_test.dart | 22 + .../test/health_check_result_test.dart | 17 + .../test/inline_object1_test.dart | 24 + .../test/inline_object2_test.dart | 24 + .../test/inline_object3_test.dart | 96 ++ .../test/inline_object4_test.dart | 24 + .../test/inline_object5_test.dart | 24 + .../test/inline_object_test.dart | 24 + .../test/inline_response_default_test.dart | 17 + .../test/list_test.dart | 17 + .../test/map_test_test.dart | 32 + ..._and_additional_properties_class_test.dart | 27 + .../test/model200_response_test.dart | 22 + .../test/model_return_test.dart | 17 + .../test/name_test.dart | 32 + .../test/nullable_class_test.dart | 72 + .../test/number_only_test.dart | 17 + .../test/order_test.dart | 43 + .../test/outer_composite_test.dart | 27 + .../test/outer_enum_default_value_test.dart | 11 + ...outer_enum_integer_default_value_test.dart | 11 + .../test/outer_enum_integer_test.dart | 11 + .../test/outer_enum_test.dart | 11 + .../test/pet_api_test.dart | 89 ++ .../test/pet_test.dart | 43 + .../test/read_only_first_test.dart | 22 + .../test/special_model_name_test.dart | 17 + .../test/store_api_test.dart | 54 + .../test/tag_test.dart | 22 + .../test/user_api_test.dart | 82 + .../test/user_test.dart | 53 + 623 files changed, 28653 insertions(+), 5846 deletions(-) create mode 100644 bin/configs/dart-dio-petstore-client-lib-fake.yaml rename bin/configs/{dart-dio.yaml => dart-dio-petstore-client-lib-oas2.yaml} (77%) create mode 100644 bin/configs/dart-dio-petstore-client-lib.yaml create mode 100644 bin/configs/dart-petstore-client-lib-fake.yaml rename bin/configs/{dart-petstore_client_lib.yaml => dart-petstore-client-lib-oas2.yaml} (100%) create mode 100644 bin/configs/dart-petstore-client-lib.yaml rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/.gitignore (91%) rename samples/client/petstore/{dart2/openapi => dart-dio/petstore_client_lib}/.openapi-generator-ignore (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/.openapi-generator/FILES (97%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/.openapi-generator/VERSION (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/README.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/analysis_options.yaml (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/ApiResponse.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/Category.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/Order.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/Pet.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/PetApi.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/StoreApi.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/Tag.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/User.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/doc/UserApi.md (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/api.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/api/pet_api.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/api/store_api.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/api/user_api.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/api_util.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/auth/api_key_auth.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/auth/auth.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/auth/basic_auth.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/auth/oauth.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/model/api_response.dart (84%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/model/category.dart (84%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/model/order.dart (82%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/model/pet.dart (77%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/model/tag.dart (82%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/model/user.dart (81%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/lib/serializers.dart (100%) create mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/pom.xml rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/pubspec.yaml (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/api_response_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/category_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/order_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/pet_api_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/pet_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/store_api_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/tag_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/user_api_test.dart (100%) rename samples/client/petstore/dart-dio/{ => petstore_client_lib}/test/user_test.dart (100%) delete mode 100644 samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md delete mode 100644 samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/StoreApi.md delete mode 100644 samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Pet.md delete mode 100644 samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/PetApi.md delete mode 100644 samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/UserApi.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi/docs/Order.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi/docs/Pet.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi/docs/PetApi.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi/docs/StoreApi.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi/docs/User.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi_proto/docs/ApiResponse.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi_proto/docs/StoreApi.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi_proto/docs/User.md delete mode 100644 samples/client/petstore/dart-jaguar/openapi_proto/docs/UserApi.md delete mode 100644 samples/client/petstore/dart2/openapi/doc/ApiResponse.md delete mode 100644 samples/client/petstore/dart2/openapi/doc/Category.md delete mode 100644 samples/client/petstore/dart2/openapi/doc/Pet.md delete mode 100644 samples/client/petstore/dart2/openapi/doc/User.md delete mode 100644 samples/client/petstore/dart2/openapi/docs/ApiResponse.md delete mode 100644 samples/client/petstore/dart2/openapi/docs/Category.md delete mode 100644 samples/client/petstore/dart2/openapi/docs/Order.md delete mode 100644 samples/client/petstore/dart2/openapi/docs/Pet.md delete mode 100644 samples/client/petstore/dart2/openapi/docs/User.md delete mode 100644 samples/client/petstore/dart2/openapi/docs/UserApi.md delete mode 100644 samples/client/petstore/dart2/openapi/lib/api.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/api/pet_api.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/api/store_api.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/api/user_api.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/api_client.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/api_exception.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/api_helper.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/auth/authentication.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/auth/http_bearer_auth.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/auth/oauth.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/model/api_response.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/model/category.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/model/order.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/model/pet.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/model/tag.dart delete mode 100644 samples/client/petstore/dart2/openapi/lib/model/user.dart delete mode 100644 samples/client/petstore/dart2/openapi/pubspec.yaml delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/docs/ApiResponse.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/docs/Category.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/docs/Order.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/docs/Pet.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/docs/Tag.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/docs/User.md create mode 100644 samples/client/petstore/dart2/petstore_client_lib/pom.xml create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.gitignore rename samples/{client/petstore/dart-dio => openapi3/client/petstore/dart-dio/petstore_client_lib}/.openapi-generator-ignore (91%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/.openapi-generator/VERSION (100%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/ApiResponse.md (100%) rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/Category.md (100%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/InlineObject.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/InlineObject1.md rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/Order.md (100%) rename samples/{client/petstore/dart-jaguar/openapi_proto/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/Pet.md (80%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/doc/PetApi.md (85%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/doc/StoreApi.md (86%) rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/Tag.md (100%) rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/User.md (100%) rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib/doc}/UserApi.md (67%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object1.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart rename samples/{client/petstore/dart-dio => openapi3/client/petstore/dart-dio/petstore_client_lib}/pom.xml (97%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/api_response_test.dart (79%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/category_test.dart (75%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object1_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object_test.dart rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/order_test.dart (89%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/pet_api_test.dart (76%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/pet_test.dart (78%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/store_api_test.dart (72%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/tag_test.dart (76%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/user_api_test.dart (71%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart-dio/petstore_client_lib}/test/user_test.dart (91%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.gitignore create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/analysis_options.yaml create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md rename samples/{client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/ApiResponse.md (100%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md rename samples/{client/petstore/dart2/openapi/docs/Tag.md => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md} (73%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Capitalization.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md rename samples/{client/petstore/dart-jaguar/openapi/docs/Tag.md => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/CatAllOf.md} (73%) rename samples/{client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/Category.md (87%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ClassModel.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Client.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DogAllOf.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumClass.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumTest.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/File.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FileSchemaTestClass.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Foo.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject1.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject2.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject4.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject5.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineResponseDefault.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/List.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Model200Response.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ModelReturn.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Name.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NumberOnly.md rename samples/{client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/Order.md (100%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md rename samples/{client/petstore/dart-jaguar/flutter_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/Pet.md (80%) rename samples/{client/petstore/dart2/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/PetApi.md (74%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md rename samples/{client/petstore/dart2/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/StoreApi.md (83%) rename samples/{client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/Tag.md (100%) rename samples/{client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/User.md (100%) rename samples/{client/petstore/dart-jaguar/openapi/docs => openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc}/UserApi.md (82%) create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api_util.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/api_key_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/basic_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/oauth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/additional_properties_class.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/animal.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/api_response.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_number_only.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/capitalization.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat_all_of.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/category.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/class_model.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/client.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog_all_of.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_class.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file_schema_test_class.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/foo.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/has_only_read_only.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/health_check_result.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object1.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object4.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object5.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_response_default.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/list.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/map_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model200_response.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_return.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/name.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/nullable_class.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/number_only.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/order.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_composite.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/read_only_first.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/tag.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/user.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pom.xml create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/animal_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/another_fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/capitalization_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/class_model_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/client_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/default_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_arrays_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_schema_test_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/has_only_read_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/health_check_result_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object1_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object2_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object4_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object5_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/list_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/map_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model200_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model_return_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/name_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/nullable_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_composite_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/read_only_first_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/.analysis_options create mode 100644 samples/openapi3/client/petstore/dart2/petstore/README.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore/pom.xml create mode 100644 samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib}/.gitignore (100%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib}/.openapi-generator/FILES (85%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib}/.travis.yml (79%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib}/README.md (93%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md rename samples/{client/petstore/dart-jaguar/openapi/docs => openapi3/client/petstore/dart2/petstore_client_lib/doc}/Category.md (77%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/InlineObject.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/InlineObject1.md rename samples/{client/petstore/dart-jaguar/openapi_proto/docs => openapi3/client/petstore/dart2/petstore_client_lib/doc}/Order.md (58%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Pet.md rename samples/{client/petstore/dart2/petstore_client_lib/docs => openapi3/client/petstore/dart2/petstore_client_lib/doc}/PetApi.md (73%) rename samples/{client/petstore/dart2/petstore_client_lib/docs => openapi3/client/petstore/dart2/petstore_client_lib/doc}/StoreApi.md (79%) rename samples/{client/petstore/dart-jaguar/openapi_proto/docs => openapi3/client/petstore/dart2/petstore_client_lib/doc}/Tag.md (77%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/User.md rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib}/doc/UserApi.md (58%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib}/git_push.sh (100%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object1.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object1_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ApiResponse.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Capitalization.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/CatAllOf.md rename samples/{client/petstore/dart-jaguar/openapi_proto/docs => openapi3/client/petstore/dart2/petstore_client_lib_fake/doc}/Category.md (77%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ClassModel.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Client.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DogAllOf.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/File.md rename samples/{client/petstore/dart-jaguar/openapi/docs/ApiResponse.md => openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FileSchemaTestClass.md} (64%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Foo.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject1.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject2.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject4.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject5.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineResponseDefault.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/List.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MapTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Model200Response.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ModelReturn.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Name.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NumberOnly.md rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib_fake}/doc/Order.md (58%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md rename samples/{client/petstore/dart-jaguar/openapi_proto/docs => openapi3/client/petstore/dart2/petstore_client_lib_fake/doc}/PetApi.md (53%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md rename samples/{client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs => openapi3/client/petstore/dart2/petstore_client_lib_fake/doc}/StoreApi.md (67%) rename samples/{client/petstore/dart2/openapi => openapi3/client/petstore/dart2/petstore_client_lib_fake}/doc/Tag.md (77%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/User.md rename samples/{client/petstore/dart2/petstore_client_lib/docs => openapi3/client/petstore/dart2/petstore_client_lib_fake/doc}/UserApi.md (71%) create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/git_push.sh create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/client.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object1.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object4.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object5.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/list.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object1_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object2_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object4_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object5_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/list_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart diff --git a/.gitignore b/.gitignore index e24cf380cfe..980aad7ded4 100644 --- a/.gitignore +++ b/.gitignore @@ -234,11 +234,15 @@ samples/client/petstore/erlang-proper/rebar.lock samples/server/petstore/erlang-server/_build/ samples/server/petstore/erlang-server/rebar.lock -# dart -samples/client/petstore/dart/petstore/packages -samples/client/petstore/dart/flutter_petstore/test/packages -samples/client/petstore/dart/petstore/test/packages -**/.dart_tool +# Dart +**/dart*/**/.dart_tool +**/dart*/**/.packages +**/dart*/**/pubspec.lock +# Dart dio +**/dart*/**/*.g.dart +# Dart jaguar +**/dart*/**/*.jser.dart +**/dart*/**/*.jretro.dart # JS samples/client/petstore/javascript-es6/package-lock.json diff --git a/bin/configs/dart-dio-petstore-client-lib-fake.yaml b/bin/configs/dart-dio-petstore-client-lib-fake.yaml new file mode 100644 index 00000000000..2463da464ed --- /dev/null +++ b/bin/configs/dart-dio-petstore-client-lib-fake.yaml @@ -0,0 +1,6 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/dart-dio +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-dio.yaml b/bin/configs/dart-dio-petstore-client-lib-oas2.yaml similarity index 77% rename from bin/configs/dart-dio.yaml rename to bin/configs/dart-dio-petstore-client-lib-oas2.yaml index 7013cbd4fae..447136518a8 100644 --- a/bin/configs/dart-dio.yaml +++ b/bin/configs/dart-dio-petstore-client-lib-oas2.yaml @@ -1,5 +1,5 @@ generatorName: dart-dio -outputDir: samples/client/petstore/dart-dio +outputDir: samples/client/petstore/dart-dio/petstore_client_lib inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/dart-dio additionalProperties: diff --git a/bin/configs/dart-dio-petstore-client-lib.yaml b/bin/configs/dart-dio-petstore-client-lib.yaml new file mode 100644 index 00000000000..8db24ccb0ce --- /dev/null +++ b/bin/configs/dart-dio-petstore-client-lib.yaml @@ -0,0 +1,6 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/dart-dio +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-petstore-client-lib-fake.yaml b/bin/configs/dart-petstore-client-lib-fake.yaml new file mode 100644 index 00000000000..8dda4df4b0a --- /dev/null +++ b/bin/configs/dart-petstore-client-lib-fake.yaml @@ -0,0 +1,6 @@ +generatorName: dart +outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/dart2 +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-petstore_client_lib.yaml b/bin/configs/dart-petstore-client-lib-oas2.yaml similarity index 100% rename from bin/configs/dart-petstore_client_lib.yaml rename to bin/configs/dart-petstore-client-lib-oas2.yaml diff --git a/bin/configs/dart-petstore-client-lib.yaml b/bin/configs/dart-petstore-client-lib.yaml new file mode 100644 index 00000000000..8b4a6deefd7 --- /dev/null +++ b/bin/configs/dart-petstore-client-lib.yaml @@ -0,0 +1,6 @@ +generatorName: dart +outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/dart2 +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/modules/openapi-generator/src/main/resources/dart-dio/class.mustache b/modules/openapi-generator/src/main/resources/dart-dio/class.mustache index be116b59e8d..5ad5beee02c 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/class.mustache @@ -8,12 +8,12 @@ abstract class {{classname}} implements Built<{{classname}}, {{classname}}Builde {{#vars}} {{#description}}/* {{{description}}} */{{/description}} {{#isNullable}} - @nullable + @nullable {{/isNullable}} @BuiltValueField(wireName: r'{{baseName}}') {{#isEnum}}{{classname}}{{{nameInCamelCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} get {{name}}; {{#allowableValues}} - {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}} + {{#min}}// range from {{min}} to {{max}}{{/min}}//{{^min}} enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}} {{/allowableValues}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/model.mustache b/modules/openapi-generator/src/main/resources/dart-dio/model.mustache index ff2c84d195c..b696da9cdb4 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/model.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/model.mustache @@ -1,8 +1,8 @@ {{#models}} {{#model}} {{#imports}} - import '{{.}}'; +import '{{.}}'; {{/imports}} - {{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} +{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} {{/model}} {{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache index bfcce5442b4..58a78278602 100644 --- a/modules/openapi-generator/src/main/resources/dart2/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -152,7 +152,12 @@ class {{{classname}}} { {{/items.isArray}} {{/isMap}} {{^isMap}} + {{#isBinary}} + {{{name}}}: null, // No support for decoding binary content from JSON + {{/isBinary}} + {{^isBinary}} {{{name}}}: {{{complexType}}}.fromJson(json['{{{baseName}}}']), + {{/isBinary}} {{/isMap}} {{/isArray}} {{/complexType}} diff --git a/pom.xml b/pom.xml index 9952eff87d0..79ff6da7d47 100644 --- a/pom.xml +++ b/pom.xml @@ -1349,8 +1349,12 @@ samples/client/petstore/javascript-promise-es6 samples/server/petstore/go-api-server samples/server/petstore/go-gin-api-server + samples/client/petstore/dart2/petstore_client_lib samples/client/petstore/dart2/petstore - samples/client/petstore/dart-dio + samples/openapi3/client/petstore/dart2/petstore_client_lib + samples/openapi3/client/petstore/dart2/petstore + samples/client/petstore/dart-dio/petstore_client_lib + samples/openapi3/client/petstore/dart-dio/petstore_client_lib samples/client/petstore/dart-jaguar/openapi samples/client/petstore/dart-jaguar/flutter_petstore/openapi diff --git a/samples/client/petstore/dart-dio/.gitignore b/samples/client/petstore/dart-dio/petstore_client_lib/.gitignore similarity index 91% rename from samples/client/petstore/dart-dio/.gitignore rename to samples/client/petstore/dart-dio/petstore_client_lib/.gitignore index f8005b318fe..8092a49d515 100644 --- a/samples/client/petstore/dart-dio/.gitignore +++ b/samples/client/petstore/dart-dio/petstore_client_lib/.gitignore @@ -27,9 +27,6 @@ doc/api/ # (Library packages only! Remove pattern if developing an application package) pubspec.lock -# Don't commit *.g.dart files which are genrated during integration tests -lib/**/*.g.dart - # Don’t commit files and directories created by other development environments. # For example, if your development environment creates any of the following files, # consider putting them in a global ignore file: diff --git a/samples/client/petstore/dart2/openapi/.openapi-generator-ignore b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/dart2/openapi/.openapi-generator-ignore rename to samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore diff --git a/samples/client/petstore/dart-dio/.openapi-generator/FILES b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES similarity index 97% rename from samples/client/petstore/dart-dio/.openapi-generator/FILES rename to samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES index e9358a18c39..b14eb44e2a0 100644 --- a/samples/client/petstore/dart-dio/.openapi-generator/FILES +++ b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.gitignore README.md analysis_options.yaml doc/ApiResponse.md diff --git a/samples/client/petstore/dart-dio/.openapi-generator/VERSION b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/dart-dio/.openapi-generator/VERSION rename to samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION diff --git a/samples/client/petstore/dart-dio/README.md b/samples/client/petstore/dart-dio/petstore_client_lib/README.md similarity index 100% rename from samples/client/petstore/dart-dio/README.md rename to samples/client/petstore/dart-dio/petstore_client_lib/README.md diff --git a/samples/client/petstore/dart-dio/analysis_options.yaml b/samples/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml similarity index 100% rename from samples/client/petstore/dart-dio/analysis_options.yaml rename to samples/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml diff --git a/samples/client/petstore/dart-dio/doc/ApiResponse.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/ApiResponse.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md diff --git a/samples/client/petstore/dart-dio/doc/Category.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Category.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/Category.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/Category.md diff --git a/samples/client/petstore/dart-dio/doc/Order.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Order.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/Order.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/Order.md diff --git a/samples/client/petstore/dart-dio/doc/Pet.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/Pet.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md diff --git a/samples/client/petstore/dart-dio/doc/PetApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/PetApi.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md diff --git a/samples/client/petstore/dart-dio/doc/StoreApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/StoreApi.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md diff --git a/samples/client/petstore/dart-dio/doc/Tag.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/Tag.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md diff --git a/samples/client/petstore/dart-dio/doc/User.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/User.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/User.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/User.md diff --git a/samples/client/petstore/dart-dio/doc/UserApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md similarity index 100% rename from samples/client/petstore/dart-dio/doc/UserApi.md rename to samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md diff --git a/samples/client/petstore/dart-dio/lib/api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/api.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart diff --git a/samples/client/petstore/dart-dio/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/api/pet_api.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart diff --git a/samples/client/petstore/dart-dio/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/api/store_api.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart diff --git a/samples/client/petstore/dart-dio/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/api/user_api.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart diff --git a/samples/client/petstore/dart-dio/lib/api_util.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/api_util.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart diff --git a/samples/client/petstore/dart-dio/lib/auth/api_key_auth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/auth/api_key_auth.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart diff --git a/samples/client/petstore/dart-dio/lib/auth/auth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/auth/auth.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart diff --git a/samples/client/petstore/dart-dio/lib/auth/basic_auth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/auth/basic_auth.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart diff --git a/samples/client/petstore/dart-dio/lib/auth/oauth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/auth/oauth.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart diff --git a/samples/client/petstore/dart-dio/lib/model/api_response.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart similarity index 84% rename from samples/client/petstore/dart-dio/lib/model/api_response.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart index 897197d7d9f..77381d6b5e2 100644 --- a/samples/client/petstore/dart-dio/lib/model/api_response.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart @@ -1,4 +1,4 @@ - import 'package:built_value/built_value.dart'; +import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'api_response.g.dart'; @@ -6,15 +6,15 @@ part 'api_response.g.dart'; abstract class ApiResponse implements Built { - @nullable + @nullable @BuiltValueField(wireName: r'code') int get code; - @nullable + @nullable @BuiltValueField(wireName: r'type') String get type; - @nullable + @nullable @BuiltValueField(wireName: r'message') String get message; diff --git a/samples/client/petstore/dart-dio/lib/model/category.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart similarity index 84% rename from samples/client/petstore/dart-dio/lib/model/category.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart index 25f277d0324..46e4a1f7d88 100644 --- a/samples/client/petstore/dart-dio/lib/model/category.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart @@ -1,4 +1,4 @@ - import 'package:built_value/built_value.dart'; +import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'category.g.dart'; @@ -6,11 +6,11 @@ part 'category.g.dart'; abstract class Category implements Built { - @nullable + @nullable @BuiltValueField(wireName: r'id') int get id; - @nullable + @nullable @BuiltValueField(wireName: r'name') String get name; diff --git a/samples/client/petstore/dart-dio/lib/model/order.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart similarity index 82% rename from samples/client/petstore/dart-dio/lib/model/order.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart index 3931fb9d72b..700b6578821 100644 --- a/samples/client/petstore/dart-dio/lib/model/order.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart @@ -1,5 +1,5 @@ - import 'package:built_collection/built_collection.dart'; - import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'order.g.dart'; @@ -7,28 +7,28 @@ part 'order.g.dart'; abstract class Order implements Built { - @nullable + @nullable @BuiltValueField(wireName: r'id') int get id; - @nullable + @nullable @BuiltValueField(wireName: r'petId') int get petId; - @nullable + @nullable @BuiltValueField(wireName: r'quantity') int get quantity; - @nullable + @nullable @BuiltValueField(wireName: r'shipDate') DateTime get shipDate; /* Order Status */ - @nullable + @nullable @BuiltValueField(wireName: r'status') OrderStatus get status; - //enum statusEnum { placed, approved, delivered, }; + // enum statusEnum { placed, approved, delivered, }; - @nullable + @nullable @BuiltValueField(wireName: r'complete') bool get complete; diff --git a/samples/client/petstore/dart-dio/lib/model/pet.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart similarity index 77% rename from samples/client/petstore/dart-dio/lib/model/pet.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart index 25431aefcb9..cbd2317378f 100644 --- a/samples/client/petstore/dart-dio/lib/model/pet.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart @@ -1,7 +1,7 @@ - import 'package:openapi/model/tag.dart'; - import 'package:built_collection/built_collection.dart'; - import 'package:openapi/model/category.dart'; - import 'package:built_value/built_value.dart'; +import 'package:openapi/model/tag.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/model/category.dart'; +import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'pet.g.dart'; @@ -9,30 +9,30 @@ part 'pet.g.dart'; abstract class Pet implements Built { - @nullable + @nullable @BuiltValueField(wireName: r'id') int get id; - @nullable + @nullable @BuiltValueField(wireName: r'category') Category get category; - @nullable + @nullable @BuiltValueField(wireName: r'name') String get name; - @nullable + @nullable @BuiltValueField(wireName: r'photoUrls') BuiltList get photoUrls; - @nullable + @nullable @BuiltValueField(wireName: r'tags') BuiltList get tags; /* pet status in the store */ - @nullable + @nullable @BuiltValueField(wireName: r'status') PetStatus get status; - //enum statusEnum { available, pending, sold, }; + // enum statusEnum { available, pending, sold, }; // Boilerplate code needed to wire-up generated code Pet._(); diff --git a/samples/client/petstore/dart-dio/lib/model/tag.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart similarity index 82% rename from samples/client/petstore/dart-dio/lib/model/tag.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart index b4f4433ef4b..6ff5d3eb3cd 100644 --- a/samples/client/petstore/dart-dio/lib/model/tag.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart @@ -1,4 +1,4 @@ - import 'package:built_value/built_value.dart'; +import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'tag.g.dart'; @@ -6,11 +6,11 @@ part 'tag.g.dart'; abstract class Tag implements Built { - @nullable + @nullable @BuiltValueField(wireName: r'id') int get id; - @nullable + @nullable @BuiltValueField(wireName: r'name') String get name; diff --git a/samples/client/petstore/dart-dio/lib/model/user.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart similarity index 81% rename from samples/client/petstore/dart-dio/lib/model/user.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart index 0ee8eb03690..cf78ae941ce 100644 --- a/samples/client/petstore/dart-dio/lib/model/user.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart @@ -1,4 +1,4 @@ - import 'package:built_value/built_value.dart'; +import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'user.g.dart'; @@ -6,35 +6,35 @@ part 'user.g.dart'; abstract class User implements Built { - @nullable + @nullable @BuiltValueField(wireName: r'id') int get id; - @nullable + @nullable @BuiltValueField(wireName: r'username') String get username; - @nullable + @nullable @BuiltValueField(wireName: r'firstName') String get firstName; - @nullable + @nullable @BuiltValueField(wireName: r'lastName') String get lastName; - @nullable + @nullable @BuiltValueField(wireName: r'email') String get email; - @nullable + @nullable @BuiltValueField(wireName: r'password') String get password; - @nullable + @nullable @BuiltValueField(wireName: r'phone') String get phone; /* User Status */ - @nullable + @nullable @BuiltValueField(wireName: r'userStatus') int get userStatus; diff --git a/samples/client/petstore/dart-dio/lib/serializers.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart similarity index 100% rename from samples/client/petstore/dart-dio/lib/serializers.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/pom.xml b/samples/client/petstore/dart-dio/petstore_client_lib/pom.xml new file mode 100644 index 00000000000..4f661ca5a8d --- /dev/null +++ b/samples/client/petstore/dart-dio/petstore_client_lib/pom.xml @@ -0,0 +1,88 @@ + + 4.0.0 + org.openapitools + DartDioPetstoreClientLibOAS2Tests + pom + 1.0.0-SNAPSHOT + DartDio Petstore Client Lib OAS2 + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-run-build-runner + pre-integration-test + + exec + + + pub + + run + build_runner + build + + + + + pub-test + integration-test + + exec + + + pub + + run + test + + + + + + + + diff --git a/samples/client/petstore/dart-dio/pubspec.yaml b/samples/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml similarity index 100% rename from samples/client/petstore/dart-dio/pubspec.yaml rename to samples/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml diff --git a/samples/client/petstore/dart-dio/test/api_response_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/api_response_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart diff --git a/samples/client/petstore/dart-dio/test/category_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/category_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart diff --git a/samples/client/petstore/dart-dio/test/order_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/order_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart diff --git a/samples/client/petstore/dart-dio/test/pet_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/pet_api_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart diff --git a/samples/client/petstore/dart-dio/test/pet_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/pet_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart diff --git a/samples/client/petstore/dart-dio/test/store_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/store_api_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart diff --git a/samples/client/petstore/dart-dio/test/tag_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/tag_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart diff --git a/samples/client/petstore/dart-dio/test/user_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/user_api_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart diff --git a/samples/client/petstore/dart-dio/test/user_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart similarity index 100% rename from samples/client/petstore/dart-dio/test/user_test.dart rename to samples/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md deleted file mode 100644 index 3e4ef1cedb2..00000000000 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md +++ /dev/null @@ -1,379 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **Post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **Delete** /pet/:petId | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **Get** /pet/:petId | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **Put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **Post** /pet/:petId | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **Post** /pet/:petId/uploadImage | uploads an image - - -# **addPet** -> addPet(body) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(body); -} catch (e) { - print("Exception when calling PetApi->addPet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **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) - -# **deletePet** -> deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | Pet id to delete -var apiKey = apiKey_example; // String | - -try { - api_instance.deletePet(petId, apiKey); -} catch (e) { - print("Exception when calling PetApi->deletePet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByStatus** -> List findPetsByStatus(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var status = []; // List | Status values that need to be considered for filter - -try { - var result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print("Exception when calling PetApi->findPetsByStatus: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByTags** -> List findPetsByTags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var tags = []; // List | Tags to filter by - -try { - var result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print("Exception when calling PetApi->findPetsByTags: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getPetById** -> Pet getPetById(petId) - -Find pet by ID - -Returns a single pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to return - -try { - var result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print("Exception when calling PetApi->getPetById: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePet** -> updatePet(body) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.updatePet(body); -} catch (e) { - print("Exception when calling PetApi->updatePet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **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) - -# **updatePetWithForm** -> updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet that needs to be updated -var name = name_example; // String | Updated name of the pet -var status = status_example; // String | Updated status of the pet - -try { - api_instance.updatePetWithForm(petId, name, status); -} catch (e) { - print("Exception when calling PetApi->updatePetWithForm: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **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) - -# **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) - -uploads an image - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to update -var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = BINARY_DATA_HERE; // MultipartFile | file to upload - -try { - var result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print("Exception when calling PetApi->uploadFile: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: 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-jaguar/flutter_petstore/openapi/docs/StoreApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/StoreApi.md deleted file mode 100644 index c40c0eff43f..00000000000 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/StoreApi.md +++ /dev/null @@ -1,186 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **Delete** /store/order/:orderId | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **Get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **Get** /store/order/:orderId | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **Post** /store/order | Place an order for a pet - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - api_instance.deleteOrder(orderId); -} catch (e) { - print("Exception when calling StoreApi->deleteOrder: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | [default to null] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getInventory** -> Map getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; - -var api_instance = new StoreApi(); - -try { - var result = api_instance.getInventory(); - print(result); -} catch (e) { - print("Exception when calling StoreApi->getInventory: $e\n"); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: 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) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = 789; // int | ID of pet that needs to be fetched - -try { - var result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print("Exception when calling StoreApi->getOrderById: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | [default to null] - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(body) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet - -try { - var result = api_instance.placeOrder(body); - print(result); -} catch (e) { - print("Exception when calling StoreApi->placeOrder: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/api_response_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/api_response_test.dart index ebf142904e9..ba2202d24c4 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/api_response_test.dart +++ b/samples/client/petstore/dart-jaguar/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 = new ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/category_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/category_test.dart index c5cea4b5bc3..0dcaa8b7977 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/category_test.dart +++ b/samples/client/petstore/dart-jaguar/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 = new Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/order_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/order_test.dart index 9982020d8cf..aa9dcc69c4f 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/order_test.dart +++ b/samples/client/petstore/dart-jaguar/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 = new Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/pet_api_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/pet_api_test.dart index fa95dccad3c..e9dcc0d83b3 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/pet_api_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/pet_api_test.dart @@ -9,14 +9,14 @@ void main() { group('tests for PetApi', () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet body) async test('test addPet', () async { // TODO }); // Deletes a pet // - //Future deletePet(int petId, { String apiKey }) async + //Future deletePet(int petId, { String apiKey }) async test('test deletePet', () async { // TODO }); @@ -25,7 +25,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(List status) async test('test findPetsByStatus', () 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) async test('test findPetsByTags', () async { // TODO }); @@ -43,28 +43,28 @@ void main() { // // Returns a single pet // - //Future getPetById(int petId) async + //Future getPetById(int petId) async test('test getPetById', () async { // TODO }); // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet body) async test('test updatePet', () async { // TODO }); // Updates a pet in the store with form data // - //Future updatePetWithForm(int petId, { String name, String status }) async + //Future updatePetWithForm(int petId, { String name, String status }) async test('test updatePetWithForm', () async { // TODO }); // uploads an image // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async test('test uploadFile', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/store_api_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/store_api_test.dart index 496d051e833..49f763fa098 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/store_api_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/store_api_test.dart @@ -11,7 +11,7 @@ void main() { // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // - //Future deleteOrder(String orderId) async + //Future deleteOrder(String orderId) async test('test deleteOrder', () async { // TODO }); @@ -20,7 +20,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); @@ -29,14 +29,14 @@ void main() { // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // - //Future getOrderById(int orderId) async + //Future getOrderById(int orderId) async test('test getOrderById', () async { // TODO }); // Place an order for a pet // - //Future placeOrder(Order body) async + //Future placeOrder(Order body) async test('test placeOrder', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/tag_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/tag_test.dart index 6ee16c51bba..58477c9e758 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/tag_test.dart +++ b/samples/client/petstore/dart-jaguar/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 = new Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_api_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_api_test.dart index f040b01bf43..5cedd41d55e 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_api_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_api_test.dart @@ -11,21 +11,21 @@ void main() { // // This can only be done by the logged in user. // - //Future createUser(User body) async + //Future createUser(User body) async test('test createUser', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(List body) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(List body) async test('test createUsersWithListInput', () async { // TODO }); @@ -34,28 +34,28 @@ void main() { // // This can only be done by the logged in user. // - //Future deleteUser(String username) async + //Future deleteUser(String username) async test('test deleteUser', () async { // TODO }); // Get user by user name // - //Future getUserByName(String username) async + //Future getUserByName(String username) async test('test getUserByName', () async { // TODO }); // Logs user into the system // - //Future loginUser(String username, String password) async + //Future loginUser(String username, String password) async test('test loginUser', () async { // TODO }); // Logs out current logged in user session // - //Future logoutUser() async + //Future logoutUser() async test('test logoutUser', () 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 body) async test('test updateUser', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_test.dart index 5a6340c4f4b..ae6096d0f51 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/test/user_test.dart +++ b/samples/client/petstore/dart-jaguar/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 = new User(); group('test User', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Pet.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Pet.md deleted file mode 100644 index ce5708cc134..00000000000 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to const []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] -**status** | **String** | pet status in the store | [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-jaguar/flutter_proto_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/PetApi.md deleted file mode 100644 index 3e4ef1cedb2..00000000000 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/PetApi.md +++ /dev/null @@ -1,379 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **Post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **Delete** /pet/:petId | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **Get** /pet/:petId | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **Put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **Post** /pet/:petId | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **Post** /pet/:petId/uploadImage | uploads an image - - -# **addPet** -> addPet(body) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(body); -} catch (e) { - print("Exception when calling PetApi->addPet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **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) - -# **deletePet** -> deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | Pet id to delete -var apiKey = apiKey_example; // String | - -try { - api_instance.deletePet(petId, apiKey); -} catch (e) { - print("Exception when calling PetApi->deletePet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByStatus** -> List findPetsByStatus(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var status = []; // List | Status values that need to be considered for filter - -try { - var result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print("Exception when calling PetApi->findPetsByStatus: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByTags** -> List findPetsByTags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var tags = []; // List | Tags to filter by - -try { - var result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print("Exception when calling PetApi->findPetsByTags: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getPetById** -> Pet getPetById(petId) - -Find pet by ID - -Returns a single pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to return - -try { - var result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print("Exception when calling PetApi->getPetById: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePet** -> updatePet(body) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.updatePet(body); -} catch (e) { - print("Exception when calling PetApi->updatePet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **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) - -# **updatePetWithForm** -> updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet that needs to be updated -var name = name_example; // String | Updated name of the pet -var status = status_example; // String | Updated status of the pet - -try { - api_instance.updatePetWithForm(petId, name, status); -} catch (e) { - print("Exception when calling PetApi->updatePetWithForm: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **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) - -# **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) - -uploads an image - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to update -var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = BINARY_DATA_HERE; // MultipartFile | file to upload - -try { - var result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print("Exception when calling PetApi->uploadFile: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: 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-jaguar/flutter_proto_petstore/openapi/docs/UserApi.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/UserApi.md deleted file mode 100644 index 91cad43d7a1..00000000000 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/UserApi.md +++ /dev/null @@ -1,349 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **Post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **Delete** /user/:username | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **Get** /user/:username | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **Get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **Get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **Put** /user/:username | Updated user - - -# **createUser** -> createUser(body) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = new User(); // User | Created user object - -try { - api_instance.createUser(body); -} catch (e) { - print("Exception when calling UserApi->createUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object - -try { - api_instance.createUsersWithArrayInput(body); -} catch (e) { - print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object - -try { - api_instance.createUsersWithListInput(body); -} catch (e) { - print("Exception when calling UserApi->createUsersWithListInput: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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) - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The name that needs to be deleted - -try { - api_instance.deleteUser(username); -} catch (e) { - print("Exception when calling UserApi->deleteUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | [default to null] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - var result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print("Exception when calling UserApi->getUserByName: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The user name for login -var password = password_example; // String | The password for login in clear text - -try { - var result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print("Exception when calling UserApi->loginUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **logoutUser** -> logoutUser() - -Logs out current logged in user session - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); - -try { - api_instance.logoutUser(); -} catch (e) { - print("Exception when calling UserApi->logoutUser: $e\n"); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> updateUser(username, body) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object - -try { - api_instance.updateUser(username, body); -} catch (e) { - print("Exception when calling UserApi->updateUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | [default to null] - **body** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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-jaguar/flutter_proto_petstore/openapi/test/api_response_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/api_response_test.dart index ebf142904e9..ba2202d24c4 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/api_response_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_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 = new ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/category_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/category_test.dart index c5cea4b5bc3..0dcaa8b7977 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/category_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_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 = new Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/order_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/order_test.dart index 9982020d8cf..aa9dcc69c4f 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/order_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_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 = new Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/pet_api_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/pet_api_test.dart index fa95dccad3c..e9dcc0d83b3 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/pet_api_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/pet_api_test.dart @@ -9,14 +9,14 @@ void main() { group('tests for PetApi', () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet body) async test('test addPet', () async { // TODO }); // Deletes a pet // - //Future deletePet(int petId, { String apiKey }) async + //Future deletePet(int petId, { String apiKey }) async test('test deletePet', () async { // TODO }); @@ -25,7 +25,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(List status) async test('test findPetsByStatus', () 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) async test('test findPetsByTags', () async { // TODO }); @@ -43,28 +43,28 @@ void main() { // // Returns a single pet // - //Future getPetById(int petId) async + //Future getPetById(int petId) async test('test getPetById', () async { // TODO }); // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet body) async test('test updatePet', () async { // TODO }); // Updates a pet in the store with form data // - //Future updatePetWithForm(int petId, { String name, String status }) async + //Future updatePetWithForm(int petId, { String name, String status }) async test('test updatePetWithForm', () async { // TODO }); // uploads an image // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async test('test uploadFile', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/store_api_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/store_api_test.dart index 496d051e833..49f763fa098 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/store_api_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/store_api_test.dart @@ -11,7 +11,7 @@ void main() { // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // - //Future deleteOrder(String orderId) async + //Future deleteOrder(String orderId) async test('test deleteOrder', () async { // TODO }); @@ -20,7 +20,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); @@ -29,14 +29,14 @@ void main() { // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // - //Future getOrderById(int orderId) async + //Future getOrderById(int orderId) async test('test getOrderById', () async { // TODO }); // Place an order for a pet // - //Future placeOrder(Order body) async + //Future placeOrder(Order body) async test('test placeOrder', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/tag_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/tag_test.dart index 6ee16c51bba..58477c9e758 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/tag_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_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 = new Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_api_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_api_test.dart index f040b01bf43..5cedd41d55e 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_api_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_api_test.dart @@ -11,21 +11,21 @@ void main() { // // This can only be done by the logged in user. // - //Future createUser(User body) async + //Future createUser(User body) async test('test createUser', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(List body) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(List body) async test('test createUsersWithListInput', () async { // TODO }); @@ -34,28 +34,28 @@ void main() { // // This can only be done by the logged in user. // - //Future deleteUser(String username) async + //Future deleteUser(String username) async test('test deleteUser', () async { // TODO }); // Get user by user name // - //Future getUserByName(String username) async + //Future getUserByName(String username) async test('test getUserByName', () async { // TODO }); // Logs user into the system // - //Future loginUser(String username, String password) async + //Future loginUser(String username, String password) async test('test loginUser', () async { // TODO }); // Logs out current logged in user session // - //Future logoutUser() async + //Future logoutUser() async test('test logoutUser', () 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 body) async test('test updateUser', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_test.dart b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_test.dart index 5a6340c4f4b..ae6096d0f51 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/test/user_test.dart +++ b/samples/client/petstore/dart-jaguar/flutter_proto_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 = new User(); group('test User', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/openapi/docs/Order.md b/samples/client/petstore/dart-jaguar/openapi/docs/Order.md deleted file mode 100644 index 310ce6c65be..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi/docs/Order.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Order - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] -**complete** | **bool** | | [optional] [default to false] - -[[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-jaguar/openapi/docs/Pet.md b/samples/client/petstore/dart-jaguar/openapi/docs/Pet.md deleted file mode 100644 index ce5708cc134..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi/docs/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to const []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] -**status** | **String** | pet status in the store | [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-jaguar/openapi/docs/PetApi.md b/samples/client/petstore/dart-jaguar/openapi/docs/PetApi.md deleted file mode 100644 index 3e4ef1cedb2..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi/docs/PetApi.md +++ /dev/null @@ -1,379 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **Post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **Delete** /pet/:petId | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **Get** /pet/:petId | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **Put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **Post** /pet/:petId | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **Post** /pet/:petId/uploadImage | uploads an image - - -# **addPet** -> addPet(body) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(body); -} catch (e) { - print("Exception when calling PetApi->addPet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **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) - -# **deletePet** -> deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | Pet id to delete -var apiKey = apiKey_example; // String | - -try { - api_instance.deletePet(petId, apiKey); -} catch (e) { - print("Exception when calling PetApi->deletePet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByStatus** -> List findPetsByStatus(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var status = []; // List | Status values that need to be considered for filter - -try { - var result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print("Exception when calling PetApi->findPetsByStatus: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByTags** -> List findPetsByTags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var tags = []; // List | Tags to filter by - -try { - var result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print("Exception when calling PetApi->findPetsByTags: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getPetById** -> Pet getPetById(petId) - -Find pet by ID - -Returns a single pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to return - -try { - var result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print("Exception when calling PetApi->getPetById: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePet** -> updatePet(body) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.updatePet(body); -} catch (e) { - print("Exception when calling PetApi->updatePet: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **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) - -# **updatePetWithForm** -> updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet that needs to be updated -var name = name_example; // String | Updated name of the pet -var status = status_example; // String | Updated status of the pet - -try { - api_instance.updatePetWithForm(petId, name, status); -} catch (e) { - print("Exception when calling PetApi->updatePetWithForm: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **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) - -# **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) - -uploads an image - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to update -var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = BINARY_DATA_HERE; // MultipartFile | file to upload - -try { - var result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print("Exception when calling PetApi->uploadFile: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: 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-jaguar/openapi/docs/StoreApi.md b/samples/client/petstore/dart-jaguar/openapi/docs/StoreApi.md deleted file mode 100644 index c40c0eff43f..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi/docs/StoreApi.md +++ /dev/null @@ -1,186 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **Delete** /store/order/:orderId | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **Get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **Get** /store/order/:orderId | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **Post** /store/order | Place an order for a pet - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - api_instance.deleteOrder(orderId); -} catch (e) { - print("Exception when calling StoreApi->deleteOrder: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | [default to null] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getInventory** -> Map getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; - -var api_instance = new StoreApi(); - -try { - var result = api_instance.getInventory(); - print(result); -} catch (e) { - print("Exception when calling StoreApi->getInventory: $e\n"); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: 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) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = 789; // int | ID of pet that needs to be fetched - -try { - var result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print("Exception when calling StoreApi->getOrderById: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | [default to null] - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(body) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet - -try { - var result = api_instance.placeOrder(body); - print(result); -} catch (e) { - print("Exception when calling StoreApi->placeOrder: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart-jaguar/openapi/docs/User.md b/samples/client/petstore/dart-jaguar/openapi/docs/User.md deleted file mode 100644 index 3761b70cf0b..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi/docs/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [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-jaguar/openapi/test/pet_api_test.dart b/samples/client/petstore/dart-jaguar/openapi/test/pet_api_test.dart index fa95dccad3c..e9dcc0d83b3 100644 --- a/samples/client/petstore/dart-jaguar/openapi/test/pet_api_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi/test/pet_api_test.dart @@ -9,14 +9,14 @@ void main() { group('tests for PetApi', () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet body) async test('test addPet', () async { // TODO }); // Deletes a pet // - //Future deletePet(int petId, { String apiKey }) async + //Future deletePet(int petId, { String apiKey }) async test('test deletePet', () async { // TODO }); @@ -25,7 +25,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(List status) async test('test findPetsByStatus', () 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) async test('test findPetsByTags', () async { // TODO }); @@ -43,28 +43,28 @@ void main() { // // Returns a single pet // - //Future getPetById(int petId) async + //Future getPetById(int petId) async test('test getPetById', () async { // TODO }); // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet body) async test('test updatePet', () async { // TODO }); // Updates a pet in the store with form data // - //Future updatePetWithForm(int petId, { String name, String status }) async + //Future updatePetWithForm(int petId, { String name, String status }) async test('test updatePetWithForm', () async { // TODO }); // uploads an image // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async test('test uploadFile', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/openapi/test/store_api_test.dart b/samples/client/petstore/dart-jaguar/openapi/test/store_api_test.dart index 496d051e833..49f763fa098 100644 --- a/samples/client/petstore/dart-jaguar/openapi/test/store_api_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi/test/store_api_test.dart @@ -11,7 +11,7 @@ void main() { // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // - //Future deleteOrder(String orderId) async + //Future deleteOrder(String orderId) async test('test deleteOrder', () async { // TODO }); @@ -20,7 +20,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); @@ -29,14 +29,14 @@ void main() { // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // - //Future getOrderById(int orderId) async + //Future getOrderById(int orderId) async test('test getOrderById', () async { // TODO }); // Place an order for a pet // - //Future placeOrder(Order body) async + //Future placeOrder(Order body) async test('test placeOrder', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/openapi/test/user_api_test.dart b/samples/client/petstore/dart-jaguar/openapi/test/user_api_test.dart index f040b01bf43..5cedd41d55e 100644 --- a/samples/client/petstore/dart-jaguar/openapi/test/user_api_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi/test/user_api_test.dart @@ -11,21 +11,21 @@ void main() { // // This can only be done by the logged in user. // - //Future createUser(User body) async + //Future createUser(User body) async test('test createUser', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(List body) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(List body) async test('test createUsersWithListInput', () async { // TODO }); @@ -34,28 +34,28 @@ void main() { // // This can only be done by the logged in user. // - //Future deleteUser(String username) async + //Future deleteUser(String username) async test('test deleteUser', () async { // TODO }); // Get user by user name // - //Future getUserByName(String username) async + //Future getUserByName(String username) async test('test getUserByName', () async { // TODO }); // Logs user into the system // - //Future loginUser(String username, String password) async + //Future loginUser(String username, String password) async test('test loginUser', () async { // TODO }); // Logs out current logged in user session // - //Future logoutUser() async + //Future logoutUser() async test('test logoutUser', () 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 body) async test('test updateUser', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/docs/ApiResponse.md b/samples/client/petstore/dart-jaguar/openapi_proto/docs/ApiResponse.md deleted file mode 100644 index 92422f0f446..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [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-jaguar/openapi_proto/docs/StoreApi.md b/samples/client/petstore/dart-jaguar/openapi_proto/docs/StoreApi.md deleted file mode 100644 index d6e8ed69343..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/StoreApi.md +++ /dev/null @@ -1,186 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **Delete** /store/order/:orderId | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **Get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **Get** /store/order/:orderId | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **Post** /store/order | Place an order for a pet - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - api_instance.deleteOrder(orderId); -} catch (e) { - print("Exception when calling StoreApi->deleteOrder: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | [default to null] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getInventory** -> Map getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; - -var api_instance = new StoreApi(); - -try { - var result = api_instance.getInventory(); - print(result); -} catch (e) { - print("Exception when calling StoreApi->getInventory: $e\n"); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: 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) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = 789; // int | ID of pet that needs to be fetched - -try { - var result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print("Exception when calling StoreApi->getOrderById: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | [default to null] - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(body) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet - -try { - var result = api_instance.placeOrder(body); - print(result); -} catch (e) { - print("Exception when calling StoreApi->placeOrder: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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-jaguar/openapi_proto/docs/User.md b/samples/client/petstore/dart-jaguar/openapi_proto/docs/User.md deleted file mode 100644 index 3761b70cf0b..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [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-jaguar/openapi_proto/docs/UserApi.md b/samples/client/petstore/dart-jaguar/openapi_proto/docs/UserApi.md deleted file mode 100644 index 91cad43d7a1..00000000000 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/UserApi.md +++ /dev/null @@ -1,349 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **Post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **Delete** /user/:username | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **Get** /user/:username | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **Get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **Get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **Put** /user/:username | Updated user - - -# **createUser** -> createUser(body) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = new User(); // User | Created user object - -try { - api_instance.createUser(body); -} catch (e) { - print("Exception when calling UserApi->createUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object - -try { - api_instance.createUsersWithArrayInput(body); -} catch (e) { - print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object - -try { - api_instance.createUsersWithListInput(body); -} catch (e) { - print("Exception when calling UserApi->createUsersWithListInput: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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) - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The name that needs to be deleted - -try { - api_instance.deleteUser(username); -} catch (e) { - print("Exception when calling UserApi->deleteUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | [default to null] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - var result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print("Exception when calling UserApi->getUserByName: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The user name for login -var password = password_example; // String | The password for login in clear text - -try { - var result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print("Exception when calling UserApi->loginUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **logoutUser** -> logoutUser() - -Logs out current logged in user session - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); - -try { - api_instance.logoutUser(); -} catch (e) { - print("Exception when calling UserApi->logoutUser: $e\n"); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> updateUser(username, body) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object - -try { - api_instance.updateUser(username, body); -} catch (e) { - print("Exception when calling UserApi->updateUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | [default to null] - **body** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/octet-stream - - **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-jaguar/openapi_proto/test/api_response_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/api_response_test.dart index ebf142904e9..ba2202d24c4 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/api_response_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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 = new ApiResponse(); group('test ApiResponse', () { // int code (default value: null) diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/category_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/category_test.dart index c5cea4b5bc3..0dcaa8b7977 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/category_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/category_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Pet(); + var instance = new Category(); group('test Category', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/order_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/order_test.dart index 9982020d8cf..aa9dcc69c4f 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/order_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/order_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Pet(); + var instance = new Order(); group('test Order', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/pet_api_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/pet_api_test.dart index fa95dccad3c..e9dcc0d83b3 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/pet_api_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/pet_api_test.dart @@ -9,14 +9,14 @@ void main() { group('tests for PetApi', () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet body) async test('test addPet', () async { // TODO }); // Deletes a pet // - //Future deletePet(int petId, { String apiKey }) async + //Future deletePet(int petId, { String apiKey }) async test('test deletePet', () async { // TODO }); @@ -25,7 +25,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(List status) async test('test findPetsByStatus', () 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) async test('test findPetsByTags', () async { // TODO }); @@ -43,28 +43,28 @@ void main() { // // Returns a single pet // - //Future getPetById(int petId) async + //Future getPetById(int petId) async test('test getPetById', () async { // TODO }); // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet body) async test('test updatePet', () async { // TODO }); // Updates a pet in the store with form data // - //Future updatePetWithForm(int petId, { String name, String status }) async + //Future updatePetWithForm(int petId, { String name, String status }) async test('test updatePetWithForm', () async { // TODO }); // uploads an image // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async test('test uploadFile', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/store_api_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/store_api_test.dart index 496d051e833..49f763fa098 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/store_api_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/store_api_test.dart @@ -11,7 +11,7 @@ void main() { // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // - //Future deleteOrder(String orderId) async + //Future deleteOrder(String orderId) async test('test deleteOrder', () async { // TODO }); @@ -20,7 +20,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); @@ -29,14 +29,14 @@ void main() { // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // - //Future getOrderById(int orderId) async + //Future getOrderById(int orderId) async test('test getOrderById', () async { // TODO }); // Place an order for a pet // - //Future placeOrder(Order body) async + //Future placeOrder(Order body) async test('test placeOrder', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/tag_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/tag_test.dart index 6ee16c51bba..58477c9e758 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/tag_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/tag_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Pet(); + var instance = new Tag(); group('test Tag', () { // int id (default value: null) diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/user_api_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/user_api_test.dart index f040b01bf43..5cedd41d55e 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/user_api_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/user_api_test.dart @@ -11,21 +11,21 @@ void main() { // // This can only be done by the logged in user. // - //Future createUser(User body) async + //Future createUser(User body) async test('test createUser', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(List body) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(List body) async test('test createUsersWithListInput', () async { // TODO }); @@ -34,28 +34,28 @@ void main() { // // This can only be done by the logged in user. // - //Future deleteUser(String username) async + //Future deleteUser(String username) async test('test deleteUser', () async { // TODO }); // Get user by user name // - //Future getUserByName(String username) async + //Future getUserByName(String username) async test('test getUserByName', () async { // TODO }); // Logs user into the system // - //Future loginUser(String username, String password) async + //Future loginUser(String username, String password) async test('test loginUser', () async { // TODO }); // Logs out current logged in user session // - //Future logoutUser() async + //Future logoutUser() async test('test logoutUser', () 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 body) async test('test updateUser', () async { // TODO }); diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/test/user_test.dart b/samples/client/petstore/dart-jaguar/openapi_proto/test/user_test.dart index 5a6340c4f4b..ae6096d0f51 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/test/user_test.dart +++ b/samples/client/petstore/dart-jaguar/openapi_proto/test/user_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; // tests for User void main() { - var instance = new Pet(); + var instance = new User(); group('test User', () { // int id (default value: null) diff --git a/samples/client/petstore/dart2/openapi/doc/ApiResponse.md b/samples/client/petstore/dart2/openapi/doc/ApiResponse.md deleted file mode 100644 index 92422f0f446..00000000000 --- a/samples/client/petstore/dart2/openapi/doc/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [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/dart2/openapi/doc/Category.md b/samples/client/petstore/dart2/openapi/doc/Category.md deleted file mode 100644 index cc0d1633b59..00000000000 --- a/samples/client/petstore/dart2/openapi/doc/Category.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Category - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [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/dart2/openapi/doc/Pet.md b/samples/client/petstore/dart2/openapi/doc/Pet.md deleted file mode 100644 index 191e1fc66a9..00000000000 --- a/samples/client/petstore/dart2/openapi/doc/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [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/dart2/openapi/doc/User.md b/samples/client/petstore/dart2/openapi/doc/User.md deleted file mode 100644 index 3761b70cf0b..00000000000 --- a/samples/client/petstore/dart2/openapi/doc/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [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/dart2/openapi/docs/ApiResponse.md b/samples/client/petstore/dart2/openapi/docs/ApiResponse.md deleted file mode 100644 index 92422f0f446..00000000000 --- a/samples/client/petstore/dart2/openapi/docs/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [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/dart2/openapi/docs/Category.md b/samples/client/petstore/dart2/openapi/docs/Category.md deleted file mode 100644 index cc0d1633b59..00000000000 --- a/samples/client/petstore/dart2/openapi/docs/Category.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Category - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [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/dart2/openapi/docs/Order.md b/samples/client/petstore/dart2/openapi/docs/Order.md deleted file mode 100644 index 310ce6c65be..00000000000 --- a/samples/client/petstore/dart2/openapi/docs/Order.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Order - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] -**complete** | **bool** | | [optional] [default to false] - -[[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/dart2/openapi/docs/Pet.md b/samples/client/petstore/dart2/openapi/docs/Pet.md deleted file mode 100644 index 191e1fc66a9..00000000000 --- a/samples/client/petstore/dart2/openapi/docs/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [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/dart2/openapi/docs/User.md b/samples/client/petstore/dart2/openapi/docs/User.md deleted file mode 100644 index 3761b70cf0b..00000000000 --- a/samples/client/petstore/dart2/openapi/docs/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [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/dart2/openapi/docs/UserApi.md b/samples/client/petstore/dart2/openapi/docs/UserApi.md deleted file mode 100644 index 1ee5f6fced6..00000000000 --- a/samples/client/petstore/dart2/openapi/docs/UserApi.md +++ /dev/null @@ -1,349 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user - - -# **createUser** -> createUser(body) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); -var body = User(); // User | Created user object - -try { - api_instance.createUser(body); -} catch (e) { - print("Exception when calling UserApi->createUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithArrayInput** -> createUsersWithArrayInput(body) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); -var body = [List<User>()]; // List | List of user object - -try { - api_instance.createUsersWithArrayInput(body); -} catch (e) { - print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithListInput** -> createUsersWithListInput(body) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); -var body = [List<User>()]; // List | List of user object - -try { - api_instance.createUsersWithListInput(body); -} catch (e) { - print("Exception when calling UserApi->createUsersWithListInput: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); -var username = username_example; // String | The name that needs to be deleted - -try { - api_instance.deleteUser(username); -} catch (e) { - print("Exception when calling UserApi->deleteUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | [default to null] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); -var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - var result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print("Exception when calling UserApi->getUserByName: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - -### Example -```dart -import 'package:openapi/api.dart'; - -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 - -try { - var result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print("Exception when calling UserApi->loginUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **logoutUser** -> logoutUser() - -Logs out current logged in user session - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); - -try { - api_instance.logoutUser(); -} catch (e) { - print("Exception when calling UserApi->logoutUser: $e\n"); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> updateUser(username, body) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = UserApi(); -var username = username_example; // String | name that need to be deleted -var body = User(); // User | Updated user object - -try { - api_instance.updateUser(username, body); -} catch (e) { - print("Exception when calling UserApi->updateUser: $e\n"); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | [default to null] - **body** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart2/openapi/lib/api.dart b/samples/client/petstore/dart2/openapi/lib/api.dart deleted file mode 100644 index e73e8722381..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api.dart +++ /dev/null @@ -1,28 +0,0 @@ -library openapi.api; - -import 'dart:async'; -import 'dart:convert'; -import 'package:http/http.dart'; - -part 'api_client.dart'; -part 'api_helper.dart'; -part 'api_exception.dart'; -part 'auth/authentication.dart'; -part 'auth/api_key_auth.dart'; -part 'auth/oauth.dart'; -part 'auth/http_basic_auth.dart'; -part 'auth/http_bearer_auth.dart'; - -part 'api/pet_api.dart'; -part 'api/store_api.dart'; -part 'api/user_api.dart'; - -part 'model/api_response.dart'; -part 'model/category.dart'; -part 'model/order.dart'; -part 'model/pet.dart'; -part 'model/tag.dart'; -part 'model/user.dart'; - - -ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart deleted file mode 100644 index a413df7b424..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart +++ /dev/null @@ -1,496 +0,0 @@ -part of openapi.api; - - - -class PetApi { - final ApiClient apiClient; - - PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - /// Add a new pet to the store with HTTP info returned - /// - /// - Future addPetWithHttpInfo(Pet body) async { - Object postBody = body; - - // verify required params are set - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/pet".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = ["application/json","application/xml"]; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Add a new pet to the store - /// - /// - Future addPet(Pet body) async { - Response response = await addPetWithHttpInfo(body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Deletes a pet with HTTP info returned - /// - /// - Future deletePetWithHttpInfo(int petId, { String apiKey }) async { - Object postBody; - - // verify required params are set - if(petId == null) { - throw ApiException(400, "Missing required param: petId"); - } - - // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - headerParams["api_key"] = apiKey; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Deletes a pet - /// - /// - Future deletePet(int petId, { String apiKey }) async { - Response response = await deletePetWithHttpInfo(petId, apiKey: apiKey ); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Finds Pets by status with HTTP info returned - /// - /// Multiple status values can be provided with comma separated strings - Future findPetsByStatusWithHttpInfo(List status) async { - Object postBody; - - // verify required params are set - if(status == null) { - throw ApiException(400, "Missing required param: status"); - } - - // create path and map variables - String path = "/pet/findByStatus".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status)); - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - Future> findPetsByStatus(List status) async { - Response response = await findPetsByStatusWithHttpInfo(status); - if(response.statusCode >= 400) { - 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 { - return null; - } - } - - /// Finds Pets by tags with HTTP info returned - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future findPetsByTagsWithHttpInfo(List tags) async { - Object postBody; - - // verify required params are set - if(tags == null) { - throw ApiException(400, "Missing required param: tags"); - } - - // create path and map variables - String path = "/pet/findByTags".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future> findPetsByTags(List tags) async { - Response response = await findPetsByTagsWithHttpInfo(tags); - if(response.statusCode >= 400) { - 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 { - return null; - } - } - - /// Find pet by ID with HTTP info returned - /// - /// Returns a single pet - Future getPetByIdWithHttpInfo(int petId) async { - Object postBody; - - // verify required params are set - if(petId == null) { - throw ApiException(400, "Missing required param: petId"); - } - - // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["api_key"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Find pet by ID - /// - /// Returns a single pet - Future getPetById(int petId) async { - Response response = await getPetByIdWithHttpInfo(petId); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; - } else { - return null; - } - } - - /// Update an existing pet with HTTP info returned - /// - /// - Future updatePetWithHttpInfo(Pet body) async { - Object postBody = body; - - // verify required params are set - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/pet".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = ["application/json","application/xml"]; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Update an existing pet - /// - /// - Future updatePet(Pet body) async { - Response response = await updatePetWithHttpInfo(body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Updates a pet in the store with form data with HTTP info returned - /// - /// - Future updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async { - Object postBody; - - // verify required params are set - if(petId == null) { - throw ApiException(400, "Missing required param: petId"); - } - - // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = ["application/x-www-form-urlencoded"]; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if (name != null) { - hasFields = true; - mp.fields['name'] = parameterToString(name); - } - if (status != null) { - hasFields = true; - mp.fields['status'] = parameterToString(status); - } - if(hasFields) - postBody = mp; - } - else { - if (name != null) - formParams['name'] = parameterToString(name); - if (status != null) - formParams['status'] = parameterToString(status); - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Updates a pet in the store with form data - /// - /// - Future updatePetWithForm(int petId, { String name, String status }) async { - Response response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status ); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// uploads an image with HTTP info returned - /// - /// - Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async { - Object postBody; - - // verify required params are set - if(petId == null) { - throw ApiException(400, "Missing required param: petId"); - } - - // create path and map variables - String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = ["multipart/form-data"]; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["petstore_auth"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields['file'] = file.field; - mp.files.add(file); - } - if(hasFields) - postBody = mp; - } - else { - if (additionalMetadata != null) - formParams['additionalMetadata'] = parameterToString(additionalMetadata); - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// uploads an image - /// - /// - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { - Response response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file ); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; - } else { - return null; - } - } - -} diff --git a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart deleted file mode 100644 index 10dc4a35b85..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart +++ /dev/null @@ -1,239 +0,0 @@ -part of openapi.api; - - - -class StoreApi { - final ApiClient apiClient; - - StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - /// Delete purchase order by ID with HTTP info returned - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - Future deleteOrderWithHttpInfo(String orderId) async { - Object postBody; - - // verify required params are set - if(orderId == null) { - throw ApiException(400, "Missing required param: orderId"); - } - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - Future deleteOrder(String orderId) async { - Response response = await deleteOrderWithHttpInfo(orderId); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Returns pet inventories by status with HTTP info returned - /// - /// Returns a map of status codes to quantities - Future getInventoryWithHttpInfo() async { - Object postBody; - - // verify required params are set - - // create path and map variables - String path = "/store/inventory".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = ["api_key"]; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - Future> getInventory() async { - Response response = await getInventoryWithHttpInfo(); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); - ; - } else { - return null; - } - } - - /// Find purchase order by ID with HTTP info returned - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - Future getOrderByIdWithHttpInfo(int orderId) async { - Object postBody; - - // verify required params are set - if(orderId == null) { - throw ApiException(400, "Missing required param: orderId"); - } - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - Future getOrderById(int orderId) async { - Response response = await getOrderByIdWithHttpInfo(orderId); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; - } else { - return null; - } - } - - /// Place an order for a pet with HTTP info returned - /// - /// - Future placeOrderWithHttpInfo(Order body) async { - Object postBody = body; - - // verify required params are set - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/store/order".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Place an order for a pet - /// - /// - Future placeOrder(Order body) async { - Response response = await placeOrderWithHttpInfo(body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; - } else { - return null; - } - } - -} diff --git a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart deleted file mode 100644 index a940ca41071..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart +++ /dev/null @@ -1,473 +0,0 @@ -part of openapi.api; - - - -class UserApi { - final ApiClient apiClient; - - UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - /// Create user with HTTP info returned - /// - /// This can only be done by the logged in user. - Future createUserWithHttpInfo(User body) async { - Object postBody = body; - - // verify required params are set - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/user".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Create user - /// - /// This can only be done by the logged in user. - Future createUser(User body) async { - Response response = await createUserWithHttpInfo(body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Creates list of users with given input array with HTTP info returned - /// - /// - Future createUsersWithArrayInputWithHttpInfo(List body) async { - Object postBody = body; - - // verify required params are set - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/user/createWithArray".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Creates list of users with given input array - /// - /// - Future createUsersWithArrayInput(List body) async { - Response response = await createUsersWithArrayInputWithHttpInfo(body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Creates list of users with given input array with HTTP info returned - /// - /// - Future createUsersWithListInputWithHttpInfo(List body) async { - Object postBody = body; - - // verify required params are set - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/user/createWithList".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Creates list of users with given input array - /// - /// - Future createUsersWithListInput(List body) async { - Response response = await createUsersWithListInputWithHttpInfo(body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Delete user with HTTP info returned - /// - /// This can only be done by the logged in user. - Future deleteUserWithHttpInfo(String username) async { - Object postBody; - - // verify required params are set - if(username == null) { - throw ApiException(400, "Missing required param: username"); - } - - // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Delete user - /// - /// This can only be done by the logged in user. - Future deleteUser(String username) async { - Response response = await deleteUserWithHttpInfo(username); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Get user by user name with HTTP info returned - /// - /// - Future getUserByNameWithHttpInfo(String username) async { - Object postBody; - - // verify required params are set - if(username == null) { - throw ApiException(400, "Missing required param: username"); - } - - // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Get user by user name - /// - /// - Future getUserByName(String username) async { - Response response = await getUserByNameWithHttpInfo(username); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; - } else { - return null; - } - } - - /// Logs user into the system with HTTP info returned - /// - /// - Future loginUserWithHttpInfo(String username, String password) async { - Object postBody; - - // verify required params are set - if(username == null) { - throw ApiException(400, "Missing required param: username"); - } - if(password == null) { - throw ApiException(400, "Missing required param: password"); - } - - // create path and map variables - String path = "/user/login".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("", "username", username)); - queryParams.addAll(_convertParametersForCollectionFormat("", "password", password)); - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Logs user into the system - /// - /// - Future loginUser(String username, String password) async { - Response response = await loginUserWithHttpInfo(username, password); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; - } else { - return null; - } - } - - /// Logs out current logged in user session with HTTP info returned - /// - /// - Future logoutUserWithHttpInfo() async { - Object postBody; - - // verify required params are set - - // create path and map variables - String path = "/user/logout".replaceAll("{format}","json"); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Logs out current logged in user session - /// - /// - Future logoutUser() async { - Response response = await logoutUserWithHttpInfo(); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - - /// Updated user with HTTP info returned - /// - /// This can only be done by the logged in user. - Future updateUserWithHttpInfo(String username, User body) async { - Object postBody = body; - - // verify required params are set - if(username == null) { - throw ApiException(400, "Missing required param: username"); - } - if(body == null) { - throw ApiException(400, "Missing required param: body"); - } - - // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - - List contentTypes = []; - - String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - List authNames = []; - - if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } - - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames); - return response; - } - - /// Updated user - /// - /// This can only be done by the logged in user. - Future updateUser(String username, User body) async { - Response response = await updateUserWithHttpInfo(username, body); - if(response.statusCode >= 400) { - throw ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - } else { - return; - } - } - -} diff --git a/samples/client/petstore/dart2/openapi/lib/api_client.dart b/samples/client/petstore/dart2/openapi/lib/api_client.dart deleted file mode 100644 index d68c9691879..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api_client.dart +++ /dev/null @@ -1,167 +0,0 @@ -part of openapi.api; - -class QueryParam { - String name; - String value; - - QueryParam(this.name, this.value); -} - -class ApiClient { - - String basePath; - var client = Client(); - - Map _defaultHeaderMap = {}; - Map _authentications = {}; - - final _regList = RegExp(r'^List<(.*)>$'); - final _regMap = RegExp(r'^Map$'); - - ApiClient({this.basePath = "http://petstore.swagger.io/v2"}) { - // Setup authentications (key: authentication name, value: authentication). - _authentications['api_key'] = ApiKeyAuth("header", "api_key"); - _authentications['petstore_auth'] = OAuth(); - } - - void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; - } - - dynamic _deserialize(dynamic value, String targetType) { - try { - switch (targetType) { - case 'String': - return '$value'; - case 'int': - return value is int ? value : int.parse('$value'); - case 'bool': - return value is bool ? value : '$value'.toLowerCase() == 'true'; - case 'double': - return value is double ? value : double.parse('$value'); - case 'ApiResponse': - return ApiResponse.fromJson(value); - case 'Category': - return Category.fromJson(value); - case 'Order': - return Order.fromJson(value); - case 'Pet': - return Pet.fromJson(value); - case 'Tag': - return Tag.fromJson(value); - case 'User': - return User.fromJson(value); - default: - { - Match match; - if (value is List && - (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) { - var newTargetType = match[1]; - return Map.fromIterables(value.keys, - value.values.map((v) => _deserialize(v, newTargetType))); - } - } - } - } on Exception catch (e, stack) { - throw ApiException.withInner(500, 'Exception during deserialization.', e, stack); - } - throw ApiException(500, 'Could not find a suitable class for deserialization'); - } - - dynamic deserialize(String json, String targetType) { - // Remove all spaces. Necessary for reg expressions as well. - targetType = targetType.replaceAll(' ', ''); - - if (targetType == 'String') return json; - - var decodedJson = jsonDecode(json); - return _deserialize(decodedJson, targetType); - } - - String serialize(Object obj) { - String serialized = ''; - if (obj == null) { - serialized = ''; - } else { - serialized = json.encode(obj); - } - return serialized; - } - - // We don't use a Map for queryParams. - // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String path, - String method, - Iterable queryParams, - Object body, - Map headerParams, - Map formParams, - String nullableContentType, - List authNames) async { - - _updateParamsForAuth(authNames, queryParams, headerParams); - - var ps = queryParams - .where((p) => p.value != null) - .map((p) => '${p.name}=${Uri.encodeQueryComponent(p.value)}'); - - String queryString = ps.isNotEmpty ? - '?' + ps.join('&') : - ''; - - String url = basePath + path + queryString; - - headerParams.addAll(_defaultHeaderMap); - if (nullableContentType != null) { - final contentType = nullableContentType; - headerParams['Content-Type'] = contentType; - } - - if(body is MultipartRequest) { - var request = MultipartRequest(method, Uri.parse(url)); - request.fields.addAll(body.fields); - request.files.addAll(body.files); - request.headers.addAll(body.headers); - request.headers.addAll(headerParams); - var response = await client.send(request); - return Response.fromStream(response); - } else { - var msgBody = nullableContentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); - final nullableHeaderParams = (headerParams.isEmpty)? null: headerParams; - switch(method) { - case "POST": - return client.post(url, headers: nullableHeaderParams, body: msgBody); - case "PUT": - return client.put(url, headers: nullableHeaderParams, body: msgBody); - case "DELETE": - return client.delete(url, headers: nullableHeaderParams); - case "PATCH": - return client.patch(url, headers: nullableHeaderParams, body: msgBody); - case "HEAD": - return client.head(url, headers: nullableHeaderParams); - default: - return client.get(url, headers: nullableHeaderParams); - } - } - } - - /// Update query and header parameters based on authentication settings. - /// @param authNames The authentications to apply - void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { - authNames.forEach((authName) { - Authentication auth = _authentications[authName]; - if (auth == null) throw ArgumentError("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - }); - } - - T getAuthentication(String name) { - var authentication = _authentications[name]; - - return authentication is T ? authentication : null; - } -} diff --git a/samples/client/petstore/dart2/openapi/lib/api_exception.dart b/samples/client/petstore/dart2/openapi/lib/api_exception.dart deleted file mode 100644 index 668abe2c96b..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api_exception.dart +++ /dev/null @@ -1,23 +0,0 @@ -part of openapi.api; - -class ApiException implements Exception { - int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; - - ApiException(this.code, this.message); - - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); - - String toString() { - if (message == null) return "ApiException"; - - if (innerException == null) { - return "ApiException $code: $message"; - } - - return "ApiException $code: $message (Inner exception: $innerException)\n\n" + - stackTrace.toString(); - } -} diff --git a/samples/client/petstore/dart2/openapi/lib/api_helper.dart b/samples/client/petstore/dart2/openapi/lib/api_helper.dart deleted file mode 100644 index c57b111ca87..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/api_helper.dart +++ /dev/null @@ -1,56 +0,0 @@ -part of openapi.api; - -const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; - -// port from Java version -Iterable _convertParametersForCollectionFormat( - String collectionFormat, String name, dynamic value) { - var params = []; - - // preconditions - if (name == null || name.isEmpty || value == null) return params; - - if (value is! List) { - params.add(QueryParam(name, parameterToString(value))); - return params; - } - - List values = value as List; - - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) - ? "csv" - : collectionFormat; // default: csv - - if (collectionFormat == "multi") { - return values.map((v) => QueryParam(name, parameterToString(v))); - } - - String delimiter = _delimiters[collectionFormat] ?? ","; - - params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); - return params; -} - -/// Format the given parameter object into string. -String parameterToString(dynamic value) { - if (value == null) { - return ''; - } else if (value is DateTime) { - return value.toUtc().toIso8601String(); - } else { - return value.toString(); - } -} - -/// Returns the decoded body by utf-8 if application/json with the given headers. -/// Else, returns the decoded body by default algorithm of dart:http. -/// Because avoid to text garbling when header only contains "application/json" without "; charset=utf-8". -String _decodeBodyBytes(Response response) { - var contentType = response.headers['content-type']; - if (contentType != null && contentType.contains("application/json")) { - return utf8.decode(response.bodyBytes); - } else { - return response.body; - } -} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart deleted file mode 100644 index 8384f0516ce..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart +++ /dev/null @@ -1,29 +0,0 @@ -part of openapi.api; - -class ApiKeyAuth implements Authentication { - - final String location; - final String paramName; - 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'; - } else { - value = _apiKey; - } - - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } - } -} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/authentication.dart b/samples/client/petstore/dart2/openapi/lib/auth/authentication.dart deleted file mode 100644 index abd5e2fe68a..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/auth/authentication.dart +++ /dev/null @@ -1,7 +0,0 @@ -part of openapi.api; - -abstract class Authentication { - - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); -} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart deleted file mode 100644 index da931fa2634..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart +++ /dev/null @@ -1,16 +0,0 @@ -part of openapi.api; - -class HttpBasicAuth implements Authentication { - - 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)); - } - - set username(String username) => _username = username; - set password(String password) => _password = password; -} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/http_bearer_auth.dart b/samples/client/petstore/dart2/openapi/lib/auth/http_bearer_auth.dart deleted file mode 100644 index 19a348c965e..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/auth/http_bearer_auth.dart +++ /dev/null @@ -1,25 +0,0 @@ -part of openapi.api; - -class HttpBearerAuth implements Authentication { - dynamic _accessToken; - - HttpBearerAuth() { } - - @override - void applyToParams(List queryParams, Map headerParams) { - if (_accessToken is String) { - headerParams["Authorization"] = "Bearer " + _accessToken; - } else if (_accessToken is String Function()){ - headerParams["Authorization"] = "Bearer " + _accessToken(); - } else { - throw ArgumentError('Type of Bearer accessToken should be String or String Function().'); - } - } - - void setAccessToken(dynamic accessToken) { - if (!((accessToken is String) | (accessToken is String Function()))){ - throw ArgumentError('Type of Bearer accessToken should be String or String Function().'); - } - this._accessToken = accessToken; - } -} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart2/openapi/lib/auth/oauth.dart deleted file mode 100644 index 230471e44fc..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/auth/oauth.dart +++ /dev/null @@ -1,16 +0,0 @@ -part of openapi.api; - -class OAuth implements Authentication { - String _accessToken; - - OAuth({String accessToken}) : _accessToken = accessToken; - - @override - void applyToParams(List queryParams, Map headerParams) { - if (_accessToken != null) { - headerParams["Authorization"] = "Bearer $_accessToken"; - } - } - - set accessToken(String accessToken) => _accessToken = accessToken; -} diff --git a/samples/client/petstore/dart2/openapi/lib/model/api_response.dart b/samples/client/petstore/dart2/openapi/lib/model/api_response.dart deleted file mode 100644 index c5b6886be8b..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/model/api_response.dart +++ /dev/null @@ -1,58 +0,0 @@ -part of openapi.api; - -class ApiResponse { - - int code = null; - - String type = null; - - String message = null; - ApiResponse(); - - @override - String toString() { - return 'ApiResponse[code=$code, type=$type, message=$message, ]'; - } - - ApiResponse.fromJson(Map json) { - if (json == null) return; - code = json['code']; - type = json['type']; - message = json['message']; - } - - Map toJson() { - 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 ? List() : json.map((value) => ApiResponse.fromJson(value)).toList(); - } - - 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; - } - - // maps a json object with a list of ApiResponse-objects as value to a dart map - static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = ApiResponse.listFromJson(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 deleted file mode 100644 index 686ad33cac8..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/model/category.dart +++ /dev/null @@ -1,53 +0,0 @@ -part of openapi.api; - -class Category { - - int id = null; - - String name = null; - Category(); - - @override - String toString() { - return 'Category[id=$id, name=$name, ]'; - } - - Category.fromJson(Map json) { - if (json == null) return; - id = json['id']; - name = json['name']; - } - - Map toJson() { - Map json = {}; - if (id != null) - json['id'] = id; - if (name != null) - json['name'] = name; - return json; - } - - static List listFromJson(List json) { - return json == null ? List() : json.map((value) => Category.fromJson(value)).toList(); - } - - 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; - } - - // maps a json object with a list of Category-objects as value to a dart map - static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Category.listFromJson(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 deleted file mode 100644 index 66cbd07902f..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/model/order.dart +++ /dev/null @@ -1,76 +0,0 @@ -part of openapi.api; - -class Order { - - int id = null; - - int petId = null; - - int quantity = null; - - DateTime shipDate = null; - /// Order Status - StatusEnum status = null; - - bool complete = false; - - @override - String toString() { - return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]'; - } - - Order.fromJson(Map json) { - if (json == null) return; - id = json['id']; - petId = json['petId']; - quantity = json['quantity']; - shipDate = (json['shipDate'] == null) ? - null : - DateTime.parse(json['shipDate']); - status = json['status']; - complete = json['complete']; - } - - Map toJson() { - 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 ? List() : json.map((value) => Order.fromJson(value)).toList(); - } - - 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; - } - - // maps a json object with a list of Order-objects as value to a dart map - static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Order.listFromJson(value); - }); - } - return map; - } -} - - -enum StatusEnum { placed, approved, delivered, } diff --git a/samples/client/petstore/dart2/openapi/lib/model/pet.dart b/samples/client/petstore/dart2/openapi/lib/model/pet.dart deleted file mode 100644 index 09c1325f9ca..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/model/pet.dart +++ /dev/null @@ -1,80 +0,0 @@ -part of openapi.api; - -class Pet { - - int id = null; - - Category category = null; - - String name = null; - - List photoUrls = []; - - List tags = []; - /// pet status in the store - StatusEnum status = null; - - @override - String toString() { - return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]'; - } - - Pet.fromJson(Map json) { - if (json == null) return; - id = json['id']; - category = (json['category'] == null) ? - null : - Category.fromJson(json['category']); - name = json['name']; - photoUrls = (json['photoUrls'] == null) ? - null : - (json['photoUrls'] as List).cast(); - tags = (json['tags'] == null) ? - null : - Tag.listFromJson(json['tags']); - status = json['status']; - } - - Map toJson() { - 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 ? List() : json.map((value) => Pet.fromJson(value)).toList(); - } - - 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; - } - - // maps a json object with a list of Pet-objects as value to a dart map - static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Pet.listFromJson(value); - }); - } - return map; - } -} - - -enum StatusEnum { available, pending, sold, } diff --git a/samples/client/petstore/dart2/openapi/lib/model/tag.dart b/samples/client/petstore/dart2/openapi/lib/model/tag.dart deleted file mode 100644 index 01be72b5806..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/model/tag.dart +++ /dev/null @@ -1,51 +0,0 @@ -part of openapi.api; - -class Tag { - - int id = null; - - String name = null; - - @override - String toString() { - return 'Tag[id=$id, name=$name, ]'; - } - - Tag.fromJson(Map json) { - if (json == null) return; - id = json['id']; - name = json['name']; - } - - Map toJson() { - Map json = {}; - if (id != null) - json['id'] = id; - if (name != null) - json['name'] = name; - return json; - } - - static List listFromJson(List json) { - return json == null ? List() : json.map((value) => Tag.fromJson(value)).toList(); - } - - 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; - } - - // maps a json object with a list of Tag-objects as value to a dart map - static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Tag.listFromJson(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 deleted file mode 100644 index 685ffadb4ee..00000000000 --- a/samples/client/petstore/dart2/openapi/lib/model/user.dart +++ /dev/null @@ -1,83 +0,0 @@ -part of openapi.api; - -class User { - - int id = null; - - String username = null; - - String firstName = null; - - String lastName = null; - - String email = null; - - String password = null; - - String phone = null; - /* User Status */ - int userStatus = null; - User(); - - @override - String toString() { - return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]'; - } - - User.fromJson(Map json) { - if (json == null) return; - id = json['id']; - username = json['username']; - firstName = json['firstName']; - lastName = json['lastName']; - email = json['email']; - password = json['password']; - phone = json['phone']; - userStatus = json['userStatus']; - } - - Map toJson() { - 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 ? List() : json.map((value) => User.fromJson(value)).toList(); - } - - 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; - } - - // maps a json object with a list of User-objects as value to a dart map - static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = User.listFromJson(value); - }); - } - return map; - } -} - diff --git a/samples/client/petstore/dart2/openapi/pubspec.yaml b/samples/client/petstore/dart2/openapi/pubspec.yaml deleted file mode 100644 index 58c44ac9eb5..00000000000 --- a/samples/client/petstore/dart2/openapi/pubspec.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: openapi -version: 1.0.0 -description: OpenAPI API client -authors: - - Author -homepage: homepage -environment: - sdk: '>=2.0.0 <3.0.0' -dependencies: - http: '>=0.12.0 <0.13.0' -dev_dependencies: - test: ^1.3.0 diff --git a/samples/client/petstore/dart2/petstore/pom.xml b/samples/client/petstore/dart2/petstore/pom.xml index c4ce7b4d68e..a14b4717c61 100644 --- a/samples/client/petstore/dart2/petstore/pom.xml +++ b/samples/client/petstore/dart2/petstore/pom.xml @@ -1,10 +1,10 @@ 4.0.0 org.openapitools - Dart2PetstoreClientTests + Dart2PetstoreClientOAS2Tests pom 1.0.0-SNAPSHOT - Dart2 Petstore Client + Dart2 Petstore Client OAS2 diff --git a/samples/client/petstore/dart2/petstore_client_lib/docs/ApiResponse.md b/samples/client/petstore/dart2/petstore_client_lib/docs/ApiResponse.md deleted file mode 100644 index 92422f0f446..00000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [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/dart2/petstore_client_lib/docs/Category.md b/samples/client/petstore/dart2/petstore_client_lib/docs/Category.md deleted file mode 100644 index cc0d1633b59..00000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/Category.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Category - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [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/dart2/petstore_client_lib/docs/Order.md b/samples/client/petstore/dart2/petstore_client_lib/docs/Order.md deleted file mode 100644 index 310ce6c65be..00000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/Order.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Order - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] -**complete** | **bool** | | [optional] [default to false] - -[[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/dart2/petstore_client_lib/docs/Pet.md b/samples/client/petstore/dart2/petstore_client_lib/docs/Pet.md deleted file mode 100644 index 191e1fc66a9..00000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [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/dart2/petstore_client_lib/docs/Tag.md b/samples/client/petstore/dart2/petstore_client_lib/docs/Tag.md deleted file mode 100644 index ded7b32ac3d..00000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/Tag.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Tag - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [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/dart2/petstore_client_lib/docs/User.md b/samples/client/petstore/dart2/petstore_client_lib/docs/User.md deleted file mode 100644 index 3761b70cf0b..00000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [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/dart2/petstore_client_lib/pom.xml b/samples/client/petstore/dart2/petstore_client_lib/pom.xml new file mode 100644 index 00000000000..e1f8ce7d3cb --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + org.openapitools + Dart2PetstoreClientLibOAS2Tests + pom + 1.0.0-SNAPSHOT + Dart2 Petstore Client Lib OAS2 + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + test + + + + + + + + diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart index 6c2882a0620..ea8360134e8 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart @@ -3,20 +3,20 @@ import 'package:test/test.dart'; // tests for ApiResponse void main() { - var instance = new ApiResponse(); + final instance = ApiResponse(); group('test ApiResponse', () { - // int code (default value: null) + // int code test('to test the property `code`', () async { // TODO }); - // String type (default value: null) + // String type test('to test the property `type`', () async { // TODO }); - // String message (default value: null) + // String message test('to test the property `message`', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart index 277bdfb709d..3138399072d 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart @@ -3,15 +3,15 @@ import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Category(); + final instance = Category(); group('test Category', () { - // int id (default value: null) + // int id test('to test the property `id`', () async { // TODO }); - // String name (default value: null) + // String name test('to test the property `name`', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart index 0c3178ac699..5d1c4ae1e72 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart @@ -3,31 +3,31 @@ import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Order(); + final instance = Order(); group('test Order', () { - // int id (default value: null) + // int id test('to test the property `id`', () async { // TODO }); - // int petId (default value: null) + // int petId test('to test the property `petId`', () async { // TODO }); - // int quantity (default value: null) + // int quantity test('to test the property `quantity`', () async { // TODO }); - // DateTime shipDate (default value: null) + // DateTime shipDate test('to test the property `shipDate`', () async { // TODO }); // Order Status - // String status (default value: null) + // String status test('to test the property `status`', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart index 409b7962536..cdaf1b2fd8f 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart @@ -1,22 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + import 'package:openapi/api.dart'; import 'package:test/test.dart'; /// tests for PetApi void main() { - var instance = PetApi(); + final instance = PetApi(); group('tests for PetApi', () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet body) async test('test addPet', () async { // TODO }); // Deletes a pet // - //Future deletePet(int petId, { String apiKey }) async + //Future deletePet(int petId, { String apiKey }) async test('test deletePet', () async { // TODO }); @@ -25,7 +34,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(List status) async test('test findPetsByStatus', () async { // TODO }); @@ -34,7 +43,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) async test('test findPetsByTags', () async { // TODO }); @@ -43,28 +52,28 @@ void main() { // // Returns a single pet // - //Future getPetById(int petId) async + //Future getPetById(int petId) async test('test getPetById', () async { // TODO }); // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet body) async test('test updatePet', () async { // TODO }); // Updates a pet in the store with form data // - //Future updatePetWithForm(int petId, { String name, String status }) async + //Future updatePetWithForm(int petId, { String name, String status }) async test('test updatePetWithForm', () async { // TODO }); // uploads an image // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async test('test uploadFile', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart index acfb87a3fb1..b91619505ef 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart @@ -3,36 +3,36 @@ import 'package:test/test.dart'; // tests for Pet void main() { - var instance = new Pet(); + final instance = Pet(); group('test Pet', () { - // int id (default value: null) + // int id test('to test the property `id`', () async { // TODO }); - // Category category (default value: null) + // Category category test('to test the property `category`', () async { // TODO }); - // String name (default value: null) + // String name test('to test the property `name`', () async { // TODO }); - // List photoUrls (default value: []) + // List photoUrls (default value: const []) test('to test the property `photoUrls`', () async { // TODO }); - // List tags (default value: []) + // List tags (default value: const []) test('to test the property `tags`', () async { // TODO }); // pet status in the store - // String status (default value: null) + // String status test('to test the property `status`', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart index e2c7ab94b17..22ca5e8354c 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart @@ -1,17 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + import 'package:openapi/api.dart'; import 'package:test/test.dart'; /// tests for StoreApi void main() { - var instance = StoreApi(); + final instance = StoreApi(); group('tests for StoreApi', () { // Delete purchase order by ID // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // - //Future deleteOrder(String orderId) async + //Future deleteOrder(String orderId) async test('test deleteOrder', () async { // TODO }); @@ -20,7 +29,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); @@ -29,14 +38,14 @@ void main() { // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // - //Future getOrderById(int orderId) async + //Future getOrderById(int orderId) async test('test getOrderById', () async { // TODO }); // Place an order for a pet // - //Future placeOrder(Order body) async + //Future placeOrder(Order body) async test('test placeOrder', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart index 4b133ff675d..f042b4c9117 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart @@ -3,15 +3,15 @@ import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Tag(); + final instance = Tag(); group('test Tag', () { - // int id (default value: null) + // int id test('to test the property `id`', () async { // TODO }); - // String name (default value: null) + // String name test('to test the property `name`', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart index 5d124a61117..5f3e029c83f 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart @@ -1,31 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + import 'package:openapi/api.dart'; import 'package:test/test.dart'; /// tests for UserApi void main() { - var instance = UserApi(); + final 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 body) async test('test createUser', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithArrayInput(List body) async + //Future createUsersWithArrayInput(List body) async test('test createUsersWithArrayInput', () async { // TODO }); // Creates list of users with given input array // - //Future createUsersWithListInput(List body) async + //Future createUsersWithListInput(List body) async test('test createUsersWithListInput', () async { // TODO }); @@ -34,28 +43,28 @@ void main() { // // This can only be done by the logged in user. // - //Future deleteUser(String username) async + //Future deleteUser(String username) async test('test deleteUser', () async { // TODO }); // Get user by user name // - //Future getUserByName(String username) async + //Future getUserByName(String username) async test('test getUserByName', () async { // TODO }); // Logs user into the system // - //Future loginUser(String username, String password) async + //Future loginUser(String username, String password) async test('test loginUser', () async { // TODO }); // Logs out current logged in user session // - //Future logoutUser() async + //Future logoutUser() async test('test logoutUser', () async { // TODO }); @@ -64,7 +73,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 body) async test('test updateUser', () async { // TODO }); diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart index c0e542757f5..c14c0b47964 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart @@ -3,46 +3,46 @@ import 'package:test/test.dart'; // tests for User void main() { - var instance = new User(); + final instance = User(); group('test User', () { - // int id (default value: null) + // int id test('to test the property `id`', () async { // TODO }); - // String username (default value: null) + // String username test('to test the property `username`', () async { // TODO }); - // String firstName (default value: null) + // String firstName test('to test the property `firstName`', () async { // TODO }); - // String lastName (default value: null) + // String lastName test('to test the property `lastName`', () async { // TODO }); - // String email (default value: null) + // String email test('to test the property `email`', () async { // TODO }); - // String password (default value: null) + // String password test('to test the property `password`', () async { // TODO }); - // String phone (default value: null) + // String phone test('to test the property `phone`', () async { // TODO }); // User Status - // int userStatus (default value: null) + // int userStatus test('to test the property `userStatus`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.gitignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.gitignore new file mode 100644 index 00000000000..8092a49d515 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.gitignore @@ -0,0 +1,37 @@ +# See https://dart.dev/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: +*.iml // IntelliJ +*.ipr // IntelliJ +*.iws // IntelliJ +.idea/ // IntelliJ +.DS_Store // Mac diff --git a/samples/client/petstore/dart-dio/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore similarity index 91% rename from samples/client/petstore/dart-dio/.openapi-generator-ignore rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore index 911312f6da9..7484ee590a3 100644 --- a/samples/client/petstore/dart-dio/.openapi-generator-ignore +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore @@ -21,6 +21,3 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md - -# Don't regenerate .gitignore as it contains customizations for generated dart files -.gitignore diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES new file mode 100644 index 00000000000..fc6fd23b987 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES @@ -0,0 +1,33 @@ +.gitignore +README.md +analysis_options.yaml +doc/ApiResponse.md +doc/Category.md +doc/InlineObject.md +doc/InlineObject1.md +doc/Order.md +doc/Pet.md +doc/PetApi.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +lib/api.dart +lib/api/pet_api.dart +lib/api/store_api.dart +lib/api/user_api.dart +lib/api_util.dart +lib/auth/api_key_auth.dart +lib/auth/auth.dart +lib/auth/basic_auth.dart +lib/auth/oauth.dart +lib/model/api_response.dart +lib/model/category.dart +lib/model/inline_object.dart +lib/model/inline_object1.dart +lib/model/order.dart +lib/model/pet.dart +lib/model/tag.dart +lib/model/user.dart +lib/serializers.dart +pubspec.yaml diff --git a/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/dart2/openapi/.openapi-generator/VERSION rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md new file mode 100644 index 00000000000..63eb7e3c20c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md @@ -0,0 +1,118 @@ +# openapi +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +Dart 1.20.0 or later OR Flutter 0.0.20 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + var result = api_instance.addPet(pet); + print(result); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **post** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **put** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **post** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **get** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **put** /user/{username} | Updated user + + +## Documentation For Models + + - [ApiResponse](doc//ApiResponse.md) + - [Category](doc//Category.md) + - [InlineObject](doc//InlineObject.md) + - [InlineObject1](doc//InlineObject1.md) + - [Order](doc//Order.md) + - [Pet](doc//Pet.md) + - [Tag](doc//Tag.md) + - [User](doc//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml new file mode 100644 index 00000000000..655cb67bd88 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml @@ -0,0 +1 @@ +analyzer: \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/ApiResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/ApiResponse.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Category.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Category.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Category.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Category.md diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/InlineObject.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/InlineObject.md new file mode 100644 index 00000000000..1789b30bb81 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/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/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/InlineObject1.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/InlineObject1.md new file mode 100644 index 00000000000..37aaa575901 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/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** | [**Uint8List**](Uint8List.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-jaguar/flutter_petstore/openapi/docs/Order.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Order.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Order.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Order.md diff --git a/samples/client/petstore/dart-jaguar/openapi_proto/docs/Pet.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md similarity index 80% rename from samples/client/petstore/dart-jaguar/openapi_proto/docs/Pet.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md index ce5708cc134..619e45d1848 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/Pet.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md @@ -11,8 +11,8 @@ Name | Type | Description | Notes **id** | **int** | | [optional] [default to null] **category** | [**Category**](Category.md) | | [optional] [default to null] **name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to const []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**photoUrls** | **BuiltList<String>** | | [default to const []] +**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] [default to const []] **status** | **String** | pet status in the store | [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/dart2/openapi/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md similarity index 85% rename from samples/client/petstore/dart2/openapi/doc/PetApi.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md index 7b5de3894a9..0119bd4fa41 100644 --- a/samples/client/petstore/dart2/openapi/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md @@ -9,18 +9,18 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**addPet**](PetApi.md#addPet) | **post** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **delete** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **get** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **get** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **get** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **put** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **post** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **post** /pet/{petId}/uploadImage | uploads an image # **addPet** -> addPet(body) +> Pet addPet(pet) Add a new pet to the store @@ -30,11 +30,12 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + var result = api_instance.addPet(pet); + print(result); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -44,11 +45,11 @@ 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 -void (empty response body) +[**Pet**](Pet.md) ### Authorization @@ -57,7 +58,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: Not defined + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -72,7 +73,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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | @@ -118,7 +119,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 = PetApi(); +var api_instance = new PetApi(); var status = []; // List | Status values that need to be considered for filter try { @@ -133,7 +134,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -163,7 +164,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 = PetApi(); +var api_instance = new PetApi(); var tags = []; // List | Tags to filter by try { @@ -178,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -210,7 +211,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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | ID of pet to return try { @@ -243,7 +244,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) +> Pet updatePet(pet) Update an existing pet @@ -253,11 +254,12 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(body); + var result = api_instance.updatePet(pet); + print(result); } catch (e) { print("Exception when calling PetApi->updatePet: $e\n"); } @@ -267,11 +269,11 @@ 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 -void (empty response body) +[**Pet**](Pet.md) ### Authorization @@ -280,7 +282,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: Not defined + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -295,7 +297,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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet @@ -341,10 +343,10 @@ 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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = BINARY_DATA_HERE; // MultipartFile | file to upload +var file = BINARY_DATA_HERE; // Uint8List | file to upload try { var result = api_instance.uploadFile(petId, additionalMetadata, file); @@ -360,7 +362,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **int**| ID of pet to update | [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **file** | **Uint8List**| file to upload | [optional] [default to null] ### Return type diff --git a/samples/client/petstore/dart2/openapi/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md similarity index 86% rename from samples/client/petstore/dart2/openapi/doc/StoreApi.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md index 1cc37e2a47a..ff948b30a44 100644 --- a/samples/client/petstore/dart2/openapi/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteOrder) | **delete** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **get** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **get** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **post** /store/order | Place an order for a pet # **deleteOrder** @@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); +var api_instance = new StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { @@ -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 = StoreApi(); +var api_instance = new StoreApi(); try { var result = api_instance.getInventory(); @@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); +var api_instance = new StoreApi(); var orderId = 789; // int | ID of pet that needs to be fetched try { @@ -144,7 +144,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **placeOrder** -> Order placeOrder(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 = StoreApi(); -var body = Order(); // Order | order placed for purchasing the pet +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet try { - var result = api_instance.placeOrder(body); + var result = api_instance.placeOrder(order); print(result); } catch (e) { print("Exception when calling StoreApi->placeOrder: $e\n"); @@ -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-jaguar/flutter_petstore/openapi/docs/Tag.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Tag.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/User.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/User.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/User.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/User.md diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md similarity index 67% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/UserApi.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md index 24494bd8757..08348d54d24 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md @@ -9,18 +9,18 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **Post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **Delete** /user/:username | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **Get** /user/:username | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **Get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **Get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **Put** /user/:username | Updated user +[**createUser**](UserApi.md#createUser) | **post** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **post** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **post** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **delete** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **get** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **get** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **get** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **put** /user/{username} | Updated user # **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: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var user = new User(); // User | Created user object try { - api_instance.createUser(body); + api_instance.createUser(user); } catch (e) { print("Exception when calling UserApi->createUser: $e\n"); } @@ -44,7 +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 +[api_key](../README.md#api_key) ### 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: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var user = [new 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>**](User.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 +[api_key](../README.md#api_key) ### 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: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var user = [new 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>**](User.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 +[api_key](../README.md#api_key) ### 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,6 +163,10 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); var username = username_example; // String | The name that needs to be deleted @@ -174,7 +190,7 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers @@ -275,6 +291,10 @@ Logs out current logged in user session ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); @@ -294,7 +314,7 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### 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: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; var api_instance = new UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var user = new User(); // User | Updated user object try { - api_instance.updateUser(username, body); + api_instance.updateUser(username, user); } catch (e) { print("Exception when calling UserApi->updateUser: $e\n"); } @@ -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 +[api_key](../README.md#api_key) ### 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/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart new file mode 100644 index 00000000000..5cca5eafdc6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart @@ -0,0 +1,81 @@ +library openapi.api; + +import 'package:dio/dio.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/serializers.dart'; +import 'package:openapi/auth/api_key_auth.dart'; +import 'package:openapi/auth/basic_auth.dart'; +import 'package:openapi/auth/oauth.dart'; +import 'package:openapi/api/pet_api.dart'; +import 'package:openapi/api/store_api.dart'; +import 'package:openapi/api/user_api.dart'; + + +final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; + +class Openapi { + + Dio dio; + Serializers serializers; + String basePath = "http://petstore.swagger.io/v2"; + + Openapi({this.dio, Serializers serializers, String basePathOverride, List interceptors}) { + if (dio == null) { + BaseOptions options = new BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: 5000, + receiveTimeout: 3000, + ); + this.dio = new Dio(options); + } + + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } + + this.serializers = serializers ?? standardSerializers; + } + + void setOAuthToken(String name, String token) { + (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor, orElse: null) as OAuthInterceptor)?.tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (this.dio.interceptors.firstWhere((element) => element is BasicAuthInterceptor, orElse: null) as BasicAuthInterceptor)?.authInfo[name] = BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor, orElse: null) as ApiKeyAuthInterceptor)?.apiKeys[name] = apiKey; + } + + + /** + * Get PetApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + PetApi getPetApi() { + return PetApi(dio, serializers); + } + + + /** + * Get StoreApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + StoreApi getStoreApi() { + return StoreApi(dio, serializers); + } + + + /** + * Get UserApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + UserApi getUserApi() { + return UserApi(dio, serializers); + } + + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart new file mode 100644 index 00000000000..2bd010ffc46 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -0,0 +1,406 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/api_response.dart'; +import 'dart:typed_data'; +import 'package:openapi/api_util.dart'; + +class PetApi { + final Dio _dio; + Serializers _serializers; + + PetApi(this._dio, this._serializers); + + /// Add a new pet to the store + /// + /// + Future>addPet(Pet pet,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json","application/xml"]; + + + var serializedBody = _serializers.serialize(pet); + var jsonpet = json.encode(serializedBody); + bodyData = jsonpet; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Pet); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Deletes a pet + /// + /// + FuturedeletePet(int petId,{ String apiKey,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + headerParams[r'api_key'] = apiKey; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + Future>>findPetsByStatus(List status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/findByStatus"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'status'] = status; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); + final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); + final data = dataList.toList(); + + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future>>findPetsByTags(List tags,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/findByTags"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'tags'] = tags; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); + final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); + final data = dataList.toList(); + + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Find pet by ID + /// + /// Returns a single pet + Future>getPetById(int petId,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Pet); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Update an existing pet + /// + /// + Future>updatePet(Pet pet,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json","application/xml"]; + + + var serializedBody = _serializers.serialize(pet); + var jsonpet = json.encode(serializedBody); + bodyData = jsonpet; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Pet); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Updates a pet in the store with form data + /// + /// + FutureupdatePetWithForm(int petId,{ String name,String status,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/x-www-form-urlencoded"]; + + Map formData = {}; + formData['name'] = parameterToString(_serializers, name); + formData['status'] = parameterToString(_serializers, status); + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// uploads an image + /// + /// + Future>uploadFile(int petId,{ String additionalMetadata,Uint8List file,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}/uploadImage".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["multipart/form-data"]; + + Map formData = {}; + if (additionalMetadata != null) { + formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); + } + if (file != null) { + formData[r'file'] = MultipartFile.fromBytes(file, filename: r'file'); + } + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(ApiResponse); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart new file mode 100644 index 00000000000..6973ffd113e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -0,0 +1,201 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/order.dart'; + +class StoreApi { + final Dio _dio; + Serializers _serializers; + + StoreApi(this._dio, this._serializers); + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + FuturedeleteOrder(String orderId,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/order/{orderId}".replaceAll("{" r'orderId' "}", orderId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/inventory"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Map); + final data = _serializers.deserializeWith>(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future>getOrderById(int orderId,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/order/{orderId}".replaceAll("{" r'orderId' "}", orderId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Order); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Place an order for a pet + /// + /// + Future>placeOrder(Order order,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/order"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(order); + var jsonorder = json.encode(serializedBody); + bodyData = jsonorder; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Order); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart new file mode 100644 index 00000000000..3aac92bbfc8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -0,0 +1,340 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/user.dart'; + +class UserApi { + final Dio _dio; + Serializers _serializers; + + UserApi(this._dio, this._serializers); + + /// Create user + /// + /// This can only be done by the logged in user. + FuturecreateUser(User user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(user); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Creates list of users with given input array + /// + /// + FuturecreateUsersWithArrayInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/createWithArray"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + final type = const FullType(BuiltList, const [const FullType(User)]); + var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Creates list of users with given input array + /// + /// + FuturecreateUsersWithListInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/createWithList"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + final type = const FullType(BuiltList, const [const FullType(User)]); + var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Delete user + /// + /// This can only be done by the logged in user. + FuturedeleteUser(String username,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Get user by user name + /// + /// + Future>getUserByName(String username,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(User); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Logs user into the system + /// + /// + Future>loginUser(String username,String password,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/login"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'username'] = username; + queryParams[r'password'] = password; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(String); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Logs out current logged in user session + /// + /// + FuturelogoutUser({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/logout"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Updated user + /// + /// This can only be done by the logged in user. + FutureupdateUser(String username,User user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(user); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart new file mode 100644 index 00000000000..e99530f6c39 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart @@ -0,0 +1,14 @@ +import 'dart:convert'; + +import 'package:built_value/serializer.dart'; + +/// Format the given parameter object into string. +String parameterToString(Serializers serializers, dynamic value) { + if (value == null) { + return ''; + } else if (value is String || value is num) { + return value.toString(); + } else { + return json.encode(serializers.serialize(value)); + } +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..6cde089a9a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart @@ -0,0 +1,27 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map apiKeys = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + break; + } + } + return super.onRequest(options); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart new file mode 100644 index 00000000000..703127c762b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List> getAuthInfo(RequestOptions route, String type) { + if (route.extra.containsKey("secure")) { + final auth = route.extra["secure"]; + List> results = []; + for (var info in auth) { + if(info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart new file mode 100644 index 00000000000..14334a2d288 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart @@ -0,0 +1,31 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map authInfo = {}; + + @override + Future onRequest(RequestOptions options) { + final metadataAuthInfo = getAuthInfo(options, 'basic'); + for (var info in metadataAuthInfo) { + final authName = info['name']; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + String basicAuth = 'Basic ' + base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}')); + options.headers['Authorization'] = basicAuth; + break; + } + } + + return super.onRequest(options); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart new file mode 100644 index 00000000000..3fb06b580b9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart @@ -0,0 +1,20 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map tokens = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + options.headers["Authorization"] = "Bearer ${token}"; + break; + } + } + return super.onRequest(options); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart new file mode 100644 index 00000000000..77381d6b5e2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart @@ -0,0 +1,27 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +abstract class ApiResponse implements Built { + + + @nullable + @BuiltValueField(wireName: r'code') + int get code; + + @nullable + @BuiltValueField(wireName: r'type') + String get type; + + @nullable + @BuiltValueField(wireName: r'message') + String get message; + + // Boilerplate code needed to wire-up generated code + ApiResponse._(); + + factory ApiResponse([updates(ApiResponseBuilder b)]) = _$ApiResponse; + static Serializer get serializer => _$apiResponseSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart new file mode 100644 index 00000000000..46e4a1f7d88 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +abstract class Category implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'name') + String get name; + + // Boilerplate code needed to wire-up generated code + Category._(); + + factory Category([updates(CategoryBuilder b)]) = _$Category; + static Serializer get serializer => _$categorySerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object.dart new file mode 100644 index 00000000000..281a2a6505e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object.g.dart'; + +abstract class InlineObject implements Built { + + /* Updated name of the pet */ + @nullable + @BuiltValueField(wireName: r'name') + String get name; + /* Updated status of the pet */ + @nullable + @BuiltValueField(wireName: r'status') + String get status; + + // Boilerplate code needed to wire-up generated code + InlineObject._(); + + factory InlineObject([updates(InlineObjectBuilder b)]) = _$InlineObject; + static Serializer get serializer => _$inlineObjectSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object1.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object1.dart new file mode 100644 index 00000000000..ea094e5ce09 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/inline_object1.dart @@ -0,0 +1,24 @@ +import 'dart:typed_data'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object1.g.dart'; + +abstract class InlineObject1 implements Built { + + /* Additional data to pass to server */ + @nullable + @BuiltValueField(wireName: r'additionalMetadata') + String get additionalMetadata; + /* file to upload */ + @nullable + @BuiltValueField(wireName: r'file') + Uint8List get file; + + // Boilerplate code needed to wire-up generated code + InlineObject1._(); + + factory InlineObject1([updates(InlineObject1Builder b)]) = _$InlineObject1; + static Serializer get serializer => _$inlineObject1Serializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart new file mode 100644 index 00000000000..700b6578821 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart @@ -0,0 +1,62 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +abstract class Order implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'petId') + int get petId; + + @nullable + @BuiltValueField(wireName: r'quantity') + int get quantity; + + @nullable + @BuiltValueField(wireName: r'shipDate') + DateTime get shipDate; + /* Order Status */ + @nullable + @BuiltValueField(wireName: r'status') + OrderStatus get status; + // enum statusEnum { placed, approved, delivered, }; + + @nullable + @BuiltValueField(wireName: r'complete') + bool get complete; + + // Boilerplate code needed to wire-up generated code + Order._(); + + factory Order([updates(OrderBuilder b)]) = _$Order; + static Serializer get serializer => _$orderSerializer; +} + +class OrderStatus extends EnumClass { + + /// Order Status + @BuiltValueEnumConst(wireName: 'placed') + static const OrderStatus placed = _$placed; + /// Order Status + @BuiltValueEnumConst(wireName: 'approved') + static const OrderStatus approved = _$approved; + /// Order Status + @BuiltValueEnumConst(wireName: 'delivered') + static const OrderStatus delivered = _$delivered; + + static Serializer get serializer => _$orderStatusSerializer; + + const OrderStatus._(String name): super(name); + + static BuiltSet get values => _$orderStatusValues; + static OrderStatus valueOf(String name) => _$orderStatusValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart new file mode 100644 index 00000000000..cbd2317378f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart @@ -0,0 +1,64 @@ +import 'package:openapi/model/tag.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/model/category.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pet.g.dart'; + +abstract class Pet implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'category') + Category get category; + + @nullable + @BuiltValueField(wireName: r'name') + String get name; + + @nullable + @BuiltValueField(wireName: r'photoUrls') + BuiltList get photoUrls; + + @nullable + @BuiltValueField(wireName: r'tags') + BuiltList get tags; + /* pet status in the store */ + @nullable + @BuiltValueField(wireName: r'status') + PetStatus get status; + // enum statusEnum { available, pending, sold, }; + + // Boilerplate code needed to wire-up generated code + Pet._(); + + factory Pet([updates(PetBuilder b)]) = _$Pet; + static Serializer get serializer => _$petSerializer; +} + +class PetStatus extends EnumClass { + + /// pet status in the store + @BuiltValueEnumConst(wireName: 'available') + static const PetStatus available = _$available; + /// pet status in the store + @BuiltValueEnumConst(wireName: 'pending') + static const PetStatus pending = _$pending; + /// pet status in the store + @BuiltValueEnumConst(wireName: 'sold') + static const PetStatus sold = _$sold; + + static Serializer get serializer => _$petStatusSerializer; + + const PetStatus._(String name): super(name); + + static BuiltSet get values => _$petStatusValues; + static PetStatus valueOf(String name) => _$petStatusValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart new file mode 100644 index 00000000000..6ff5d3eb3cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +abstract class Tag implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'name') + String get name; + + // Boilerplate code needed to wire-up generated code + Tag._(); + + factory Tag([updates(TagBuilder b)]) = _$Tag; + static Serializer get serializer => _$tagSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart new file mode 100644 index 00000000000..cf78ae941ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart @@ -0,0 +1,47 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +abstract class User implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'username') + String get username; + + @nullable + @BuiltValueField(wireName: r'firstName') + String get firstName; + + @nullable + @BuiltValueField(wireName: r'lastName') + String get lastName; + + @nullable + @BuiltValueField(wireName: r'email') + String get email; + + @nullable + @BuiltValueField(wireName: r'password') + String get password; + + @nullable + @BuiltValueField(wireName: r'phone') + String get phone; + /* User Status */ + @nullable + @BuiltValueField(wireName: r'userStatus') + int get userStatus; + + // Boilerplate code needed to wire-up generated code + User._(); + + factory User([updates(UserBuilder b)]) = _$User; + static Serializer get serializer => _$userSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart new file mode 100644 index 00000000000..3173d4bb5dc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart @@ -0,0 +1,65 @@ +library serializers; + +import 'package:built_value/iso_8601_date_time_serializer.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/standard_json_plugin.dart'; + +import 'package:openapi/model/api_response.dart'; +import 'package:openapi/model/category.dart'; +import 'package:openapi/model/inline_object.dart'; +import 'package:openapi/model/inline_object1.dart'; +import 'package:openapi/model/order.dart'; +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/tag.dart'; +import 'package:openapi/model/user.dart'; + + +part 'serializers.g.dart'; + +@SerializersFor(const [ +ApiResponse, +Category, +InlineObject, +InlineObject1, +Order, +Pet, +Tag, +User, + +]) + +//allow all models to be serialized within a list +Serializers serializers = (_$serializers.toBuilder() +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ApiResponse)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Category)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject1)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Order)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Pet)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Tag)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(User)]), +() => new ListBuilder()) + +..add(Iso8601DateTimeSerializer()) +).build(); + +Serializers standardSerializers = +(serializers.toBuilder() +..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/client/petstore/dart-dio/pom.xml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pom.xml similarity index 97% rename from samples/client/petstore/dart-dio/pom.xml rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pom.xml index de74393ce9e..83864912ce7 100644 --- a/samples/client/petstore/dart-dio/pom.xml +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pom.xml @@ -1,10 +1,10 @@ 4.0.0 org.openapitools - DartDioPetstoreClientTests + DartDioPetstoreClientLibTests pom 1.0.0-SNAPSHOT - DartDio Petstore Client + DartDio Petstore Client Lib diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml new file mode 100644 index 00000000000..20b190aa1d3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml @@ -0,0 +1,14 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: ">=2.3.0 <3.0.0" +dependencies: + dio: ^3.0.9 + built_value: ^7.1.0 + built_collection: ^4.3.2 +dev_dependencies: + built_value_generator: ^7.1.0 + build_runner: ^1.7.1 + test: ^1.3.0 + diff --git a/samples/client/petstore/dart2/openapi/test/api_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart similarity index 79% rename from samples/client/petstore/dart2/openapi/test/api_response_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart index 6c2882a0620..d80b2976160 100644 --- a/samples/client/petstore/dart2/openapi/test/api_response_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart @@ -1,11 +1,11 @@ -import 'package:openapi/api.dart'; +import 'package:openapi/model/api_response.dart'; import 'package:test/test.dart'; // tests for ApiResponse void main() { - var instance = new ApiResponse(); + final instance = ApiResponse(); - group('test ApiResponse', () { + group(ApiResponse, () { // int code (default value: null) test('to test the property `code`', () async { // TODO diff --git a/samples/client/petstore/dart2/openapi/test/category_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart similarity index 75% rename from samples/client/petstore/dart2/openapi/test/category_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart index 277bdfb709d..571e020bf63 100644 --- a/samples/client/petstore/dart2/openapi/test/category_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart @@ -1,11 +1,11 @@ -import 'package:openapi/api.dart'; +import 'package:openapi/model/category.dart'; import 'package:test/test.dart'; // tests for Category void main() { - var instance = new Category(); + final instance = Category(); - group('test Category', () { + group(Category, () { // int id (default value: null) test('to test the property `id`', () async { // TODO diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object1_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object1_test.dart new file mode 100644 index 00000000000..e1fa552bdaa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object1_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object1.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject1 +void main() { + final instance = InlineObject1(); + + group(InlineObject1, () { + // Additional data to pass to server + // String additionalMetadata (default value: null) + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // Uint8List file (default value: null) + test('to test the property `file`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object_test.dart new file mode 100644 index 00000000000..551c6a07d23 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/inline_object_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject +void main() { + final instance = InlineObject(); + + group(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/dart2/openapi/test/order_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart similarity index 89% rename from samples/client/petstore/dart2/openapi/test/order_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart index 0c3178ac699..ea9ac6e14eb 100644 --- a/samples/client/petstore/dart2/openapi/test/order_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart @@ -1,11 +1,11 @@ -import 'package:openapi/api.dart'; +import 'package:openapi/model/order.dart'; import 'package:test/test.dart'; // tests for Order void main() { - var instance = new Order(); + final instance = Order(); - group('test Order', () { + group(Order, () { // int id (default value: null) test('to test the property `id`', () async { // TODO diff --git a/samples/client/petstore/dart2/openapi/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart similarity index 76% rename from samples/client/petstore/dart2/openapi/test/pet_api_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart index 409b7962536..4cd22a598c1 100644 --- a/samples/client/petstore/dart2/openapi/test/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart @@ -1,22 +1,23 @@ import 'package:openapi/api.dart'; +import 'package:openapi/api/pet_api.dart'; import 'package:test/test.dart'; /// tests for PetApi void main() { - var instance = PetApi(); + final instance = Openapi().getPetApi(); - group('tests for PetApi', () { + group(PetApi, () { // Add a new pet to the store // - //Future addPet(Pet body) async + //Future addPet(Pet pet) async test('test addPet', () async { // TODO }); // Deletes a pet // - //Future deletePet(int petId, { String apiKey }) async + //Future deletePet(int petId, { String apiKey }) async test('test deletePet', () async { // TODO }); @@ -25,7 +26,7 @@ void main() { // // Multiple status values can be provided with comma separated strings // - //Future> findPetsByStatus(List status) async + //Future> findPetsByStatus(List status) async test('test findPetsByStatus', () async { // TODO }); @@ -34,7 +35,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) async test('test findPetsByTags', () async { // TODO }); @@ -43,28 +44,28 @@ void main() { // // Returns a single pet // - //Future getPetById(int petId) async + //Future getPetById(int petId) async test('test getPetById', () async { // TODO }); // Update an existing pet // - //Future updatePet(Pet body) async + //Future updatePet(Pet pet) async test('test updatePet', () async { // TODO }); // Updates a pet in the store with form data // - //Future updatePetWithForm(int petId, { String name, String status }) async + //Future updatePetWithForm(int petId, { String name, String status }) async test('test updatePetWithForm', () async { // TODO }); // uploads an image // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + //Future uploadFile(int petId, { String additionalMetadata, Uint8List file }) async test('test uploadFile', () async { // TODO }); diff --git a/samples/client/petstore/dart2/openapi/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart similarity index 78% rename from samples/client/petstore/dart2/openapi/test/pet_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart index acfb87a3fb1..63cfc070e93 100644 --- a/samples/client/petstore/dart2/openapi/test/pet_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart @@ -1,11 +1,11 @@ -import 'package:openapi/api.dart'; +import 'package:openapi/model/pet.dart'; import 'package:test/test.dart'; // tests for Pet void main() { - var instance = new Pet(); + final instance = Pet(); - group('test Pet', () { + group(Pet, () { // int id (default value: null) test('to test the property `id`', () async { // TODO @@ -21,12 +21,12 @@ void main() { // TODO }); - // List photoUrls (default value: []) + // BuiltList photoUrls (default value: const []) test('to test the property `photoUrls`', () async { // TODO }); - // List tags (default value: []) + // BuiltList tags (default value: const []) test('to test the property `tags`', () async { // TODO }); diff --git a/samples/client/petstore/dart2/openapi/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart similarity index 72% rename from samples/client/petstore/dart2/openapi/test/store_api_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart index e2c7ab94b17..ae64309d973 100644 --- a/samples/client/petstore/dart2/openapi/test/store_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart @@ -1,17 +1,18 @@ import 'package:openapi/api.dart'; +import 'package:openapi/api/store_api.dart'; import 'package:test/test.dart'; /// tests for StoreApi void main() { - var instance = StoreApi(); + final instance = Openapi().getStoreApi(); - group('tests for StoreApi', () { + group(StoreApi, () { // Delete purchase order by ID // // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors // - //Future deleteOrder(String orderId) async + //Future deleteOrder(String orderId) async test('test deleteOrder', () async { // TODO }); @@ -20,7 +21,7 @@ void main() { // // Returns a map of status codes to quantities // - //Future> getInventory() async + //Future> getInventory() async test('test getInventory', () async { // TODO }); @@ -29,14 +30,14 @@ void main() { // // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions // - //Future getOrderById(int orderId) async + //Future getOrderById(int orderId) async test('test getOrderById', () async { // TODO }); // 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/dart2/openapi/test/tag_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart similarity index 76% rename from samples/client/petstore/dart2/openapi/test/tag_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart index 4b133ff675d..c2757a71863 100644 --- a/samples/client/petstore/dart2/openapi/test/tag_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart @@ -1,11 +1,11 @@ -import 'package:openapi/api.dart'; +import 'package:openapi/model/tag.dart'; import 'package:test/test.dart'; // tests for Tag void main() { - var instance = new Tag(); + final instance = Tag(); - group('test Tag', () { + group(Tag, () { // int id (default value: null) test('to test the property `id`', () async { // TODO diff --git a/samples/client/petstore/dart2/openapi/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart similarity index 71% rename from samples/client/petstore/dart2/openapi/test/user_api_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart index 5d124a61117..9377f97e3c3 100644 --- a/samples/client/petstore/dart2/openapi/test/user_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart @@ -1,31 +1,32 @@ import 'package:openapi/api.dart'; +import 'package:openapi/api/user_api.dart'; import 'package:test/test.dart'; /// tests for UserApi void main() { - var instance = UserApi(); + final instance = Openapi().getUserApi(); - group('tests for UserApi', () { + group(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 }); @@ -34,28 +35,28 @@ void main() { // // This can only be done by the logged in user. // - //Future deleteUser(String username) async + //Future deleteUser(String username) async test('test deleteUser', () async { // TODO }); // Get user by user name // - //Future getUserByName(String username) async + //Future getUserByName(String username) async test('test getUserByName', () async { // TODO }); // Logs user into the system // - //Future loginUser(String username, String password) async + //Future loginUser(String username, String password) async test('test loginUser', () async { // TODO }); // Logs out current logged in user session // - //Future logoutUser() async + //Future logoutUser() async test('test logoutUser', () async { // TODO }); @@ -64,7 +65,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/dart2/openapi/test/user_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart similarity index 91% rename from samples/client/petstore/dart2/openapi/test/user_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart index c0e542757f5..b598e7f7fef 100644 --- a/samples/client/petstore/dart2/openapi/test/user_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart @@ -1,11 +1,11 @@ -import 'package:openapi/api.dart'; +import 'package:openapi/model/user.dart'; import 'package:test/test.dart'; // tests for User void main() { - var instance = new User(); + final instance = User(); - group('test User', () { + group(User, () { // int id (default value: null) test('to test the property `id`', () async { // TODO diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.gitignore new file mode 100644 index 00000000000..8092a49d515 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.gitignore @@ -0,0 +1,37 @@ +# See https://dart.dev/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: +*.iml // IntelliJ +*.ipr // IntelliJ +*.iws // IntelliJ +.idea/ // IntelliJ +.DS_Store // Mac diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES new file mode 100644 index 00000000000..a187853715e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES @@ -0,0 +1,123 @@ +.gitignore +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/ClassModel.md +doc/Client.md +doc/DefaultApi.md +doc/Dog.md +doc/DogAllOf.md +doc/EnumArrays.md +doc/EnumClass.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeClassnameTags123Api.md +doc/File.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/InlineObject.md +doc/InlineObject1.md +doc/InlineObject2.md +doc/InlineObject3.md +doc/InlineObject4.md +doc/InlineObject5.md +doc/InlineResponseDefault.md +doc/List.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +lib/api.dart +lib/api/another_fake_api.dart +lib/api/default_api.dart +lib/api/fake_api.dart +lib/api/fake_classname_tags123_api.dart +lib/api/pet_api.dart +lib/api/store_api.dart +lib/api/user_api.dart +lib/api_util.dart +lib/auth/api_key_auth.dart +lib/auth/auth.dart +lib/auth/basic_auth.dart +lib/auth/oauth.dart +lib/model/additional_properties_class.dart +lib/model/animal.dart +lib/model/api_response.dart +lib/model/array_of_array_of_number_only.dart +lib/model/array_of_number_only.dart +lib/model/array_test.dart +lib/model/capitalization.dart +lib/model/cat.dart +lib/model/cat_all_of.dart +lib/model/category.dart +lib/model/class_model.dart +lib/model/client.dart +lib/model/dog.dart +lib/model/dog_all_of.dart +lib/model/enum_arrays.dart +lib/model/enum_class.dart +lib/model/enum_test.dart +lib/model/file.dart +lib/model/file_schema_test_class.dart +lib/model/foo.dart +lib/model/format_test.dart +lib/model/has_only_read_only.dart +lib/model/health_check_result.dart +lib/model/inline_object.dart +lib/model/inline_object1.dart +lib/model/inline_object2.dart +lib/model/inline_object3.dart +lib/model/inline_object4.dart +lib/model/inline_object5.dart +lib/model/inline_response_default.dart +lib/model/list.dart +lib/model/map_test.dart +lib/model/mixed_properties_and_additional_properties_class.dart +lib/model/model200_response.dart +lib/model/model_return.dart +lib/model/name.dart +lib/model/nullable_class.dart +lib/model/number_only.dart +lib/model/order.dart +lib/model/outer_composite.dart +lib/model/outer_enum.dart +lib/model/outer_enum_default_value.dart +lib/model/outer_enum_integer.dart +lib/model/outer_enum_integer_default_value.dart +lib/model/pet.dart +lib/model/read_only_first.dart +lib/model/special_model_name.dart +lib/model/tag.dart +lib/model/user.dart +lib/serializers.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION new file mode 100644 index 00000000000..d99e7162d01 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md new file mode 100644 index 00000000000..2365a8d7a1e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -0,0 +1,196 @@ +# openapi +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +Dart 1.20.0 or later OR Flutter 0.0.20 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + + +var api_instance = new AnotherFakeApi(); +var client = new Client(); // Client | client model + +try { + var result = api_instance.123test@$%SpecialTags(client); + print(result); +} catch (e) { + print("Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**123test@$%SpecialTags**](doc//AnotherFakeApi.md#123test@$%specialtags) | **patch** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **get** /foo | +*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **post** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | +*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **put** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **put** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **patch** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **get** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **delete** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **post** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **get** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **put** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **patch** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **post** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **put** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **delete** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **get** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **post** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **get** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **put** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) + - [Animal](doc//Animal.md) + - [ApiResponse](doc//ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) + - [ArrayTest](doc//ArrayTest.md) + - [Capitalization](doc//Capitalization.md) + - [Cat](doc//Cat.md) + - [CatAllOf](doc//CatAllOf.md) + - [Category](doc//Category.md) + - [ClassModel](doc//ClassModel.md) + - [Client](doc//Client.md) + - [Dog](doc//Dog.md) + - [DogAllOf](doc//DogAllOf.md) + - [EnumArrays](doc//EnumArrays.md) + - [EnumClass](doc//EnumClass.md) + - [EnumTest](doc//EnumTest.md) + - [File](doc//File.md) + - [FileSchemaTestClass](doc//FileSchemaTestClass.md) + - [Foo](doc//Foo.md) + - [FormatTest](doc//FormatTest.md) + - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) + - [HealthCheckResult](doc//HealthCheckResult.md) + - [InlineObject](doc//InlineObject.md) + - [InlineObject1](doc//InlineObject1.md) + - [InlineObject2](doc//InlineObject2.md) + - [InlineObject3](doc//InlineObject3.md) + - [InlineObject4](doc//InlineObject4.md) + - [InlineObject5](doc//InlineObject5.md) + - [InlineResponseDefault](doc//InlineResponseDefault.md) + - [List](doc//List.md) + - [MapTest](doc//MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc//Model200Response.md) + - [ModelReturn](doc//ModelReturn.md) + - [Name](doc//Name.md) + - [NullableClass](doc//NullableClass.md) + - [NumberOnly](doc//NumberOnly.md) + - [Order](doc//Order.md) + - [OuterComposite](doc//OuterComposite.md) + - [OuterEnum](doc//OuterEnum.md) + - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc//OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) + - [Pet](doc//Pet.md) + - [ReadOnlyFirst](doc//ReadOnlyFirst.md) + - [SpecialModelName](doc//SpecialModelName.md) + - [Tag](doc//Tag.md) + - [User](doc//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## bearer_test + +- **Type**: HTTP basic authentication + +## http_basic_test + +- **Type**: HTTP basic authentication + +## http_signature_test + +- **Type**: HTTP basic authentication + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/analysis_options.yaml new file mode 100644 index 00000000000..655cb67bd88 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/analysis_options.yaml @@ -0,0 +1 @@ +analyzer: \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..4f473ed345b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **BuiltMap<String, String>** | | [optional] [default to const {}] +**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](Map.md) | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md new file mode 100644 index 00000000000..1b4b3dfac54 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | [default to null] +**color** | **String** | | [optional] [default to 'red'] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md new file mode 100644 index 00000000000..ecefd25af6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**123test@$%SpecialTags**](AnotherFakeApi.md#123test@$%SpecialTags) | **patch** /another-fake/dummy | To test special tags + + +# **123test@$%SpecialTags** +> Client 123test@$%SpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new AnotherFakeApi(); +var client = new Client(); // Client | client model + +try { + var result = api_instance.123test@$%SpecialTags(client); + print(result); +} catch (e) { + print("Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: 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-jaguar/flutter_proto_petstore/openapi/docs/ApiResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ApiResponse.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/ApiResponse.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ApiResponse.md diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..49cf42af14f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](List.md) | | [optional] [default to const []] + +[[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/dart2/openapi/docs/Tag.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md similarity index 73% rename from samples/client/petstore/dart2/openapi/docs/Tag.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md index ded7b32ac3d..8107066a949 100644 --- a/samples/client/petstore/dart2/openapi/docs/Tag.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md @@ -1,4 +1,4 @@ -# openapi.model.Tag +# openapi.model.ArrayOfNumberOnly ## Load the model package ```dart @@ -8,8 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**arrayNumber** | **BuiltList<num>** | | [optional] [default to const []] [[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md new file mode 100644 index 00000000000..db2cd4c9523 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **BuiltList<String>** | | [optional] [default to const []] +**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](List.md) | | [optional] [default to const []] +**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](List.md) | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Capitalization.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Capitalization.md new file mode 100644 index 00000000000..00ccdd84f0e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] [default to null] +**capitalCamel** | **String** | | [optional] [default to null] +**smallSnake** | **String** | | [optional] [default to null] +**capitalSnake** | **String** | | [optional] [default to null] +**sCAETHFlowPoints** | **String** | | [optional] [default to null] +**ATT_NAME** | **String** | Name 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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md new file mode 100644 index 00000000000..1b6237e4ed3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | [default to null] +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [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-jaguar/openapi/docs/Tag.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/CatAllOf.md similarity index 73% rename from samples/client/petstore/dart-jaguar/openapi/docs/Tag.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/CatAllOf.md index ded7b32ac3d..b8f643e416f 100644 --- a/samples/client/petstore/dart-jaguar/openapi/docs/Tag.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/CatAllOf.md @@ -1,4 +1,4 @@ -# openapi.model.Tag +# openapi.model.CatAllOf ## Load the model package ```dart @@ -8,8 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**declawed** | **bool** | | [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-jaguar/flutter_proto_petstore/openapi/docs/Category.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Category.md similarity index 87% rename from samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Category.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Category.md index cc0d1633b59..24feec604a0 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Category.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Category.md @@ -9,7 +9,7 @@ import 'package:openapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**name** | **String** | | [default to 'default-name'] [[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ClassModel.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ClassModel.md new file mode 100644 index 00000000000..71200db1f5d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Client.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Client.md new file mode 100644 index 00000000000..ebf8c870463 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Client.md @@ -0,0 +1,15 @@ +# openapi.model.Client + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md new file mode 100644 index 00000000000..8c885ce0d96 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **get** /foo | + + +# **fooGet** +> InlineResponseDefault fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new DefaultApi(); + +try { + var result = api_instance.fooGet(); + print(result); +} catch (e) { + print("Exception when calling DefaultApi->fooGet: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: 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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md new file mode 100644 index 00000000000..6c2e2287da6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | [default to null] +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DogAllOf.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DogAllOf.md new file mode 100644 index 00000000000..45c19fe6567 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumArrays.md new file mode 100644 index 00000000000..be2f98d28d7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] [default to null] +**arrayEnum** | **BuiltList<String>** | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumClass.md new file mode 100644 index 00000000000..a9ed4c1f0c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.EnumClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumTest.md new file mode 100644 index 00000000000..e2d54c8286d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] [default to null] +**enumStringRequired** | **String** | | [default to null] +**enumInteger** | **int** | | [optional] [default to null] +**enumNumber** | **double** | | [optional] [default to null] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] [default to null] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] [default to null] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to null] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md new file mode 100644 index 00000000000..6126109bdd8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md @@ -0,0 +1,725 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **get** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **get** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **post** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **post** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **post** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **post** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **put** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **put** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **patch** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **get** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **delete** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **post** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **get** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **put** /fake/test-query-paramters | + + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); + +try { + var result = api_instance.fakeHealthGet(); + print(result); +} catch (e) { + print("Exception when calling FakeApi->fakeHealthGet: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: 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) + +# **fakeHttpSignatureTest** +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_signature_test +//defaultApiClient.getAuthentication('http_signature_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_signature_test').password = 'YOUR_PASSWORD'; + +var api_instance = new FakeApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store +var query1 = query1_example; // String | query parameter +var header1 = header1_example; // String | header parameter + +try { + api_instance.fakeHttpSignatureTest(pet, query1, header1); +} catch (e) { + print("Exception when calling FakeApi->fakeHttpSignatureTest: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] [default to null] + **header1** | **String**| header parameter | [optional] [default to null] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + +# **fakeOuterBooleanSerialize** +> bool fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var body = new bool(); // bool | Input boolean as post body + +try { + var result = api_instance.fakeOuterBooleanSerialize(body); + print(result); +} catch (e) { + print("Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + +try { + var result = api_instance.fakeOuterCompositeSerialize(outerComposite); + print(result); +} catch (e) { + print("Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterNumberSerialize** +> num fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var body = new num(); // num | Input number as post body + +try { + var result = api_instance.fakeOuterNumberSerialize(body); + print(result); +} catch (e) { + print("Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **num**| Input number as post body | [optional] + +### Return type + +**num** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var body = new String(); // String | Input string as post body + +try { + var result = api_instance.fakeOuterStringSerialize(body); + print(result); +} catch (e) { + print("Exception when calling FakeApi->fakeOuterStringSerialize: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + +try { + api_instance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (e) { + print("Exception when calling FakeApi->testBodyWithFileSchema: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var query = query_example; // String | +var user = new User(); // User | + +try { + api_instance.testBodyWithQueryParams(query, user); +} catch (e) { + print("Exception when calling FakeApi->testBodyWithQueryParams: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | [default to null] + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var client = new Client(); // Client | client model + +try { + var result = api_instance.testClientModel(client); + print(result); +} catch (e) { + print("Exception when calling FakeApi->testClientModel: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: 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) + +# **testEndpointParameters** +> testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +var api_instance = new FakeApi(); +var number = 8.14; // num | None +var double = 1.2; // double | None +var patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +var byte = BYTE_ARRAY_DATA_HERE; // String | None +var integer = 56; // int | None +var int32 = 56; // int | None +var int64 = 789; // int | None +var float = 3.4; // double | None +var string = string_example; // String | None +var binary = BINARY_DATA_HERE; // Uint8List | None +var date = 2013-10-20; // DateTime | None +var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +var password = password_example; // String | None +var callback = callback_example; // String | None + +try { + api_instance.testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch (e) { + print("Exception when calling FakeApi->testEndpointParameters: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **num**| None | [default to null] + **double** | **double**| None | [default to null] + **patternWithoutDelimiter** | **String**| None | [default to null] + **byte** | **String**| None | [default to null] + **integer** | **int**| None | [optional] [default to null] + **int32** | **int**| None | [optional] [default to null] + **int64** | **int**| None | [optional] [default to null] + **float** | **double**| None | [optional] [default to null] + **string** | **String**| None | [optional] [default to null] + **binary** | **Uint8List**| None | [optional] [default to null] + **date** | **DateTime**| None | [optional] [default to null] + **dateTime** | **DateTime**| None | [optional] [default to null] + **password** | **String**| None | [optional] [default to null] + **callback** | **String**| None | [optional] [default to null] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var enumHeaderStringArray = []; // List | Header parameter enum test (string array) +var enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +var enumQueryStringArray = []; // List | Query parameter enum test (string array) +var enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +var enumQueryInteger = 56; // int | Query parameter enum test (double) +var enumQueryDouble = 1.2; // double | Query parameter enum test (double) +var enumFormStringArray = [enumFormStringArray_example]; // List | Form parameter enum test (string array) +var enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); +} catch (e) { + print("Exception when calling FakeApi->testEnumParameters: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] [default to null] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] [default to null] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: bearer_test +//defaultApiClient.getAuthentication('bearer_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('bearer_test').password = 'YOUR_PASSWORD'; + +var api_instance = new FakeApi(); +var requiredStringGroup = 56; // int | Required String in group parameters +var requiredBooleanGroup = true; // bool | Required Boolean in group parameters +var requiredInt64Group = 789; // int | Required Integer in group parameters +var stringGroup = 56; // int | String in group parameters +var booleanGroup = true; // bool | Boolean in group parameters +var int64Group = 789; // int | Integer in group parameters + +try { + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch (e) { + print("Exception when calling FakeApi->testGroupParameters: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | [default to null] + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | [default to null] + **requiredInt64Group** | **int**| Required Integer in group parameters | [default to null] + **stringGroup** | **int**| String in group parameters | [optional] [default to null] + **booleanGroup** | **bool**| Boolean in group parameters | [optional] [default to null] + **int64Group** | **int**| Integer in group parameters | [optional] [default to null] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var requestBody = new Map<String, String>(); // Map | request body + +try { + api_instance.testInlineAdditionalProperties(requestBody); +} catch (e) { + print("Exception when calling FakeApi->testInlineAdditionalProperties: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, String>**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var param = param_example; // String | field1 +var param2 = param2_example; // String | field2 + +try { + api_instance.testJsonFormData(param, param2); +} catch (e) { + print("Exception when calling FakeApi->testJsonFormData: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | [default to null] + **param2** | **String**| field2 | [default to null] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var pipe = []; // List | +var ioutil = []; // List | +var http = []; // List | +var url = []; // List | +var context = []; // List | + +try { + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); +} catch (e) { + print("Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List<String>**](String.md)| | [default to const []] + **ioutil** | [**List<String>**](String.md)| | [default to const []] + **http** | [**List<String>**](String.md)| | [default to const []] + **url** | [**List<String>**](String.md)| | [default to const []] + **context** | [**List<String>**](String.md)| | [default to const []] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..d879d940aca --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **patch** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +var api_instance = new FakeClassnameTags123Api(); +var client = new Client(); // Client | client model + +try { + var result = api_instance.testClassname(client); + print(result); +} catch (e) { + print("Exception when calling FakeClassnameTags123Api->testClassname: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: 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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/File.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/File.md new file mode 100644 index 00000000000..eaa492c21f5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/File.md @@ -0,0 +1,15 @@ +# openapi.model.File + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FileSchemaTestClass.md new file mode 100644 index 00000000000..3e3af96cf14 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**MultipartFile**](MultipartFile.md) | | [optional] [default to null] +**files** | [**BuiltList<MultipartFile>**](MultipartFile.md) | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Foo.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Foo.md new file mode 100644 index 00000000000..092ee227d3b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md new file mode 100644 index 00000000000..4d676e2000e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] [default to null] +**int32** | **int** | | [optional] [default to null] +**int64** | **int** | | [optional] [default to null] +**number** | **num** | | [default to null] +**float** | **double** | | [optional] [default to null] +**double** | **double** | | [optional] [default to null] +**decimal** | [**Decimal**](Decimal.md) | | [optional] [default to null] +**string** | **String** | | [optional] [default to null] +**byte** | **String** | | [default to null] +**binary** | [**Uint8List**](Uint8List.md) | | [optional] [default to null] +**date** | [**DateTime**](DateTime.md) | | [default to null] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**uuid** | **String** | | [optional] [default to null] +**password** | **String** | | [default to null] +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] [default to null] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HasOnlyReadOnly.md new file mode 100644 index 00000000000..25583acdb41 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to null] +**foo** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HealthCheckResult.md new file mode 100644 index 00000000000..ef9230ec17b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject.md new file mode 100644 index 00000000000..1789b30bb81 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject1.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject1.md new file mode 100644 index 00000000000..37aaa575901 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/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** | [**Uint8List**](Uint8List.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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject2.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject2.md new file mode 100644 index 00000000000..595c585507f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject2.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject2 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumFormStringArray** | **BuiltList<String>** | Form parameter enum test (string array) | [optional] [default to const []] +**enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to '-efg'] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md new file mode 100644 index 00000000000..ec71d5f41f4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md @@ -0,0 +1,28 @@ +# openapi.model.InlineObject3 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | None | [optional] [default to null] +**int32** | **int** | None | [optional] [default to null] +**int64** | **int** | None | [optional] [default to null] +**number** | **num** | None | [default to null] +**float** | **double** | None | [optional] [default to null] +**double** | **double** | None | [default to null] +**string** | **String** | None | [optional] [default to null] +**patternWithoutDelimiter** | **String** | None | [default to null] +**byte** | **String** | None | [default to null] +**binary** | [**Uint8List**](Uint8List.md) | None | [optional] [default to null] +**date** | [**DateTime**](DateTime.md) | None | [optional] [default to null] +**dateTime** | [**DateTime**](DateTime.md) | None | [optional] [default to null] +**password** | **String** | None | [optional] [default to null] +**callback** | **String** | None | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject4.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject4.md new file mode 100644 index 00000000000..ad273a04827 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject4.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject4 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | [default to null] +**param2** | **String** | field2 | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject5.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject5.md new file mode 100644 index 00000000000..168f55b1525 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject5.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject5 + +## 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] +**requiredFile** | [**Uint8List**](Uint8List.md) | file to upload | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineResponseDefault.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineResponseDefault.md new file mode 100644 index 00000000000..505d0ba55c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineResponseDefault.md @@ -0,0 +1,15 @@ +# openapi.model.InlineResponseDefault + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/List.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/List.md new file mode 100644 index 00000000000..0b145a9d498 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/List.md @@ -0,0 +1,15 @@ +# openapi.model.List + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md new file mode 100644 index 00000000000..c9355eab36d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](Map.md) | | [optional] [default to const {}] +**mapOfEnumString** | **BuiltMap<String, String>** | | [optional] [default to const {}] +**directMap** | **BuiltMap<String, bool>** | | [optional] [default to const {}] +**indirectMap** | **BuiltMap<String, bool>** | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..26fadf4d0f1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] [default to null] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**map** | [**BuiltMap<String, Animal>**](Animal.md) | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Model200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Model200Response.md new file mode 100644 index 00000000000..0142612fca8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] [default to null] +**class_** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ModelReturn.md new file mode 100644 index 00000000000..1cba65d72fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Name.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Name.md new file mode 100644 index 00000000000..efb8098a6f8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [default to null] +**snakeCase** | **int** | | [optional] [default to null] +**property** | **String** | | [optional] [default to null] +**n123number** | **int** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md new file mode 100644 index 00000000000..5c3443d6342 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] [default to null] +**numberProp** | **num** | | [optional] [default to null] +**booleanProp** | **bool** | | [optional] [default to null] +**stringProp** | **String** | | [optional] [default to null] +**dateProp** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**arrayNullableProp** | [**BuiltList<JsonObject>**](Object.md) | | [optional] [default to const []] +**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](Object.md) | | [optional] [default to const []] +**arrayItemsNullable** | [**BuiltList<JsonObject>**](Object.md) | | [optional] [default to const []] +**objectNullableProp** | [**BuiltMap<String, JsonObject>**](Object.md) | | [optional] [default to const {}] +**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](Object.md) | | [optional] [default to const {}] +**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](Object.md) | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NumberOnly.md new file mode 100644 index 00000000000..dd7011e3798 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [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-jaguar/flutter_proto_petstore/openapi/docs/Order.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Order.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Order.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Order.md diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterComposite.md new file mode 100644 index 00000000000..c03674fcdb2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] [default to null] +**myString** | **String** | | [optional] [default to null] +**myBoolean** | **bool** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnum.md new file mode 100644 index 00000000000..af62ad87ab2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..c1bf8b0dec4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumInteger.md new file mode 100644 index 00000000000..8c80a9e5c85 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..eb8b55d7024 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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-jaguar/flutter_petstore/openapi/docs/Pet.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md similarity index 80% rename from samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Pet.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md index ce5708cc134..619e45d1848 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Pet.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md @@ -11,8 +11,8 @@ Name | Type | Description | Notes **id** | **int** | | [optional] [default to null] **category** | [**Category**](Category.md) | | [optional] [default to null] **name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to const []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**photoUrls** | **BuiltList<String>** | | [default to const []] +**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] [default to const []] **status** | **String** | pet status in the store | [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/dart2/openapi/docs/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md similarity index 74% rename from samples/client/petstore/dart2/openapi/docs/PetApi.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md index 7b5de3894a9..1eb54f8d385 100644 --- a/samples/client/petstore/dart2/openapi/docs/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md @@ -5,22 +5,23 @@ import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://petstore.swagger.io/v2* +All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**addPet**](PetApi.md#addPet) | **post** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **delete** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **get** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **get** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **get** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **put** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **post** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **post** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **addPet** -> addPet(body) +> addPet(pet) Add a new pet to the store @@ -30,11 +31,11 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + api_instance.addPet(pet); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -44,7 +45,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 @@ -72,7 +73,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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | Pet id to delete var apiKey = apiKey_example; // String | @@ -118,7 +119,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 = PetApi(); +var api_instance = new PetApi(); var status = []; // List | Status values that need to be considered for filter try { @@ -133,7 +134,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -163,7 +164,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 = PetApi(); +var api_instance = new PetApi(); var tags = []; // List | Tags to filter by try { @@ -178,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -210,7 +211,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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | ID of pet to return try { @@ -243,7 +244,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 @@ -253,11 +254,11 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(body); + api_instance.updatePet(pet); } catch (e) { print("Exception when calling PetApi->updatePet: $e\n"); } @@ -267,7 +268,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 @@ -295,7 +296,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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet var status = status_example; // String | Updated status of the pet @@ -341,10 +342,10 @@ 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 = PetApi(); +var api_instance = new PetApi(); var petId = 789; // int | ID of pet to update var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = BINARY_DATA_HERE; // MultipartFile | file to upload +var file = BINARY_DATA_HERE; // Uint8List | file to upload try { var result = api_instance.uploadFile(petId, additionalMetadata, file); @@ -360,7 +361,54 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **int**| ID of pet to update | [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **file** | **Uint8List**| file to upload | [optional] [default to null] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: 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) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example +```dart +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 petId = 789; // int | ID of pet to update +var requiredFile = BINARY_DATA_HERE; // Uint8List | file to upload +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + var result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(result); +} catch (e) { + print("Exception when calling PetApi->uploadFileWithRequiredFile: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | [default to null] + **requiredFile** | **Uint8List**| file to upload | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] ### Return type diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ReadOnlyFirst.md new file mode 100644 index 00000000000..ac7dd38e0d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to null] +**baz** | **String** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md new file mode 100644 index 00000000000..69251c785b5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**$special[propertyName]** | **int** | | [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/dart2/openapi/docs/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md similarity index 83% rename from samples/client/petstore/dart2/openapi/docs/StoreApi.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md index 1cc37e2a47a..10196b4cfa4 100644 --- a/samples/client/petstore/dart2/openapi/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md @@ -5,14 +5,14 @@ import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://petstore.swagger.io/v2* +All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteOrder) | **delete** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **get** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **get** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **post** /store/order | Place an order for a pet # **deleteOrder** @@ -26,7 +26,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); +var api_instance = new StoreApi(); var orderId = orderId_example; // String | ID of the order that needs to be deleted try { @@ -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 = StoreApi(); +var api_instance = new StoreApi(); try { var result = api_instance.getInventory(); @@ -111,7 +111,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); +var api_instance = new StoreApi(); var orderId = 789; // int | ID of pet that needs to be fetched try { @@ -144,7 +144,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **placeOrder** -> Order placeOrder(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 = StoreApi(); -var body = Order(); // Order | order placed for purchasing the pet +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet try { - var result = api_instance.placeOrder(body); + var result = api_instance.placeOrder(order); print(result); } catch (e) { print("Exception when calling StoreApi->placeOrder: $e\n"); @@ -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-jaguar/flutter_proto_petstore/openapi/docs/Tag.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Tag.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/Tag.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Tag.md diff --git a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/User.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/User.md similarity index 100% rename from samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/User.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/User.md diff --git a/samples/client/petstore/dart-jaguar/openapi/docs/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md similarity index 82% rename from samples/client/petstore/dart-jaguar/openapi/docs/UserApi.md rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md index 24494bd8757..f4334518616 100644 --- a/samples/client/petstore/dart-jaguar/openapi/docs/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md @@ -5,22 +5,22 @@ import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://petstore.swagger.io/v2* +All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **Post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **Delete** /user/:username | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **Get** /user/:username | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **Get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **Get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **Put** /user/:username | Updated user +[**createUser**](UserApi.md#createUser) | **post** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **post** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **post** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **delete** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **get** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **get** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **get** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **put** /user/{username} | Updated user # **createUser** -> createUser(body) +> createUser(user) Create user @@ -31,10 +31,10 @@ This can only be done by the logged in user. import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var body = new User(); // User | Created user object +var user = new User(); // User | Created user object try { - api_instance.createUser(body); + api_instance.createUser(user); } catch (e) { print("Exception when calling UserApi->createUser: $e\n"); } @@ -44,7 +44,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -56,13 +56,13 @@ No authorization required ### 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 @@ -71,10 +71,10 @@ Creates list of users with given input array import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var user = [new 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 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -96,13 +96,13 @@ No authorization required ### 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 @@ -111,10 +111,10 @@ Creates list of users with given input array import 'package:openapi/api.dart'; var api_instance = new UserApi(); -var body = [new List<User>()]; // List | List of user object +var user = [new 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 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ No authorization required ### 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) @@ -304,7 +304,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 @@ -316,10 +316,10 @@ import 'package:openapi/api.dart'; var api_instance = new UserApi(); var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object +var user = new User(); // User | Updated user object try { - api_instance.updateUser(username, body); + api_instance.updateUser(username, user); } catch (e) { print("Exception when calling UserApi->updateUser: $e\n"); } @@ -330,7 +330,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 @@ -342,7 +342,7 @@ No authorization required ### 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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart new file mode 100644 index 00000000000..d98f4b08b4e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart @@ -0,0 +1,121 @@ +library openapi.api; + +import 'package:dio/dio.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/serializers.dart'; +import 'package:openapi/auth/api_key_auth.dart'; +import 'package:openapi/auth/basic_auth.dart'; +import 'package:openapi/auth/oauth.dart'; +import 'package:openapi/api/another_fake_api.dart'; +import 'package:openapi/api/default_api.dart'; +import 'package:openapi/api/fake_api.dart'; +import 'package:openapi/api/fake_classname_tags123_api.dart'; +import 'package:openapi/api/pet_api.dart'; +import 'package:openapi/api/store_api.dart'; +import 'package:openapi/api/user_api.dart'; + + +final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; + +class Openapi { + + Dio dio; + Serializers serializers; + String basePath = "http://petstore.swagger.io:80/v2"; + + Openapi({this.dio, Serializers serializers, String basePathOverride, List interceptors}) { + if (dio == null) { + BaseOptions options = new BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: 5000, + receiveTimeout: 3000, + ); + this.dio = new Dio(options); + } + + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } + + this.serializers = serializers ?? standardSerializers; + } + + void setOAuthToken(String name, String token) { + (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor, orElse: null) as OAuthInterceptor)?.tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (this.dio.interceptors.firstWhere((element) => element is BasicAuthInterceptor, orElse: null) as BasicAuthInterceptor)?.authInfo[name] = BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor, orElse: null) as ApiKeyAuthInterceptor)?.apiKeys[name] = apiKey; + } + + + /** + * Get AnotherFakeApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + AnotherFakeApi getAnotherFakeApi() { + return AnotherFakeApi(dio, serializers); + } + + + /** + * Get DefaultApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + DefaultApi getDefaultApi() { + return DefaultApi(dio, serializers); + } + + + /** + * Get FakeApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + FakeApi getFakeApi() { + return FakeApi(dio, serializers); + } + + + /** + * Get FakeClassnameTags123Api instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + FakeClassnameTags123Api getFakeClassnameTags123Api() { + return FakeClassnameTags123Api(dio, serializers); + } + + + /** + * Get PetApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + PetApi getPetApi() { + return PetApi(dio, serializers); + } + + + /** + * Get StoreApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + StoreApi getStoreApi() { + return StoreApi(dio, serializers); + } + + + /** + * Get UserApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + UserApi getUserApi() { + return UserApi(dio, serializers); + } + + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart new file mode 100644 index 00000000000..795cbc91c98 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -0,0 +1,68 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/client.dart'; + +class AnotherFakeApi { + final Dio _dio; + Serializers _serializers; + + AnotherFakeApi(this._dio, this._serializers); + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + Future>123test@$%SpecialTags(Client client,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/another-fake/dummy"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(client); + var jsonclient = json.encode(serializedBody); + bodyData = jsonclient; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'patch'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Client); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart new file mode 100644 index 00000000000..8dcef4f418f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart @@ -0,0 +1,65 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/inline_response_default.dart'; + +class DefaultApi { + final Dio _dio; + Serializers _serializers; + + DefaultApi(this._dio, this._serializers); + + /// + /// + /// + Future>fooGet({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/foo"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(InlineResponseDefault); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart new file mode 100644 index 00000000000..233fab23f2c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -0,0 +1,703 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/client.dart'; +import 'package:openapi/model/file_schema_test_class.dart'; +import 'package:openapi/model/outer_composite.dart'; +import 'package:openapi/model/user.dart'; +import 'package:openapi/model/health_check_result.dart'; +import 'package:openapi/model/pet.dart'; +import 'dart:typed_data'; +import 'package:openapi/api_util.dart'; + +class FakeApi { + final Dio _dio; + Serializers _serializers; + + FakeApi(this._dio, this._serializers); + + /// Health check endpoint + /// + /// + Future>fakeHealthGet({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/health"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(HealthCheckResult); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// test http signature authentication + /// + /// + FuturefakeHttpSignatureTest(Pet pet,{ String query1,String header1,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/http-signature-test"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + headerParams[r'header_1'] = header1; + queryParams[r'query_1'] = query1; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json","application/xml"]; + + + var serializedBody = _serializers.serialize(pet); + var jsonpet = json.encode(serializedBody); + bodyData = jsonpet; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "http", "name": "http_signature_test" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// + /// + /// Test serialization of outer boolean types + Future>fakeOuterBooleanSerialize({ bool body,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/outer/boolean"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(body); + var jsonbody = json.encode(serializedBody); + bodyData = jsonbody; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(bool); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// + /// + /// Test serialization of object with outer number type + Future>fakeOuterCompositeSerialize({ OuterComposite outerComposite,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/outer/composite"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(outerComposite); + var jsonouterComposite = json.encode(serializedBody); + bodyData = jsonouterComposite; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(OuterComposite); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// + /// + /// Test serialization of outer number types + Future>fakeOuterNumberSerialize({ num body,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/outer/number"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(body); + var jsonbody = json.encode(serializedBody); + bodyData = jsonbody; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(num); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// + /// + /// Test serialization of outer string types + Future>fakeOuterStringSerialize({ String body,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/outer/string"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(body); + var jsonbody = json.encode(serializedBody); + bodyData = jsonbody; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(String); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + FuturetestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/body-with-file-schema"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(fileSchemaTestClass); + var jsonfileSchemaTestClass = json.encode(serializedBody); + bodyData = jsonfileSchemaTestClass; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// + /// + /// + FuturetestBodyWithQueryParams(String query,User user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/body-with-query-params"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'query'] = query; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(user); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// To test \"client\" model + /// + /// To test \"client\" model + Future>testClientModel(Client client,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(client); + var jsonclient = json.encode(serializedBody); + bodyData = jsonclient; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'patch'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Client); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + FuturetestEndpointParameters(num number,double double,String patternWithoutDelimiter,String byte,{ int integer,int int32,int int64,double float,String string,Uint8List binary,DateTime date,DateTime dateTime,String password,String callback,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/x-www-form-urlencoded"]; + + Map formData = {}; + formData['integer'] = parameterToString(_serializers, integer); + formData['int32'] = parameterToString(_serializers, int32); + formData['int64'] = parameterToString(_serializers, int64); + formData['number'] = parameterToString(_serializers, number); + formData['float'] = parameterToString(_serializers, float); + formData['double'] = parameterToString(_serializers, double); + formData['string'] = parameterToString(_serializers, string); + formData['pattern_without_delimiter'] = parameterToString(_serializers, patternWithoutDelimiter); + formData['byte'] = parameterToString(_serializers, byte); + formData['binary'] = parameterToString(_serializers, binary); + formData['date'] = parameterToString(_serializers, date); + formData['dateTime'] = parameterToString(_serializers, dateTime); + formData['password'] = parameterToString(_serializers, password); + formData['callback'] = parameterToString(_serializers, callback); + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "http", "name": "http_basic_test" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// To test enum parameters + /// + /// To test enum parameters + FuturetestEnumParameters({ List enumHeaderStringArray,String enumHeaderString,List enumQueryStringArray,String enumQueryString,int enumQueryInteger,double enumQueryDouble,List enumFormStringArray,String enumFormString,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + headerParams[r'enum_header_string_array'] = enumHeaderStringArray; + headerParams[r'enum_header_string'] = enumHeaderString; + queryParams[r'enum_query_string_array'] = enumQueryStringArray; + queryParams[r'enum_query_string'] = enumQueryString; + queryParams[r'enum_query_integer'] = enumQueryInteger; + queryParams[r'enum_query_double'] = enumQueryDouble; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/x-www-form-urlencoded"]; + + Map formData = {}; + formData['enum_form_string_array'] = parameterToString(_serializers, enumFormStringArray); + formData['enum_form_string'] = parameterToString(_serializers, enumFormString); + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + FuturetestGroupParameters(int requiredStringGroup,bool requiredBooleanGroup,int requiredInt64Group,{ int stringGroup,bool booleanGroup,int int64Group,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + headerParams[r'required_boolean_group'] = requiredBooleanGroup; + headerParams[r'boolean_group'] = booleanGroup; + queryParams[r'required_string_group'] = requiredStringGroup; + queryParams[r'required_int64_group'] = requiredInt64Group; + queryParams[r'string_group'] = stringGroup; + queryParams[r'int64_group'] = int64Group; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "http", "name": "bearer_test" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// test inline additionalProperties + /// + /// + FuturetestInlineAdditionalProperties(Map requestBody,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/inline-additionalProperties"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(requestBody); + var jsonrequestBody = json.encode(serializedBody); + bodyData = jsonrequestBody; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// test json serialization of form data + /// + /// + FuturetestJsonFormData(String param,String param2,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/jsonFormData"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/x-www-form-urlencoded"]; + + Map formData = {}; + formData['param'] = parameterToString(_serializers, param); + formData['param2'] = parameterToString(_serializers, param2); + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// + /// + /// To test the collection format in query parameters + FuturetestQueryParameterCollectionFormat(List pipe,List ioutil,List http,List url,List context,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/test-query-paramters"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'pipe'] = pipe; + queryParams[r'ioutil'] = ioutil; + queryParams[r'http'] = http; + queryParams[r'url'] = url; + queryParams[r'context'] = context; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart new file mode 100644 index 00000000000..1e87b70e59d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -0,0 +1,68 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/client.dart'; + +class FakeClassnameTags123Api { + final Dio _dio; + Serializers _serializers; + + FakeClassnameTags123Api(this._dio, this._serializers); + + /// To test class name in snake case + /// + /// To test class name in snake case + Future>testClassname(Client client,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake_classname_test"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(client); + var jsonclient = json.encode(serializedBody); + bodyData = jsonclient; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'patch'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key_query", "keyName": "api_key_query", "where": "query" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Client); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart new file mode 100644 index 00000000000..ba908f8a778 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -0,0 +1,435 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/api_response.dart'; +import 'dart:typed_data'; +import 'package:openapi/api_util.dart'; + +class PetApi { + final Dio _dio; + Serializers _serializers; + + PetApi(this._dio, this._serializers); + + /// Add a new pet to the store + /// + /// + FutureaddPet(Pet pet,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json","application/xml"]; + + + var serializedBody = _serializers.serialize(pet); + var jsonpet = json.encode(serializedBody); + bodyData = jsonpet; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Deletes a pet + /// + /// + FuturedeletePet(int petId,{ String apiKey,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + headerParams[r'api_key'] = apiKey; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + Future>>findPetsByStatus(List status,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/findByStatus"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'status'] = status; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); + final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); + final data = dataList.toList(); + + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future>>findPetsByTags(List tags,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/findByTags"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'tags'] = tags; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); + final BuiltList dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); + final data = dataList.toList(); + + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Find pet by ID + /// + /// Returns a single pet + Future>getPetById(int petId,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Pet); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Update an existing pet + /// + /// + FutureupdatePet(Pet pet,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json","application/xml"]; + + + var serializedBody = _serializers.serialize(pet); + var jsonpet = json.encode(serializedBody); + bodyData = jsonpet; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Updates a pet in the store with form data + /// + /// + FutureupdatePetWithForm(int petId,{ String name,String status,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/x-www-form-urlencoded"]; + + Map formData = {}; + formData['name'] = parameterToString(_serializers, name); + formData['status'] = parameterToString(_serializers, status); + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// uploads an image + /// + /// + Future>uploadFile(int petId,{ String additionalMetadata,Uint8List file,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/pet/{petId}/uploadImage".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["multipart/form-data"]; + + Map formData = {}; + if (additionalMetadata != null) { + formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); + } + if (file != null) { + formData[r'file'] = MultipartFile.fromBytes(file, filename: r'file'); + } + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(ApiResponse); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// uploads an image (required) + /// + /// + Future>uploadFileWithRequiredFile(int petId,Uint8List requiredFile,{ String additionalMetadata,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/fake/{petId}/uploadImageWithRequiredFile".replaceAll("{" r'petId' "}", petId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["multipart/form-data"]; + + Map formData = {}; + if (additionalMetadata != null) { + formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); + } + if (requiredFile != null) { + formData[r'requiredFile'] = MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'); + } + bodyData = FormData.fromMap(formData); + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(ApiResponse); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart new file mode 100644 index 00000000000..e6b34959c46 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart @@ -0,0 +1,201 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/order.dart'; + +class StoreApi { + final Dio _dio; + Serializers _serializers; + + StoreApi(this._dio, this._serializers); + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + FuturedeleteOrder(String orderId,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/order/{order_id}".replaceAll("{" r'order_id' "}", orderId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future>>getInventory({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/inventory"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Map); + final data = _serializers.deserializeWith>(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future>getOrderById(int orderId,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/order/{order_id}".replaceAll("{" r'order_id' "}", orderId.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Order); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Place an order for a pet + /// + /// + Future>placeOrder(Order order,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/store/order"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(order); + var jsonorder = json.encode(serializedBody); + bodyData = jsonorder; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(Order); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart new file mode 100644 index 00000000000..db5a9319c4a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart @@ -0,0 +1,340 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +import 'package:openapi/model/user.dart'; + +class UserApi { + final Dio _dio; + Serializers _serializers; + + UserApi(this._dio, this._serializers); + + /// Create user + /// + /// This can only be done by the logged in user. + FuturecreateUser(User user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(user); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Creates list of users with given input array + /// + /// + FuturecreateUsersWithArrayInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/createWithArray"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + final type = const FullType(BuiltList, const [const FullType(User)]); + var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Creates list of users with given input array + /// + /// + FuturecreateUsersWithListInput(List user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/createWithList"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + final type = const FullType(BuiltList, const [const FullType(User)]); + var serializedBody = _serializers.serialize(BuiltList.from(user), specifiedType: type); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Delete user + /// + /// This can only be done by the logged in user. + FuturedeleteUser(String username,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'delete'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Get user by user name + /// + /// + Future>getUserByName(String username,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(User); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Logs user into the system + /// + /// + Future>loginUser(String username,String password,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/login"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams[r'username'] = username; + queryParams[r'password'] = password; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ).then((response) { + + final serializer = _serializers.serializerForType(String); + final data = _serializers.deserializeWith(serializer, response.data is String ? jsonDecode(response.data) : response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Logs out current logged in user session + /// + /// + FuturelogoutUser({ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/logout"; + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + /// Updated user + /// + /// This can only be done by the logged in user. + FutureupdateUser(String username,User user,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + + String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString()); + + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + dynamic bodyData; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + + List contentTypes = ["application/json"]; + + + var serializedBody = _serializers.serialize(user); + var jsonuser = json.encode(serializedBody); + bodyData = jsonuser; + + return _dio.request( + _path, + queryParameters: queryParams, + data: bodyData, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + extra: { + 'secure': [], + }, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api_util.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api_util.dart new file mode 100644 index 00000000000..e99530f6c39 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api_util.dart @@ -0,0 +1,14 @@ +import 'dart:convert'; + +import 'package:built_value/serializer.dart'; + +/// Format the given parameter object into string. +String parameterToString(Serializers serializers, dynamic value) { + if (value == null) { + return ''; + } else if (value is String || value is num) { + return value.toString(); + } else { + return json.encode(serializers.serialize(value)); + } +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..6cde089a9a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/api_key_auth.dart @@ -0,0 +1,27 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map apiKeys = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + break; + } + } + return super.onRequest(options); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/auth.dart new file mode 100644 index 00000000000..703127c762b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/auth.dart @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List> getAuthInfo(RequestOptions route, String type) { + if (route.extra.containsKey("secure")) { + final auth = route.extra["secure"]; + List> results = []; + for (var info in auth) { + if(info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/basic_auth.dart new file mode 100644 index 00000000000..14334a2d288 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/basic_auth.dart @@ -0,0 +1,31 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map authInfo = {}; + + @override + Future onRequest(RequestOptions options) { + final metadataAuthInfo = getAuthInfo(options, 'basic'); + for (var info in metadataAuthInfo) { + final authName = info['name']; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + String basicAuth = 'Basic ' + base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}')); + options.headers['Authorization'] = basicAuth; + break; + } + } + + return super.onRequest(options); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/oauth.dart new file mode 100644 index 00000000000..3fb06b580b9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/auth/oauth.dart @@ -0,0 +1,20 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map tokens = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + options.headers["Authorization"] = "Bearer ${token}"; + break; + } + } + return super.onRequest(options); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/additional_properties_class.dart new file mode 100644 index 00000000000..b4f78aa5d79 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/additional_properties_class.dart @@ -0,0 +1,24 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'additional_properties_class.g.dart'; + +abstract class AdditionalPropertiesClass implements Built { + + + @nullable + @BuiltValueField(wireName: r'map_property') + BuiltMap get mapProperty; + + @nullable + @BuiltValueField(wireName: r'map_of_map_property') + BuiltMap> get mapOfMapProperty; + + // Boilerplate code needed to wire-up generated code + AdditionalPropertiesClass._(); + + factory AdditionalPropertiesClass([updates(AdditionalPropertiesClassBuilder b)]) = _$AdditionalPropertiesClass; + static Serializer get serializer => _$additionalPropertiesClassSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/animal.dart new file mode 100644 index 00000000000..5b90bf9deb6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/animal.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'animal.g.dart'; + +abstract class Animal implements Built { + + + @nullable + @BuiltValueField(wireName: r'className') + String get className; + + @nullable + @BuiltValueField(wireName: r'color') + String get color; + + // Boilerplate code needed to wire-up generated code + Animal._(); + + factory Animal([updates(AnimalBuilder b)]) = _$Animal; + static Serializer get serializer => _$animalSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/api_response.dart new file mode 100644 index 00000000000..77381d6b5e2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/api_response.dart @@ -0,0 +1,27 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +abstract class ApiResponse implements Built { + + + @nullable + @BuiltValueField(wireName: r'code') + int get code; + + @nullable + @BuiltValueField(wireName: r'type') + String get type; + + @nullable + @BuiltValueField(wireName: r'message') + String get message; + + // Boilerplate code needed to wire-up generated code + ApiResponse._(); + + factory ApiResponse([updates(ApiResponseBuilder b)]) = _$ApiResponse; + static Serializer get serializer => _$apiResponseSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart new file mode 100644 index 00000000000..881680996f4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -0,0 +1,20 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_array_of_number_only.g.dart'; + +abstract class ArrayOfArrayOfNumberOnly implements Built { + + + @nullable + @BuiltValueField(wireName: r'ArrayArrayNumber') + BuiltList> get arrayArrayNumber; + + // Boilerplate code needed to wire-up generated code + ArrayOfArrayOfNumberOnly._(); + + factory ArrayOfArrayOfNumberOnly([updates(ArrayOfArrayOfNumberOnlyBuilder b)]) = _$ArrayOfArrayOfNumberOnly; + static Serializer get serializer => _$arrayOfArrayOfNumberOnlySerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_number_only.dart new file mode 100644 index 00000000000..0ec79a5d826 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_of_number_only.dart @@ -0,0 +1,20 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_number_only.g.dart'; + +abstract class ArrayOfNumberOnly implements Built { + + + @nullable + @BuiltValueField(wireName: r'ArrayNumber') + BuiltList get arrayNumber; + + // Boilerplate code needed to wire-up generated code + ArrayOfNumberOnly._(); + + factory ArrayOfNumberOnly([updates(ArrayOfNumberOnlyBuilder b)]) = _$ArrayOfNumberOnly; + static Serializer get serializer => _$arrayOfNumberOnlySerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_test.dart new file mode 100644 index 00000000000..7af4ca09ded --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/array_test.dart @@ -0,0 +1,29 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/model/read_only_first.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_test.g.dart'; + +abstract class ArrayTest implements Built { + + + @nullable + @BuiltValueField(wireName: r'array_of_string') + BuiltList get arrayOfString; + + @nullable + @BuiltValueField(wireName: r'array_array_of_integer') + BuiltList> get arrayArrayOfInteger; + + @nullable + @BuiltValueField(wireName: r'array_array_of_model') + BuiltList> get arrayArrayOfModel; + + // Boilerplate code needed to wire-up generated code + ArrayTest._(); + + factory ArrayTest([updates(ArrayTestBuilder b)]) = _$ArrayTest; + static Serializer get serializer => _$arrayTestSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/capitalization.dart new file mode 100644 index 00000000000..14223f6d298 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/capitalization.dart @@ -0,0 +1,39 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'capitalization.g.dart'; + +abstract class Capitalization implements Built { + + + @nullable + @BuiltValueField(wireName: r'smallCamel') + String get smallCamel; + + @nullable + @BuiltValueField(wireName: r'CapitalCamel') + String get capitalCamel; + + @nullable + @BuiltValueField(wireName: r'small_Snake') + String get smallSnake; + + @nullable + @BuiltValueField(wireName: r'Capital_Snake') + String get capitalSnake; + + @nullable + @BuiltValueField(wireName: r'SCA_ETH_Flow_Points') + String get sCAETHFlowPoints; + /* Name of the pet */ + @nullable + @BuiltValueField(wireName: r'ATT_NAME') + String get ATT_NAME; + + // Boilerplate code needed to wire-up generated code + Capitalization._(); + + factory Capitalization([updates(CapitalizationBuilder b)]) = _$Capitalization; + static Serializer get serializer => _$capitalizationSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat.dart new file mode 100644 index 00000000000..c692db29f92 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat.dart @@ -0,0 +1,29 @@ +import 'package:openapi/model/animal.dart'; +import 'package:openapi/model/cat_all_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat.g.dart'; + +abstract class Cat implements Built { + + + @nullable + @BuiltValueField(wireName: r'className') + String get className; + + @nullable + @BuiltValueField(wireName: r'color') + String get color; + + @nullable + @BuiltValueField(wireName: r'declawed') + bool get declawed; + + // Boilerplate code needed to wire-up generated code + Cat._(); + + factory Cat([updates(CatBuilder b)]) = _$Cat; + static Serializer get serializer => _$catSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat_all_of.dart new file mode 100644 index 00000000000..331a86c32ac --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/cat_all_of.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat_all_of.g.dart'; + +abstract class CatAllOf implements Built { + + + @nullable + @BuiltValueField(wireName: r'declawed') + bool get declawed; + + // Boilerplate code needed to wire-up generated code + CatAllOf._(); + + factory CatAllOf([updates(CatAllOfBuilder b)]) = _$CatAllOf; + static Serializer get serializer => _$catAllOfSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/category.dart new file mode 100644 index 00000000000..46e4a1f7d88 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/category.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +abstract class Category implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'name') + String get name; + + // Boilerplate code needed to wire-up generated code + Category._(); + + factory Category([updates(CategoryBuilder b)]) = _$Category; + static Serializer get serializer => _$categorySerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/class_model.dart new file mode 100644 index 00000000000..028826b1c89 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/class_model.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'class_model.g.dart'; + +abstract class ClassModel implements Built { + + + @nullable + @BuiltValueField(wireName: r'_class') + String get class_; + + // Boilerplate code needed to wire-up generated code + ClassModel._(); + + factory ClassModel([updates(ClassModelBuilder b)]) = _$ClassModel; + static Serializer get serializer => _$classModelSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/client.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/client.dart new file mode 100644 index 00000000000..0fed7f6c2f2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/client.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'client.g.dart'; + +abstract class Client implements Built { + + + @nullable + @BuiltValueField(wireName: r'client') + String get client; + + // Boilerplate code needed to wire-up generated code + Client._(); + + factory Client([updates(ClientBuilder b)]) = _$Client; + static Serializer get serializer => _$clientSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog.dart new file mode 100644 index 00000000000..b3787f304b1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog.dart @@ -0,0 +1,29 @@ +import 'package:openapi/model/animal.dart'; +import 'package:openapi/model/dog_all_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog.g.dart'; + +abstract class Dog implements Built { + + + @nullable + @BuiltValueField(wireName: r'className') + String get className; + + @nullable + @BuiltValueField(wireName: r'color') + String get color; + + @nullable + @BuiltValueField(wireName: r'breed') + String get breed; + + // Boilerplate code needed to wire-up generated code + Dog._(); + + factory Dog([updates(DogBuilder b)]) = _$Dog; + static Serializer get serializer => _$dogSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog_all_of.dart new file mode 100644 index 00000000000..6a1654ebe99 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/dog_all_of.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog_all_of.g.dart'; + +abstract class DogAllOf implements Built { + + + @nullable + @BuiltValueField(wireName: r'breed') + String get breed; + + // Boilerplate code needed to wire-up generated code + DogAllOf._(); + + factory DogAllOf([updates(DogAllOfBuilder b)]) = _$DogAllOf; + static Serializer get serializer => _$dogAllOfSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart new file mode 100644 index 00000000000..b5712fd623e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -0,0 +1,58 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_arrays.g.dart'; + +abstract class EnumArrays implements Built { + + + @nullable + @BuiltValueField(wireName: r'just_symbol') + EnumArraysJustSymbol get justSymbol; + // enum justSymbolEnum { >=, $, }; + + @nullable + @BuiltValueField(wireName: r'array_enum') + EnumArraysArrayEnum get arrayEnum; + // enum arrayEnumEnum { fish, crab, }; + + // Boilerplate code needed to wire-up generated code + EnumArrays._(); + + factory EnumArrays([updates(EnumArraysBuilder b)]) = _$EnumArrays; + static Serializer get serializer => _$enumArraysSerializer; +} + +class EnumArraysJustSymbol extends EnumClass { + + @BuiltValueEnumConst(wireName: '>=') + static const EnumArraysJustSymbol >= = _$>=; + @BuiltValueEnumConst(wireName: '$') + static const EnumArraysJustSymbol $ = _$$; + + static Serializer get serializer => _$enumArraysJustSymbolSerializer; + + const EnumArraysJustSymbol._(String name): super(name); + + static BuiltSet get values => _$enumArraysJustSymbolValues; + static EnumArraysJustSymbol valueOf(String name) => _$enumArraysJustSymbolValueOf(name); +} + + +class EnumArraysArrayEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: 'fish') + static const EnumArraysArrayEnum fish = _$fish; + @BuiltValueEnumConst(wireName: 'crab') + static const EnumArraysArrayEnum crab = _$crab; + + static Serializer get serializer => _$enumArraysArrayEnumSerializer; + + const EnumArraysArrayEnum._(String name): super(name); + + static BuiltSet get values => _$enumArraysArrayEnumValues; + static EnumArraysArrayEnum valueOf(String name) => _$enumArraysArrayEnumValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_class.dart new file mode 100644 index 00000000000..d57f91c50fb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_class.dart @@ -0,0 +1,31 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_class.g.dart'; + +class EnumClass extends EnumClass { + + @BuiltValueEnumConst(wireName: '_abc') + static const EnumClass abc = _$abc; + @BuiltValueEnumConst(wireName: '-efg') + static const EnumClass efg = _$efg; + @BuiltValueEnumConst(wireName: '(xyz)') + static const EnumClass (xyz) = _$(xyz); + + static Serializer get serializer => _$enumClassSerializer; + + const EnumClass._(String name): super(name); + + static BuiltSet get values => _$values; + static EnumClass valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class EnumClassMixin = Object with _$EnumClassMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart new file mode 100644 index 00000000000..bfa602fb218 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart @@ -0,0 +1,128 @@ +import 'package:openapi/model/outer_enum_integer_default_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/model/outer_enum_default_value.dart'; +import 'package:openapi/model/outer_enum.dart'; +import 'package:openapi/model/outer_enum_integer.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_test.g.dart'; + +abstract class EnumTest implements Built { + + + @nullable + @BuiltValueField(wireName: r'enum_string') + EnumTestEnumString get enumString; + // enum enumStringEnum { UPPER, lower, , }; + + @nullable + @BuiltValueField(wireName: r'enum_string_required') + EnumTestEnumStringRequired get enumStringRequired; + // enum enumStringRequiredEnum { UPPER, lower, , }; + + @nullable + @BuiltValueField(wireName: r'enum_integer') + EnumTestEnumInteger get enumInteger; + // enum enumIntegerEnum { 1, -1, }; + + @nullable + @BuiltValueField(wireName: r'enum_number') + EnumTestEnumNumber get enumNumber; + // enum enumNumberEnum { 1.1, -1.2, }; + + @nullable + @BuiltValueField(wireName: r'outerEnum') + OuterEnum get outerEnum; + // enum outerEnumEnum { placed, approved, delivered, }; + + @nullable + @BuiltValueField(wireName: r'outerEnumInteger') + OuterEnumInteger get outerEnumInteger; + // enum outerEnumIntegerEnum { 0, 1, 2, }; + + @nullable + @BuiltValueField(wireName: r'outerEnumDefaultValue') + OuterEnumDefaultValue get outerEnumDefaultValue; + // enum outerEnumDefaultValueEnum { placed, approved, delivered, }; + + @nullable + @BuiltValueField(wireName: r'outerEnumIntegerDefaultValue') + OuterEnumIntegerDefaultValue get outerEnumIntegerDefaultValue; + // enum outerEnumIntegerDefaultValueEnum { 0, 1, 2, }; + + // Boilerplate code needed to wire-up generated code + EnumTest._(); + + factory EnumTest([updates(EnumTestBuilder b)]) = _$EnumTest; + static Serializer get serializer => _$enumTestSerializer; +} + +class EnumTestEnumString extends EnumClass { + + @BuiltValueEnumConst(wireName: 'UPPER') + static const EnumTestEnumString uPPER = _$uPPER; + @BuiltValueEnumConst(wireName: 'lower') + static const EnumTestEnumString lower = _$lower; + @BuiltValueEnumConst(wireName: '') + static const EnumTestEnumString empty = _$empty; + + static Serializer get serializer => _$enumTestEnumStringSerializer; + + const EnumTestEnumString._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumStringValues; + static EnumTestEnumString valueOf(String name) => _$enumTestEnumStringValueOf(name); +} + + +class EnumTestEnumStringRequired extends EnumClass { + + @BuiltValueEnumConst(wireName: 'UPPER') + static const EnumTestEnumStringRequired uPPER = _$uPPER; + @BuiltValueEnumConst(wireName: 'lower') + static const EnumTestEnumStringRequired lower = _$lower; + @BuiltValueEnumConst(wireName: '') + static const EnumTestEnumStringRequired empty = _$empty; + + static Serializer get serializer => _$enumTestEnumStringRequiredSerializer; + + const EnumTestEnumStringRequired._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumStringRequiredValues; + static EnumTestEnumStringRequired valueOf(String name) => _$enumTestEnumStringRequiredValueOf(name); +} + + +class EnumTestEnumInteger extends EnumClass { + + @BuiltValueEnumConst(wireName: 1) + static const EnumTestEnumInteger number1 = _$number1; + @BuiltValueEnumConst(wireName: -1) + static const EnumTestEnumInteger number1 = _$number1; + + static Serializer get serializer => _$enumTestEnumIntegerSerializer; + + const EnumTestEnumInteger._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumIntegerValues; + static EnumTestEnumInteger valueOf(String name) => _$enumTestEnumIntegerValueOf(name); +} + + +class EnumTestEnumNumber extends EnumClass { + + @BuiltValueEnumConst(wireName: '1.1') + static const EnumTestEnumNumber 11_ = _$11_; + @BuiltValueEnumConst(wireName: '-1.2') + static const EnumTestEnumNumber 12_ = _$12_; + + static Serializer get serializer => _$enumTestEnumNumberSerializer; + + const EnumTestEnumNumber._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumNumberValues; + static EnumTestEnumNumber valueOf(String name) => _$enumTestEnumNumberValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file.dart new file mode 100644 index 00000000000..db11b10fe2f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'file.g.dart'; + +abstract class File implements Built { + + /* Test capitalization */ + @nullable + @BuiltValueField(wireName: r'sourceURI') + String get sourceURI; + + // Boilerplate code needed to wire-up generated code + File._(); + + factory File([updates(FileBuilder b)]) = _$File; + static Serializer get serializer => _$fileSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file_schema_test_class.dart new file mode 100644 index 00000000000..da0d549aa38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/file_schema_test_class.dart @@ -0,0 +1,25 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/model/multipart_file.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'file_schema_test_class.g.dart'; + +abstract class FileSchemaTestClass implements Built { + + + @nullable + @BuiltValueField(wireName: r'file') + MultipartFile get file; + + @nullable + @BuiltValueField(wireName: r'files') + BuiltList get files; + + // Boilerplate code needed to wire-up generated code + FileSchemaTestClass._(); + + factory FileSchemaTestClass([updates(FileSchemaTestClassBuilder b)]) = _$FileSchemaTestClass; + static Serializer get serializer => _$fileSchemaTestClassSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/foo.dart new file mode 100644 index 00000000000..6ccd1f51fb9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/foo.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo.g.dart'; + +abstract class Foo implements Built { + + + @nullable + @BuiltValueField(wireName: r'bar') + String get bar; + + // Boilerplate code needed to wire-up generated code + Foo._(); + + factory Foo([updates(FooBuilder b)]) = _$Foo; + static Serializer get serializer => _$fooSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart new file mode 100644 index 00000000000..c709b2b2016 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart @@ -0,0 +1,81 @@ +import 'dart:typed_data'; +import 'package:openapi/model/decimal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'format_test.g.dart'; + +abstract class FormatTest implements Built { + + + @nullable + @BuiltValueField(wireName: r'integer') + int get integer; + + @nullable + @BuiltValueField(wireName: r'int32') + int get int32; + + @nullable + @BuiltValueField(wireName: r'int64') + int get int64; + + @nullable + @BuiltValueField(wireName: r'number') + num get number; + + @nullable + @BuiltValueField(wireName: r'float') + double get float; + + @nullable + @BuiltValueField(wireName: r'double') + double get double; + + @nullable + @BuiltValueField(wireName: r'decimal') + Decimal get decimal; + + @nullable + @BuiltValueField(wireName: r'string') + String get string; + + @nullable + @BuiltValueField(wireName: r'byte') + String get byte; + + @nullable + @BuiltValueField(wireName: r'binary') + Uint8List get binary; + + @nullable + @BuiltValueField(wireName: r'date') + DateTime get date; + + @nullable + @BuiltValueField(wireName: r'dateTime') + DateTime get dateTime; + + @nullable + @BuiltValueField(wireName: r'uuid') + String get uuid; + + @nullable + @BuiltValueField(wireName: r'password') + String get password; + /* A string that is a 10 digit number. Can have leading zeros. */ + @nullable + @BuiltValueField(wireName: r'pattern_with_digits') + String get patternWithDigits; + /* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */ + @nullable + @BuiltValueField(wireName: r'pattern_with_digits_and_delimiter') + String get patternWithDigitsAndDelimiter; + + // Boilerplate code needed to wire-up generated code + FormatTest._(); + + factory FormatTest([updates(FormatTestBuilder b)]) = _$FormatTest; + static Serializer get serializer => _$formatTestSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/has_only_read_only.dart new file mode 100644 index 00000000000..323a0933628 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/has_only_read_only.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'has_only_read_only.g.dart'; + +abstract class HasOnlyReadOnly implements Built { + + + @nullable + @BuiltValueField(wireName: r'bar') + String get bar; + + @nullable + @BuiltValueField(wireName: r'foo') + String get foo; + + // Boilerplate code needed to wire-up generated code + HasOnlyReadOnly._(); + + factory HasOnlyReadOnly([updates(HasOnlyReadOnlyBuilder b)]) = _$HasOnlyReadOnly; + static Serializer get serializer => _$hasOnlyReadOnlySerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/health_check_result.dart new file mode 100644 index 00000000000..699a32d0870 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/health_check_result.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'health_check_result.g.dart'; + +abstract class HealthCheckResult implements Built { + + + @nullable + @BuiltValueField(wireName: r'NullableMessage') + String get nullableMessage; + + // Boilerplate code needed to wire-up generated code + HealthCheckResult._(); + + factory HealthCheckResult([updates(HealthCheckResultBuilder b)]) = _$HealthCheckResult; + static Serializer get serializer => _$healthCheckResultSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object.dart new file mode 100644 index 00000000000..281a2a6505e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object.g.dart'; + +abstract class InlineObject implements Built { + + /* Updated name of the pet */ + @nullable + @BuiltValueField(wireName: r'name') + String get name; + /* Updated status of the pet */ + @nullable + @BuiltValueField(wireName: r'status') + String get status; + + // Boilerplate code needed to wire-up generated code + InlineObject._(); + + factory InlineObject([updates(InlineObjectBuilder b)]) = _$InlineObject; + static Serializer get serializer => _$inlineObjectSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object1.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object1.dart new file mode 100644 index 00000000000..ea094e5ce09 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object1.dart @@ -0,0 +1,24 @@ +import 'dart:typed_data'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object1.g.dart'; + +abstract class InlineObject1 implements Built { + + /* Additional data to pass to server */ + @nullable + @BuiltValueField(wireName: r'additionalMetadata') + String get additionalMetadata; + /* file to upload */ + @nullable + @BuiltValueField(wireName: r'file') + Uint8List get file; + + // Boilerplate code needed to wire-up generated code + InlineObject1._(); + + factory InlineObject1([updates(InlineObject1Builder b)]) = _$InlineObject1; + static Serializer get serializer => _$inlineObject1Serializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart new file mode 100644 index 00000000000..6c90dd84455 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart @@ -0,0 +1,65 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object2.g.dart'; + +abstract class InlineObject2 implements Built { + + /* Form parameter enum test (string array) */ + @nullable + @BuiltValueField(wireName: r'enum_form_string_array') + InlineObject2EnumFormStringArray get enumFormStringArray; + // enum enumFormStringArrayEnum { >, $, }; + /* Form parameter enum test (string) */ + @nullable + @BuiltValueField(wireName: r'enum_form_string') + InlineObject2EnumFormString get enumFormString; + // enum enumFormStringEnum { _abc, -efg, (xyz), }; + + // Boilerplate code needed to wire-up generated code + InlineObject2._(); + + factory InlineObject2([updates(InlineObject2Builder b)]) = _$InlineObject2; + static Serializer get serializer => _$inlineObject2Serializer; +} + +class InlineObject2EnumFormStringArray extends EnumClass { + + /// Form parameter enum test (string array) + @BuiltValueEnumConst(wireName: '>') + static const InlineObject2EnumFormStringArray > = _$>; + /// Form parameter enum test (string array) + @BuiltValueEnumConst(wireName: '$') + static const InlineObject2EnumFormStringArray $ = _$$; + + static Serializer get serializer => _$inlineObject2EnumFormStringArraySerializer; + + const InlineObject2EnumFormStringArray._(String name): super(name); + + static BuiltSet get values => _$inlineObject2EnumFormStringArrayValues; + static InlineObject2EnumFormStringArray valueOf(String name) => _$inlineObject2EnumFormStringArrayValueOf(name); +} + + +class InlineObject2EnumFormString extends EnumClass { + + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: '_abc') + static const InlineObject2EnumFormString abc = _$abc; + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: '-efg') + static const InlineObject2EnumFormString efg = _$efg; + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: '(xyz)') + static const InlineObject2EnumFormString (xyz) = _$(xyz); + + static Serializer get serializer => _$inlineObject2EnumFormStringSerializer; + + const InlineObject2EnumFormString._(String name): super(name); + + static BuiltSet get values => _$inlineObject2EnumFormStringValues; + static InlineObject2EnumFormString valueOf(String name) => _$inlineObject2EnumFormStringValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart new file mode 100644 index 00000000000..19e26a0e069 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart @@ -0,0 +1,72 @@ +import 'dart:typed_data'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object3.g.dart'; + +abstract class InlineObject3 implements Built { + + /* None */ + @nullable + @BuiltValueField(wireName: r'integer') + int get integer; + /* None */ + @nullable + @BuiltValueField(wireName: r'int32') + int get int32; + /* None */ + @nullable + @BuiltValueField(wireName: r'int64') + int get int64; + /* None */ + @nullable + @BuiltValueField(wireName: r'number') + num get number; + /* None */ + @nullable + @BuiltValueField(wireName: r'float') + double get float; + /* None */ + @nullable + @BuiltValueField(wireName: r'double') + double get double; + /* None */ + @nullable + @BuiltValueField(wireName: r'string') + String get string; + /* None */ + @nullable + @BuiltValueField(wireName: r'pattern_without_delimiter') + String get patternWithoutDelimiter; + /* None */ + @nullable + @BuiltValueField(wireName: r'byte') + String get byte; + /* None */ + @nullable + @BuiltValueField(wireName: r'binary') + Uint8List get binary; + /* None */ + @nullable + @BuiltValueField(wireName: r'date') + DateTime get date; + /* None */ + @nullable + @BuiltValueField(wireName: r'dateTime') + DateTime get dateTime; + /* None */ + @nullable + @BuiltValueField(wireName: r'password') + String get password; + /* None */ + @nullable + @BuiltValueField(wireName: r'callback') + String get callback; + + // Boilerplate code needed to wire-up generated code + InlineObject3._(); + + factory InlineObject3([updates(InlineObject3Builder b)]) = _$InlineObject3; + static Serializer get serializer => _$inlineObject3Serializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object4.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object4.dart new file mode 100644 index 00000000000..7e3e6ac921b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object4.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object4.g.dart'; + +abstract class InlineObject4 implements Built { + + /* field1 */ + @nullable + @BuiltValueField(wireName: r'param') + String get param; + /* field2 */ + @nullable + @BuiltValueField(wireName: r'param2') + String get param2; + + // Boilerplate code needed to wire-up generated code + InlineObject4._(); + + factory InlineObject4([updates(InlineObject4Builder b)]) = _$InlineObject4; + static Serializer get serializer => _$inlineObject4Serializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object5.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object5.dart new file mode 100644 index 00000000000..bd8dfcc4f35 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object5.dart @@ -0,0 +1,24 @@ +import 'dart:typed_data'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_object5.g.dart'; + +abstract class InlineObject5 implements Built { + + /* Additional data to pass to server */ + @nullable + @BuiltValueField(wireName: r'additionalMetadata') + String get additionalMetadata; + /* file to upload */ + @nullable + @BuiltValueField(wireName: r'requiredFile') + Uint8List get requiredFile; + + // Boilerplate code needed to wire-up generated code + InlineObject5._(); + + factory InlineObject5([updates(InlineObject5Builder b)]) = _$InlineObject5; + static Serializer get serializer => _$inlineObject5Serializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_response_default.dart new file mode 100644 index 00000000000..1f9507deb9b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_response_default.dart @@ -0,0 +1,20 @@ +import 'package:openapi/model/foo.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_response_default.g.dart'; + +abstract class InlineResponseDefault implements Built { + + + @nullable + @BuiltValueField(wireName: r'string') + Foo get string; + + // Boilerplate code needed to wire-up generated code + InlineResponseDefault._(); + + factory InlineResponseDefault([updates(InlineResponseDefaultBuilder b)]) = _$InlineResponseDefault; + static Serializer get serializer => _$inlineResponseDefaultSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/list.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/list.dart new file mode 100644 index 00000000000..1e5d88da3ed --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/list.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'list.g.dart'; + +abstract class List implements Built { + + + @nullable + @BuiltValueField(wireName: r'123-list') + String get n123list; + + // Boilerplate code needed to wire-up generated code + List._(); + + factory List([updates(ListBuilder b)]) = _$List; + static Serializer get serializer => _$listSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/map_test.dart new file mode 100644 index 00000000000..8b41950dda7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/map_test.dart @@ -0,0 +1,49 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'map_test.g.dart'; + +abstract class MapTest implements Built { + + + @nullable + @BuiltValueField(wireName: r'map_map_of_string') + BuiltMap> get mapMapOfString; + + @nullable + @BuiltValueField(wireName: r'map_of_enum_string') + MapTestMapOfEnumString get mapOfEnumString; + // enum mapOfEnumStringEnum { UPPER, lower, }; + + @nullable + @BuiltValueField(wireName: r'direct_map') + BuiltMap get directMap; + + @nullable + @BuiltValueField(wireName: r'indirect_map') + BuiltMap get indirectMap; + + // Boilerplate code needed to wire-up generated code + MapTest._(); + + factory MapTest([updates(MapTestBuilder b)]) = _$MapTest; + static Serializer get serializer => _$mapTestSerializer; +} + +class MapTestMapOfEnumString extends EnumClass { + + @BuiltValueEnumConst(wireName: 'UPPER') + static const MapTestMapOfEnumString uPPER = _$uPPER; + @BuiltValueEnumConst(wireName: 'lower') + static const MapTestMapOfEnumString lower = _$lower; + + static Serializer get serializer => _$mapTestMapOfEnumStringSerializer; + + const MapTestMapOfEnumString._(String name): super(name); + + static BuiltSet get values => _$mapTestMapOfEnumStringValues; + static MapTestMapOfEnumString valueOf(String name) => _$mapTestMapOfEnumStringValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 00000000000..f8f57817314 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,29 @@ +import 'package:openapi/model/animal.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +abstract class MixedPropertiesAndAdditionalPropertiesClass implements Built { + + + @nullable + @BuiltValueField(wireName: r'uuid') + String get uuid; + + @nullable + @BuiltValueField(wireName: r'dateTime') + DateTime get dateTime; + + @nullable + @BuiltValueField(wireName: r'map') + BuiltMap get map; + + // Boilerplate code needed to wire-up generated code + MixedPropertiesAndAdditionalPropertiesClass._(); + + factory MixedPropertiesAndAdditionalPropertiesClass([updates(MixedPropertiesAndAdditionalPropertiesClassBuilder b)]) = _$MixedPropertiesAndAdditionalPropertiesClass; + static Serializer get serializer => _$mixedPropertiesAndAdditionalPropertiesClassSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model200_response.dart new file mode 100644 index 00000000000..1a3c2363b40 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model200_response.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model200_response.g.dart'; + +abstract class Model200Response implements Built { + + + @nullable + @BuiltValueField(wireName: r'name') + int get name; + + @nullable + @BuiltValueField(wireName: r'class') + String get class_; + + // Boilerplate code needed to wire-up generated code + Model200Response._(); + + factory Model200Response([updates(Model200ResponseBuilder b)]) = _$Model200Response; + static Serializer get serializer => _$n200responseSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_return.dart new file mode 100644 index 00000000000..679b5eef063 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_return.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_return.g.dart'; + +abstract class ModelReturn implements Built { + + + @nullable + @BuiltValueField(wireName: r'return') + int get return_; + + // Boilerplate code needed to wire-up generated code + ModelReturn._(); + + factory ModelReturn([updates(ModelReturnBuilder b)]) = _$ModelReturn; + static Serializer get serializer => _$return_Serializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/name.dart new file mode 100644 index 00000000000..958619cfe08 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/name.dart @@ -0,0 +1,31 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'name.g.dart'; + +abstract class Name implements Built { + + + @nullable + @BuiltValueField(wireName: r'name') + int get name; + + @nullable + @BuiltValueField(wireName: r'snake_case') + int get snakeCase; + + @nullable + @BuiltValueField(wireName: r'property') + String get property; + + @nullable + @BuiltValueField(wireName: r'123Number') + int get n123number; + + // Boilerplate code needed to wire-up generated code + Name._(); + + factory Name([updates(NameBuilder b)]) = _$Name; + static Serializer get serializer => _$nameSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/nullable_class.dart new file mode 100644 index 00000000000..d0594cab0a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/nullable_class.dart @@ -0,0 +1,65 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'nullable_class.g.dart'; + +abstract class NullableClass implements Built { + + + @nullable + @BuiltValueField(wireName: r'integer_prop') + int get integerProp; + + @nullable + @BuiltValueField(wireName: r'number_prop') + num get numberProp; + + @nullable + @BuiltValueField(wireName: r'boolean_prop') + bool get booleanProp; + + @nullable + @BuiltValueField(wireName: r'string_prop') + String get stringProp; + + @nullable + @BuiltValueField(wireName: r'date_prop') + DateTime get dateProp; + + @nullable + @BuiltValueField(wireName: r'datetime_prop') + DateTime get datetimeProp; + + @nullable + @BuiltValueField(wireName: r'array_nullable_prop') + BuiltList get arrayNullableProp; + + @nullable + @BuiltValueField(wireName: r'array_and_items_nullable_prop') + BuiltList get arrayAndItemsNullableProp; + + @nullable + @BuiltValueField(wireName: r'array_items_nullable') + BuiltList get arrayItemsNullable; + + @nullable + @BuiltValueField(wireName: r'object_nullable_prop') + BuiltMap get objectNullableProp; + + @nullable + @BuiltValueField(wireName: r'object_and_items_nullable_prop') + BuiltMap get objectAndItemsNullableProp; + + @nullable + @BuiltValueField(wireName: r'object_items_nullable') + BuiltMap get objectItemsNullable; + + // Boilerplate code needed to wire-up generated code + NullableClass._(); + + factory NullableClass([updates(NullableClassBuilder b)]) = _$NullableClass; + static Serializer get serializer => _$nullableClassSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/number_only.dart new file mode 100644 index 00000000000..e38815d4b94 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/number_only.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'number_only.g.dart'; + +abstract class NumberOnly implements Built { + + + @nullable + @BuiltValueField(wireName: r'JustNumber') + num get justNumber; + + // Boilerplate code needed to wire-up generated code + NumberOnly._(); + + factory NumberOnly([updates(NumberOnlyBuilder b)]) = _$NumberOnly; + static Serializer get serializer => _$numberOnlySerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/order.dart new file mode 100644 index 00000000000..700b6578821 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/order.dart @@ -0,0 +1,62 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +abstract class Order implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'petId') + int get petId; + + @nullable + @BuiltValueField(wireName: r'quantity') + int get quantity; + + @nullable + @BuiltValueField(wireName: r'shipDate') + DateTime get shipDate; + /* Order Status */ + @nullable + @BuiltValueField(wireName: r'status') + OrderStatus get status; + // enum statusEnum { placed, approved, delivered, }; + + @nullable + @BuiltValueField(wireName: r'complete') + bool get complete; + + // Boilerplate code needed to wire-up generated code + Order._(); + + factory Order([updates(OrderBuilder b)]) = _$Order; + static Serializer get serializer => _$orderSerializer; +} + +class OrderStatus extends EnumClass { + + /// Order Status + @BuiltValueEnumConst(wireName: 'placed') + static const OrderStatus placed = _$placed; + /// Order Status + @BuiltValueEnumConst(wireName: 'approved') + static const OrderStatus approved = _$approved; + /// Order Status + @BuiltValueEnumConst(wireName: 'delivered') + static const OrderStatus delivered = _$delivered; + + static Serializer get serializer => _$orderStatusSerializer; + + const OrderStatus._(String name): super(name); + + static BuiltSet get values => _$orderStatusValues; + static OrderStatus valueOf(String name) => _$orderStatusValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_composite.dart new file mode 100644 index 00000000000..dd60f4deb44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_composite.dart @@ -0,0 +1,27 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_composite.g.dart'; + +abstract class OuterComposite implements Built { + + + @nullable + @BuiltValueField(wireName: r'my_number') + num get myNumber; + + @nullable + @BuiltValueField(wireName: r'my_string') + String get myString; + + @nullable + @BuiltValueField(wireName: r'my_boolean') + bool get myBoolean; + + // Boilerplate code needed to wire-up generated code + OuterComposite._(); + + factory OuterComposite([updates(OuterCompositeBuilder b)]) = _$OuterComposite; + static Serializer get serializer => _$outerCompositeSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum.dart new file mode 100644 index 00000000000..05b0fc104ca --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum.dart @@ -0,0 +1,31 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum.g.dart'; + +class OuterEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: 'placed') + static const OuterEnum placed = _$placed; + @BuiltValueEnumConst(wireName: 'approved') + static const OuterEnum approved = _$approved; + @BuiltValueEnumConst(wireName: 'delivered') + static const OuterEnum delivered = _$delivered; + + static Serializer get serializer => _$outerEnumSerializer; + + const OuterEnum._(String name): super(name); + + static BuiltSet get values => _$values; + static OuterEnum valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumMixin = Object with _$OuterEnumMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart new file mode 100644 index 00000000000..b20b371e1d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -0,0 +1,31 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_default_value.g.dart'; + +class OuterEnumDefaultValue extends EnumClass { + + @BuiltValueEnumConst(wireName: 'placed') + static const OuterEnumDefaultValue placed = _$placed; + @BuiltValueEnumConst(wireName: 'approved') + static const OuterEnumDefaultValue approved = _$approved; + @BuiltValueEnumConst(wireName: 'delivered') + static const OuterEnumDefaultValue delivered = _$delivered; + + static Serializer get serializer => _$outerEnumDefaultValueSerializer; + + const OuterEnumDefaultValue._(String name): super(name); + + static BuiltSet get values => _$values; + static OuterEnumDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumDefaultValueMixin = Object with _$OuterEnumDefaultValueMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer.dart new file mode 100644 index 00000000000..00884670520 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer.dart @@ -0,0 +1,31 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer.g.dart'; + +class OuterEnumInteger extends EnumClass { + + @BuiltValueEnumConst(wireName: 0) + static const OuterEnumInteger number0 = _$number0; + @BuiltValueEnumConst(wireName: 1) + static const OuterEnumInteger number1 = _$number1; + @BuiltValueEnumConst(wireName: 2) + static const OuterEnumInteger number2 = _$number2; + + static Serializer get serializer => _$outerEnumIntegerSerializer; + + const OuterEnumInteger._(String name): super(name); + + static BuiltSet get values => _$values; + static OuterEnumInteger valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerMixin = Object with _$OuterEnumIntegerMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart new file mode 100644 index 00000000000..069c15d5f01 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -0,0 +1,31 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer_default_value.g.dart'; + +class OuterEnumIntegerDefaultValue extends EnumClass { + + @BuiltValueEnumConst(wireName: 0) + static const OuterEnumIntegerDefaultValue number0 = _$number0; + @BuiltValueEnumConst(wireName: 1) + static const OuterEnumIntegerDefaultValue number1 = _$number1; + @BuiltValueEnumConst(wireName: 2) + static const OuterEnumIntegerDefaultValue number2 = _$number2; + + static Serializer get serializer => _$outerEnumIntegerDefaultValueSerializer; + + const OuterEnumIntegerDefaultValue._(String name): super(name); + + static BuiltSet get values => _$values; + static OuterEnumIntegerDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerDefaultValueMixin = Object with _$OuterEnumIntegerDefaultValueMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart new file mode 100644 index 00000000000..cbd2317378f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart @@ -0,0 +1,64 @@ +import 'package:openapi/model/tag.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/model/category.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pet.g.dart'; + +abstract class Pet implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'category') + Category get category; + + @nullable + @BuiltValueField(wireName: r'name') + String get name; + + @nullable + @BuiltValueField(wireName: r'photoUrls') + BuiltList get photoUrls; + + @nullable + @BuiltValueField(wireName: r'tags') + BuiltList get tags; + /* pet status in the store */ + @nullable + @BuiltValueField(wireName: r'status') + PetStatus get status; + // enum statusEnum { available, pending, sold, }; + + // Boilerplate code needed to wire-up generated code + Pet._(); + + factory Pet([updates(PetBuilder b)]) = _$Pet; + static Serializer get serializer => _$petSerializer; +} + +class PetStatus extends EnumClass { + + /// pet status in the store + @BuiltValueEnumConst(wireName: 'available') + static const PetStatus available = _$available; + /// pet status in the store + @BuiltValueEnumConst(wireName: 'pending') + static const PetStatus pending = _$pending; + /// pet status in the store + @BuiltValueEnumConst(wireName: 'sold') + static const PetStatus sold = _$sold; + + static Serializer get serializer => _$petStatusSerializer; + + const PetStatus._(String name): super(name); + + static BuiltSet get values => _$petStatusValues; + static PetStatus valueOf(String name) => _$petStatusValueOf(name); +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/read_only_first.dart new file mode 100644 index 00000000000..abfa9f4408e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/read_only_first.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'read_only_first.g.dart'; + +abstract class ReadOnlyFirst implements Built { + + + @nullable + @BuiltValueField(wireName: r'bar') + String get bar; + + @nullable + @BuiltValueField(wireName: r'baz') + String get baz; + + // Boilerplate code needed to wire-up generated code + ReadOnlyFirst._(); + + factory ReadOnlyFirst([updates(ReadOnlyFirstBuilder b)]) = _$ReadOnlyFirst; + static Serializer get serializer => _$readOnlyFirstSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart new file mode 100644 index 00000000000..9d3dd4d7be7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -0,0 +1,19 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'special_model_name.g.dart'; + +abstract class SpecialModelName implements Built { + + + @nullable + @BuiltValueField(wireName: r'$special[property.name]') + int get $special[propertyName]; + + // Boilerplate code needed to wire-up generated code + SpecialModelName._(); + + factory SpecialModelName([updates(SpecialModelNameBuilder b)]) = _$SpecialModelName; + static Serializer get serializer => _$specialModelNameSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/tag.dart new file mode 100644 index 00000000000..6ff5d3eb3cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/tag.dart @@ -0,0 +1,23 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +abstract class Tag implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'name') + String get name; + + // Boilerplate code needed to wire-up generated code + Tag._(); + + factory Tag([updates(TagBuilder b)]) = _$Tag; + static Serializer get serializer => _$tagSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/user.dart new file mode 100644 index 00000000000..cf78ae941ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/user.dart @@ -0,0 +1,47 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +abstract class User implements Built { + + + @nullable + @BuiltValueField(wireName: r'id') + int get id; + + @nullable + @BuiltValueField(wireName: r'username') + String get username; + + @nullable + @BuiltValueField(wireName: r'firstName') + String get firstName; + + @nullable + @BuiltValueField(wireName: r'lastName') + String get lastName; + + @nullable + @BuiltValueField(wireName: r'email') + String get email; + + @nullable + @BuiltValueField(wireName: r'password') + String get password; + + @nullable + @BuiltValueField(wireName: r'phone') + String get phone; + /* User Status */ + @nullable + @BuiltValueField(wireName: r'userStatus') + int get userStatus; + + // Boilerplate code needed to wire-up generated code + User._(); + + factory User([updates(UserBuilder b)]) = _$User; + static Serializer get serializer => _$userSerializer; +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart new file mode 100644 index 00000000000..7c786d661ec --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart @@ -0,0 +1,270 @@ +library serializers; + +import 'package:built_value/iso_8601_date_time_serializer.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/standard_json_plugin.dart'; + +import 'package:openapi/model/additional_properties_class.dart'; +import 'package:openapi/model/animal.dart'; +import 'package:openapi/model/api_response.dart'; +import 'package:openapi/model/array_of_array_of_number_only.dart'; +import 'package:openapi/model/array_of_number_only.dart'; +import 'package:openapi/model/array_test.dart'; +import 'package:openapi/model/capitalization.dart'; +import 'package:openapi/model/cat.dart'; +import 'package:openapi/model/cat_all_of.dart'; +import 'package:openapi/model/category.dart'; +import 'package:openapi/model/class_model.dart'; +import 'package:openapi/model/client.dart'; +import 'package:openapi/model/dog.dart'; +import 'package:openapi/model/dog_all_of.dart'; +import 'package:openapi/model/enum_arrays.dart'; +import 'package:openapi/model/enum_class.dart'; +import 'package:openapi/model/enum_test.dart'; +import 'package:openapi/model/file.dart'; +import 'package:openapi/model/file_schema_test_class.dart'; +import 'package:openapi/model/foo.dart'; +import 'package:openapi/model/format_test.dart'; +import 'package:openapi/model/has_only_read_only.dart'; +import 'package:openapi/model/health_check_result.dart'; +import 'package:openapi/model/inline_object.dart'; +import 'package:openapi/model/inline_object1.dart'; +import 'package:openapi/model/inline_object2.dart'; +import 'package:openapi/model/inline_object3.dart'; +import 'package:openapi/model/inline_object4.dart'; +import 'package:openapi/model/inline_object5.dart'; +import 'package:openapi/model/inline_response_default.dart'; +import 'package:openapi/model/list.dart'; +import 'package:openapi/model/map_test.dart'; +import 'package:openapi/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/model/model200_response.dart'; +import 'package:openapi/model/model_return.dart'; +import 'package:openapi/model/name.dart'; +import 'package:openapi/model/nullable_class.dart'; +import 'package:openapi/model/number_only.dart'; +import 'package:openapi/model/order.dart'; +import 'package:openapi/model/outer_composite.dart'; +import 'package:openapi/model/outer_enum.dart'; +import 'package:openapi/model/outer_enum_default_value.dart'; +import 'package:openapi/model/outer_enum_integer.dart'; +import 'package:openapi/model/outer_enum_integer_default_value.dart'; +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/read_only_first.dart'; +import 'package:openapi/model/special_model_name.dart'; +import 'package:openapi/model/tag.dart'; +import 'package:openapi/model/user.dart'; + + +part 'serializers.g.dart'; + +@SerializersFor(const [ +AdditionalPropertiesClass, +Animal, +ApiResponse, +ArrayOfArrayOfNumberOnly, +ArrayOfNumberOnly, +ArrayTest, +Capitalization, +Cat, +CatAllOf, +Category, +ClassModel, +Client, +Dog, +DogAllOf, +EnumArrays, +EnumClass, +EnumTest, +File, +FileSchemaTestClass, +Foo, +FormatTest, +HasOnlyReadOnly, +HealthCheckResult, +InlineObject, +InlineObject1, +InlineObject2, +InlineObject3, +InlineObject4, +InlineObject5, +InlineResponseDefault, +List, +MapTest, +MixedPropertiesAndAdditionalPropertiesClass, +Model200Response, +ModelReturn, +Name, +NullableClass, +NumberOnly, +Order, +OuterComposite, +OuterEnum, +OuterEnumDefaultValue, +OuterEnumInteger, +OuterEnumIntegerDefaultValue, +Pet, +ReadOnlyFirst, +SpecialModelName, +Tag, +User, + +]) + +//allow all models to be serialized within a list +Serializers serializers = (_$serializers.toBuilder() +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(AdditionalPropertiesClass)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Animal)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ApiResponse)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ArrayOfArrayOfNumberOnly)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ArrayOfNumberOnly)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ArrayTest)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Capitalization)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Cat)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(CatAllOf)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Category)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ClassModel)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Client)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Dog)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(DogAllOf)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(EnumArrays)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(EnumClass)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(EnumTest)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(File)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(FileSchemaTestClass)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Foo)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(FormatTest)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(HasOnlyReadOnly)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(HealthCheckResult)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject1)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject2)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject3)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject4)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineObject5)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(InlineResponseDefault)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(List)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(MapTest)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(MixedPropertiesAndAdditionalPropertiesClass)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Model200Response)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ModelReturn)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Name)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(NullableClass)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(NumberOnly)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Order)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(OuterComposite)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(OuterEnum)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(OuterEnumDefaultValue)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(OuterEnumInteger)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(OuterEnumIntegerDefaultValue)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Pet)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ReadOnlyFirst)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(SpecialModelName)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Tag)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(User)]), +() => new ListBuilder()) + +..add(Iso8601DateTimeSerializer()) +).build(); + +Serializers standardSerializers = +(serializers.toBuilder() +..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pom.xml new file mode 100644 index 00000000000..a37f8b9b5e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pom.xml @@ -0,0 +1,88 @@ + + 4.0.0 + org.openapitools + DartDioPetstoreClientLibFakeTests + pom + 1.0.0-SNAPSHOT + DartDio Petstore Client Lib Fake + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-run-build-runner + pre-integration-test + + exec + + + pub + + run + build_runner + build + + + + + pub-test + integration-test + + exec + + + pub + + run + test + + + + + + + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml new file mode 100644 index 00000000000..20b190aa1d3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/pubspec.yaml @@ -0,0 +1,14 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: ">=2.3.0 <3.0.0" +dependencies: + dio: ^3.0.9 + built_value: ^7.1.0 + built_collection: ^4.3.2 +dev_dependencies: + built_value_generator: ^7.1.0 + build_runner: ^1.7.1 + test: ^1.3.0 + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/additional_properties_class_test.dart new file mode 100644 index 00000000000..cf1888a7461 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/additional_properties_class_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/additional_properties_class.dart'; +import 'package:test/test.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClass(); + + group(AdditionalPropertiesClass, () { + // BuiltMap mapProperty (default value: const {}) + test('to test the property `mapProperty`', () async { + // TODO + }); + + // BuiltMap> mapOfMapProperty (default value: const {}) + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/animal_test.dart new file mode 100644 index 00000000000..bae2d856b6c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/animal_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/animal.dart'; +import 'package:test/test.dart'; + +// tests for Animal +void main() { + final instance = Animal(); + + group(Animal, () { + // String className (default value: null) + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/another_fake_api_test.dart new file mode 100644 index 00000000000..aa85d074c12 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/another_fake_api_test.dart @@ -0,0 +1,21 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/another_fake_api.dart'; +import 'package:test/test.dart'; + + +/// tests for AnotherFakeApi +void main() { + final instance = Openapi().getAnotherFakeApi(); + + group(AnotherFakeApi, () { + // To test special tags + // + // To test special tags and operation ID starting with number + // + //Future 123test@$%SpecialTags(Client client) async + test('test 123test@$%SpecialTags', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/api_response_test.dart new file mode 100644 index 00000000000..d80b2976160 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/api_response_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/model/api_response.dart'; +import 'package:test/test.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponse(); + + group(ApiResponse, () { + // int code (default value: null) + test('to test the property `code`', () async { + // TODO + }); + + // String type (default value: null) + test('to test the property `type`', () async { + // TODO + }); + + // String message (default value: null) + test('to test the property `message`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart new file mode 100644 index 00000000000..e7384400a22 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/array_of_array_of_number_only.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnly(); + + group(ArrayOfArrayOfNumberOnly, () { + // BuiltList> arrayArrayNumber (default value: const []) + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_number_only_test.dart new file mode 100644 index 00000000000..f40a137a8d2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_of_number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/array_of_number_only.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnly(); + + group(ArrayOfNumberOnly, () { + // BuiltList arrayNumber (default value: const []) + test('to test the property `arrayNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_test_test.dart new file mode 100644 index 00000000000..f8059a850cc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/array_test_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/model/array_test.dart'; +import 'package:test/test.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTest(); + + group(ArrayTest, () { + // BuiltList arrayOfString (default value: const []) + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfInteger (default value: const []) + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfModel (default value: const []) + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/capitalization_test.dart new file mode 100644 index 00000000000..304df4d82af --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/model/capitalization.dart'; +import 'package:test/test.dart'; + +// tests for Capitalization +void main() { + final instance = Capitalization(); + + group(Capitalization, () { + // String smallCamel (default value: null) + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel (default value: null) + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake (default value: null) + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake (default value: null) + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints (default value: null) + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME (default value: null) + test('to test the property `ATT_NAME`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_all_of_test.dart new file mode 100644 index 00000000000..b8e84359a30 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_all_of_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/cat_all_of.dart'; +import 'package:test/test.dart'; + +// tests for CatAllOf +void main() { + final instance = CatAllOf(); + + group(CatAllOf, () { + // bool declawed (default value: null) + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_test.dart new file mode 100644 index 00000000000..a066e555492 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/cat_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/model/cat.dart'; +import 'package:test/test.dart'; + +// tests for Cat +void main() { + final instance = Cat(); + + group(Cat, () { + // String className (default value: null) + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed (default value: null) + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/category_test.dart new file mode 100644 index 00000000000..4ef34fea723 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/category_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/category.dart'; +import 'package:test/test.dart'; + +// tests for Category +void main() { + final instance = Category(); + + group(Category, () { + // int id (default value: null) + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/class_model_test.dart new file mode 100644 index 00000000000..d8daf6f70dd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/class_model_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/class_model.dart'; +import 'package:test/test.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModel(); + + group(ClassModel, () { + // String class_ (default value: null) + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/client_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/client_test.dart new file mode 100644 index 00000000000..135d8cca032 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/client_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/client.dart'; +import 'package:test/test.dart'; + +// tests for Client +void main() { + final instance = Client(); + + group(Client, () { + // String client (default value: null) + test('to test the property `client`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/default_api_test.dart new file mode 100644 index 00000000000..408b570c494 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/default_api.dart'; +import 'package:test/test.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_all_of_test.dart new file mode 100644 index 00000000000..4f208c95b6f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_all_of_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/dog_all_of.dart'; +import 'package:test/test.dart'; + +// tests for DogAllOf +void main() { + final instance = DogAllOf(); + + group(DogAllOf, () { + // String breed (default value: null) + test('to test the property `breed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_test.dart new file mode 100644 index 00000000000..6042386f178 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/dog_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/model/dog.dart'; +import 'package:test/test.dart'; + +// tests for Dog +void main() { + final instance = Dog(); + + group(Dog, () { + // String className (default value: null) + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed (default value: null) + test('to test the property `breed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_arrays_test.dart new file mode 100644 index 00000000000..5c8b0da4c05 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_arrays_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/enum_arrays.dart'; +import 'package:test/test.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArrays(); + + group(EnumArrays, () { + // String justSymbol (default value: null) + test('to test the property `justSymbol`', () async { + // TODO + }); + + // BuiltList arrayEnum (default value: const []) + test('to test the property `arrayEnum`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_class_test.dart new file mode 100644 index 00000000000..c99bebb5370 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_class_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/model/enum_class.dart'; +import 'package:test/test.dart'; + +// tests for EnumClass +void main() { + + group(EnumClass, () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_test_test.dart new file mode 100644 index 00000000000..3565cb937a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/enum_test_test.dart @@ -0,0 +1,52 @@ +import 'package:openapi/model/enum_test.dart'; +import 'package:test/test.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTest(); + + group(EnumTest, () { + // String enumString (default value: null) + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired (default value: null) + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger (default value: null) + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber (default value: null) + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum (default value: null) + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger (default value: null) + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue (default value: null) + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue (default value: null) + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart new file mode 100644 index 00000000000..1450145c2ab --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,123 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/fake_api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeApi +void main() { + final instance = Openapi().getFakeApi(); + + group(FakeApi, () { + // Health check endpoint + // + //Future fakeHealthGet() async + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // For this test, the body for this request much reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(Client client) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, Uint8List binary, DateTime date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart new file mode 100644 index 00000000000..b13dc103ba1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,21 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/fake_classname_tags123_api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeClassnameTags123Api +void main() { + final instance = Openapi().getFakeClassnameTags123Api(); + + group(FakeClassnameTags123Api, () { + // To test class name in snake case + // + // To test class name in snake case + // + //Future testClassname(Client client) async + test('test testClassname', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_schema_test_class_test.dart new file mode 100644 index 00000000000..3dac8bab3af --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_schema_test_class_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/file_schema_test_class.dart'; +import 'package:test/test.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClass(); + + group(FileSchemaTestClass, () { + // MultipartFile file (default value: null) + test('to test the property `file`', () async { + // TODO + }); + + // BuiltList files (default value: const []) + test('to test the property `files`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_test.dart new file mode 100644 index 00000000000..77177e13035 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/file_test.dart @@ -0,0 +1,18 @@ +import 'package:openapi/model/file.dart'; +import 'package:test/test.dart'; + +// tests for File +void main() { + final instance = File(); + + group(File, () { + // Test capitalization + // String sourceURI (default value: null) + test('to test the property `sourceURI`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_test.dart new file mode 100644 index 00000000000..c788dd3a3c9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/foo.dart'; +import 'package:test/test.dart'; + +// tests for Foo +void main() { + final instance = Foo(); + + group(Foo, () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart new file mode 100644 index 00000000000..4850f7618fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart @@ -0,0 +1,94 @@ +import 'package:openapi/model/format_test.dart'; +import 'package:test/test.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTest(); + + group(FormatTest, () { + // int integer (default value: null) + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 (default value: null) + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 (default value: null) + test('to test the property `int64`', () async { + // TODO + }); + + // num number (default value: null) + test('to test the property `number`', () async { + // TODO + }); + + // double float (default value: null) + test('to test the property `float`', () async { + // TODO + }); + + // double double (default value: null) + test('to test the property `double`', () async { + // TODO + }); + + // Decimal decimal (default value: null) + test('to test the property `decimal`', () async { + // TODO + }); + + // String string (default value: null) + test('to test the property `string`', () async { + // TODO + }); + + // String byte (default value: null) + test('to test the property `byte`', () async { + // TODO + }); + + // Uint8List binary (default value: null) + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date (default value: null) + test('to test the property `date`', () async { + // TODO + }); + + // DateTime dateTime (default value: null) + test('to test the property `dateTime`', () async { + // TODO + }); + + // String uuid (default value: null) + test('to test the property `uuid`', () async { + // TODO + }); + + // String password (default value: null) + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits (default value: null) + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter (default value: null) + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/has_only_read_only_test.dart new file mode 100644 index 00000000000..4a6bfc857dd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/has_only_read_only_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/has_only_read_only.dart'; +import 'package:test/test.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnly(); + + group(HasOnlyReadOnly, () { + // String bar (default value: null) + test('to test the property `bar`', () async { + // TODO + }); + + // String foo (default value: null) + test('to test the property `foo`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/health_check_result_test.dart new file mode 100644 index 00000000000..fb5896b660d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/health_check_result_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/health_check_result.dart'; +import 'package:test/test.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResult(); + + group(HealthCheckResult, () { + // String nullableMessage (default value: null) + test('to test the property `nullableMessage`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object1_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object1_test.dart new file mode 100644 index 00000000000..e1fa552bdaa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object1_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object1.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject1 +void main() { + final instance = InlineObject1(); + + group(InlineObject1, () { + // Additional data to pass to server + // String additionalMetadata (default value: null) + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // Uint8List file (default value: null) + test('to test the property `file`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object2_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object2_test.dart new file mode 100644 index 00000000000..b79ae66b097 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object2_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object2.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject2 +void main() { + final instance = InlineObject2(); + + group(InlineObject2, () { + // Form parameter enum test (string array) + // BuiltList enumFormStringArray (default value: const []) + test('to test the property `enumFormStringArray`', () async { + // TODO + }); + + // Form parameter enum test (string) + // String enumFormString (default value: '-efg') + test('to test the property `enumFormString`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart new file mode 100644 index 00000000000..43c7490c444 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart @@ -0,0 +1,96 @@ +import 'package:openapi/model/inline_object3.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject3 +void main() { + final instance = InlineObject3(); + + group(InlineObject3, () { + // None + // int integer (default value: null) + test('to test the property `integer`', () async { + // TODO + }); + + // None + // int int32 (default value: null) + test('to test the property `int32`', () async { + // TODO + }); + + // None + // int int64 (default value: null) + test('to test the property `int64`', () async { + // TODO + }); + + // None + // num number (default value: null) + test('to test the property `number`', () async { + // TODO + }); + + // None + // double float (default value: null) + test('to test the property `float`', () async { + // TODO + }); + + // None + // double double (default value: null) + test('to test the property `double`', () async { + // TODO + }); + + // None + // String string (default value: null) + test('to test the property `string`', () async { + // TODO + }); + + // None + // String patternWithoutDelimiter (default value: null) + test('to test the property `patternWithoutDelimiter`', () async { + // TODO + }); + + // None + // String byte (default value: null) + test('to test the property `byte`', () async { + // TODO + }); + + // None + // Uint8List binary (default value: null) + test('to test the property `binary`', () async { + // TODO + }); + + // None + // DateTime date (default value: null) + test('to test the property `date`', () async { + // TODO + }); + + // None + // DateTime dateTime (default value: null) + test('to test the property `dateTime`', () async { + // TODO + }); + + // None + // String password (default value: null) + test('to test the property `password`', () async { + // TODO + }); + + // None + // String callback (default value: null) + test('to test the property `callback`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object4_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object4_test.dart new file mode 100644 index 00000000000..73c073efc0a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object4_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object4.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject4 +void main() { + final instance = InlineObject4(); + + group(InlineObject4, () { + // field1 + // String param (default value: null) + test('to test the property `param`', () async { + // TODO + }); + + // field2 + // String param2 (default value: null) + test('to test the property `param2`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object5_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object5_test.dart new file mode 100644 index 00000000000..4e4fb7e9229 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object5_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object5.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject5 +void main() { + final instance = InlineObject5(); + + group(InlineObject5, () { + // Additional data to pass to server + // String additionalMetadata (default value: null) + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // Uint8List requiredFile (default value: null) + test('to test the property `requiredFile`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object_test.dart new file mode 100644 index 00000000000..551c6a07d23 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/model/inline_object.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject +void main() { + final instance = InlineObject(); + + group(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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart new file mode 100644 index 00000000000..acf32ff97f9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/inline_response_default.dart'; +import 'package:test/test.dart'; + +// tests for InlineResponseDefault +void main() { + final instance = InlineResponseDefault(); + + group(InlineResponseDefault, () { + // Foo string (default value: null) + test('to test the property `string`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/list_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/list_test.dart new file mode 100644 index 00000000000..136abf20644 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/list_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/list.dart'; +import 'package:test/test.dart'; + +// tests for List +void main() { + final instance = List(); + + group(List, () { + // String n123list (default value: null) + test('to test the property `n123list`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/map_test_test.dart new file mode 100644 index 00000000000..90d2efc8805 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/map_test_test.dart @@ -0,0 +1,32 @@ +import 'package:openapi/model/map_test.dart'; +import 'package:test/test.dart'; + +// tests for MapTest +void main() { + final instance = MapTest(); + + group(MapTest, () { + // BuiltMap> mapMapOfString (default value: const {}) + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // BuiltMap mapOfEnumString (default value: const {}) + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // BuiltMap directMap (default value: const {}) + test('to test the property `directMap`', () async { + // TODO + }); + + // BuiltMap indirectMap (default value: const {}) + test('to test the property `indirectMap`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 00000000000..5e545881931 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:test/test.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClass(); + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid (default value: null) + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime (default value: null) + test('to test the property `dateTime`', () async { + // TODO + }); + + // BuiltMap map (default value: const {}) + test('to test the property `map`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model200_response_test.dart new file mode 100644 index 00000000000..8d91a2fb850 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model200_response_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/model200_response.dart'; +import 'package:test/test.dart'; + +// tests for Model200Response +void main() { + final instance = Model200Response(); + + group(Model200Response, () { + // int name (default value: null) + test('to test the property `name`', () async { + // TODO + }); + + // String class_ (default value: null) + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model_return_test.dart new file mode 100644 index 00000000000..2fc81f4da6c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/model_return_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/model_return.dart'; +import 'package:test/test.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturn(); + + group(ModelReturn, () { + // int return_ (default value: null) + test('to test the property `return_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/name_test.dart new file mode 100644 index 00000000000..cbc273245e9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/name_test.dart @@ -0,0 +1,32 @@ +import 'package:openapi/model/name.dart'; +import 'package:test/test.dart'; + +// tests for Name +void main() { + final instance = Name(); + + group(Name, () { + // int name (default value: null) + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase (default value: null) + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property (default value: null) + test('to test the property `property`', () async { + // TODO + }); + + // int n123number (default value: null) + test('to test the property `n123number`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/nullable_class_test.dart new file mode 100644 index 00000000000..8452f6d4be4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/nullable_class_test.dart @@ -0,0 +1,72 @@ +import 'package:openapi/model/nullable_class.dart'; +import 'package:test/test.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClass(); + + group(NullableClass, () { + // int integerProp (default value: null) + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp (default value: null) + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp (default value: null) + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp (default value: null) + test('to test the property `stringProp`', () async { + // TODO + }); + + // DateTime dateProp (default value: null) + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp (default value: null) + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // BuiltList arrayNullableProp (default value: const []) + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // BuiltList arrayAndItemsNullableProp (default value: const []) + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltList arrayItemsNullable (default value: const []) + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // BuiltMap objectNullableProp (default value: const {}) + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // BuiltMap objectAndItemsNullableProp (default value: const {}) + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltMap objectItemsNullable (default value: const {}) + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/number_only_test.dart new file mode 100644 index 00000000000..0b905011687 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/number_only.dart'; +import 'package:test/test.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnly(); + + group(NumberOnly, () { + // num justNumber (default value: null) + test('to test the property `justNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/order_test.dart new file mode 100644 index 00000000000..ea9ac6e14eb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/order_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/model/order.dart'; +import 'package:test/test.dart'; + +// tests for Order +void main() { + final instance = Order(); + + group(Order, () { + // int id (default value: null) + test('to test the property `id`', () async { + // TODO + }); + + // int petId (default value: null) + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity (default value: null) + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate (default value: null) + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status (default value: null) + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_composite_test.dart new file mode 100644 index 00000000000..b6231d10498 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_composite_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/model/outer_composite.dart'; +import 'package:test/test.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterComposite(); + + group(OuterComposite, () { + // num myNumber (default value: null) + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString (default value: null) + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean (default value: null) + test('to test the property `myBoolean`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_default_value_test.dart new file mode 100644 index 00000000000..6d52fa338b0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_default_value_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/model/outer_enum_default_value.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group(OuterEnumDefaultValue, () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 00000000000..7b9bcbfa6ae --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/model/outer_enum_integer_default_value.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group(OuterEnumIntegerDefaultValue, () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_test.dart new file mode 100644 index 00000000000..d56e7e16554 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_integer_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/model/outer_enum_integer.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumInteger +void main() { + + group(OuterEnumInteger, () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_test.dart new file mode 100644 index 00000000000..40d43920465 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_enum_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/model/outer_enum.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnum +void main() { + + group(OuterEnum, () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart new file mode 100644 index 00000000000..a576981450b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart @@ -0,0 +1,81 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/pet_api.dart'; +import 'package:test/test.dart'; + + +/// tests for PetApi +void main() { + final instance = Openapi().getPetApi(); + + group(PetApi, () { + // Add a new pet to the store + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(List tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + //Future uploadFile(int petId, { String additionalMetadata, Uint8List file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + //Future uploadFileWithRequiredFile(int petId, Uint8List requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart new file mode 100644 index 00000000000..63cfc070e93 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/model/pet.dart'; +import 'package:test/test.dart'; + +// tests for Pet +void main() { + final instance = Pet(); + + group(Pet, () { + // int id (default value: null) + test('to test the property `id`', () async { + // TODO + }); + + // Category category (default value: null) + test('to test the property `category`', () async { + // TODO + }); + + // String name (default value: null) + test('to test the property `name`', () async { + // TODO + }); + + // BuiltList photoUrls (default value: const []) + test('to test the property `photoUrls`', () async { + // TODO + }); + + // BuiltList tags (default value: const []) + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status (default value: null) + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/read_only_first_test.dart new file mode 100644 index 00000000000..3c69d593aca --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/read_only_first_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/read_only_first.dart'; +import 'package:test/test.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirst(); + + group(ReadOnlyFirst, () { + // String bar (default value: null) + test('to test the property `bar`', () async { + // TODO + }); + + // String baz (default value: null) + test('to test the property `baz`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart new file mode 100644 index 00000000000..5747c9d1b67 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/model/special_model_name.dart'; +import 'package:test/test.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelName(); + + group(SpecialModelName, () { + // int $special[propertyName] (default value: null) + test('to test the property `$special[propertyName]`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart new file mode 100644 index 00000000000..ae64309d973 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/store_api_test.dart @@ -0,0 +1,46 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/store_api.dart'; +import 'package:test/test.dart'; + + +/// tests for StoreApi +void main() { + final instance = Openapi().getStoreApi(); + + group(StoreApi, () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/tag_test.dart new file mode 100644 index 00000000000..c2757a71863 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/tag_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/model/tag.dart'; +import 'package:test/test.dart'; + +// tests for Tag +void main() { + final instance = Tag(); + + group(Tag, () { + // int id (default value: null) + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: null) + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart new file mode 100644 index 00000000000..9377f97e3c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_api_test.dart @@ -0,0 +1,74 @@ +import 'package:openapi/api.dart'; +import 'package:openapi/api/user_api.dart'; +import 'package:test/test.dart'; + + +/// tests for UserApi +void main() { + final instance = Openapi().getUserApi(); + + group(UserApi, () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_test.dart new file mode 100644 index 00000000000..b598e7f7fef --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/user_test.dart @@ -0,0 +1,53 @@ +import 'package:openapi/model/user.dart'; +import 'package:test/test.dart'; + +// tests for User +void main() { + final instance = User(); + + group(User, () { + // int id (default value: null) + test('to test the property `id`', () async { + // TODO + }); + + // String username (default value: null) + test('to test the property `username`', () async { + // TODO + }); + + // String firstName (default value: null) + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName (default value: null) + test('to test the property `lastName`', () async { + // TODO + }); + + // String email (default value: null) + test('to test the property `email`', () async { + // TODO + }); + + // String password (default value: null) + test('to test the property `password`', () async { + // TODO + }); + + // String phone (default value: null) + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus (default value: null) + test('to test the property `userStatus`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/.analysis_options b/samples/openapi3/client/petstore/dart2/petstore/.analysis_options new file mode 100644 index 00000000000..a10d4c5a05c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true diff --git a/samples/openapi3/client/petstore/dart2/petstore/README.md b/samples/openapi3/client/petstore/dart2/petstore/README.md new file mode 100644 index 00000000000..2139c301745 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/README.md @@ -0,0 +1,37 @@ +# Background + +## Current state of tests + +TL;DR currently the only tests are e2e tests that were adapted to use a faked http client. While pushing data around as a smoke test has some value, more testing is required. In particular we need comprehensive unit/integration tests. + +- an old set of e2e tests are skipped for CI, as they hit a live endpoint and so are inherently flaky + - `pet_test.dart` + - `store_test.dart` + - `user_test.dart` +- the above set of tests were adapted to use a faked http client + - the tests are not really well suited to being used with a stubbed client, many are basically just testing the endpoint logic + - while not a great set of tests, they do have some value as a smoke test for template changes +- the adapted tests and files that contain test data: + - `pet_test_fake_client.dart` + - `store_test_fake_client.dart` + - `user_test_fake_client.dart` + - `fake_client.dart` + - `file_upload_response.json` + +## Assumptions + +- the tests will be run as part of CI and so have access to dart:io + +# Running + +## If not already done, resolve dependencies + +`pub get` + +## To run tests in a single file: + +`pub run test test/pet_test.dart` + +## To run all tests in the test folder: + +`pub run test` diff --git a/samples/openapi3/client/petstore/dart2/petstore/pom.xml b/samples/openapi3/client/petstore/dart2/petstore/pom.xml new file mode 100644 index 00000000000..c4ce7b4d68e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + org.openapitools + Dart2PetstoreClientTests + pom + 1.0.0-SNAPSHOT + Dart2 Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + test + + + + + + + + diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml new file mode 100644 index 00000000000..f2630175093 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml @@ -0,0 +1,13 @@ +name: petstore_client +version: 1.0.0 +description: Petstore client using OpenAPI library +environment: + sdk: '>=2.5.0 <3.0.0' +dependencies: + openapi: + path: ../petstore_client_lib +dev_dependencies: + test: ^1.8.0 + mockito: ^4.1.1 + http: ^0.12.0 + collection: ^1.14.12 diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart b/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart new file mode 100644 index 00000000000..95c735deb38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart @@ -0,0 +1,133 @@ +import 'dart:convert'; + +import 'package:collection/collection.dart'; +import 'package:http/http.dart'; +import 'package:mockito/mockito.dart'; + +/// A fake client that checks for expected values and returns given responses +/// +/// Checks for the expected values (url, headers, body) and throws if not found +/// +/// If exception is non-null the request will throw the exception, after other +/// checks are performed +class FakeClient extends Fake implements Client { + FakeClient({ + this.throwException, + this.expectedPostRequestBody, + this.postResponseBody, + this.expectedGetRequestBody, + this.getResponseBody, + this.deleteResponseBody, + this.expectedPutRequestBody, + this.putResponseBody, + this.sendResponseBody, + this.expectedUrl, + this.expectedHeaders = null, + }); + + Exception throwException; + Object expectedPostRequestBody; + String postResponseBody; + String expectedGetRequestBody; + String getResponseBody; + String deleteResponseBody; + String expectedPutRequestBody; + String putResponseBody; + String sendResponseBody; + String expectedUrl; + Map expectedHeaders; + + @override + Future post(url, + {Map headers, body, Encoding encoding}) async { + // check that the request was made with expected values + if (url != expectedUrl) { + throw StateError( + 'POST was called with unexpected url: ${url} should be ${expectedUrl}'); + } + if (!MapEquality().equals(headers, expectedHeaders)) { + throw StateError( + 'POST was called with unexpected headers: ${headers} should be ${expectedHeaders}'); + } + // currently we only expect Map (and subtypes) or Strings + if (body is Map) { + if (!MapEquality().equals(body, expectedPostRequestBody)) { + throw StateError( + 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}'); + } + } else if (body != expectedPostRequestBody) { + throw StateError( + 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}'); + } + + // throw if set to throw + if (throwException != null) throw throwException; + + return Response(postResponseBody, 200); + } + + @override + Future get(url, {Map headers}) async { + // check that the request was made with expected values + if (url != expectedUrl) { + throw StateError( + 'GET was called with unexpected url: ${url} should be ${expectedUrl}'); + } + if (!MapEquality().equals(headers, expectedHeaders)) { + throw StateError( + 'GET was called with unexpected headers: ${headers} should be ${expectedHeaders}'); + } + + // throw if set to throw + if (throwException != null) throw throwException; + + return Response(getResponseBody, 200); + } + + @override + Future delete(url, {Map headers}) async { + // check that the request was made with expected values + if (url != expectedUrl) { + throw StateError( + 'DELETE was called with unexpected url: ${url} should be ${expectedUrl}'); + } + if (!MapEquality().equals(headers, expectedHeaders)) { + throw StateError( + 'DELETE was called with unexpected headers: ${headers} should be ${expectedHeaders}'); + } + + // throw if set to throw + if (throwException != null) throw throwException; + + return Response(deleteResponseBody, 200); + } + + @override + Future put(url, + {Map headers, body, Encoding encoding}) async { + // check that the request was made with expected values + if (url != expectedUrl) { + throw StateError( + 'PUT was called with unexpected url: ${url} should be ${expectedUrl}'); + } + if (!MapEquality().equals(headers, expectedHeaders)) { + throw StateError( + 'PUT was called with unexpected headers: ${headers} should be ${expectedHeaders}'); + } + if (body != expectedPutRequestBody) { + throw StateError( + 'PUT was called with unexpected body: ${body} should be ${expectedPutRequestBody}'); + } + + // throw if set to throw + if (throwException != null) throw throwException; + + return Response(putResponseBody, 200); + } + + @override + Future send(BaseRequest request) async { + List bytes = utf8.encode(sendResponseBody); + return StreamedResponse(Stream.fromIterable([bytes]), 200); + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json b/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json new file mode 100644 index 00000000000..8855b00d9e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json @@ -0,0 +1 @@ +{"code":200,"type":"unknown","message":"additionalMetadata: \nFile uploaded to ./null, 4 bytes"} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json b/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json new file mode 100644 index 00000000000..b4388d1e7b3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json @@ -0,0 +1 @@ +{"mine":1,"sold":18,"string":568,"Dead":2,"test":2,"Nonavailable":1,"custom":3,"pending":20,"available":2212,"notAvailable":26,"avaiflable":1,"AVAILABLE":1,"swimming":1,"availablee":2,"success":1,"105":1,"missing":11,"disabled":1,"Available":1,"]]>":1} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart new file mode 100644 index 00000000000..9cdc65fe52d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart @@ -0,0 +1,9 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +void main() { + test('Check if default value is generated', () async { + var order = Order(); + expect(order.complete, equals(false)); + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart new file mode 100644 index 00000000000..41f66951484 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart @@ -0,0 +1,242 @@ +import 'dart:io'; +import 'dart:math'; + +import 'package:http/http.dart'; +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'fake_client.dart'; +import 'random_id.dart'; + +void main() { + final petApi = PetApi(); + + Pet makePet({ + int id = 1234, + String name = 'Fluffy', + String status = '', + }) { + final category = Category() + ..id = 1234 + ..name = 'eyeColor'; + final tags = [ + Tag() + ..id = 1234 + ..name = 'New York', + Tag() + ..id = 124321 + ..name = 'Jose' + ]; + return Pet() + ..id = id + ..category = category + ..tags = tags + ..name = name + ..status = PetStatusEnum.fromJson(status) + ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; + } + + /// Setup the fake client then call [petApi.addPet] + Future addPet(Pet pet) { + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(pet), + postResponseBody: petApi.apiClient.serialize(pet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + return petApi.addPet(pet); + } + + group('Pet API with faked client', () { + test('adds a new pet and gets it by id', () async { + final id = newId(); + final newPet = makePet(id: id); + + // use the pet api to add a pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + await petApi.addPet(newPet); + + // retrieve the same pet by id + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + getResponseBody: petApi.apiClient.serialize(newPet), + ); + final retrievedPet = await petApi.getPetById(id); + + // check that the retrieved id is as expected + expect(retrievedPet.id, equals(id)); + }); + + test('doesn\'t get non-existing pet by id', () { + final id = newId(); + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + throwException: ApiException(400, 'not found'), + ); + expect( + petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + }); + + test('deletes existing pet by id', () async { + final id = newId(); + Pet newPet = makePet(id: id); + + // add a new pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + await petApi.addPet(newPet); + + // delete the pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + expectedHeaders: { + 'api_key': 'special-key' + }, + deleteResponseBody: '', + ); + await petApi.deletePet(id, apiKey: 'special-key'); + + // check for the deleted pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + throwException: ApiException(400, 'Not found'), + ); + expect( + petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + }); + + test('updates pet with form', () async { + final id = newId(); + final newPet = makePet(id: id, name: 'Snowy'); + + // add a new pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + await petApi.addPet(newPet); + + final multipartRequest = MultipartRequest(null, null); + multipartRequest.fields['name'] = 'Doge'; + multipartRequest.fields['status'] = ''; + + // update with form + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + expectedHeaders: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + expectedPostRequestBody: {'name': 'Doge', 'status': ''}, + postResponseBody: '', + ); + await petApi.updatePetWithForm(id, name: 'Doge', status: ''); + + // check update worked + newPet.name = 'Doge'; + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + getResponseBody: petApi.apiClient.serialize(newPet), + ); + final pet = await petApi.getPetById(id); + expect(pet.name, equals('Doge')); + }); + + test('updates existing pet', () async { + final id = newId(); + final name = 'Snowy'; + final newPet = makePet(id: id); + final updatePet = makePet(id: id, name: name); + + // add a new pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + await petApi.addPet(newPet); + + // update the same pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPutRequestBody: petApi.apiClient.serialize(updatePet), + putResponseBody: petApi.apiClient.serialize(updatePet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + await petApi.updatePet(updatePet); + + // check update worked + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', + getResponseBody: petApi.apiClient.serialize(updatePet), + ); + final pet = await petApi.getPetById(id); + expect(pet.name, equals(name)); + }); + + test('finds pets by status', () async { + final id1 = newId(); + final id2 = newId(); + final id3 = newId(); + final status = PetStatusEnum.available_.value; + final pet1 = makePet(id: id1, status: status); + final pet2 = makePet(id: id2, status: status); + final pet3 = makePet(id: id3, status: PetStatusEnum.sold_.value); + + return Future.wait([addPet(pet1), addPet(pet2), addPet(pet3)]) + .then((_) async { + // retrieve pets by status + petApi.apiClient.client = FakeClient( + expectedUrl: + 'http://petstore.swagger.io/v2/pet/findByStatus?status=$status', + getResponseBody: petApi.apiClient.serialize([pet1, pet2]), + ); + final pets = await petApi.findPetsByStatus([status]); + + // tests serialisation and deserialisation of enum + final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available_); + expect(petsByStatus.length, equals(2)); + final petIds = pets.map((pet) => pet.id).toList(); + expect(petIds, contains(id1)); + expect(petIds, contains(id2)); + expect(petIds, isNot(contains(id3))); + }); + }); + + test('uploads a pet image', () async { + final id = newId(); + final newPet = makePet(id: id); + // get some test data (recorded from live response) + final uploadResponse = + await File('test/file_upload_response.json').readAsString(); + + // add a new pet + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: { 'Content-Type': 'application/json' } + ); + await petApi.addPet(newPet); + + petApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/pet', + sendResponseBody: uploadResponse, + ); + final file = + new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); + await petApi.uploadFile(id, additionalMetadata: '', file: file); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart new file mode 100644 index 00000000000..10a71acd9a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart @@ -0,0 +1,106 @@ +import 'dart:async'; + +import 'package:http/http.dart'; +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'random_id.dart'; + +void main() { + var petApi = PetApi(); + + Pet makePet({ + int id = 1234, + String name = 'Fluffy', + String status = '', + }) { + final category = Category() + ..id = 1234 + ..name = 'eyeColor'; + final tags = [ + Tag() + ..id = 1234 + ..name = 'New York', + Tag() + ..id = 124321 + ..name = 'Jose' + ]; + + return Pet( + id : id, + category: category, + name: name, //required field + tags: tags, + photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field + ) + ..status = PetStatusEnum.fromJson(status) + ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; + } + + group('Pet API with live client', () { + test('adds a new pet and gets it by id', () async { + var id = newId(); + await petApi.addPet(makePet(id: id)); + var pet = await petApi.getPetById(id); + expect(pet.id, equals(id)); + }); + + test('doesn\'t get non-existing pet by id', () { + expect(petApi.getPetById(newId()), + throwsA(equals(TypeMatcher()))); + }); + + test('deletes existing pet by id', () async { + var id = newId(); + await petApi.addPet(makePet(id: id)); + await petApi.deletePet(id, apiKey: 'special-key'); + expect( + petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + }); + + test('updates pet with form', () async { + var id = newId(); + + await petApi.addPet(makePet(id: id, name: 'Snowy')); + await petApi.updatePetWithForm(id, name: 'Doge', status: ''); + var pet = await petApi.getPetById(id); + expect(pet.name, equals('Doge')); + }); + + test('updates existing pet', () async { + var id = newId(); + var name = 'Snowy'; + + await petApi.addPet(makePet(id: id)); + await petApi.updatePet(makePet(id: id, name: name)); + var pet = await petApi.getPetById(id); + expect(pet.name, equals(name)); + }); + + test('finds pets by status', () async { + var id1 = newId(); + var id2 = newId(); + var id3 = newId(); + var status = PetStatusEnum.available_.value; + + return Future.wait([ + petApi.addPet(makePet(id: id1, status: status)), + petApi.addPet(makePet(id: id2, status: status)), + petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold_.value)) + ]).then((_) async { + var pets = await petApi.findPetsByStatus([status]); + var petIds = pets.map((pet) => pet.id).toList(); + expect(petIds, contains(id1)); + expect(petIds, contains(id2)); + expect(petIds, isNot(contains(id3))); + }); + }); + + test('uploads a pet image', () async { + var id = newId(); + await petApi.addPet(makePet(id: id)); + var file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); + await petApi.uploadFile(id, additionalMetadata: '', file: file); + }); + }, skip: 'e2e tests for CI'); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart b/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart new file mode 100644 index 00000000000..0457428c7dd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart @@ -0,0 +1,7 @@ +import 'dart:math'; + +final _random = new Random(); + +int newId() { + return _random.nextInt(999999); +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart new file mode 100644 index 00000000000..5ebdc63861d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart @@ -0,0 +1,89 @@ +import 'dart:io'; + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'fake_client.dart'; +import 'random_id.dart'; + +void main() { + var storeApi = new StoreApi(); + + Order makeOrder({int id}) { + return Order() + ..id = id + ..petId = 1234 + ..quantity = 1 + ..shipDate = DateTime.now() + ..status + ..complete = false; + } + + group('Store API with faked client', () { + test('places an order and gets it by id', () async { + // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. + // final id = newId(); + // final newOrder = makeOrder(id: id); + + // // use the store api to add an order + // storeApi.apiClient.client = FakeClient( + // expectedUrl: 'http://petstore.swagger.io/v2/store/order', + // expectedPostRequestBody: storeApi.apiClient.serialize(newOrder), + // postResponseBody: storeApi.apiClient.serialize(newOrder), + // expectedHeaders: {"Content-Type": "application/json"} + // ); + // await storeApi.placeOrder(newOrder); + + // // retrieve the same order by id + // storeApi.apiClient.client = FakeClient( + // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', + // getResponseBody: storeApi.apiClient.serialize(newOrder), + // ); + // final placedOrder = await storeApi.getOrderById(id); + // expect(placedOrder.id, equals(id)); + }); + + test('deletes an order', () async { + // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. + // final id = newId(); + // final newOrder = makeOrder(id: id); + + // // use the store api to add an order + // storeApi.apiClient.client = FakeClient( + // expectedUrl: 'http://petstore.swagger.io/v2/store/order', + // expectedPostRequestBody: storeApi.apiClient.serialize(newOrder), + // postResponseBody: storeApi.apiClient.serialize(newOrder), + // expectedHeaders: {"Content-Type": "application/json"} + // ); + // await storeApi.placeOrder(newOrder); + + // // delete the same order + // storeApi.apiClient.client = FakeClient( + // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', + // deleteResponseBody: '', + // ); + // await storeApi.deleteOrder(id.toString()); + + // // try and retrieve the order + // storeApi.apiClient.client = FakeClient( + // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', + // throwException: ApiException(400, 'Not found'), + // ); + // expect(storeApi.getOrderById(id), + // throwsA(equals(TypeMatcher()))); + }); + + test('gets the store inventory', () async { + // get some test data (recorded from live response) + final inventoryResponse = + await File('test/inventory_response.json').readAsString(); + // use the store api to get the inventory + storeApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/store/inventory', + getResponseBody: inventoryResponse, + ); + Map inventory = await storeApi.getInventory(); + expect(inventory.length, isNot(equals(0))); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart new file mode 100644 index 00000000000..b2175238819 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart @@ -0,0 +1,44 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'random_id.dart'; + +void main() { + var storeApi = new StoreApi(); + + Order makeOrder({int id}) { + return Order() + ..id = id + ..petId = 1234 + ..quantity = 1 + ..shipDate = DateTime.now() + ..status + ..complete = false; + } + + group('Store API with live client', () { + test('places an order and gets it by id', () async { + // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. + // var id = newId(); + + // await storeApi.placeOrder(makeOrder(id: id)); + // var order = await storeApi.getOrderById(id); + // expect(order.id, equals(id)); + }); + + test('deletes an order', () async { + // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. + // var id = newId(); + + // await storeApi.placeOrder(makeOrder(id: id)); + // await storeApi.deleteOrder(id.toString()); + // expect(storeApi.getOrderById(id), + // throwsA(equals(TypeMatcher()))); + }); + + test('gets the store inventory', () async { + Map inventory = await storeApi.getInventory(); + expect(inventory.length, isNot(equals(0))); + }); + }); // , skip: 'e2e tests for CI' +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart new file mode 100644 index 00000000000..2d549e84fc8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart @@ -0,0 +1,176 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'fake_client.dart'; +import 'random_id.dart'; + +void main() { + var userApi = new UserApi(); + + User makeUser( + {int id, String userName = 'username', String password = 'password'}) { + return User() + ..id = id + ..username = userName + ..firstName = 'firstname' + ..lastName = 'lastname' + ..email = 'email' + ..password = password + ..phone = 'phone' + ..userStatus = 0; + } + + group('User API with faked client', () { + test('creates a user', () async { + final id = newId(); + final username = 'Mally45'; + final newUser = makeUser(id: id, userName: username); + + // use the user api to create a user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user', + expectedPostRequestBody: userApi.apiClient.serialize(newUser), + expectedHeaders: { 'Content-Type': 'application/json' }, + postResponseBody: userApi.apiClient.serialize(newUser), + ); + await userApi.createUser(newUser); + + // retrieve the same user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user/$username', + getResponseBody: userApi.apiClient.serialize(newUser), + ); + var user = await userApi.getUserByName(username); + expect(user.id, equals(id)); + }); + + test('creates users with list input', () async { + final firstId = newId(); + final joe = 'Joe'; + + final sally = 'Sally'; + final secondId = newId(); + + final users = [ + makeUser(id: firstId, userName: joe), + makeUser(id: secondId, userName: sally), + ]; + + // use the user api to create a list of users + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user/createWithList', + expectedPostRequestBody: userApi.apiClient.serialize(users), + expectedHeaders: { 'Content-Type': 'application/json' }, + postResponseBody: userApi.apiClient.serialize(users), + ); + await userApi.createUsersWithListInput(users); + + // retrieve the users + userApi.apiClient.client = FakeClient( + expectedUrl: + 'http://petstore.swagger.io/v2/user/${users.elementAt(0).username}', + getResponseBody: userApi.apiClient.serialize( + users.elementAt(0), + ), + ); + final firstUser = await userApi.getUserByName(joe); + userApi.apiClient.client = FakeClient( + expectedUrl: + 'http://petstore.swagger.io/v2/user/${users.elementAt(1).username}', + getResponseBody: userApi.apiClient.serialize( + users.elementAt(1), + ), + ); + final secondUser = await userApi.getUserByName(sally); + expect(firstUser.id, equals(firstId)); + expect(secondUser.id, equals(secondId)); + }); + + test('updates a user', () async { + final username = 'Arkjam89'; + final email = 'test@example.com'; + final newUser = makeUser(id: newId(), userName: username); + + // use the user api to create a user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user', + expectedPostRequestBody: userApi.apiClient.serialize(newUser), + expectedHeaders: { 'Content-Type': 'application/json' }, + postResponseBody: userApi.apiClient.serialize(newUser), + ); + await userApi.createUser(newUser); + newUser.email = email; + + // use the user api to update the user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', + expectedPutRequestBody: userApi.apiClient.serialize(newUser), + expectedHeaders: { 'Content-Type': 'application/json' }, + putResponseBody: userApi.apiClient.serialize(newUser), + ); + await userApi.updateUser(username, newUser); + + // retrieve the same user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', + getResponseBody: userApi.apiClient.serialize(newUser), + ); + var foundUser = await userApi.getUserByName(username); + expect(foundUser.email, equals(email)); + }); + + test('deletes a user', () async { + final username = 'Riddlem325'; + final newUser = makeUser(id: newId(), userName: username); + + // use the user api to create a user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user', + expectedPostRequestBody: userApi.apiClient.serialize(newUser), + expectedHeaders: { 'Content-Type': 'application/json' }, + postResponseBody: userApi.apiClient.serialize(newUser), + ); + await userApi.createUser(newUser); + + // delete the same user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', + deleteResponseBody: '', + ); + await userApi.deleteUser(username); + + // try and retrieve the user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', + throwException: ApiException(400, 'Not found'), + ); + expect(userApi.getUserByName(username), + throwsA(TypeMatcher())); + }); + + test('logs a user in', () async { + final username = 'sgarad625'; + final password = 'lokimoki1'; + final newUser = + makeUser(id: newId(), userName: username, password: password); + + // use the user api to create a user + userApi.apiClient.client = FakeClient( + expectedUrl: 'http://petstore.swagger.io/v2/user', + expectedPostRequestBody: userApi.apiClient.serialize(newUser), + expectedHeaders: { 'Content-Type': 'application/json' }, + postResponseBody: userApi.apiClient.serialize(newUser), + ); + await userApi.createUser(newUser); + + // use the user api to login + userApi.apiClient.client = FakeClient( + expectedUrl: + 'http://petstore.swagger.io/v2/user/login?username=${newUser.username}&password=${newUser.password}', + getResponseBody: 'logged in user session:', + ); + final result = await userApi.loginUser(username, password); + expect(result, contains('logged in user session:')); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart new file mode 100644 index 00000000000..ea34b3713fa --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart @@ -0,0 +1,80 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'random_id.dart'; + +void main() { + var userApi = new UserApi(); + + User makeUser( + {int id, String userName = 'username', String password = 'password'}) { + return User() + ..id = id + ..username = userName + ..firstName = 'firstname' + ..lastName = 'lastname' + ..email = 'email' + ..password = password + ..phone = 'phone' + ..userStatus = 0; + } + + group('User API with live client', () { + test('creates a user', () async { + var id = newId(); + var username = 'Mally45'; + await userApi.createUser(makeUser(id: id, userName: username)); + var user = await userApi.getUserByName(username); + expect(user.id, equals(id)); + }); + + test('creates users with list input', () async { + var firstId = newId(); + var joe = 'Joe'; + + var sally = 'Sally'; + var secondId = newId(); + + var users = [ + makeUser(id: firstId, userName: joe), + makeUser(id: secondId, userName: sally), + ]; + + await userApi.createUsersWithListInput(users); + var firstUser = await userApi.getUserByName(joe); + var secondUser = await userApi.getUserByName(sally); + expect(firstUser.id, equals(firstId)); + expect(secondUser.id, equals(secondId)); + }); + + test('updates a user', () async { + var username = 'Arkjam89'; + var email = 'test@example.com'; + var user = makeUser(id: newId(), userName: username); + + await userApi.createUser(user); + user.email = email; + await userApi.updateUser(username, user); + var foundUser = await userApi.getUserByName(username); + expect(foundUser.email, equals(email)); + }); + + test('deletes a user', () async { + var username = 'Riddlem325'; + await userApi.createUser(makeUser(id: newId(), userName: username)); + await userApi.deleteUser(username); + expect(userApi.getUserByName(username), + throwsA(TypeMatcher())); + }); + + test('logs a user in', () async { + var username = 'sgarad625'; + var password = 'lokimoki1'; + var user = makeUser(id: newId(), userName: username, password: password); + + await userApi.createUser(user); + var result = await userApi.loginUser(username, password); + expect(result, contains('logged in user session:')); + }); + }, skip: 'e2e tests for CI'); +} diff --git a/samples/client/petstore/dart2/openapi/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore similarity index 100% rename from samples/client/petstore/dart2/openapi/.gitignore rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/dart2/openapi/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES similarity index 85% rename from samples/client/petstore/dart2/openapi/.openapi-generator/FILES rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES index 7cc5afea821..cf77ef761d2 100644 --- a/samples/client/petstore/dart2/openapi/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES @@ -3,6 +3,8 @@ README.md doc/ApiResponse.md doc/Category.md +doc/InlineObject.md +doc/InlineObject1.md doc/Order.md doc/Pet.md doc/PetApi.md @@ -25,6 +27,8 @@ lib/auth/http_bearer_auth.dart lib/auth/oauth.dart lib/model/api_response.dart lib/model/category.dart +lib/model/inline_object.dart +lib/model/inline_object1.dart lib/model/order.dart lib/model/pet.dart lib/model/tag.dart diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION new file mode 100644 index 00000000000..d99e7162d01 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml similarity index 79% rename from samples/client/petstore/dart2/openapi/.travis.yml rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml index d0758bc9f0d..1a3af66d54c 100644 --- a/samples/client/petstore/dart2/openapi/.travis.yml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml @@ -1,3 +1,6 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# # https://docs.travis-ci.com/user/languages/dart/ # language: dart diff --git a/samples/client/petstore/dart2/openapi/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md similarity index 93% rename from samples/client/petstore/dart2/openapi/README.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md index 1cf4ca28f0a..7ad8c2ceb5e 100644 --- a/samples/client/petstore/dart2/openapi/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md @@ -42,13 +42,14 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + final result = api_instance.addPet(pet); + print(result); } catch (e) { - print("Exception when calling PetApi->addPet: $e\n"); + print('Exception when calling PetApi->addPet: $e\n'); } ``` @@ -85,6 +86,8 @@ Class | Method | HTTP request | Description - [ApiResponse](doc//ApiResponse.md) - [Category](doc//Category.md) + - [InlineObject](doc//InlineObject.md) + - [InlineObject1](doc//InlineObject1.md) - [Order](doc//Order.md) - [Pet](doc//Pet.md) - [Tag](doc//Tag.md) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md new file mode 100644 index 00000000000..7ad5da0f89e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + +[[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-jaguar/openapi/docs/Category.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Category.md similarity index 77% rename from samples/client/petstore/dart-jaguar/openapi/docs/Category.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Category.md index cc0d1633b59..98d0b14be7b 100644 --- a/samples/client/petstore/dart-jaguar/openapi/docs/Category.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Category.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**name** | **String** | | [optional] [[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/openapi3/client/petstore/dart2/petstore_client_lib/doc/InlineObject.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/InlineObject.md new file mode 100644 index 00000000000..9aa480dee58 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/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] +**status** | **String** | Updated status of the pet | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib/doc/InlineObject1.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/InlineObject1.md new file mode 100644 index 00000000000..013aa87e9bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/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] +**file** | [**MultipartFile**](File.md) | file to upload | [optional] + +[[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-jaguar/openapi_proto/docs/Order.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Order.md similarity index 58% rename from samples/client/petstore/dart-jaguar/openapi_proto/docs/Order.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Order.md index 310ce6c65be..bde5ffe51a2 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/Order.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Order.md @@ -8,11 +8,11 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] **complete** | **bool** | | [optional] [default to false] [[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/openapi3/client/petstore/dart2/petstore_client_lib/doc/Pet.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Pet.md new file mode 100644 index 00000000000..88512ee3703 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List** | | [default to const []] +**tags** | [**List**](Tag.md) | | [optional] [default to const []] +**status** | **String** | pet status in the store | [optional] + +[[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/dart2/petstore_client_lib/docs/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md similarity index 73% rename from samples/client/petstore/dart2/petstore_client_lib/docs/PetApi.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md index 7b5de3894a9..f4902fe552d 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **addPet** -> addPet(body) +> Pet addPet(pet) Add a new pet to the store @@ -30,13 +30,14 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + final result = api_instance.addPet(pet); + print(result); } catch (e) { - print("Exception when calling PetApi->addPet: $e\n"); + print('Exception when calling PetApi->addPet: $e\n'); } ``` @@ -44,11 +45,11 @@ 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 -void (empty response body) +[**Pet**](Pet.md) ### Authorization @@ -57,7 +58,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: Not defined + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -72,14 +73,14 @@ 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 = PetApi(); -var petId = 789; // int | Pet id to delete -var apiKey = apiKey_example; // String | +final api_instance = PetApi(); +final petId = 789; // int | Pet id to delete +final apiKey = apiKey_example; // String | try { api_instance.deletePet(petId, apiKey); } catch (e) { - print("Exception when calling PetApi->deletePet: $e\n"); + print('Exception when calling PetApi->deletePet: $e\n'); } ``` @@ -87,8 +88,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] ### Return type @@ -118,14 +119,14 @@ 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 = PetApi(); -var status = []; // List | Status values that need to be considered for filter +final api_instance = PetApi(); +final status = []; // List | Status values that need to be considered for filter try { - var result = api_instance.findPetsByStatus(status); + final result = api_instance.findPetsByStatus(status); print(result); } catch (e) { - print("Exception when calling PetApi->findPetsByStatus: $e\n"); + print('Exception when calling PetApi->findPetsByStatus: $e\n'); } ``` @@ -133,7 +134,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -163,14 +164,14 @@ 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 = PetApi(); -var tags = []; // List | Tags to filter by +final api_instance = PetApi(); +final tags = []; // List | Tags to filter by try { - var result = api_instance.findPetsByTags(tags); + final result = api_instance.findPetsByTags(tags); print(result); } catch (e) { - print("Exception when calling PetApi->findPetsByTags: $e\n"); + print('Exception when calling PetApi->findPetsByTags: $e\n'); } ``` @@ -178,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -210,14 +211,14 @@ 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 = PetApi(); -var petId = 789; // int | ID of pet to return +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to return try { - var result = api_instance.getPetById(petId); + final result = api_instance.getPetById(petId); print(result); } catch (e) { - print("Exception when calling PetApi->getPetById: $e\n"); + print('Exception when calling PetApi->getPetById: $e\n'); } ``` @@ -225,7 +226,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] + **petId** | **int**| ID of pet to return | ### Return type @@ -243,7 +244,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) +> Pet updatePet(pet) Update an existing pet @@ -253,13 +254,14 @@ 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 = PetApi(); -var body = Pet(); // Pet | Pet object that needs to be added to the store +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.updatePet(body); + final result = api_instance.updatePet(pet); + print(result); } catch (e) { - print("Exception when calling PetApi->updatePet: $e\n"); + print('Exception when calling PetApi->updatePet: $e\n'); } ``` @@ -267,11 +269,11 @@ 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 -void (empty response body) +[**Pet**](Pet.md) ### Authorization @@ -280,7 +282,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: Not defined + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -295,15 +297,15 @@ 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 = 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 +final api_instance = PetApi(); +final petId = 789; // int | ID of pet that needs to be updated +final name = name_example; // String | Updated name of the pet +final status = status_example; // String | Updated status of the pet try { api_instance.updatePetWithForm(petId, name, status); } catch (e) { - print("Exception when calling PetApi->updatePetWithForm: $e\n"); + print('Exception when calling PetApi->updatePetWithForm: $e\n'); } ``` @@ -311,9 +313,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -341,16 +343,16 @@ 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 = 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 +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final file = BINARY_DATA_HERE; // MultipartFile | file to upload try { - var result = api_instance.uploadFile(petId, additionalMetadata, file); + final result = api_instance.uploadFile(petId, additionalMetadata, file); print(result); } catch (e) { - print("Exception when calling PetApi->uploadFile: $e\n"); + print('Exception when calling PetApi->uploadFile: $e\n'); } ``` @@ -358,9 +360,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] ### Return type diff --git a/samples/client/petstore/dart2/petstore_client_lib/docs/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md similarity index 79% rename from samples/client/petstore/dart2/petstore_client_lib/docs/StoreApi.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md index 1cc37e2a47a..8ec0bb80443 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md @@ -26,13 +26,13 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); -var orderId = orderId_example; // String | ID of the order that needs to be deleted +final api_instance = StoreApi(); +final orderId = orderId_example; // String | ID of the order that needs to be deleted try { api_instance.deleteOrder(orderId); } catch (e) { - print("Exception when calling StoreApi->deleteOrder: $e\n"); + print('Exception when calling StoreApi->deleteOrder: $e\n'); } ``` @@ -40,7 +40,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + **orderId** | **String**| ID of the order that needs to be deleted | ### Return type @@ -72,13 +72,13 @@ 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 = StoreApi(); +final api_instance = StoreApi(); try { - var result = api_instance.getInventory(); + final result = api_instance.getInventory(); print(result); } catch (e) { - print("Exception when calling StoreApi->getInventory: $e\n"); + print('Exception when calling StoreApi->getInventory: $e\n'); } ``` @@ -111,14 +111,14 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); -var orderId = 789; // int | ID of pet that needs to be fetched +final api_instance = StoreApi(); +final orderId = 789; // int | ID of pet that needs to be fetched try { - var result = api_instance.getOrderById(orderId); + final result = api_instance.getOrderById(orderId); print(result); } catch (e) { - print("Exception when calling StoreApi->getOrderById: $e\n"); + print('Exception when calling StoreApi->getOrderById: $e\n'); } ``` @@ -126,7 +126,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + **orderId** | **int**| ID of pet that needs to be fetched | ### Return type @@ -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,14 +152,14 @@ Place an order for a pet ```dart import 'package:openapi/api.dart'; -var api_instance = StoreApi(); -var body = Order(); // Order | order placed for purchasing the pet +final api_instance = StoreApi(); +final order = Order(); // Order | order placed for purchasing the pet try { - var result = api_instance.placeOrder(body); + final result = api_instance.placeOrder(order); print(result); } catch (e) { - print("Exception when calling StoreApi->placeOrder: $e\n"); + 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-jaguar/openapi_proto/docs/Tag.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Tag.md similarity index 77% rename from samples/client/petstore/dart-jaguar/openapi_proto/docs/Tag.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Tag.md index ded7b32ac3d..c219f987c19 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/Tag.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/Tag.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**name** | **String** | | [optional] [[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/openapi3/client/petstore/dart2/petstore_client_lib/doc/User.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/User.md new file mode 100644 index 00000000000..fa87e64d859 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[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/dart2/openapi/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md similarity index 58% rename from samples/client/petstore/dart2/openapi/doc/UserApi.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md index 1ee5f6fced6..7b1d3371529 100644 --- a/samples/client/petstore/dart2/openapi/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(body) +> createUser(user) Create user @@ -29,14 +29,18 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = UserApi(); -var body = User(); // User | Created user object +final api_instance = UserApi(); +final 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"); + 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,31 +56,35 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### 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: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = UserApi(); -var body = [List<User>()]; // List | List of user object +final api_instance = UserApi(); +final user = [List()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(body); + api_instance.createUsersWithArrayInput(user); } catch (e) { - print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } ``` @@ -84,7 +92,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List**](User.md)| List of user object | ### Return type @@ -92,31 +100,35 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### 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: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = UserApi(); -var body = [List<User>()]; // List | List of user object +final api_instance = UserApi(); +final user = [List()]; // List | List of user object try { - api_instance.createUsersWithListInput(body); + api_instance.createUsersWithListInput(user); } catch (e) { - print("Exception when calling UserApi->createUsersWithListInput: $e\n"); + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } ``` @@ -124,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List**](User.md)| List of user object | ### Return type @@ -132,11 +144,11 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### 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,14 +163,18 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = UserApi(); -var username = username_example; // String | The name that needs to be deleted +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be deleted try { api_instance.deleteUser(username); } catch (e) { - print("Exception when calling UserApi->deleteUser: $e\n"); + print('Exception when calling UserApi->deleteUser: $e\n'); } ``` @@ -166,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | [default to null] + **username** | **String**| The name that needs to be deleted | ### Return type @@ -174,7 +190,7 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### HTTP request headers @@ -192,14 +208,14 @@ Get user by user name ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. try { - var result = api_instance.getUserByName(username); + final result = api_instance.getUserByName(username); print(result); } catch (e) { - print("Exception when calling UserApi->getUserByName: $e\n"); + print('Exception when calling UserApi->getUserByName: $e\n'); } ``` @@ -207,7 +223,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | ### Return type @@ -233,15 +249,15 @@ Logs user into the system ```dart import 'package:openapi/api.dart'; -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 +final api_instance = UserApi(); +final username = username_example; // String | The user name for login +final password = password_example; // String | The password for login in clear text try { - var result = api_instance.loginUser(username, password); + final result = api_instance.loginUser(username, password); print(result); } catch (e) { - print("Exception when calling UserApi->loginUser: $e\n"); + print('Exception when calling UserApi->loginUser: $e\n'); } ``` @@ -249,8 +265,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -275,13 +291,17 @@ Logs out current logged in user session ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = UserApi(); +final api_instance = UserApi(); try { api_instance.logoutUser(); } catch (e) { - print("Exception when calling UserApi->logoutUser: $e\n"); + print('Exception when calling UserApi->logoutUser: $e\n'); } ``` @@ -294,7 +314,7 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### 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,15 +333,19 @@ This can only be done by the logged in user. ### Example ```dart import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -var api_instance = UserApi(); -var username = username_example; // String | name that need to be deleted -var body = User(); // User | Updated user object +final api_instance = UserApi(); +final username = username_example; // String | name that need to be deleted +final 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"); + print('Exception when calling UserApi->updateUser: $e\n'); } ``` @@ -329,8 +353,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | [default to null] - **body** | [**User**](User.md)| Updated user object | + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -338,11 +362,11 @@ void (empty response body) ### Authorization -No authorization required +[api_key](../README.md#api_key) ### 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/dart2/openapi/git_push.sh b/samples/openapi3/client/petstore/dart2/petstore_client_lib/git_push.sh similarity index 100% rename from samples/client/petstore/dart2/openapi/git_push.sh rename to samples/openapi3/client/petstore/dart2/petstore_client_lib/git_push.sh diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart new file mode 100644 index 00000000000..2541a00eaf7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; +import 'package:meta/meta.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; +part 'auth/http_bearer_auth.dart'; + +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +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'; + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart new file mode 100644 index 00000000000..fe66df99963 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -0,0 +1,645 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class PetApi { + PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Add a new pet to the store + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPetWithHttpInfo(Pet pet) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/pet'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Add a new pet to the store + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPet(Pet pet) async { + final response = await addPetWithHttpInfo(pet); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; + } + return null; + } + + /// Deletes a pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePetWithHttpInfo(int petId, { String apiKey }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (apiKey != null) { + headerParams['api_key'] = parameterToString(apiKey); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Deletes a pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePet(int petId, { String apiKey }) async { + final response = await deletePetWithHttpInfo(petId, apiKey: apiKey ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future findPetsByStatusWithHttpInfo(List status) async { + // Verify required params are set. + if (status == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); + } + + final path = '/pet/findByStatus'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future> findPetsByStatus(List status) async { + final response = await findPetsByStatusWithHttpInfo(status); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .map((item) => item as Pet) + .toList(growable: false); + } + return null; + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] tags (required): + /// Tags to filter by + Future findPetsByTagsWithHttpInfo(List tags) async { + // Verify required params are set. + if (tags == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); + } + + final path = '/pet/findByTags'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// + /// * [List] tags (required): + /// Tags to filter by + Future> findPetsByTags(List tags) async { + final response = await findPetsByTagsWithHttpInfo(tags); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .map((item) => item as Pet) + .toList(growable: false); + } + return null; + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetByIdWithHttpInfo(int petId) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetById(int petId) async { + final response = await getPetByIdWithHttpInfo(petId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; + } + return null; + } + + /// Update an existing pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePetWithHttpInfo(Pet pet) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/pet'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Update an existing pet + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePet(Pet pet) async { + final response = await updatePetWithHttpInfo(pet); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; + } + return null; + } + + /// Updates a pet in the store with form data + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (name != null) { + hasFields = true; + mp.fields['name'] = parameterToString(name); + } + if (status != null) { + hasFields = true; + mp.fields['status'] = parameterToString(status); + } + if (hasFields) { + postBody = mp; + } + } else { + if (name != null) { + formParams['name'] = parameterToString(name); + } + if (status != null) { + formParams['status'] = parameterToString(status); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Updates a pet in the store with form data + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithForm(int petId, { String name, String status }) async { + final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// uploads an image + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}/uploadImage'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['multipart/form-data']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields['file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; + } + } else { + if (additionalMetadata != null) { + formParams['additionalMetadata'] = parameterToString(additionalMetadata); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// uploads an image + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { + final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart new file mode 100644 index 00000000000..14cbb056efe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart @@ -0,0 +1,289 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class StoreApi { + StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrderWithHttpInfo(String orderId) async { + // Verify required params are set. + if (orderId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); + } + + final path = '/store/order/{orderId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'orderId' + '}', orderId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrder(String orderId) async { + final response = await deleteOrderWithHttpInfo(orderId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + /// + /// Note: This method returns the HTTP [Response]. + Future getInventoryWithHttpInfo() async { + final path = '/store/inventory'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() async { + final response = await getInventoryWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + } + return null; + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderByIdWithHttpInfo(int orderId) async { + // Verify required params are set. + if (orderId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); + } + + final path = '/store/order/{orderId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'orderId' + '}', orderId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderById(int orderId) async { + final response = await getOrderByIdWithHttpInfo(orderId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; + } + return null; + } + + /// Place an order for a pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrderWithHttpInfo(Order order) async { + // Verify required params are set. + if (order == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); + } + + final path = '/store/order'.replaceAll('{format}', 'json'); + + Object postBody = order; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Place an order for a pet + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrder(Order order) async { + final response = await placeOrderWithHttpInfo(order); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart new file mode 100644 index 00000000000..b45b14b9ae0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart @@ -0,0 +1,556 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class UserApi { + UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUserWithHttpInfo(User user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUser(User user) async { + final response = await createUserWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInputWithHttpInfo(List user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/createWithArray'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Creates list of users with given input array + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInput(List user) async { + final response = await createUsersWithArrayInputWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInputWithHttpInfo(List user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/createWithList'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Creates list of users with given input array + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInput(List user) async { + final response = await createUsersWithListInputWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUserWithHttpInfo(String username) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUser(String username) async { + final response = await deleteUserWithHttpInfo(username); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Get user by user name + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByNameWithHttpInfo(String username) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get user by user name + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByName(String username) async { + final response = await getUserByNameWithHttpInfo(username); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; + } + return null; + } + + /// Logs user into the system + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUserWithHttpInfo(String username, String password) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + if (password == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); + } + + final path = '/user/login'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); + queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Logs user into the system + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUser(String username, String password) async { + final response = await loginUserWithHttpInfo(username, password); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return null; + } + + /// Logs out current logged in user session + /// + /// Note: This method returns the HTTP [Response]. + Future logoutUserWithHttpInfo() async { + final path = '/user/logout'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Logs out current logged in user session + Future logoutUser() async { + final response = await logoutUserWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUserWithHttpInfo(String username, User user) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUser(String username, User user) async { + final response = await updateUserWithHttpInfo(username, user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart new file mode 100644 index 00000000000..295d81cdf22 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -0,0 +1,218 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiClient { + ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { + // Setup authentications (key: authentication name, value: authentication). + _authentications['api_key'] = ApiKeyAuth('header', 'api_key'); + _authentications['petstore_auth'] = OAuth(); + } + + final String basePath; + + var _client = Client(); + + /// Returns the current HTTP [Client] instance to use in this class. + /// + /// The return value is guaranteed to never be null. + Client get client => _client; + + /// Requests to use a new HTTP [Client] in this class. + /// + /// If the [newClient] is null, an [ArgumentError] is thrown. + set client(Client newClient) { + if (newClient == null) { + throw ArgumentError('New client instance cannot be null.'); + } + _client = newClient; + } + + final _defaultHeaderMap = {}; + final _authentications = {}; + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + dynamic deserialize(String json, String targetType, {bool growable}) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + return targetType == 'String' + ? json + : _deserialize(jsonDecode(json), targetType, growable: true == growable); + } + + String serialize(Object obj) => obj == null ? '' : json.encode(obj); + + T getAuthentication(String name) { + final authentication = _authentications[name]; + return authentication is T ? authentication : null; + } + + // We don’t use a Map for queryParams. + // If collectionFormat is 'multi', a key might appear multiple times. + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String nullableContentType, + List authNames, + ) async { + _updateParamsForAuth(authNames, queryParams, headerParams); + + headerParams.addAll(_defaultHeaderMap); + + final urlEncodedQueryParams = queryParams + .where((param) => param.value != null) + .map((param) => '$param'); + + final queryString = urlEncodedQueryParams.isNotEmpty + ? '?${urlEncodedQueryParams.join('&')}' + : ''; + + final url = '$basePath$path$queryString'; + + if (nullableContentType != null) { + headerParams['Content-Type'] = nullableContentType; + } + + try { + // Special case for uploading a single file which isn’t a 'multipart/form-data'. + if ( + body is MultipartFile && (nullableContentType == null || + !nullableContentType.toLowerCase().startsWith('multipart/form-data')) + ) { + final request = StreamedRequest(method, Uri.parse(url)); + request.headers.addAll(headerParams); + request.contentLength = body.length; + body.finalize().listen( + request.sink.add, + onDone: request.sink.close, + onError: (error, trace) => request.sink.close(), + cancelOnError: true, + ); + final response = await _client.send(request); + return Response.fromStream(response); + } + + if (body is MultipartRequest) { + final request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + final response = await _client.send(request); + return Response.fromStream(response); + } + + final msgBody = nullableContentType == 'application/x-www-form-urlencoded' + ? formParams + : serialize(body); + final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; + + switch(method) { + case 'POST': return await _client.post(url, headers: nullableHeaderParams, body: msgBody,); + case 'PUT': return await _client.put(url, headers: nullableHeaderParams, body: msgBody,); + case 'DELETE': return await _client.delete(url, headers: nullableHeaderParams,); + case 'PATCH': return await _client.patch(url, headers: nullableHeaderParams, body: msgBody,); + case 'HEAD': return await _client.head(url, headers: nullableHeaderParams,); + case 'GET': return await _client.get(url, headers: nullableHeaderParams,); + } + } on SocketException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); + } on TlsException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); + } on IOException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); + } on ClientException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); + } on Exception catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); + } + + throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); + } + + dynamic _deserialize(dynamic value, String targetType, {bool growable}) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + if (value is bool) { + return value; + } + final valueString = '$value'.toLowerCase(); + return valueString == 'true' || valueString == '1'; + break; + case 'double': + return value is double ? value : double.parse('$value'); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'InlineObject': + return InlineObject.fromJson(value); + case 'InlineObject1': + return InlineObject1.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'Pet': + return Pet.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'User': + return User.fromJson(value); + default: + Match match; + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toList(growable: true == growable); + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return Map.fromIterables( + value.keys, + value.values.map((v) => _deserialize(v, newTargetType, growable: growable)), + ); + } + break; + } + } on Exception catch (e, stack) { + throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', e, stack,); + } + throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth( + List authNames, + List queryParams, + Map headerParams, + ) { + authNames.forEach((authName) { + final auth = _authentications[authName]; + if (auth == null) { + throw ArgumentError('Authentication undefined: $authName'); + } + auth.applyToParams(queryParams, headerParams); + }); + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart new file mode 100644 index 00000000000..1537c9769b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiException implements Exception { + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + String toString() { + if (message == null) { + return 'ApiException'; + } + if (innerException == null) { + return 'ApiException $code: $message'; + } + return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart new file mode 100644 index 00000000000..141f4a7f5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +// Ported from the Java version. +Iterable _convertParametersForCollectionFormat( + String collectionFormat, + String name, + dynamic value, +) { + final params = []; + + // preconditions + if (name != null && !name.isEmpty && value != null) { + if (value is List) { + // get the collection format, default: csv + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? 'csv' + : collectionFormat; + + if (collectionFormat == 'multi') { + return value.map((v) => QueryParam(name, parameterToString(v))); + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter))); + } else { + params.add(QueryParam(name, parameterToString(value))); + } + } + + return params; +} + +/// Format the given parameter object into a [String]. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } + if (value is DateTime) { + return value.toUtc().toIso8601String(); + } + return value.toString(); +} + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +String _decodeBodyBytes(Response response) { + final contentType = response.headers['content-type']; + return contentType != null && contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + : response.body; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..41a4afd85d9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix; + String apiKey; + + @override + void applyToParams(List queryParams, Map headerParams) { + final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } else if (location == 'cookie' && value != null) { + headerParams.update('Cookie', (String existingCookie) { + return '$existingCookie; $paramName=$value'; + }, ifAbsent: () => '$paramName=$value'); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart new file mode 100644 index 00000000000..5ca198d41fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +abstract class Authentication { + /// Apply authentication settings to header and query params. + void applyToParams(List queryParams, Map headerParams); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart new file mode 100644 index 00000000000..6dc36a13f49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HttpBasicAuth implements Authentication { + String username; + String password; + + @override + void applyToParams(List queryParams, Map headerParams) { + final credentials = (username ?? '') + ':' + (password ?? ''); + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart new file mode 100644 index 00000000000..a23b65fac5e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +typedef HttpBearerAuthProvider = String Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + dynamic _accessToken; + + dynamic get accessToken => _accessToken; + + set accessToken(dynamic accessToken) { + if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { + throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + } + this._accessToken = accessToken; + } + + @override + void applyToParams(List queryParams, Map headerParams) { + if (_accessToken is String) { + headerParams['Authorization'] = 'Bearer $_accessToken'; + } else if (_accessToken is HttpBearerAuthProvider) { + headerParams['Authorization'] = 'Bearer ${_accessToken()}'; + } else { + throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart new file mode 100644 index 00000000000..c0463ad3900 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart @@ -0,0 +1,23 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OAuth implements Authentication { + OAuth({this.accessToken}); + + String accessToken; + + @override + void applyToParams(List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart new file mode 100644 index 00000000000..4724017e846 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart @@ -0,0 +1,92 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + this.code, + this.type, + this.message, + }); + + + int code; + + + String type; + + + String message; + + @override + bool operator ==(Object other) => identical(this, other) || other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => + (code == null ? 0 : code.hashCode) + + (type == null ? 0 : type.hashCode) + + (message == null ? 0 : message.hashCode); + + @override + String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; + + Map toJson() { + final json = {}; + if (code != null) { + json['code'] = code; + } + if (type != null) { + json['type'] = type; + } + if (message != null) { + json['message'] = message; + } + return json; + } + + /// Returns a new [ApiResponse] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ApiResponse fromJson(Map json) => json == null + ? null + : ApiResponse( + code: json['code'], + type: json['type'], + message: json['message'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ApiResponse.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ApiResponse.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ApiResponse-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ApiResponse.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart new file mode 100644 index 00000000000..0500aa5c93f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Category { + /// Returns a new [Category] instance. + Category({ + this.id, + this.name, + }); + + + int id; + + + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Category && + other.id == id && + other.name == name; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode); + + @override + String toString() => 'Category[id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (id != null) { + json['id'] = id; + } + if (name != null) { + json['name'] = name; + } + return json; + } + + /// Returns a new [Category] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Category fromJson(Map json) => json == null + ? null + : Category( + id: json['id'], + name: json['name'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Category.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Category.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Category-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Category.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object.dart new file mode 100644 index 00000000000..a57294e7018 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject { + /// Returns a new [InlineObject] instance. + InlineObject({ + this.name, + this.status, + }); + + /// Updated name of the pet + String name; + + /// Updated status of the pet + String status; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject && + other.name == name && + other.status == status; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (status == null ? 0 : status.hashCode); + + @override + String toString() => 'InlineObject[name=$name, status=$status]'; + + Map toJson() { + final json = {}; + if (name != null) { + json['name'] = name; + } + if (status != null) { + json['status'] = status; + } + return json; + } + + /// Returns a new [InlineObject] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject fromJson(Map json) => json == null + ? null + : InlineObject( + name: json['name'], + status: json['status'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object1.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object1.dart new file mode 100644 index 00000000000..8d62fbf7dcb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/inline_object1.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject1 { + /// Returns a new [InlineObject1] instance. + InlineObject1({ + this.additionalMetadata, + this.file, + }); + + /// Additional data to pass to server + String additionalMetadata; + + /// file to upload + MultipartFile file; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject1 && + other.additionalMetadata == additionalMetadata && + other.file == file; + + @override + int get hashCode => + (additionalMetadata == null ? 0 : additionalMetadata.hashCode) + + (file == null ? 0 : file.hashCode); + + @override + String toString() => 'InlineObject1[additionalMetadata=$additionalMetadata, file=$file]'; + + Map toJson() { + final json = {}; + if (additionalMetadata != null) { + json['additionalMetadata'] = additionalMetadata; + } + if (file != null) { + json['file'] = file; + } + return json; + } + + /// Returns a new [InlineObject1] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject1 fromJson(Map json) => json == null + ? null + : InlineObject1( + additionalMetadata: json['additionalMetadata'], + file: null, // No support for decoding binary content from JSON + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject1.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject1.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject1-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject1.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart new file mode 100644 index 00000000000..67b1b43c7d5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -0,0 +1,201 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Order { + /// Returns a new [Order] instance. + Order({ + this.id, + this.petId, + this.quantity, + this.shipDate, + this.status, + this.complete = false, + }); + + + int id; + + + int petId; + + + int quantity; + + + DateTime shipDate; + + /// Order Status + OrderStatusEnum status; + + + bool complete; + + @override + bool operator ==(Object other) => identical(this, other) || other is Order && + other.id == id && + other.petId == petId && + other.quantity == quantity && + other.shipDate == shipDate && + other.status == status && + other.complete == complete; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (petId == null ? 0 : petId.hashCode) + + (quantity == null ? 0 : quantity.hashCode) + + (shipDate == null ? 0 : shipDate.hashCode) + + (status == null ? 0 : status.hashCode) + + (complete == null ? 0 : complete.hashCode); + + @override + String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; + + Map toJson() { + final 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.toUtc().toIso8601String(); + } + if (status != null) { + json['status'] = status; + } + if (complete != null) { + json['complete'] = complete; + } + return json; + } + + /// Returns a new [Order] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Order fromJson(Map json) => json == null + ? null + : Order( + id: json['id'], + petId: json['petId'], + quantity: json['quantity'], + shipDate: json['shipDate'] == null + ? null + : DateTime.parse(json['shipDate']), + status: OrderStatusEnum.fromJson(json['status']), + complete: json['complete'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Order.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Order.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Order-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Order.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + +/// Order Status +class OrderStatusEnum { + /// Instantiate a new enum with the provided [value]. + const OrderStatusEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is OrderStatusEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const placed_ = OrderStatusEnum._('placed'); + static const approved_ = OrderStatusEnum._('approved'); + static const delivered_ = OrderStatusEnum._('delivered'); + + /// List of all possible values in this [enum][OrderStatusEnum]. + static const values = [ + placed_, + approved_, + delivered_, + ]; + + static OrderStatusEnum fromJson(dynamic value) => + OrderStatusEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => OrderStatusEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, +/// and [decode] dynamic data back to [OrderStatusEnum]. +class OrderStatusEnumTypeTransformer { + const OrderStatusEnumTypeTransformer._(); + + factory OrderStatusEnumTypeTransformer() => _instance ??= OrderStatusEnumTypeTransformer._(); + + String encode(OrderStatusEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a OrderStatusEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OrderStatusEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'placed': return OrderStatusEnum.placed_; + case 'approved': return OrderStatusEnum.approved_; + case 'delivered': return OrderStatusEnum.delivered_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [OrderStatusEnumTypeTransformer] instance. + static OrderStatusEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart new file mode 100644 index 00000000000..668b567ec4e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -0,0 +1,201 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Pet { + /// Returns a new [Pet] instance. + Pet({ + this.id, + this.category, + @required this.name, + this.photoUrls = const [], + this.tags = const [], + this.status, + }); + + + int id; + + + Category category; + + + String name; + + + List photoUrls; + + + List tags; + + /// pet status in the store + PetStatusEnum status; + + @override + bool operator ==(Object other) => identical(this, other) || other is Pet && + other.id == id && + other.category == category && + other.name == name && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (category == null ? 0 : category.hashCode) + + (name == null ? 0 : name.hashCode) + + (photoUrls == null ? 0 : photoUrls.hashCode) + + (tags == null ? 0 : tags.hashCode) + + (status == null ? 0 : status.hashCode); + + @override + String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; + + Map toJson() { + final 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; + } + + /// Returns a new [Pet] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Pet fromJson(Map json) => json == null + ? null + : Pet( + id: json['id'], + category: Category.fromJson(json['category']), + name: json['name'], + photoUrls: json['photoUrls'] == null + ? null + : (json['photoUrls'] as List).cast(), + tags: Tag.listFromJson(json['tags']), + status: PetStatusEnum.fromJson(json['status']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Pet.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Pet.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Pet-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Pet.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + +/// pet status in the store +class PetStatusEnum { + /// Instantiate a new enum with the provided [value]. + const PetStatusEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is PetStatusEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const available_ = PetStatusEnum._('available'); + static const pending_ = PetStatusEnum._('pending'); + static const sold_ = PetStatusEnum._('sold'); + + /// List of all possible values in this [enum][PetStatusEnum]. + static const values = [ + available_, + pending_, + sold_, + ]; + + static PetStatusEnum fromJson(dynamic value) => + PetStatusEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => PetStatusEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [PetStatusEnum] to String, +/// and [decode] dynamic data back to [PetStatusEnum]. +class PetStatusEnumTypeTransformer { + const PetStatusEnumTypeTransformer._(); + + factory PetStatusEnumTypeTransformer() => _instance ??= PetStatusEnumTypeTransformer._(); + + String encode(PetStatusEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a PetStatusEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + PetStatusEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'available': return PetStatusEnum.available_; + case 'pending': return PetStatusEnum.pending_; + case 'sold': return PetStatusEnum.sold_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [PetStatusEnumTypeTransformer] instance. + static PetStatusEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart new file mode 100644 index 00000000000..dd24d1e0cd6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Tag { + /// Returns a new [Tag] instance. + Tag({ + this.id, + this.name, + }); + + + int id; + + + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Tag && + other.id == id && + other.name == name; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode); + + @override + String toString() => 'Tag[id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (id != null) { + json['id'] = id; + } + if (name != null) { + json['name'] = name; + } + return json; + } + + /// Returns a new [Tag] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Tag fromJson(Map json) => json == null + ? null + : Tag( + id: json['id'], + name: json['name'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Tag.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Tag.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Tag-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Tag.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart new file mode 100644 index 00000000000..3d21b5822c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class User { + /// Returns a new [User] instance. + User({ + this.id, + this.username, + this.firstName, + this.lastName, + this.email, + this.password, + this.phone, + this.userStatus, + }); + + + int id; + + + String username; + + + String firstName; + + + String lastName; + + + String email; + + + String password; + + + String phone; + + /// User Status + int userStatus; + + @override + bool operator ==(Object other) => identical(this, other) || other is User && + other.id == id && + other.username == username && + other.firstName == firstName && + other.lastName == lastName && + other.email == email && + other.password == password && + other.phone == phone && + other.userStatus == userStatus; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (username == null ? 0 : username.hashCode) + + (firstName == null ? 0 : firstName.hashCode) + + (lastName == null ? 0 : lastName.hashCode) + + (email == null ? 0 : email.hashCode) + + (password == null ? 0 : password.hashCode) + + (phone == null ? 0 : phone.hashCode) + + (userStatus == null ? 0 : userStatus.hashCode); + + @override + String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; + + Map toJson() { + final 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; + } + + /// Returns a new [User] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static User fromJson(Map json) => json == null + ? null + : User( + id: json['id'], + username: json['username'], + firstName: json['firstName'], + lastName: json['lastName'], + email: json['email'], + password: json['password'], + phone: json['phone'], + userStatus: json['userStatus'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => User.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = User.fromJson(v)); + } + return map; + } + + // maps a json object with a list of User-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = User.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml new file mode 100644 index 00000000000..2ff67a1fcef --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + org.openapitools + Dart2PetstoreClientLibTests + pom + 1.0.0-SNAPSHOT + Dart2 Petstore Client Lib + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + test + + + + + + + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml new file mode 100644 index 00000000000..78ba0e8da82 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -0,0 +1,18 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# + +name: 'openapi' +version: '1.0.0' +description: 'OpenAPI API client' +authors: + - 'Author ' +homepage: 'homepage' +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.12.0 <0.13.0' + intl: '^0.16.1' + meta: '^1.1.8' +dev_dependencies: + test: '^1.3.0' diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart new file mode 100644 index 00000000000..ea8360134e8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponse(); + + group('test ApiResponse', () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart new file mode 100644 index 00000000000..3138399072d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/category_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Category +void main() { + final instance = Category(); + + group('test Category', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object1_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object1_test.dart new file mode 100644 index 00000000000..0ee5baa0570 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object1_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject1 +void main() { + final instance = InlineObject1(); + + group('test InlineObject1', () { + // Additional data to pass to server + // String additionalMetadata + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // MultipartFile file + test('to test the property `file`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object_test.dart new file mode 100644 index 00000000000..f340e52b1d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/inline_object_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject +void main() { + final instance = InlineObject(); + + group('test InlineObject', () { + // Updated name of the pet + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Updated status of the pet + // String status + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart new file mode 100644 index 00000000000..5d1c4ae1e72 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/order_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Order +void main() { + final instance = Order(); + + group('test Order', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart new file mode 100644 index 00000000000..f143f490530 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for PetApi +void main() { + final instance = PetApi(); + + group('tests for PetApi', () { + // Add a new pet to the store + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(List tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + test('test uploadFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart new file mode 100644 index 00000000000..b91619505ef --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/pet_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Pet +void main() { + final instance = Pet(); + + group('test Pet', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // List photoUrls (default value: const []) + test('to test the property `photoUrls`', () async { + // TODO + }); + + // List tags (default value: const []) + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart new file mode 100644 index 00000000000..4a7ed54abbb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for StoreApi +void main() { + final instance = StoreApi(); + + group('tests for StoreApi', () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart new file mode 100644 index 00000000000..f042b4c9117 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/tag_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Tag +void main() { + final instance = Tag(); + + group('test Tag', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart new file mode 100644 index 00000000000..73ee89a2945 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for UserApi +void main() { + final instance = UserApi(); + + group('tests for UserApi', () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart new file mode 100644 index 00000000000..c14c0b47964 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/test/user_test.dart @@ -0,0 +1,53 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for User +void main() { + final instance = User(); + + group('test User', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES new file mode 100644 index 00000000000..76bedbbf4bc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES @@ -0,0 +1,126 @@ +.gitignore +.travis.yml +README.md +doc/AdditionalPropertiesClass.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/ClassModel.md +doc/Client.md +doc/DefaultApi.md +doc/Dog.md +doc/DogAllOf.md +doc/EnumArrays.md +doc/EnumClass.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeClassnameTags123Api.md +doc/File.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/InlineObject.md +doc/InlineObject1.md +doc/InlineObject2.md +doc/InlineObject3.md +doc/InlineObject4.md +doc/InlineObject5.md +doc/InlineResponseDefault.md +doc/List.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +git_push.sh +lib/api.dart +lib/api/another_fake_api.dart +lib/api/default_api.dart +lib/api/fake_api.dart +lib/api/fake_classname_tags123_api.dart +lib/api/pet_api.dart +lib/api/store_api.dart +lib/api/user_api.dart +lib/api_client.dart +lib/api_exception.dart +lib/api_helper.dart +lib/auth/api_key_auth.dart +lib/auth/authentication.dart +lib/auth/http_basic_auth.dart +lib/auth/http_bearer_auth.dart +lib/auth/oauth.dart +lib/model/additional_properties_class.dart +lib/model/animal.dart +lib/model/api_response.dart +lib/model/array_of_array_of_number_only.dart +lib/model/array_of_number_only.dart +lib/model/array_test.dart +lib/model/capitalization.dart +lib/model/cat.dart +lib/model/cat_all_of.dart +lib/model/category.dart +lib/model/class_model.dart +lib/model/client.dart +lib/model/dog.dart +lib/model/dog_all_of.dart +lib/model/enum_arrays.dart +lib/model/enum_class.dart +lib/model/enum_test.dart +lib/model/file.dart +lib/model/file_schema_test_class.dart +lib/model/foo.dart +lib/model/format_test.dart +lib/model/has_only_read_only.dart +lib/model/health_check_result.dart +lib/model/inline_object.dart +lib/model/inline_object1.dart +lib/model/inline_object2.dart +lib/model/inline_object3.dart +lib/model/inline_object4.dart +lib/model/inline_object5.dart +lib/model/inline_response_default.dart +lib/model/list.dart +lib/model/map_test.dart +lib/model/mixed_properties_and_additional_properties_class.dart +lib/model/model200_response.dart +lib/model/model_return.dart +lib/model/name.dart +lib/model/nullable_class.dart +lib/model/number_only.dart +lib/model/order.dart +lib/model/outer_composite.dart +lib/model/outer_enum.dart +lib/model/outer_enum_default_value.dart +lib/model/outer_enum_integer.dart +lib/model/outer_enum_integer_default_value.dart +lib/model/pet.dart +lib/model/read_only_first.dart +lib/model/special_model_name.dart +lib/model/tag.dart +lib/model/user.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/VERSION new file mode 100644 index 00000000000..d99e7162d01 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml new file mode 100644 index 00000000000..1a3af66d54c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.travis.yml @@ -0,0 +1,14 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# +# https://docs.travis-ci.com/user/languages/dart/ +# +language: dart +dart: +# Install a specific stable release +- "2.2.0" +install: +- pub get + +script: +- pub run test diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md new file mode 100644 index 00000000000..df2666fc1c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -0,0 +1,195 @@ +# openapi +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 2.0 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` + +### Local +To use the package in your local drive, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + + +final api_instance = AnotherFakeApi(); +final client = Client(); // Client | client model + +try { + final result = api_instance.123test@$%SpecialTags(client); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n'); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**123test@$%SpecialTags**](doc//AnotherFakeApi.md#123test@$%specialtags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) + - [Animal](doc//Animal.md) + - [ApiResponse](doc//ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) + - [ArrayTest](doc//ArrayTest.md) + - [Capitalization](doc//Capitalization.md) + - [Cat](doc//Cat.md) + - [CatAllOf](doc//CatAllOf.md) + - [Category](doc//Category.md) + - [ClassModel](doc//ClassModel.md) + - [Client](doc//Client.md) + - [Dog](doc//Dog.md) + - [DogAllOf](doc//DogAllOf.md) + - [EnumArrays](doc//EnumArrays.md) + - [EnumClass](doc//EnumClass.md) + - [EnumTest](doc//EnumTest.md) + - [File](doc//File.md) + - [FileSchemaTestClass](doc//FileSchemaTestClass.md) + - [Foo](doc//Foo.md) + - [FormatTest](doc//FormatTest.md) + - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) + - [HealthCheckResult](doc//HealthCheckResult.md) + - [InlineObject](doc//InlineObject.md) + - [InlineObject1](doc//InlineObject1.md) + - [InlineObject2](doc//InlineObject2.md) + - [InlineObject3](doc//InlineObject3.md) + - [InlineObject4](doc//InlineObject4.md) + - [InlineObject5](doc//InlineObject5.md) + - [InlineResponseDefault](doc//InlineResponseDefault.md) + - [List](doc//List.md) + - [MapTest](doc//MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc//Model200Response.md) + - [ModelReturn](doc//ModelReturn.md) + - [Name](doc//Name.md) + - [NullableClass](doc//NullableClass.md) + - [NumberOnly](doc//NumberOnly.md) + - [Order](doc//Order.md) + - [OuterComposite](doc//OuterComposite.md) + - [OuterEnum](doc//OuterEnum.md) + - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc//OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) + - [Pet](doc//Pet.md) + - [ReadOnlyFirst](doc//ReadOnlyFirst.md) + - [SpecialModelName](doc//SpecialModelName.md) + - [Tag](doc//Tag.md) + - [User](doc//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## bearer_test + +- **Type**: HTTP Bearer authentication + +## http_basic_test + +- **Type**: HTTP Basic authentication + +## http_signature_test + + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..859d4d0b7a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map** | | [optional] [default to const {}] +**mapOfMapProperty** | [**Map>**](Map.md) | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md new file mode 100644 index 00000000000..415b56e9bc2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md new file mode 100644 index 00000000000..4a6ad365bdc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**123test@$%SpecialTags**](AnotherFakeApi.md#123test@$%SpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + +# **123test@$%SpecialTags** +> Client 123test@$%SpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = AnotherFakeApi(); +final client = Client(); // Client | client model + +try { + final result = api_instance.123test@$%SpecialTags(client); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: 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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ApiResponse.md new file mode 100644 index 00000000000..7ad5da0f89e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..0a0dc2a7b75 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List>**](List.md) | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..01b6f58870f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **List** | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayTest.md new file mode 100644 index 00000000000..598a895bb20 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List** | | [optional] [default to const []] +**arrayArrayOfInteger** | [**List>**](List.md) | | [optional] [default to const []] +**arrayArrayOfModel** | [**List>**](List.md) | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Capitalization.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Capitalization.md new file mode 100644 index 00000000000..4a07b4eb820 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md new file mode 100644 index 00000000000..6552eea4b43 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/CatAllOf.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/CatAllOf.md new file mode 100644 index 00000000000..36b2ae0e8ab --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[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-jaguar/openapi_proto/docs/Category.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Category.md similarity index 77% rename from samples/client/petstore/dart-jaguar/openapi_proto/docs/Category.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Category.md index cc0d1633b59..ae6bc52e89d 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/Category.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Category.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**name** | **String** | | [default to 'default-name'] [[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ClassModel.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ClassModel.md new file mode 100644 index 00000000000..13ae5d3a470 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Client.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Client.md new file mode 100644 index 00000000000..8e8f3c56b1a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Client.md @@ -0,0 +1,15 @@ +# openapi.model.Client + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md new file mode 100644 index 00000000000..fb0ca9b2012 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | + + +# **fooGet** +> InlineResponseDefault fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = DefaultApi(); + +try { + final result = api_instance.fooGet(); + print(result); +} catch (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: 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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md new file mode 100644 index 00000000000..d36439b767b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DogAllOf.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DogAllOf.md new file mode 100644 index 00000000000..97a7c8fba49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumArrays.md new file mode 100644 index 00000000000..2c12a0e6168 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **List** | | [optional] [default to const []] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumClass.md new file mode 100644 index 00000000000..a9ed4c1f0c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.EnumClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumTest.md new file mode 100644 index 00000000000..7c24fe2347b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **int** | | [optional] +**enumNumber** | **double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md new file mode 100644 index 00000000000..8602c25ca80 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md @@ -0,0 +1,725 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | + + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); + +try { + final result = api_instance.fakeHealthGet(); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeHealthGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: 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) + +# **fakeHttpSignatureTest** +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store +final query1 = query1_example; // String | query parameter +final header1 = header1_example; // String | header parameter + +try { + api_instance.fakeHttpSignatureTest(pet, query1, header1); +} catch (e) { + print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] + **header1** | **String**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + +# **fakeOuterBooleanSerialize** +> bool fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = bool(); // bool | Input boolean as post body + +try { + final result = api_instance.fakeOuterBooleanSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final outerComposite = OuterComposite(); // OuterComposite | Input composite as post body + +try { + final result = api_instance.fakeOuterCompositeSerialize(outerComposite); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterNumberSerialize** +> num fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = num(); // num | Input number as post body + +try { + final result = api_instance.fakeOuterNumberSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **num**| Input number as post body | [optional] + +### Return type + +**num** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = String(); // String | Input string as post body + +try { + final result = api_instance.fakeOuterStringSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | + +try { + api_instance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final query = query_example; // String | +final user = User(); // User | + +try { + api_instance.testBodyWithQueryParams(query, user); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final client = Client(); // Client | client model + +try { + final result = api_instance.testClientModel(client); + print(result); +} catch (e) { + print('Exception when calling FakeApi->testClientModel: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: 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) + +# **testEndpointParameters** +> testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +final api_instance = FakeApi(); +final number = 8.14; // num | None +final double = 1.2; // double | None +final patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final byte = BYTE_ARRAY_DATA_HERE; // String | None +final integer = 56; // int | None +final int32 = 56; // int | None +final int64 = 789; // int | None +final float = 3.4; // double | None +final string = string_example; // String | None +final binary = BINARY_DATA_HERE; // MultipartFile | None +final date = 2013-10-20; // DateTime | None +final dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +final password = password_example; // String | None +final callback = callback_example; // String | None + +try { + api_instance.testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch (e) { + print('Exception when calling FakeApi->testEndpointParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **num**| None | + **double** | **double**| None | + **patternWithoutDelimiter** | **String**| None | + **byte** | **String**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **double**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **MultipartFile**| None | [optional] + **date** | **DateTime**| None | [optional] + **dateTime** | **DateTime**| None | [optional] + **password** | **String**| None | [optional] + **callback** | **String**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final enumHeaderStringArray = []; // List | Header parameter enum test (string array) +final enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final enumQueryStringArray = []; // List | Query parameter enum test (string array) +final enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final enumQueryInteger = 56; // int | Query parameter enum test (double) +final enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final enumFormStringArray = [enumFormStringArray_example]; // List | Form parameter enum test (string array) +final enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); +} catch (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**List**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumFormStringArray** | [**List**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP Bearer authorization: bearer_test +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer_test').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer_test').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = FakeApi(); +final requiredStringGroup = 56; // int | Required String in group parameters +final requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final requiredInt64Group = 789; // int | Required Integer in group parameters +final stringGroup = 56; // int | String in group parameters +final booleanGroup = true; // bool | Boolean in group parameters +final int64Group = 789; // int | Integer in group parameters + +try { + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch (e) { + print('Exception when calling FakeApi->testGroupParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **int**| Required Integer in group parameters | + **stringGroup** | **int**| String in group parameters | [optional] + **booleanGroup** | **bool**| Boolean in group parameters | [optional] + **int64Group** | **int**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final requestBody = Map(); // Map | request body + +try { + api_instance.testInlineAdditionalProperties(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final param = param_example; // String | field1 +final param2 = param2_example; // String | field2 + +try { + api_instance.testJsonFormData(param, param2); +} catch (e) { + print('Exception when calling FakeApi->testJsonFormData: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final pipe = []; // List | +final ioutil = []; // List | +final http = []; // List | +final url = []; // List | +final context = []; // List | + +try { + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); +} catch (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List**](String.md)| | [default to const []] + **ioutil** | [**List**](String.md)| | [default to const []] + **http** | [**List**](String.md)| | [default to const []] + **url** | [**List**](String.md)| | [default to const []] + **context** | [**List**](String.md)| | [default to const []] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..3c0be2a0435 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +final api_instance = FakeClassnameTags123Api(); +final client = Client(); // Client | client model + +try { + final result = api_instance.testClassname(client); + print(result); +} catch (e) { + print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: 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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/File.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/File.md new file mode 100644 index 00000000000..02f2e417682 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/File.md @@ -0,0 +1,15 @@ +# openapi.model.File + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [optional] + +[[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-jaguar/openapi/docs/ApiResponse.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FileSchemaTestClass.md similarity index 64% rename from samples/client/petstore/dart-jaguar/openapi/docs/ApiResponse.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FileSchemaTestClass.md index 92422f0f446..d5b1765fdc1 100644 --- a/samples/client/petstore/dart-jaguar/openapi/docs/ApiResponse.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FileSchemaTestClass.md @@ -1,4 +1,4 @@ -# openapi.model.ApiResponse +# openapi.model.FileSchemaTestClass ## Load the model package ```dart @@ -8,9 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [optional] [default to null] +**file** | [**MultipartFile**](MultipartFile.md) | | [optional] +**files** | [**List**](MultipartFile.md) | | [optional] [default to const []] [[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Foo.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Foo.md new file mode 100644 index 00000000000..185b76e3f5b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md new file mode 100644 index 00000000000..8ff40a8249c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double** | **double** | | [optional] +**decimal** | [**Decimal**](Decimal.md) | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**MultipartFile**](File.md) | | [optional] +**date** | [**DateTime**](DateTime.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HasOnlyReadOnly.md new file mode 100644 index 00000000000..f2d30e9fb68 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HealthCheckResult.md new file mode 100644 index 00000000000..4d6aeb75d96 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject.md new file mode 100644 index 00000000000..9aa480dee58 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/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] +**status** | **String** | Updated status of the pet | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject1.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject1.md new file mode 100644 index 00000000000..013aa87e9bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/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] +**file** | [**MultipartFile**](File.md) | file to upload | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject2.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject2.md new file mode 100644 index 00000000000..64edf2983bc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject2.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject2 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumFormStringArray** | **List** | Form parameter enum test (string array) | [optional] [default to const []] +**enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to '-efg'] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md new file mode 100644 index 00000000000..1d8524d35c7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md @@ -0,0 +1,28 @@ +# openapi.model.InlineObject3 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | None | [optional] +**int32** | **int** | None | [optional] +**int64** | **int** | None | [optional] +**number** | **num** | None | +**float** | **double** | None | [optional] +**double** | **double** | None | +**string** | **String** | None | [optional] +**patternWithoutDelimiter** | **String** | None | +**byte** | **String** | None | +**binary** | [**MultipartFile**](File.md) | None | [optional] +**date** | [**DateTime**](DateTime.md) | None | [optional] +**dateTime** | [**DateTime**](DateTime.md) | None | [optional] +**password** | **String** | None | [optional] +**callback** | **String** | None | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject4.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject4.md new file mode 100644 index 00000000000..3823ffff979 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject4.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject4 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | +**param2** | **String** | field2 | + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject5.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject5.md new file mode 100644 index 00000000000..b82544d520a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject5.md @@ -0,0 +1,16 @@ +# openapi.model.InlineObject5 + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**requiredFile** | [**MultipartFile**](File.md) | file to upload | + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineResponseDefault.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineResponseDefault.md new file mode 100644 index 00000000000..c5e61e1162b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineResponseDefault.md @@ -0,0 +1,15 @@ +# openapi.model.InlineResponseDefault + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/List.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/List.md new file mode 100644 index 00000000000..91fb93c5c2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/List.md @@ -0,0 +1,15 @@ +# openapi.model.List + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MapTest.md new file mode 100644 index 00000000000..a1732207bfc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map>**](Map.md) | | [optional] [default to const {}] +**mapOfEnumString** | **Map** | | [optional] [default to const {}] +**directMap** | **Map** | | [optional] [default to const {}] +**indirectMap** | **Map** | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..1f7f66b684f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**Map**](Animal.md) | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Model200Response.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Model200Response.md new file mode 100644 index 00000000000..5aa3fb97c32 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**class_** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ModelReturn.md new file mode 100644 index 00000000000..bc02df7a369 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Name.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Name.md new file mode 100644 index 00000000000..9da6e75fbf5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snakeCase** | **int** | | [optional] [readonly] +**property** | **String** | | [optional] +**n123number** | **int** | | [optional] [readonly] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md new file mode 100644 index 00000000000..9b2e46df0a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] +**numberProp** | **num** | | [optional] +**booleanProp** | **bool** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**DateTime**](DateTime.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | [**List**](Object.md) | | [optional] [default to const []] +**arrayAndItemsNullableProp** | [**List**](Object.md) | | [optional] [default to const []] +**arrayItemsNullable** | [**List**](Object.md) | | [optional] [default to const []] +**objectNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] +**objectAndItemsNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] +**objectItemsNullable** | [**Map**](Object.md) | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NumberOnly.md new file mode 100644 index 00000000000..d8096a3db37 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [optional] + +[[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/dart2/openapi/doc/Order.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Order.md similarity index 58% rename from samples/client/petstore/dart2/openapi/doc/Order.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Order.md index 310ce6c65be..bde5ffe51a2 100644 --- a/samples/client/petstore/dart2/openapi/doc/Order.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Order.md @@ -8,11 +8,11 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] **complete** | **bool** | | [optional] [default to false] [[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterComposite.md new file mode 100644 index 00000000000..04bab7eff5d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **bool** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnum.md new file mode 100644 index 00000000000..af62ad87ab2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..c1bf8b0dec4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumInteger.md new file mode 100644 index 00000000000..8c80a9e5c85 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..eb8b55d7024 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md new file mode 100644 index 00000000000..88512ee3703 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List** | | [default to const []] +**tags** | [**List**](Tag.md) | | [optional] [default to const []] +**status** | **String** | pet status in the store | [optional] + +[[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-jaguar/openapi_proto/docs/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md similarity index 53% rename from samples/client/petstore/dart-jaguar/openapi_proto/docs/PetApi.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md index 3e4ef1cedb2..5320ca9ae5a 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/docs/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md @@ -5,22 +5,23 @@ import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://petstore.swagger.io/v2* +All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **Post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **Delete** /pet/:petId | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **Get** /pet/:petId | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **Put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **Post** /pet/:petId | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **Post** /pet/:petId/uploadImage | uploads an image +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **addPet** -> addPet(body) +> addPet(pet) Add a new pet to the store @@ -28,15 +29,15 @@ 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 +final api_instance = PetApi(); +final 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"); + print('Exception when calling PetApi->addPet: $e\n'); } ``` @@ -44,7 +45,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,16 +71,16 @@ 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 petId = 789; // int | Pet id to delete -var apiKey = apiKey_example; // String | +final api_instance = PetApi(); +final petId = 789; // int | Pet id to delete +final apiKey = apiKey_example; // String | try { api_instance.deletePet(petId, apiKey); } catch (e) { - print("Exception when calling PetApi->deletePet: $e\n"); + print('Exception when calling PetApi->deletePet: $e\n'); } ``` @@ -87,8 +88,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] ### Return type @@ -116,16 +117,16 @@ 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 status = []; // List | Status values that need to be considered for filter +final api_instance = PetApi(); +final status = []; // List | Status values that need to be considered for filter try { - var result = api_instance.findPetsByStatus(status); + final result = api_instance.findPetsByStatus(status); print(result); } catch (e) { - print("Exception when calling PetApi->findPetsByStatus: $e\n"); + print('Exception when calling PetApi->findPetsByStatus: $e\n'); } ``` @@ -133,7 +134,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] + **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -161,16 +162,16 @@ 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 tags = []; // List | Tags to filter by +final api_instance = PetApi(); +final tags = []; // List | Tags to filter by try { - var result = api_instance.findPetsByTags(tags); + final result = api_instance.findPetsByTags(tags); print(result); } catch (e) { - print("Exception when calling PetApi->findPetsByTags: $e\n"); + print('Exception when calling PetApi->findPetsByTags: $e\n'); } ``` @@ -178,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] + **tags** | [**List**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -206,18 +207,18 @@ 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 petId = 789; // int | ID of pet to return +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to return try { - var result = api_instance.getPetById(petId); + final result = api_instance.getPetById(petId); print(result); } catch (e) { - print("Exception when calling PetApi->getPetById: $e\n"); + print('Exception when calling PetApi->getPetById: $e\n'); } ``` @@ -225,7 +226,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] + **petId** | **int**| ID of pet to return | ### Return type @@ -243,7 +244,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,15 +252,15 @@ 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 +final api_instance = PetApi(); +final 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"); + print('Exception when calling PetApi->updatePet: $e\n'); } ``` @@ -267,7 +268,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,17 +294,17 @@ 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 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 +final api_instance = PetApi(); +final petId = 789; // int | ID of pet that needs to be updated +final name = name_example; // String | Updated name of the pet +final status = status_example; // String | Updated status of the pet try { api_instance.updatePetWithForm(petId, name, status); } catch (e) { - print("Exception when calling PetApi->updatePetWithForm: $e\n"); + print('Exception when calling PetApi->updatePetWithForm: $e\n'); } ``` @@ -311,9 +312,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -339,18 +340,18 @@ 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 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 +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final file = BINARY_DATA_HERE; // MultipartFile | file to upload try { - var result = api_instance.uploadFile(petId, additionalMetadata, file); + final result = api_instance.uploadFile(petId, additionalMetadata, file); print(result); } catch (e) { - print("Exception when calling PetApi->uploadFile: $e\n"); + print('Exception when calling PetApi->uploadFile: $e\n'); } ``` @@ -358,9 +359,56 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null] + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: 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) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **MultipartFile**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ReadOnlyFirst.md new file mode 100644 index 00000000000..fa6f9e4305d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **String** | | [optional] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md new file mode 100644 index 00000000000..cbac888c3dc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**$special[propertyName]** | **int** | | [optional] + +[[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-jaguar/flutter_proto_petstore/openapi/docs/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md similarity index 67% rename from samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/StoreApi.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md index d6e8ed69343..258b08e898c 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md @@ -5,14 +5,14 @@ import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://petstore.swagger.io/v2* +All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **Delete** /store/order/:orderId | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **Get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **Get** /store/order/:orderId | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **Post** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet # **deleteOrder** @@ -26,13 +26,13 @@ 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 orderId = orderId_example; // String | ID of the order that needs to be deleted +final api_instance = StoreApi(); +final orderId = orderId_example; // String | ID of the order that needs to be deleted try { api_instance.deleteOrder(orderId); } catch (e) { - print("Exception when calling StoreApi->deleteOrder: $e\n"); + print('Exception when calling StoreApi->deleteOrder: $e\n'); } ``` @@ -40,7 +40,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + **orderId** | **String**| ID of the order that needs to be deleted | ### Return type @@ -68,17 +68,17 @@ 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(); +final api_instance = StoreApi(); try { - var result = api_instance.getInventory(); + final result = api_instance.getInventory(); print(result); } catch (e) { - print("Exception when calling StoreApi->getInventory: $e\n"); + print('Exception when calling StoreApi->getInventory: $e\n'); } ``` @@ -111,14 +111,14 @@ 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 orderId = 789; // int | ID of pet that needs to be fetched +final api_instance = StoreApi(); +final orderId = 789; // int | ID of pet that needs to be fetched try { - var result = api_instance.getOrderById(orderId); + final result = api_instance.getOrderById(orderId); print(result); } catch (e) { - print("Exception when calling StoreApi->getOrderById: $e\n"); + print('Exception when calling StoreApi->getOrderById: $e\n'); } ``` @@ -126,7 +126,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + **orderId** | **int**| ID of pet that needs to be fetched | ### Return type @@ -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,14 +152,14 @@ 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 +final api_instance = StoreApi(); +final order = Order(); // Order | order placed for purchasing the pet try { - var result = api_instance.placeOrder(body); + final result = api_instance.placeOrder(order); print(result); } catch (e) { - print("Exception when calling StoreApi->placeOrder: $e\n"); + 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**: application/octet-stream + - **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/dart2/openapi/doc/Tag.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Tag.md similarity index 77% rename from samples/client/petstore/dart2/openapi/doc/Tag.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Tag.md index ded7b32ac3d..c219f987c19 100644 --- a/samples/client/petstore/dart2/openapi/doc/Tag.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Tag.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**name** | **String** | | [optional] [[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/User.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/User.md new file mode 100644 index 00000000000..fa87e64d859 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[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/dart2/petstore_client_lib/docs/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md similarity index 71% rename from samples/client/petstore/dart2/petstore_client_lib/docs/UserApi.md rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md index 1ee5f6fced6..1fcc5faa1cb 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/docs/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md @@ -5,7 +5,7 @@ import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://petstore.swagger.io/v2* +All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -20,7 +20,7 @@ Method | HTTP request | Description # **createUser** -> createUser(body) +> createUser(user) Create user @@ -30,13 +30,13 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var body = User(); // User | Created user object +final api_instance = UserApi(); +final 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"); + print('Exception when calling UserApi->createUser: $e\n'); } ``` @@ -44,7 +44,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -56,13 +56,13 @@ No authorization required ### 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 @@ -70,13 +70,13 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var body = [List<User>()]; // List | List of user object +final api_instance = UserApi(); +final user = [List()]; // List | List of user object try { - api_instance.createUsersWithArrayInput(body); + api_instance.createUsersWithArrayInput(user); } catch (e) { - print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); } ``` @@ -84,7 +84,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List**](User.md)| List of user object | ### Return type @@ -96,13 +96,13 @@ No authorization required ### 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 @@ -110,13 +110,13 @@ Creates list of users with given input array ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var body = [List<User>()]; // List | List of user object +final api_instance = UserApi(); +final user = [List()]; // List | List of user object try { - api_instance.createUsersWithListInput(body); + api_instance.createUsersWithListInput(user); } catch (e) { - print("Exception when calling UserApi->createUsersWithListInput: $e\n"); + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); } ``` @@ -124,7 +124,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ No authorization required ### 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) @@ -152,13 +152,13 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var username = username_example; // String | The name that needs to be deleted +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be deleted try { api_instance.deleteUser(username); } catch (e) { - print("Exception when calling UserApi->deleteUser: $e\n"); + print('Exception when calling UserApi->deleteUser: $e\n'); } ``` @@ -166,7 +166,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | [default to null] + **username** | **String**| The name that needs to be deleted | ### Return type @@ -192,14 +192,14 @@ Get user by user name ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. try { - var result = api_instance.getUserByName(username); + final result = api_instance.getUserByName(username); print(result); } catch (e) { - print("Exception when calling UserApi->getUserByName: $e\n"); + print('Exception when calling UserApi->getUserByName: $e\n'); } ``` @@ -207,7 +207,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | ### Return type @@ -233,15 +233,15 @@ Logs user into the system ```dart import 'package:openapi/api.dart'; -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 +final api_instance = UserApi(); +final username = username_example; // String | The user name for login +final password = password_example; // String | The password for login in clear text try { - var result = api_instance.loginUser(username, password); + final result = api_instance.loginUser(username, password); print(result); } catch (e) { - print("Exception when calling UserApi->loginUser: $e\n"); + print('Exception when calling UserApi->loginUser: $e\n'); } ``` @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -276,12 +276,12 @@ Logs out current logged in user session ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); +final api_instance = UserApi(); try { api_instance.logoutUser(); } catch (e) { - print("Exception when calling UserApi->logoutUser: $e\n"); + print('Exception when calling UserApi->logoutUser: $e\n'); } ``` @@ -304,7 +304,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 @@ -314,14 +314,14 @@ This can only be done by the logged in user. ```dart import 'package:openapi/api.dart'; -var api_instance = UserApi(); -var username = username_example; // String | name that need to be deleted -var body = User(); // User | Updated user object +final api_instance = UserApi(); +final username = username_example; // String | name that need to be deleted +final 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"); + print('Exception when calling UserApi->updateUser: $e\n'); } ``` @@ -329,8 +329,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | [default to null] - **body** | [**User**](User.md)| Updated user object | + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -342,7 +342,7 @@ No authorization required ### 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/openapi3/client/petstore/dart2/petstore_client_lib_fake/git_push.sh b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart new file mode 100644 index 00000000000..6b615a2800e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart @@ -0,0 +1,93 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; +import 'package:meta/meta.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; +part 'auth/http_bearer_auth.dart'; + +part 'api/another_fake_api.dart'; +part 'api/default_api.dart'; +part 'api/fake_api.dart'; +part 'api/fake_classname_tags123_api.dart'; +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +part 'api/user_api.dart'; + +part 'model/additional_properties_class.dart'; +part 'model/animal.dart'; +part 'model/api_response.dart'; +part 'model/array_of_array_of_number_only.dart'; +part 'model/array_of_number_only.dart'; +part 'model/array_test.dart'; +part 'model/capitalization.dart'; +part 'model/cat.dart'; +part 'model/cat_all_of.dart'; +part 'model/category.dart'; +part 'model/class_model.dart'; +part 'model/client.dart'; +part 'model/dog.dart'; +part 'model/dog_all_of.dart'; +part 'model/enum_arrays.dart'; +part 'model/enum_class.dart'; +part 'model/enum_test.dart'; +part 'model/file.dart'; +part 'model/file_schema_test_class.dart'; +part 'model/foo.dart'; +part 'model/format_test.dart'; +part 'model/has_only_read_only.dart'; +part 'model/health_check_result.dart'; +part 'model/inline_object.dart'; +part 'model/inline_object1.dart'; +part 'model/inline_object2.dart'; +part 'model/inline_object3.dart'; +part 'model/inline_object4.dart'; +part 'model/inline_object5.dart'; +part 'model/inline_response_default.dart'; +part 'model/list.dart'; +part 'model/map_test.dart'; +part 'model/mixed_properties_and_additional_properties_class.dart'; +part 'model/model200_response.dart'; +part 'model/model_return.dart'; +part 'model/name.dart'; +part 'model/nullable_class.dart'; +part 'model/number_only.dart'; +part 'model/order.dart'; +part 'model/outer_composite.dart'; +part 'model/outer_enum.dart'; +part 'model/outer_enum_default_value.dart'; +part 'model/outer_enum_integer.dart'; +part 'model/outer_enum_integer_default_value.dart'; +part 'model/pet.dart'; +part 'model/read_only_first.dart'; +part 'model/special_model_name.dart'; +part 'model/tag.dart'; +part 'model/user.dart'; + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart new file mode 100644 index 00000000000..87782fe54f6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class AnotherFakeApi { + AnotherFakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Client] client (required): + /// client model + Future 123test@$%SpecialTagsWithHttpInfo(Client client) async { + // Verify required params are set. + if (client == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); + } + + final path = '/another-fake/dummy'.replaceAll('{format}', 'json'); + + Object postBody = client; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// + /// * [Client] client (required): + /// client model + Future 123test@$%SpecialTags(Client client) async { + final response = await 123test@$%SpecialTagsWithHttpInfo(client); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Client') as Client; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart new file mode 100644 index 00000000000..73861456c98 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart @@ -0,0 +1,69 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class DefaultApi { + DefaultApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Performs an HTTP 'GET /foo' operation and returns the [Response]. + Future fooGetWithHttpInfo() async { + final path = '/foo'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future fooGet() async { + final response = await fooGetWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'InlineResponseDefault') as InlineResponseDefault; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart new file mode 100644 index 00000000000..1d17b64b8ac --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -0,0 +1,1374 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class FakeApi { + FakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Health check endpoint + /// + /// Note: This method returns the HTTP [Response]. + Future fakeHealthGetWithHttpInfo() async { + final path = '/fake/health'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Health check endpoint + Future fakeHealthGet() async { + final response = await fakeHealthGetWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'HealthCheckResult') as HealthCheckResult; + } + return null; + } + + /// test http signature authentication + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + /// + /// * [String] query1: + /// query parameter + /// + /// * [String] header1: + /// header parameter + Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1 }) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/fake/http-signature-test'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (query1 != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'query_1', query1)); + } + + if (header1 != null) { + headerParams['header_1'] = parameterToString(header1); + } + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['http_signature_test']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// test http signature authentication + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + /// + /// * [String] query1: + /// query parameter + /// + /// * [String] header1: + /// header parameter + Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async { + final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1 ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Test serialization of outer boolean types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [bool] body: + /// Input boolean as post body + Future fakeOuterBooleanSerializeWithHttpInfo({ bool body }) async { + // Verify required params are set. + + final path = '/fake/outer/boolean'.replaceAll('{format}', 'json'); + + Object postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of outer boolean types + /// + /// Parameters: + /// + /// * [bool] body: + /// Input boolean as post body + Future fakeOuterBooleanSerialize({ bool body }) async { + final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'bool') as bool; + } + return null; + } + + /// Test serialization of object with outer number type + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [OuterComposite] outerComposite: + /// Input composite as post body + Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite }) async { + // Verify required params are set. + + final path = '/fake/outer/composite'.replaceAll('{format}', 'json'); + + Object postBody = outerComposite; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of object with outer number type + /// + /// Parameters: + /// + /// * [OuterComposite] outerComposite: + /// Input composite as post body + Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async { + final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'OuterComposite') as OuterComposite; + } + return null; + } + + /// Test serialization of outer number types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [num] body: + /// Input number as post body + Future fakeOuterNumberSerializeWithHttpInfo({ num body }) async { + // Verify required params are set. + + final path = '/fake/outer/number'.replaceAll('{format}', 'json'); + + Object postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of outer number types + /// + /// Parameters: + /// + /// * [num] body: + /// Input number as post body + Future fakeOuterNumberSerialize({ num body }) async { + final response = await fakeOuterNumberSerializeWithHttpInfo( body: body ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'num') as num; + } + return null; + } + + /// Test serialization of outer string types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] body: + /// Input string as post body + Future fakeOuterStringSerializeWithHttpInfo({ String body }) async { + // Verify required params are set. + + final path = '/fake/outer/string'.replaceAll('{format}', 'json'); + + Object postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of outer string types + /// + /// Parameters: + /// + /// * [String] body: + /// Input string as post body + Future fakeOuterStringSerialize({ String body }) async { + final response = await fakeOuterStringSerializeWithHttpInfo( body: body ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return null; + } + + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [FileSchemaTestClass] fileSchemaTestClass (required): + Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) async { + // Verify required params are set. + if (fileSchemaTestClass == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: fileSchemaTestClass'); + } + + final path = '/fake/body-with-file-schema'.replaceAll('{format}', 'json'); + + Object postBody = fileSchemaTestClass; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Parameters: + /// + /// * [FileSchemaTestClass] fileSchemaTestClass (required): + Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async { + final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] query (required): + /// + /// * [User] user (required): + Future testBodyWithQueryParamsWithHttpInfo(String query, User user) async { + // Verify required params are set. + if (query == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: query'); + } + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/fake/body-with-query-params'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'query', query)); + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Parameters: + /// + /// * [String] query (required): + /// + /// * [User] user (required): + Future testBodyWithQueryParams(String query, User user) async { + final response = await testBodyWithQueryParamsWithHttpInfo(query, user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// To test \"client\" model + /// + /// To test \"client\" model + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Client] client (required): + /// client model + Future testClientModelWithHttpInfo(Client client) async { + // Verify required params are set. + if (client == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); + } + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody = client; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test \"client\" model + /// + /// To test \"client\" model + /// + /// Parameters: + /// + /// * [Client] client (required): + /// client model + Future testClientModel(Client client) async { + final response = await testClientModelWithHttpInfo(client); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Client') as Client; + } + return null; + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [num] number (required): + /// None + /// + /// * [double] double (required): + /// None + /// + /// * [String] patternWithoutDelimiter (required): + /// None + /// + /// * [String] byte (required): + /// None + /// + /// * [int] integer: + /// None + /// + /// * [int] int32: + /// None + /// + /// * [int] int64: + /// None + /// + /// * [double] float: + /// None + /// + /// * [String] string: + /// None + /// + /// * [MultipartFile] binary: + /// None + /// + /// * [DateTime] date: + /// None + /// + /// * [DateTime] dateTime: + /// None + /// + /// * [String] password: + /// None + /// + /// * [String] callback: + /// None + Future testEndpointParametersWithHttpInfo(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { + // Verify required params are set. + if (number == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: number'); + } + if (double == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: double'); + } + if (patternWithoutDelimiter == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: patternWithoutDelimiter'); + } + if (byte == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: byte'); + } + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['http_basic_test']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (integer != null) { + hasFields = true; + mp.fields['integer'] = parameterToString(integer); + } + if (int32 != null) { + hasFields = true; + mp.fields['int32'] = parameterToString(int32); + } + if (int64 != null) { + hasFields = true; + mp.fields['int64'] = parameterToString(int64); + } + if (number != null) { + hasFields = true; + mp.fields['number'] = parameterToString(number); + } + if (float != null) { + hasFields = true; + mp.fields['float'] = parameterToString(float); + } + if (double != null) { + hasFields = true; + mp.fields['double'] = parameterToString(double); + } + if (string != null) { + hasFields = true; + mp.fields['string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + hasFields = true; + mp.fields['pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + hasFields = true; + mp.fields['byte'] = parameterToString(byte); + } + if (binary != null) { + hasFields = true; + mp.fields['binary'] = binary.field; + mp.files.add(binary); + } + if (date != null) { + hasFields = true; + mp.fields['date'] = parameterToString(date); + } + if (dateTime != null) { + hasFields = true; + mp.fields['dateTime'] = parameterToString(dateTime); + } + if (password != null) { + hasFields = true; + mp.fields['password'] = parameterToString(password); + } + if (callback != null) { + hasFields = true; + mp.fields['callback'] = parameterToString(callback); + } + if (hasFields) { + postBody = mp; + } + } else { + if (integer != null) { + formParams['integer'] = parameterToString(integer); + } + if (int32 != null) { + formParams['int32'] = parameterToString(int32); + } + if (int64 != null) { + formParams['int64'] = parameterToString(int64); + } + if (number != null) { + formParams['number'] = parameterToString(number); + } + if (float != null) { + formParams['float'] = parameterToString(float); + } + if (double != null) { + formParams['double'] = parameterToString(double); + } + if (string != null) { + formParams['string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + formParams['pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + formParams['byte'] = parameterToString(byte); + } + if (date != null) { + formParams['date'] = parameterToString(date); + } + if (dateTime != null) { + formParams['dateTime'] = parameterToString(dateTime); + } + if (password != null) { + formParams['password'] = parameterToString(password); + } + if (callback != null) { + formParams['callback'] = parameterToString(callback); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// + /// * [num] number (required): + /// None + /// + /// * [double] double (required): + /// None + /// + /// * [String] patternWithoutDelimiter (required): + /// None + /// + /// * [String] byte (required): + /// None + /// + /// * [int] integer: + /// None + /// + /// * [int] int32: + /// None + /// + /// * [int] int64: + /// None + /// + /// * [double] float: + /// None + /// + /// * [String] string: + /// None + /// + /// * [MultipartFile] binary: + /// None + /// + /// * [DateTime] date: + /// None + /// + /// * [DateTime] dateTime: + /// None + /// + /// * [String] password: + /// None + /// + /// * [String] callback: + /// None + Future testEndpointParameters(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { + final response = await testEndpointParametersWithHttpInfo(number, double, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// To test enum parameters + /// + /// To test enum parameters + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] enumHeaderStringArray: + /// Header parameter enum test (string array) + /// + /// * [String] enumHeaderString: + /// Header parameter enum test (string) + /// + /// * [List] enumQueryStringArray: + /// Query parameter enum test (string array) + /// + /// * [String] enumQueryString: + /// Query parameter enum test (string) + /// + /// * [int] enumQueryInteger: + /// Query parameter enum test (double) + /// + /// * [double] enumQueryDouble: + /// Query parameter enum test (double) + /// + /// * [List] enumFormStringArray: + /// Form parameter enum test (string array) + /// + /// * [String] enumFormString: + /// Form parameter enum test (string) + Future testEnumParametersWithHttpInfo({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async { + // Verify required params are set. + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (enumQueryStringArray != null) { + queryParams.addAll(_convertParametersForCollectionFormat('multi', 'enum_query_string_array', enumQueryStringArray)); + } + if (enumQueryString != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_string', enumQueryString)); + } + if (enumQueryInteger != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_integer', enumQueryInteger)); + } + if (enumQueryDouble != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_double', enumQueryDouble)); + } + + if (enumHeaderStringArray != null) { + headerParams['enum_header_string_array'] = parameterToString(enumHeaderStringArray); + } + if (enumHeaderString != null) { + headerParams['enum_header_string'] = parameterToString(enumHeaderString); + } + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (enumFormStringArray != null) { + hasFields = true; + mp.fields['enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + hasFields = true; + mp.fields['enum_form_string'] = parameterToString(enumFormString); + } + if (hasFields) { + postBody = mp; + } + } else { + if (enumFormStringArray != null) { + formParams['enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + formParams['enum_form_string'] = parameterToString(enumFormString); + } + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test enum parameters + /// + /// To test enum parameters + /// + /// Parameters: + /// + /// * [List] enumHeaderStringArray: + /// Header parameter enum test (string array) + /// + /// * [String] enumHeaderString: + /// Header parameter enum test (string) + /// + /// * [List] enumQueryStringArray: + /// Query parameter enum test (string array) + /// + /// * [String] enumQueryString: + /// Query parameter enum test (string) + /// + /// * [int] enumQueryInteger: + /// Query parameter enum test (double) + /// + /// * [double] enumQueryDouble: + /// Query parameter enum test (double) + /// + /// * [List] enumFormStringArray: + /// Form parameter enum test (string array) + /// + /// * [String] enumFormString: + /// Form parameter enum test (string) + Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async { + final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] requiredStringGroup (required): + /// Required String in group parameters + /// + /// * [bool] requiredBooleanGroup (required): + /// Required Boolean in group parameters + /// + /// * [int] requiredInt64Group (required): + /// Required Integer in group parameters + /// + /// * [int] stringGroup: + /// String in group parameters + /// + /// * [bool] booleanGroup: + /// Boolean in group parameters + /// + /// * [int] int64Group: + /// Integer in group parameters + Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async { + // Verify required params are set. + if (requiredStringGroup == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredStringGroup'); + } + if (requiredBooleanGroup == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredBooleanGroup'); + } + if (requiredInt64Group == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredInt64Group'); + } + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'required_string_group', requiredStringGroup)); + queryParams.addAll(_convertParametersForCollectionFormat('', 'required_int64_group', requiredInt64Group)); + if (stringGroup != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'string_group', stringGroup)); + } + if (int64Group != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'int64_group', int64Group)); + } + + headerParams['required_boolean_group'] = parameterToString(requiredBooleanGroup); + if (booleanGroup != null) { + headerParams['boolean_group'] = parameterToString(booleanGroup); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer_test']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// + /// * [int] requiredStringGroup (required): + /// Required String in group parameters + /// + /// * [bool] requiredBooleanGroup (required): + /// Required Boolean in group parameters + /// + /// * [int] requiredInt64Group (required): + /// Required Integer in group parameters + /// + /// * [int] stringGroup: + /// String in group parameters + /// + /// * [bool] booleanGroup: + /// Boolean in group parameters + /// + /// * [int] int64Group: + /// Integer in group parameters + Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async { + final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// test inline additionalProperties + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody) async { + // Verify required params are set. + if (requestBody == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requestBody'); + } + + final path = '/fake/inline-additionalProperties'.replaceAll('{format}', 'json'); + + Object postBody = requestBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// test inline additionalProperties + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testInlineAdditionalProperties(Map requestBody) async { + final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// test json serialization of form data + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] param (required): + /// field1 + /// + /// * [String] param2 (required): + /// field2 + Future testJsonFormDataWithHttpInfo(String param, String param2) async { + // Verify required params are set. + if (param == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: param'); + } + if (param2 == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: param2'); + } + + final path = '/fake/jsonFormData'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (param != null) { + hasFields = true; + mp.fields['param'] = parameterToString(param); + } + if (param2 != null) { + hasFields = true; + mp.fields['param2'] = parameterToString(param2); + } + if (hasFields) { + postBody = mp; + } + } else { + if (param != null) { + formParams['param'] = parameterToString(param); + } + if (param2 != null) { + formParams['param2'] = parameterToString(param2); + } + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// test json serialization of form data + /// + /// Parameters: + /// + /// * [String] param (required): + /// field1 + /// + /// * [String] param2 (required): + /// field2 + Future testJsonFormData(String param, String param2) async { + final response = await testJsonFormDataWithHttpInfo(param, param2); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// To test the collection format in query parameters + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] pipe (required): + /// + /// * [List] ioutil (required): + /// + /// * [List] http (required): + /// + /// * [List] url (required): + /// + /// * [List] context (required): + Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) async { + // Verify required params are set. + if (pipe == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pipe'); + } + if (ioutil == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: ioutil'); + } + if (http == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: http'); + } + if (url == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: url'); + } + if (context == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: context'); + } + + final path = '/fake/test-query-paramters'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('multi', 'pipe', pipe)); + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'ioutil', ioutil)); + queryParams.addAll(_convertParametersForCollectionFormat('ssv', 'http', http)); + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'url', url)); + queryParams.addAll(_convertParametersForCollectionFormat('multi', 'context', context)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test the collection format in query parameters + /// + /// Parameters: + /// + /// * [List] pipe (required): + /// + /// * [List] ioutil (required): + /// + /// * [List] http (required): + /// + /// * [List] url (required): + /// + /// * [List] context (required): + Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async { + final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart new file mode 100644 index 00000000000..8bc9fc650a6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class FakeClassnameTags123Api { + FakeClassnameTags123Api([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// To test class name in snake case + /// + /// To test class name in snake case + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Client] client (required): + /// client model + Future testClassnameWithHttpInfo(Client client) async { + // Verify required params are set. + if (client == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); + } + + final path = '/fake_classname_test'.replaceAll('{format}', 'json'); + + Object postBody = client; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key_query']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test class name in snake case + /// + /// To test class name in snake case + /// + /// Parameters: + /// + /// * [Client] client (required): + /// client model + Future testClassname(Client client) async { + final response = await testClassnameWithHttpInfo(client); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Client') as Client; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart new file mode 100644 index 00000000000..c722b5a8a2f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -0,0 +1,729 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class PetApi { + PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Add a new pet to the store + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPetWithHttpInfo(Pet pet) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/pet'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Add a new pet to the store + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPet(Pet pet) async { + final response = await addPetWithHttpInfo(pet); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Deletes a pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePetWithHttpInfo(int petId, { String apiKey }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (apiKey != null) { + headerParams['api_key'] = parameterToString(apiKey); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Deletes a pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePet(int petId, { String apiKey }) async { + final response = await deletePetWithHttpInfo(petId, apiKey: apiKey ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future findPetsByStatusWithHttpInfo(List status) async { + // Verify required params are set. + if (status == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); + } + + final path = '/pet/findByStatus'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future> findPetsByStatus(List status) async { + final response = await findPetsByStatusWithHttpInfo(status); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .map((item) => item as Pet) + .toList(growable: false); + } + return null; + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] tags (required): + /// Tags to filter by + Future findPetsByTagsWithHttpInfo(List tags) async { + // Verify required params are set. + if (tags == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); + } + + final path = '/pet/findByTags'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// + /// * [List] tags (required): + /// Tags to filter by + Future> findPetsByTags(List tags) async { + final response = await findPetsByTagsWithHttpInfo(tags); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .map((item) => item as Pet) + .toList(growable: false); + } + return null; + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetByIdWithHttpInfo(int petId) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetById(int petId) async { + final response = await getPetByIdWithHttpInfo(petId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; + } + return null; + } + + /// Update an existing pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePetWithHttpInfo(Pet pet) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/pet'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Update an existing pet + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePet(Pet pet) async { + final response = await updatePetWithHttpInfo(pet); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Updates a pet in the store with form data + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (name != null) { + hasFields = true; + mp.fields['name'] = parameterToString(name); + } + if (status != null) { + hasFields = true; + mp.fields['status'] = parameterToString(status); + } + if (hasFields) { + postBody = mp; + } + } else { + if (name != null) { + formParams['name'] = parameterToString(name); + } + if (status != null) { + formParams['status'] = parameterToString(status); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Updates a pet in the store with form data + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithForm(int petId, { String name, String status }) async { + final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// uploads an image + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}/uploadImage'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['multipart/form-data']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields['file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; + } + } else { + if (additionalMetadata != null) { + formParams['additionalMetadata'] = parameterToString(additionalMetadata); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// uploads an image + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { + final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; + } + return null; + } + + /// uploads an image (required) + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [MultipartFile] requiredFile (required): + /// file to upload + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + if (requiredFile == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredFile'); + } + + final path = '/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['multipart/form-data']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); + } + if (requiredFile != null) { + hasFields = true; + mp.fields['requiredFile'] = requiredFile.field; + mp.files.add(requiredFile); + } + if (hasFields) { + postBody = mp; + } + } else { + if (additionalMetadata != null) { + formParams['additionalMetadata'] = parameterToString(additionalMetadata); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// uploads an image (required) + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [MultipartFile] requiredFile (required): + /// file to upload + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async { + final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart new file mode 100644 index 00000000000..f585bd0839f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/store_api.dart @@ -0,0 +1,289 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class StoreApi { + StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrderWithHttpInfo(String orderId) async { + // Verify required params are set. + if (orderId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); + } + + final path = '/store/order/{order_id}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'order_id' + '}', orderId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrder(String orderId) async { + final response = await deleteOrderWithHttpInfo(orderId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + /// + /// Note: This method returns the HTTP [Response]. + Future getInventoryWithHttpInfo() async { + final path = '/store/inventory'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() async { + final response = await getInventoryWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + } + return null; + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderByIdWithHttpInfo(int orderId) async { + // Verify required params are set. + if (orderId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); + } + + final path = '/store/order/{order_id}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'order_id' + '}', orderId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderById(int orderId) async { + final response = await getOrderByIdWithHttpInfo(orderId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; + } + return null; + } + + /// Place an order for a pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrderWithHttpInfo(Order order) async { + // Verify required params are set. + if (order == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); + } + + final path = '/store/order'.replaceAll('{format}', 'json'); + + Object postBody = order; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Place an order for a pet + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrder(Order order) async { + final response = await placeOrderWithHttpInfo(order); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart new file mode 100644 index 00000000000..787b2ea9620 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/user_api.dart @@ -0,0 +1,556 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class UserApi { + UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUserWithHttpInfo(User user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUser(User user) async { + final response = await createUserWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInputWithHttpInfo(List user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/createWithArray'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Creates list of users with given input array + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInput(List user) async { + final response = await createUsersWithArrayInputWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInputWithHttpInfo(List user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/createWithList'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Creates list of users with given input array + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInput(List user) async { + final response = await createUsersWithListInputWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUserWithHttpInfo(String username) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUser(String username) async { + final response = await deleteUserWithHttpInfo(username); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Get user by user name + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByNameWithHttpInfo(String username) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get user by user name + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByName(String username) async { + final response = await getUserByNameWithHttpInfo(username); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; + } + return null; + } + + /// Logs user into the system + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUserWithHttpInfo(String username, String password) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + if (password == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); + } + + final path = '/user/login'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); + queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Logs user into the system + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUser(String username, String password) async { + final response = await loginUserWithHttpInfo(username, password); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return null; + } + + /// Logs out current logged in user session + /// + /// Note: This method returns the HTTP [Response]. + Future logoutUserWithHttpInfo() async { + final path = '/user/logout'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Logs out current logged in user session + Future logoutUser() async { + final response = await logoutUserWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUserWithHttpInfo(String username, User user) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUser(String username, User user) async { + final response = await updateUserWithHttpInfo(username, user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart new file mode 100644 index 00000000000..2db990a70bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -0,0 +1,303 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiClient { + ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { + // Setup authentications (key: authentication name, value: authentication). + _authentications['api_key'] = ApiKeyAuth('header', 'api_key'); + _authentications['api_key_query'] = ApiKeyAuth('query', 'api_key_query'); + _authentications['bearer_test'] = HttpBearerAuth(); + _authentications['http_basic_test'] = HttpBasicAuth(); + _authentications['petstore_auth'] = OAuth(); + } + + final String basePath; + + var _client = Client(); + + /// Returns the current HTTP [Client] instance to use in this class. + /// + /// The return value is guaranteed to never be null. + Client get client => _client; + + /// Requests to use a new HTTP [Client] in this class. + /// + /// If the [newClient] is null, an [ArgumentError] is thrown. + set client(Client newClient) { + if (newClient == null) { + throw ArgumentError('New client instance cannot be null.'); + } + _client = newClient; + } + + final _defaultHeaderMap = {}; + final _authentications = {}; + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + dynamic deserialize(String json, String targetType, {bool growable}) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + return targetType == 'String' + ? json + : _deserialize(jsonDecode(json), targetType, growable: true == growable); + } + + String serialize(Object obj) => obj == null ? '' : json.encode(obj); + + T getAuthentication(String name) { + final authentication = _authentications[name]; + return authentication is T ? authentication : null; + } + + // We don’t use a Map for queryParams. + // If collectionFormat is 'multi', a key might appear multiple times. + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String nullableContentType, + List authNames, + ) async { + _updateParamsForAuth(authNames, queryParams, headerParams); + + headerParams.addAll(_defaultHeaderMap); + + final urlEncodedQueryParams = queryParams + .where((param) => param.value != null) + .map((param) => '$param'); + + final queryString = urlEncodedQueryParams.isNotEmpty + ? '?${urlEncodedQueryParams.join('&')}' + : ''; + + final url = '$basePath$path$queryString'; + + if (nullableContentType != null) { + headerParams['Content-Type'] = nullableContentType; + } + + try { + // Special case for uploading a single file which isn’t a 'multipart/form-data'. + if ( + body is MultipartFile && (nullableContentType == null || + !nullableContentType.toLowerCase().startsWith('multipart/form-data')) + ) { + final request = StreamedRequest(method, Uri.parse(url)); + request.headers.addAll(headerParams); + request.contentLength = body.length; + body.finalize().listen( + request.sink.add, + onDone: request.sink.close, + onError: (error, trace) => request.sink.close(), + cancelOnError: true, + ); + final response = await _client.send(request); + return Response.fromStream(response); + } + + if (body is MultipartRequest) { + final request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + final response = await _client.send(request); + return Response.fromStream(response); + } + + final msgBody = nullableContentType == 'application/x-www-form-urlencoded' + ? formParams + : serialize(body); + final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; + + switch(method) { + case 'POST': return await _client.post(url, headers: nullableHeaderParams, body: msgBody,); + case 'PUT': return await _client.put(url, headers: nullableHeaderParams, body: msgBody,); + case 'DELETE': return await _client.delete(url, headers: nullableHeaderParams,); + case 'PATCH': return await _client.patch(url, headers: nullableHeaderParams, body: msgBody,); + case 'HEAD': return await _client.head(url, headers: nullableHeaderParams,); + case 'GET': return await _client.get(url, headers: nullableHeaderParams,); + } + } on SocketException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); + } on TlsException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); + } on IOException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); + } on ClientException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); + } on Exception catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); + } + + throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); + } + + dynamic _deserialize(dynamic value, String targetType, {bool growable}) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + if (value is bool) { + return value; + } + final valueString = '$value'.toLowerCase(); + return valueString == 'true' || valueString == '1'; + break; + case 'double': + return value is double ? value : double.parse('$value'); + case 'AdditionalPropertiesClass': + return AdditionalPropertiesClass.fromJson(value); + case 'Animal': + return Animal.fromJson(value); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'ArrayOfArrayOfNumberOnly': + return ArrayOfArrayOfNumberOnly.fromJson(value); + case 'ArrayOfNumberOnly': + return ArrayOfNumberOnly.fromJson(value); + case 'ArrayTest': + return ArrayTest.fromJson(value); + case 'Capitalization': + return Capitalization.fromJson(value); + case 'Cat': + return Cat.fromJson(value); + case 'CatAllOf': + return CatAllOf.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'ClassModel': + return ClassModel.fromJson(value); + case 'Client': + return Client.fromJson(value); + case 'Dog': + return Dog.fromJson(value); + case 'DogAllOf': + return DogAllOf.fromJson(value); + case 'EnumArrays': + return EnumArrays.fromJson(value); + case 'EnumClass': + return EnumClassTypeTransformer().decode(value); + case 'EnumTest': + return EnumTest.fromJson(value); + case 'File': + return File.fromJson(value); + case 'FileSchemaTestClass': + return FileSchemaTestClass.fromJson(value); + case 'Foo': + return Foo.fromJson(value); + case 'FormatTest': + return FormatTest.fromJson(value); + case 'HasOnlyReadOnly': + return HasOnlyReadOnly.fromJson(value); + case 'HealthCheckResult': + return HealthCheckResult.fromJson(value); + case 'InlineObject': + return InlineObject.fromJson(value); + case 'InlineObject1': + return InlineObject1.fromJson(value); + case 'InlineObject2': + return InlineObject2.fromJson(value); + case 'InlineObject3': + return InlineObject3.fromJson(value); + case 'InlineObject4': + return InlineObject4.fromJson(value); + case 'InlineObject5': + return InlineObject5.fromJson(value); + case 'InlineResponseDefault': + return InlineResponseDefault.fromJson(value); + case 'List': + return List.fromJson(value); + case 'MapTest': + return MapTest.fromJson(value); + case 'MixedPropertiesAndAdditionalPropertiesClass': + return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value); + case 'Model200Response': + return Model200Response.fromJson(value); + case 'ModelReturn': + return ModelReturn.fromJson(value); + case 'Name': + return Name.fromJson(value); + case 'NullableClass': + return NullableClass.fromJson(value); + case 'NumberOnly': + return NumberOnly.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'OuterComposite': + return OuterComposite.fromJson(value); + case 'OuterEnum': + return OuterEnumTypeTransformer().decode(value); + case 'OuterEnumDefaultValue': + return OuterEnumDefaultValueTypeTransformer().decode(value); + case 'OuterEnumInteger': + return OuterEnumIntegerTypeTransformer().decode(value); + case 'OuterEnumIntegerDefaultValue': + return OuterEnumIntegerDefaultValueTypeTransformer().decode(value); + case 'Pet': + return Pet.fromJson(value); + case 'ReadOnlyFirst': + return ReadOnlyFirst.fromJson(value); + case 'SpecialModelName': + return SpecialModelName.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'User': + return User.fromJson(value); + default: + Match match; + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toList(growable: true == growable); + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return Map.fromIterables( + value.keys, + value.values.map((v) => _deserialize(v, newTargetType, growable: growable)), + ); + } + break; + } + } on Exception catch (e, stack) { + throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', e, stack,); + } + throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth( + List authNames, + List queryParams, + Map headerParams, + ) { + authNames.forEach((authName) { + final auth = _authentications[authName]; + if (auth == null) { + throw ArgumentError('Authentication undefined: $authName'); + } + auth.applyToParams(queryParams, headerParams); + }); + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart new file mode 100644 index 00000000000..1537c9769b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_exception.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiException implements Exception { + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + String toString() { + if (message == null) { + return 'ApiException'; + } + if (innerException == null) { + return 'ApiException $code: $message'; + } + return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart new file mode 100644 index 00000000000..ececff49c4c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +// Ported from the Java version. +Iterable _convertParametersForCollectionFormat( + String collectionFormat, + String name, + dynamic value, +) { + final params = []; + + // preconditions + if (name != null && !name.isEmpty && value != null) { + if (value is List) { + // get the collection format, default: csv + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? 'csv' + : collectionFormat; + + if (collectionFormat == 'multi') { + return value.map((v) => QueryParam(name, parameterToString(v))); + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter))); + } else { + params.add(QueryParam(name, parameterToString(value))); + } + } + + return params; +} + +/// Format the given parameter object into a [String]. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } + if (value is DateTime) { + return value.toUtc().toIso8601String(); + } + if (value is EnumClass) { + return EnumClassTypeTransformer().encode(value).toString(); + } + if (value is OuterEnum) { + return OuterEnumTypeTransformer().encode(value).toString(); + } + if (value is OuterEnumDefaultValue) { + return OuterEnumDefaultValueTypeTransformer().encode(value).toString(); + } + if (value is OuterEnumInteger) { + return OuterEnumIntegerTypeTransformer().encode(value).toString(); + } + if (value is OuterEnumIntegerDefaultValue) { + return OuterEnumIntegerDefaultValueTypeTransformer().encode(value).toString(); + } + return value.toString(); +} + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +String _decodeBodyBytes(Response response) { + final contentType = response.headers['content-type']; + return contentType != null && contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + : response.body; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..41a4afd85d9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/api_key_auth.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix; + String apiKey; + + @override + void applyToParams(List queryParams, Map headerParams) { + final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } else if (location == 'cookie' && value != null) { + headerParams.update('Cookie', (String existingCookie) { + return '$existingCookie; $paramName=$value'; + }, ifAbsent: () => '$paramName=$value'); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart new file mode 100644 index 00000000000..5ca198d41fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/authentication.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +abstract class Authentication { + /// Apply authentication settings to header and query params. + void applyToParams(List queryParams, Map headerParams); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart new file mode 100644 index 00000000000..6dc36a13f49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_basic_auth.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HttpBasicAuth implements Authentication { + String username; + String password; + + @override + void applyToParams(List queryParams, Map headerParams) { + final credentials = (username ?? '') + ':' + (password ?? ''); + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart new file mode 100644 index 00000000000..a23b65fac5e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +typedef HttpBearerAuthProvider = String Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + dynamic _accessToken; + + dynamic get accessToken => _accessToken; + + set accessToken(dynamic accessToken) { + if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { + throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + } + this._accessToken = accessToken; + } + + @override + void applyToParams(List queryParams, Map headerParams) { + if (_accessToken is String) { + headerParams['Authorization'] = 'Bearer $_accessToken'; + } else if (_accessToken is HttpBearerAuthProvider) { + headerParams['Authorization'] = 'Bearer ${_accessToken()}'; + } else { + throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart new file mode 100644 index 00000000000..c0463ad3900 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/auth/oauth.dart @@ -0,0 +1,23 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OAuth implements Authentication { + OAuth({this.accessToken}); + + String accessToken; + + @override + void applyToParams(List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart new file mode 100644 index 00000000000..9c5740763c7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AdditionalPropertiesClass { + /// Returns a new [AdditionalPropertiesClass] instance. + AdditionalPropertiesClass({ + this.mapProperty = const {}, + this.mapOfMapProperty = const {}, + }); + + + Map mapProperty; + + + Map> mapOfMapProperty; + + @override + bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && + other.mapProperty == mapProperty && + other.mapOfMapProperty == mapOfMapProperty; + + @override + int get hashCode => + (mapProperty == null ? 0 : mapProperty.hashCode) + + (mapOfMapProperty == null ? 0 : mapOfMapProperty.hashCode); + + @override + String toString() => 'AdditionalPropertiesClass[mapProperty=$mapProperty, mapOfMapProperty=$mapOfMapProperty]'; + + Map toJson() { + final json = {}; + if (mapProperty != null) { + json['map_property'] = mapProperty; + } + if (mapOfMapProperty != null) { + json['map_of_map_property'] = mapOfMapProperty; + } + return json; + } + + /// Returns a new [AdditionalPropertiesClass] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static AdditionalPropertiesClass fromJson(Map json) => json == null + ? null + : AdditionalPropertiesClass( + mapProperty: json['map_property'] == null ? + null : + (json['map_property'] as Map).cast(), + mapOfMapProperty: json['map_of_map_property'] == null + ? null + : Map.mapFromJson(json['map_of_map_property']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => AdditionalPropertiesClass.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = AdditionalPropertiesClass.fromJson(v)); + } + return map; + } + + // maps a json object with a list of AdditionalPropertiesClass-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = AdditionalPropertiesClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart new file mode 100644 index 00000000000..8c245828636 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Animal { + /// Returns a new [Animal] instance. + Animal({ + @required this.className, + this.color = 'red', + }); + + + String className; + + + String color; + + @override + bool operator ==(Object other) => identical(this, other) || other is Animal && + other.className == className && + other.color == color; + + @override + int get hashCode => + (className == null ? 0 : className.hashCode) + + (color == null ? 0 : color.hashCode); + + @override + String toString() => 'Animal[className=$className, color=$color]'; + + Map toJson() { + final json = {}; + if (className != null) { + json['className'] = className; + } + if (color != null) { + json['color'] = color; + } + return json; + } + + /// Returns a new [Animal] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Animal fromJson(Map json) => json == null + ? null + : Animal( + className: json['className'], + color: json['color'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Animal.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Animal.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Animal-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Animal.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart new file mode 100644 index 00000000000..4724017e846 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart @@ -0,0 +1,92 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + this.code, + this.type, + this.message, + }); + + + int code; + + + String type; + + + String message; + + @override + bool operator ==(Object other) => identical(this, other) || other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => + (code == null ? 0 : code.hashCode) + + (type == null ? 0 : type.hashCode) + + (message == null ? 0 : message.hashCode); + + @override + String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; + + Map toJson() { + final json = {}; + if (code != null) { + json['code'] = code; + } + if (type != null) { + json['type'] = type; + } + if (message != null) { + json['message'] = message; + } + return json; + } + + /// Returns a new [ApiResponse] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ApiResponse fromJson(Map json) => json == null + ? null + : ApiResponse( + code: json['code'], + type: json['type'], + message: json['message'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ApiResponse.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ApiResponse.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ApiResponse-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ApiResponse.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart new file mode 100644 index 00000000000..1d5e46a891c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -0,0 +1,76 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ArrayOfArrayOfNumberOnly { + /// Returns a new [ArrayOfArrayOfNumberOnly] instance. + ArrayOfArrayOfNumberOnly({ + this.arrayArrayNumber = const [], + }); + + + List> arrayArrayNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && + other.arrayArrayNumber == arrayArrayNumber; + + @override + int get hashCode => + (arrayArrayNumber == null ? 0 : arrayArrayNumber.hashCode); + + @override + String toString() => 'ArrayOfArrayOfNumberOnly[arrayArrayNumber=$arrayArrayNumber]'; + + Map toJson() { + final json = {}; + if (arrayArrayNumber != null) { + json['ArrayArrayNumber'] = arrayArrayNumber; + } + return json; + } + + /// Returns a new [ArrayOfArrayOfNumberOnly] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ArrayOfArrayOfNumberOnly fromJson(Map json) => json == null + ? null + : ArrayOfArrayOfNumberOnly( + arrayArrayNumber: json['ArrayArrayNumber'] == null + ? null + : (json['ArrayArrayNumber'] as List).map( + (e) => e == null ? null : (e as List).cast() + ).toList(growable: false), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ArrayOfArrayOfNumberOnly.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ArrayOfArrayOfNumberOnly.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ArrayOfArrayOfNumberOnly-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ArrayOfArrayOfNumberOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart new file mode 100644 index 00000000000..eed98e1cfcf --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ArrayOfNumberOnly { + /// Returns a new [ArrayOfNumberOnly] instance. + ArrayOfNumberOnly({ + this.arrayNumber = const [], + }); + + + List arrayNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && + other.arrayNumber == arrayNumber; + + @override + int get hashCode => + (arrayNumber == null ? 0 : arrayNumber.hashCode); + + @override + String toString() => 'ArrayOfNumberOnly[arrayNumber=$arrayNumber]'; + + Map toJson() { + final json = {}; + if (arrayNumber != null) { + json['ArrayNumber'] = arrayNumber; + } + return json; + } + + /// Returns a new [ArrayOfNumberOnly] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ArrayOfNumberOnly fromJson(Map json) => json == null + ? null + : ArrayOfNumberOnly( + arrayNumber: json['ArrayNumber'] == null + ? null + : (json['ArrayNumber'] as List).cast(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ArrayOfNumberOnly.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ArrayOfNumberOnly.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ArrayOfNumberOnly-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ArrayOfNumberOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart new file mode 100644 index 00000000000..bbf9f411f6a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart @@ -0,0 +1,102 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + this.arrayOfString = const [], + this.arrayArrayOfInteger = const [], + this.arrayArrayOfModel = const [], + }); + + + List arrayOfString; + + + List> arrayArrayOfInteger; + + + List> arrayArrayOfModel; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayTest && + other.arrayOfString == arrayOfString && + other.arrayArrayOfInteger == arrayArrayOfInteger && + other.arrayArrayOfModel == arrayArrayOfModel; + + @override + int get hashCode => + (arrayOfString == null ? 0 : arrayOfString.hashCode) + + (arrayArrayOfInteger == null ? 0 : arrayArrayOfInteger.hashCode) + + (arrayArrayOfModel == null ? 0 : arrayArrayOfModel.hashCode); + + @override + String toString() => 'ArrayTest[arrayOfString=$arrayOfString, arrayArrayOfInteger=$arrayArrayOfInteger, arrayArrayOfModel=$arrayArrayOfModel]'; + + Map toJson() { + final json = {}; + if (arrayOfString != null) { + json['array_of_string'] = arrayOfString; + } + if (arrayArrayOfInteger != null) { + json['array_array_of_integer'] = arrayArrayOfInteger; + } + if (arrayArrayOfModel != null) { + json['array_array_of_model'] = arrayArrayOfModel; + } + return json; + } + + /// Returns a new [ArrayTest] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ArrayTest fromJson(Map json) => json == null + ? null + : ArrayTest( + arrayOfString: json['array_of_string'] == null + ? null + : (json['array_of_string'] as List).cast(), + arrayArrayOfInteger: json['array_array_of_integer'] == null + ? null + : (json['array_array_of_integer'] as List).map( + (e) => e == null ? null : (e as List).cast() + ).toList(growable: false), + arrayArrayOfModel: json['array_array_of_model'] == null + ? null + : (json['array_array_of_model'] as List).map( + ReadOnlyFirst.listFromJson(json['array_array_of_model']) + ).toList(growable: false), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ArrayTest.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ArrayTest.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ArrayTest-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ArrayTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart new file mode 100644 index 00000000000..92468145daf --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Capitalization { + /// Returns a new [Capitalization] instance. + Capitalization({ + this.smallCamel, + this.capitalCamel, + this.smallSnake, + this.capitalSnake, + this.sCAETHFlowPoints, + this.ATT_NAME, + }); + + + String smallCamel; + + + String capitalCamel; + + + String smallSnake; + + + String capitalSnake; + + + String sCAETHFlowPoints; + + /// Name of the pet + String ATT_NAME; + + @override + bool operator ==(Object other) => identical(this, other) || other is Capitalization && + other.smallCamel == smallCamel && + other.capitalCamel == capitalCamel && + other.smallSnake == smallSnake && + other.capitalSnake == capitalSnake && + other.sCAETHFlowPoints == sCAETHFlowPoints && + other.ATT_NAME == ATT_NAME; + + @override + int get hashCode => + (smallCamel == null ? 0 : smallCamel.hashCode) + + (capitalCamel == null ? 0 : capitalCamel.hashCode) + + (smallSnake == null ? 0 : smallSnake.hashCode) + + (capitalSnake == null ? 0 : capitalSnake.hashCode) + + (sCAETHFlowPoints == null ? 0 : sCAETHFlowPoints.hashCode) + + (ATT_NAME == null ? 0 : ATT_NAME.hashCode); + + @override + String toString() => 'Capitalization[smallCamel=$smallCamel, capitalCamel=$capitalCamel, smallSnake=$smallSnake, capitalSnake=$capitalSnake, sCAETHFlowPoints=$sCAETHFlowPoints, ATT_NAME=$ATT_NAME]'; + + Map toJson() { + final json = {}; + if (smallCamel != null) { + json['smallCamel'] = smallCamel; + } + if (capitalCamel != null) { + json['CapitalCamel'] = capitalCamel; + } + if (smallSnake != null) { + json['small_Snake'] = smallSnake; + } + if (capitalSnake != null) { + json['Capital_Snake'] = capitalSnake; + } + if (sCAETHFlowPoints != null) { + json['SCA_ETH_Flow_Points'] = sCAETHFlowPoints; + } + if (ATT_NAME != null) { + json['ATT_NAME'] = ATT_NAME; + } + return json; + } + + /// Returns a new [Capitalization] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Capitalization fromJson(Map json) => json == null + ? null + : Capitalization( + smallCamel: json['smallCamel'], + capitalCamel: json['CapitalCamel'], + smallSnake: json['small_Snake'], + capitalSnake: json['Capital_Snake'], + sCAETHFlowPoints: json['SCA_ETH_Flow_Points'], + ATT_NAME: json['ATT_NAME'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Capitalization.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Capitalization.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Capitalization-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Capitalization.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart new file mode 100644 index 00000000000..83e24e971d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -0,0 +1,92 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Cat { + /// Returns a new [Cat] instance. + Cat({ + @required this.className, + this.color = 'red', + this.declawed, + }); + + + String className; + + + String color; + + + bool declawed; + + @override + bool operator ==(Object other) => identical(this, other) || other is Cat && + other.className == className && + other.color == color && + other.declawed == declawed; + + @override + int get hashCode => + (className == null ? 0 : className.hashCode) + + (color == null ? 0 : color.hashCode) + + (declawed == null ? 0 : declawed.hashCode); + + @override + String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]'; + + Map toJson() { + final json = {}; + if (className != null) { + json['className'] = className; + } + if (color != null) { + json['color'] = color; + } + if (declawed != null) { + json['declawed'] = declawed; + } + return json; + } + + /// Returns a new [Cat] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Cat fromJson(Map json) => json == null + ? null + : Cat( + className: json['className'], + color: json['color'], + declawed: json['declawed'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Cat.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Cat.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Cat-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Cat.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart new file mode 100644 index 00000000000..f263ebf4a89 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class CatAllOf { + /// Returns a new [CatAllOf] instance. + CatAllOf({ + this.declawed, + }); + + + bool declawed; + + @override + bool operator ==(Object other) => identical(this, other) || other is CatAllOf && + other.declawed == declawed; + + @override + int get hashCode => + (declawed == null ? 0 : declawed.hashCode); + + @override + String toString() => 'CatAllOf[declawed=$declawed]'; + + Map toJson() { + final json = {}; + if (declawed != null) { + json['declawed'] = declawed; + } + return json; + } + + /// Returns a new [CatAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static CatAllOf fromJson(Map json) => json == null + ? null + : CatAllOf( + declawed: json['declawed'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => CatAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = CatAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of CatAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = CatAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart new file mode 100644 index 00000000000..7a42d2e5ac0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Category { + /// Returns a new [Category] instance. + Category({ + this.id, + this.name = 'default-name', + }); + + + int id; + + + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Category && + other.id == id && + other.name == name; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode); + + @override + String toString() => 'Category[id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (id != null) { + json['id'] = id; + } + if (name != null) { + json['name'] = name; + } + return json; + } + + /// Returns a new [Category] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Category fromJson(Map json) => json == null + ? null + : Category( + id: json['id'], + name: json['name'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Category.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Category.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Category-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Category.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart new file mode 100644 index 00000000000..6677568603e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + this.class_, + }); + + + String class_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ClassModel && + other.class_ == class_; + + @override + int get hashCode => + (class_ == null ? 0 : class_.hashCode); + + @override + String toString() => 'ClassModel[class_=$class_]'; + + Map toJson() { + final json = {}; + if (class_ != null) { + json['_class'] = class_; + } + return json; + } + + /// Returns a new [ClassModel] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ClassModel fromJson(Map json) => json == null + ? null + : ClassModel( + class_: json['_class'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ClassModel.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ClassModel.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ClassModel-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ClassModel.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/client.dart new file mode 100644 index 00000000000..5b8509caf23 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/client.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Client { + /// Returns a new [Client] instance. + Client({ + this.client, + }); + + + String client; + + @override + bool operator ==(Object other) => identical(this, other) || other is Client && + other.client == client; + + @override + int get hashCode => + (client == null ? 0 : client.hashCode); + + @override + String toString() => 'Client[client=$client]'; + + Map toJson() { + final json = {}; + if (client != null) { + json['client'] = client; + } + return json; + } + + /// Returns a new [Client] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Client fromJson(Map json) => json == null + ? null + : Client( + client: json['client'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Client.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Client.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Client-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Client.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart new file mode 100644 index 00000000000..89d9e214291 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -0,0 +1,92 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Dog { + /// Returns a new [Dog] instance. + Dog({ + @required this.className, + this.color = 'red', + this.breed, + }); + + + String className; + + + String color; + + + String breed; + + @override + bool operator ==(Object other) => identical(this, other) || other is Dog && + other.className == className && + other.color == color && + other.breed == breed; + + @override + int get hashCode => + (className == null ? 0 : className.hashCode) + + (color == null ? 0 : color.hashCode) + + (breed == null ? 0 : breed.hashCode); + + @override + String toString() => 'Dog[className=$className, color=$color, breed=$breed]'; + + Map toJson() { + final json = {}; + if (className != null) { + json['className'] = className; + } + if (color != null) { + json['color'] = color; + } + if (breed != null) { + json['breed'] = breed; + } + return json; + } + + /// Returns a new [Dog] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Dog fromJson(Map json) => json == null + ? null + : Dog( + className: json['className'], + color: json['color'], + breed: json['breed'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Dog.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Dog.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Dog-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Dog.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart new file mode 100644 index 00000000000..3eac159d8b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class DogAllOf { + /// Returns a new [DogAllOf] instance. + DogAllOf({ + this.breed, + }); + + + String breed; + + @override + bool operator ==(Object other) => identical(this, other) || other is DogAllOf && + other.breed == breed; + + @override + int get hashCode => + (breed == null ? 0 : breed.hashCode); + + @override + String toString() => 'DogAllOf[breed=$breed]'; + + Map toJson() { + final json = {}; + if (breed != null) { + json['breed'] = breed; + } + return json; + } + + /// Returns a new [DogAllOf] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static DogAllOf fromJson(Map json) => json == null + ? null + : DogAllOf( + breed: json['breed'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => DogAllOf.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = DogAllOf.fromJson(v)); + } + return map; + } + + // maps a json object with a list of DogAllOf-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = DogAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart new file mode 100644 index 00000000000..2f55f6ab1e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -0,0 +1,230 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class EnumArrays { + /// Returns a new [EnumArrays] instance. + EnumArrays({ + this.justSymbol, + this.arrayEnum = const [], + }); + + + EnumArraysJustSymbolEnum justSymbol; + + + List arrayEnum; + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumArrays && + other.justSymbol == justSymbol && + other.arrayEnum == arrayEnum; + + @override + int get hashCode => + (justSymbol == null ? 0 : justSymbol.hashCode) + + (arrayEnum == null ? 0 : arrayEnum.hashCode); + + @override + String toString() => 'EnumArrays[justSymbol=$justSymbol, arrayEnum=$arrayEnum]'; + + Map toJson() { + final json = {}; + if (justSymbol != null) { + json['just_symbol'] = justSymbol; + } + if (arrayEnum != null) { + json['array_enum'] = arrayEnum; + } + return json; + } + + /// Returns a new [EnumArrays] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static EnumArrays fromJson(Map json) => json == null + ? null + : EnumArrays( + justSymbol: EnumArraysJustSymbolEnum.fromJson(json['just_symbol']), + arrayEnum: EnumArraysArrayEnumEnum.listFromJson(json['array_enum']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => EnumArrays.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = EnumArrays.fromJson(v)); + } + return map; + } + + // maps a json object with a list of EnumArrays-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = EnumArrays.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + + +class EnumArraysJustSymbolEnum { + /// Instantiate a new enum with the provided [value]. + const EnumArraysJustSymbolEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumArraysJustSymbolEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const _ = EnumArraysJustSymbolEnum._('>='); + static const _ = EnumArraysJustSymbolEnum._('$'); + + /// List of all possible values in this [enum][EnumArraysJustSymbolEnum]. + static const values = [ + _, + _, + ]; + + static EnumArraysJustSymbolEnum fromJson(dynamic value) => + EnumArraysJustSymbolEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumArraysJustSymbolEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumArraysJustSymbolEnum] to String, +/// and [decode] dynamic data back to [EnumArraysJustSymbolEnum]. +class EnumArraysJustSymbolEnumTypeTransformer { + const EnumArraysJustSymbolEnumTypeTransformer._(); + + factory EnumArraysJustSymbolEnumTypeTransformer() => _instance ??= EnumArraysJustSymbolEnumTypeTransformer._(); + + String encode(EnumArraysJustSymbolEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumArraysJustSymbolEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumArraysJustSymbolEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case '>=': return EnumArraysJustSymbolEnum._; + case '$': return EnumArraysJustSymbolEnum._; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumArraysJustSymbolEnumTypeTransformer] instance. + static EnumArraysJustSymbolEnumTypeTransformer _instance; +} + + +class EnumArraysArrayEnumEnum { + /// Instantiate a new enum with the provided [value]. + const EnumArraysArrayEnumEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumArraysArrayEnumEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const fish_ = EnumArraysArrayEnumEnum._('fish'); + static const crab_ = EnumArraysArrayEnumEnum._('crab'); + + /// List of all possible values in this [enum][EnumArraysArrayEnumEnum]. + static const values = [ + fish_, + crab_, + ]; + + static EnumArraysArrayEnumEnum fromJson(dynamic value) => + EnumArraysArrayEnumEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumArraysArrayEnumEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumArraysArrayEnumEnum] to List, +/// and [decode] dynamic data back to [EnumArraysArrayEnumEnum]. +class EnumArraysArrayEnumEnumTypeTransformer { + const EnumArraysArrayEnumEnumTypeTransformer._(); + + factory EnumArraysArrayEnumEnumTypeTransformer() => _instance ??= EnumArraysArrayEnumEnumTypeTransformer._(); + + String encode(EnumArraysArrayEnumEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumArraysArrayEnumEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumArraysArrayEnumEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'fish': return EnumArraysArrayEnumEnum.fish_; + case 'crab': return EnumArraysArrayEnumEnum.crab_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumArraysArrayEnumEnumTypeTransformer] instance. + static EnumArraysArrayEnumEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart new file mode 100644 index 00000000000..3959cdf31ae --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class EnumClass { + /// Instantiate a new enum with the provided [value]. + const EnumClass._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumClass && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const abc_ = EnumClass._('_abc'); + static const efg_ = EnumClass._('-efg'); + static const xyz_ = EnumClass._('(xyz)'); + + /// List of all possible values in this [enum][EnumClass]. + static const values = [ + abc_, + efg_, + xyz_, + ]; + + static EnumClass fromJson(dynamic value) => + EnumClassTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumClass.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumClass] to String, +/// and [decode] dynamic data back to [EnumClass]. +class EnumClassTypeTransformer { + const EnumClassTypeTransformer._(); + + factory EnumClassTypeTransformer() => _instance ??= EnumClassTypeTransformer._(); + + String encode(EnumClass data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumClass. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumClass decode(dynamic data, {bool allowNull}) { + switch (data) { + case '_abc': return EnumClass.abc_; + case '-efg': return EnumClass.efg_; + case '(xyz)': return EnumClass.xyz_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumClassTypeTransformer] instance. + static EnumClassTypeTransformer _instance; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart new file mode 100644 index 00000000000..e4f3fde9ab5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -0,0 +1,444 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class EnumTest { + /// Returns a new [EnumTest] instance. + EnumTest({ + this.enumString, + @required this.enumStringRequired, + this.enumInteger, + this.enumNumber, + this.outerEnum, + this.outerEnumInteger, + this.outerEnumDefaultValue, + this.outerEnumIntegerDefaultValue, + }); + + + EnumTestEnumStringEnum enumString; + + + EnumTestEnumStringRequiredEnum enumStringRequired; + + + EnumTestEnumIntegerEnum enumInteger; + + + EnumTestEnumNumberEnum enumNumber; + + + OuterEnum outerEnum; + + + OuterEnumInteger outerEnumInteger; + + + OuterEnumDefaultValue outerEnumDefaultValue; + + + OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue; + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumTest && + other.enumString == enumString && + other.enumStringRequired == enumStringRequired && + other.enumInteger == enumInteger && + other.enumNumber == enumNumber && + other.outerEnum == outerEnum && + other.outerEnumInteger == outerEnumInteger && + other.outerEnumDefaultValue == outerEnumDefaultValue && + other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; + + @override + int get hashCode => + (enumString == null ? 0 : enumString.hashCode) + + (enumStringRequired == null ? 0 : enumStringRequired.hashCode) + + (enumInteger == null ? 0 : enumInteger.hashCode) + + (enumNumber == null ? 0 : enumNumber.hashCode) + + (outerEnum == null ? 0 : outerEnum.hashCode) + + (outerEnumInteger == null ? 0 : outerEnumInteger.hashCode) + + (outerEnumDefaultValue == null ? 0 : outerEnumDefaultValue.hashCode) + + (outerEnumIntegerDefaultValue == null ? 0 : outerEnumIntegerDefaultValue.hashCode); + + @override + String toString() => 'EnumTest[enumString=$enumString, enumStringRequired=$enumStringRequired, enumInteger=$enumInteger, enumNumber=$enumNumber, outerEnum=$outerEnum, outerEnumInteger=$outerEnumInteger, outerEnumDefaultValue=$outerEnumDefaultValue, outerEnumIntegerDefaultValue=$outerEnumIntegerDefaultValue]'; + + Map toJson() { + final json = {}; + if (enumString != null) { + json['enum_string'] = enumString; + } + if (enumStringRequired != null) { + json['enum_string_required'] = enumStringRequired; + } + if (enumInteger != null) { + json['enum_integer'] = enumInteger; + } + if (enumNumber != null) { + json['enum_number'] = enumNumber; + } + if (outerEnum != null) { + json['outerEnum'] = outerEnum; + } + if (outerEnumInteger != null) { + json['outerEnumInteger'] = outerEnumInteger; + } + if (outerEnumDefaultValue != null) { + json['outerEnumDefaultValue'] = outerEnumDefaultValue; + } + if (outerEnumIntegerDefaultValue != null) { + json['outerEnumIntegerDefaultValue'] = outerEnumIntegerDefaultValue; + } + return json; + } + + /// Returns a new [EnumTest] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static EnumTest fromJson(Map json) => json == null + ? null + : EnumTest( + enumString: EnumTestEnumStringEnum.fromJson(json['enum_string']), + enumStringRequired: EnumTestEnumStringRequiredEnum.fromJson(json['enum_string_required']), + enumInteger: EnumTestEnumIntegerEnum.fromJson(json['enum_integer']), + enumNumber: EnumTestEnumNumberEnum.fromJson(json['enum_number']), + outerEnum: OuterEnum.fromJson(json['outerEnum']), + outerEnumInteger: OuterEnumInteger.fromJson(json['outerEnumInteger']), + outerEnumDefaultValue: OuterEnumDefaultValue.fromJson(json['outerEnumDefaultValue']), + outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue.fromJson(json['outerEnumIntegerDefaultValue']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => EnumTest.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = EnumTest.fromJson(v)); + } + return map; + } + + // maps a json object with a list of EnumTest-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = EnumTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + + +class EnumTestEnumStringEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumStringEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumTestEnumStringEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const upper_ = EnumTestEnumStringEnum._('UPPER'); + static const lower_ = EnumTestEnumStringEnum._('lower'); + static const empty = EnumTestEnumStringEnum._(''); + + /// List of all possible values in this [enum][EnumTestEnumStringEnum]. + static const values = [ + upper_, + lower_, + empty, + ]; + + static EnumTestEnumStringEnum fromJson(dynamic value) => + EnumTestEnumStringEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumTestEnumStringEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumStringEnum] to String, +/// and [decode] dynamic data back to [EnumTestEnumStringEnum]. +class EnumTestEnumStringEnumTypeTransformer { + const EnumTestEnumStringEnumTypeTransformer._(); + + factory EnumTestEnumStringEnumTypeTransformer() => _instance ??= EnumTestEnumStringEnumTypeTransformer._(); + + String encode(EnumTestEnumStringEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumStringEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumStringEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'UPPER': return EnumTestEnumStringEnum.upper_; + case 'lower': return EnumTestEnumStringEnum.lower_; + case '': return EnumTestEnumStringEnum.empty; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumTestEnumStringEnumTypeTransformer] instance. + static EnumTestEnumStringEnumTypeTransformer _instance; +} + + +class EnumTestEnumStringRequiredEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumStringRequiredEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumTestEnumStringRequiredEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const upper_ = EnumTestEnumStringRequiredEnum._('UPPER'); + static const lower_ = EnumTestEnumStringRequiredEnum._('lower'); + static const empty = EnumTestEnumStringRequiredEnum._(''); + + /// List of all possible values in this [enum][EnumTestEnumStringRequiredEnum]. + static const values = [ + upper_, + lower_, + empty, + ]; + + static EnumTestEnumStringRequiredEnum fromJson(dynamic value) => + EnumTestEnumStringRequiredEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumTestEnumStringRequiredEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumStringRequiredEnum] to String, +/// and [decode] dynamic data back to [EnumTestEnumStringRequiredEnum]. +class EnumTestEnumStringRequiredEnumTypeTransformer { + const EnumTestEnumStringRequiredEnumTypeTransformer._(); + + factory EnumTestEnumStringRequiredEnumTypeTransformer() => _instance ??= EnumTestEnumStringRequiredEnumTypeTransformer._(); + + String encode(EnumTestEnumStringRequiredEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumStringRequiredEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumStringRequiredEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'UPPER': return EnumTestEnumStringRequiredEnum.upper_; + case 'lower': return EnumTestEnumStringRequiredEnum.lower_; + case '': return EnumTestEnumStringRequiredEnum.empty; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumTestEnumStringRequiredEnumTypeTransformer] instance. + static EnumTestEnumStringRequiredEnumTypeTransformer _instance; +} + + +class EnumTestEnumIntegerEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumIntegerEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumTestEnumIntegerEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const number1_ = EnumTestEnumIntegerEnum._(1); + static const number1_ = EnumTestEnumIntegerEnum._(-1); + + /// List of all possible values in this [enum][EnumTestEnumIntegerEnum]. + static const values = [ + number1_, + number1_, + ]; + + static EnumTestEnumIntegerEnum fromJson(dynamic value) => + EnumTestEnumIntegerEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumTestEnumIntegerEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumIntegerEnum] to int, +/// and [decode] dynamic data back to [EnumTestEnumIntegerEnum]. +class EnumTestEnumIntegerEnumTypeTransformer { + const EnumTestEnumIntegerEnumTypeTransformer._(); + + factory EnumTestEnumIntegerEnumTypeTransformer() => _instance ??= EnumTestEnumIntegerEnumTypeTransformer._(); + + String encode(EnumTestEnumIntegerEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumIntegerEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumIntegerEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 1: return EnumTestEnumIntegerEnum.number1_; + case -1: return EnumTestEnumIntegerEnum.number1_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumTestEnumIntegerEnumTypeTransformer] instance. + static EnumTestEnumIntegerEnumTypeTransformer _instance; +} + + +class EnumTestEnumNumberEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumNumberEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is EnumTestEnumNumberEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const 11_ = EnumTestEnumNumberEnum._('1.1'); + static const 12_ = EnumTestEnumNumberEnum._('-1.2'); + + /// List of all possible values in this [enum][EnumTestEnumNumberEnum]. + static const values = [ + 11_, + 12_, + ]; + + static EnumTestEnumNumberEnum fromJson(dynamic value) => + EnumTestEnumNumberEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => EnumTestEnumNumberEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumNumberEnum] to double, +/// and [decode] dynamic data back to [EnumTestEnumNumberEnum]. +class EnumTestEnumNumberEnumTypeTransformer { + const EnumTestEnumNumberEnumTypeTransformer._(); + + factory EnumTestEnumNumberEnumTypeTransformer() => _instance ??= EnumTestEnumNumberEnumTypeTransformer._(); + + String encode(EnumTestEnumNumberEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumNumberEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumNumberEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case '1.1': return EnumTestEnumNumberEnum.11_; + case '-1.2': return EnumTestEnumNumberEnum.12_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [EnumTestEnumNumberEnumTypeTransformer] instance. + static EnumTestEnumNumberEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file.dart new file mode 100644 index 00000000000..e0369ac7fc4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class File { + /// Returns a new [File] instance. + File({ + this.sourceURI, + }); + + /// Test capitalization + String sourceURI; + + @override + bool operator ==(Object other) => identical(this, other) || other is File && + other.sourceURI == sourceURI; + + @override + int get hashCode => + (sourceURI == null ? 0 : sourceURI.hashCode); + + @override + String toString() => 'File[sourceURI=$sourceURI]'; + + Map toJson() { + final json = {}; + if (sourceURI != null) { + json['sourceURI'] = sourceURI; + } + return json; + } + + /// Returns a new [File] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static File fromJson(Map json) => json == null + ? null + : File( + sourceURI: json['sourceURI'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => File.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = File.fromJson(v)); + } + return map; + } + + // maps a json object with a list of File-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = File.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart new file mode 100644 index 00000000000..973a76e8f56 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FileSchemaTestClass { + /// Returns a new [FileSchemaTestClass] instance. + FileSchemaTestClass({ + this.file, + this.files = const [], + }); + + + MultipartFile file; + + + List files; + + @override + bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && + other.file == file && + other.files == files; + + @override + int get hashCode => + (file == null ? 0 : file.hashCode) + + (files == null ? 0 : files.hashCode); + + @override + String toString() => 'FileSchemaTestClass[file=$file, files=$files]'; + + Map toJson() { + final json = {}; + if (file != null) { + json['file'] = file; + } + if (files != null) { + json['files'] = files; + } + return json; + } + + /// Returns a new [FileSchemaTestClass] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static FileSchemaTestClass fromJson(Map json) => json == null + ? null + : FileSchemaTestClass( + file: MultipartFile.fromJson(json['file']), + files: MultipartFile.listFromJson(json['files']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => FileSchemaTestClass.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = FileSchemaTestClass.fromJson(v)); + } + return map; + } + + // maps a json object with a list of FileSchemaTestClass-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = FileSchemaTestClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart new file mode 100644 index 00000000000..9677a41775c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Foo { + /// Returns a new [Foo] instance. + Foo({ + this.bar = 'bar', + }); + + + String bar; + + @override + bool operator ==(Object other) => identical(this, other) || other is Foo && + other.bar == bar; + + @override + int get hashCode => + (bar == null ? 0 : bar.hashCode); + + @override + String toString() => 'Foo[bar=$bar]'; + + Map toJson() { + final json = {}; + if (bar != null) { + json['bar'] = bar; + } + return json; + } + + /// Returns a new [Foo] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Foo fromJson(Map json) => json == null + ? null + : Foo( + bar: json['bar'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Foo.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Foo.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Foo-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Foo.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart new file mode 100644 index 00000000000..04aef6bc994 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart @@ -0,0 +1,238 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FormatTest { + /// Returns a new [FormatTest] instance. + FormatTest({ + this.integer, + this.int32, + this.int64, + @required this.number, + this.float, + this.double, + this.decimal, + this.string, + @required this.byte, + this.binary, + @required this.date, + this.dateTime, + this.uuid, + @required this.password, + this.patternWithDigits, + this.patternWithDigitsAndDelimiter, + }); + + + // minimum: 10 + // maximum: 100 + int integer; + + + // minimum: 20 + // maximum: 200 + int int32; + + + int int64; + + + // minimum: 32.1 + // maximum: 543.2 + num number; + + + // minimum: 54.3 + // maximum: 987.6 + double float; + + + // minimum: 67.8 + // maximum: 123.4 + double double; + + + Decimal decimal; + + + String string; + + + String byte; + + + MultipartFile binary; + + + DateTime date; + + + DateTime dateTime; + + + String uuid; + + + String password; + + /// A string that is a 10 digit number. Can have leading zeros. + String patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + String patternWithDigitsAndDelimiter; + + @override + bool operator ==(Object other) => identical(this, other) || other is FormatTest && + other.integer == integer && + other.int32 == int32 && + other.int64 == int64 && + other.number == number && + other.float == float && + other.double == double && + other.decimal == decimal && + other.string == string && + other.byte == byte && + other.binary == binary && + other.date == date && + other.dateTime == dateTime && + other.uuid == uuid && + other.password == password && + other.patternWithDigits == patternWithDigits && + other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; + + @override + int get hashCode => + (integer == null ? 0 : integer.hashCode) + + (int32 == null ? 0 : int32.hashCode) + + (int64 == null ? 0 : int64.hashCode) + + (number == null ? 0 : number.hashCode) + + (float == null ? 0 : float.hashCode) + + (double == null ? 0 : double.hashCode) + + (decimal == null ? 0 : decimal.hashCode) + + (string == null ? 0 : string.hashCode) + + (byte == null ? 0 : byte.hashCode) + + (binary == null ? 0 : binary.hashCode) + + (date == null ? 0 : date.hashCode) + + (dateTime == null ? 0 : dateTime.hashCode) + + (uuid == null ? 0 : uuid.hashCode) + + (password == null ? 0 : password.hashCode) + + (patternWithDigits == null ? 0 : patternWithDigits.hashCode) + + (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter.hashCode); + + @override + String toString() => 'FormatTest[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double=$double, decimal=$decimal, string=$string, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, uuid=$uuid, password=$password, patternWithDigits=$patternWithDigits, patternWithDigitsAndDelimiter=$patternWithDigitsAndDelimiter]'; + + Map toJson() { + final json = {}; + if (integer != null) { + json['integer'] = integer; + } + if (int32 != null) { + json['int32'] = int32; + } + if (int64 != null) { + json['int64'] = int64; + } + if (number != null) { + json['number'] = number; + } + if (float != null) { + json['float'] = float; + } + if (double != null) { + json['double'] = double; + } + if (decimal != null) { + json['decimal'] = decimal; + } + if (string != null) { + json['string'] = string; + } + if (byte != null) { + json['byte'] = byte; + } + if (binary != null) { + json['binary'] = binary; + } + if (date != null) { + json['date'] = _dateFormatter.format(date.toUtc()); + } + if (dateTime != null) { + json['dateTime'] = dateTime.toUtc().toIso8601String(); + } + if (uuid != null) { + json['uuid'] = uuid; + } + if (password != null) { + json['password'] = password; + } + if (patternWithDigits != null) { + json['pattern_with_digits'] = patternWithDigits; + } + if (patternWithDigitsAndDelimiter != null) { + json['pattern_with_digits_and_delimiter'] = patternWithDigitsAndDelimiter; + } + return json; + } + + /// Returns a new [FormatTest] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static FormatTest fromJson(Map json) => json == null + ? null + : FormatTest( + integer: json['integer'], + int32: json['int32'], + int64: json['int64'], + number: json['number'] == null ? + null : + json['number'].toDouble(), + float: json['float'], + double: json['double'], + decimal: Decimal.fromJson(json['decimal']), + string: json['string'], + byte: json['byte'], + binary: null, // No support for decoding binary content from JSON + date: json['date'] == null + ? null + : DateTime.parse(json['date']), + dateTime: json['dateTime'] == null + ? null + : DateTime.parse(json['dateTime']), + uuid: json['uuid'], + password: json['password'], + patternWithDigits: json['pattern_with_digits'], + patternWithDigitsAndDelimiter: json['pattern_with_digits_and_delimiter'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => FormatTest.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = FormatTest.fromJson(v)); + } + return map; + } + + // maps a json object with a list of FormatTest-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = FormatTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart new file mode 100644 index 00000000000..66fc0f0d916 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HasOnlyReadOnly { + /// Returns a new [HasOnlyReadOnly] instance. + HasOnlyReadOnly({ + this.bar, + this.foo, + }); + + + String bar; + + + String foo; + + @override + bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && + other.bar == bar && + other.foo == foo; + + @override + int get hashCode => + (bar == null ? 0 : bar.hashCode) + + (foo == null ? 0 : foo.hashCode); + + @override + String toString() => 'HasOnlyReadOnly[bar=$bar, foo=$foo]'; + + Map toJson() { + final json = {}; + if (bar != null) { + json['bar'] = bar; + } + if (foo != null) { + json['foo'] = foo; + } + return json; + } + + /// Returns a new [HasOnlyReadOnly] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static HasOnlyReadOnly fromJson(Map json) => json == null + ? null + : HasOnlyReadOnly( + bar: json['bar'], + foo: json['foo'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => HasOnlyReadOnly.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = HasOnlyReadOnly.fromJson(v)); + } + return map; + } + + // maps a json object with a list of HasOnlyReadOnly-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = HasOnlyReadOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart new file mode 100644 index 00000000000..1bbeb9b677a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HealthCheckResult { + /// Returns a new [HealthCheckResult] instance. + HealthCheckResult({ + this.nullableMessage, + }); + + + String nullableMessage; + + @override + bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && + other.nullableMessage == nullableMessage; + + @override + int get hashCode => + (nullableMessage == null ? 0 : nullableMessage.hashCode); + + @override + String toString() => 'HealthCheckResult[nullableMessage=$nullableMessage]'; + + Map toJson() { + final json = {}; + if (nullableMessage != null) { + json['NullableMessage'] = nullableMessage; + } + return json; + } + + /// Returns a new [HealthCheckResult] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static HealthCheckResult fromJson(Map json) => json == null + ? null + : HealthCheckResult( + nullableMessage: json['NullableMessage'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => HealthCheckResult.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = HealthCheckResult.fromJson(v)); + } + return map; + } + + // maps a json object with a list of HealthCheckResult-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = HealthCheckResult.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object.dart new file mode 100644 index 00000000000..a57294e7018 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject { + /// Returns a new [InlineObject] instance. + InlineObject({ + this.name, + this.status, + }); + + /// Updated name of the pet + String name; + + /// Updated status of the pet + String status; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject && + other.name == name && + other.status == status; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (status == null ? 0 : status.hashCode); + + @override + String toString() => 'InlineObject[name=$name, status=$status]'; + + Map toJson() { + final json = {}; + if (name != null) { + json['name'] = name; + } + if (status != null) { + json['status'] = status; + } + return json; + } + + /// Returns a new [InlineObject] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject fromJson(Map json) => json == null + ? null + : InlineObject( + name: json['name'], + status: json['status'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object1.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object1.dart new file mode 100644 index 00000000000..8d62fbf7dcb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object1.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject1 { + /// Returns a new [InlineObject1] instance. + InlineObject1({ + this.additionalMetadata, + this.file, + }); + + /// Additional data to pass to server + String additionalMetadata; + + /// file to upload + MultipartFile file; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject1 && + other.additionalMetadata == additionalMetadata && + other.file == file; + + @override + int get hashCode => + (additionalMetadata == null ? 0 : additionalMetadata.hashCode) + + (file == null ? 0 : file.hashCode); + + @override + String toString() => 'InlineObject1[additionalMetadata=$additionalMetadata, file=$file]'; + + Map toJson() { + final json = {}; + if (additionalMetadata != null) { + json['additionalMetadata'] = additionalMetadata; + } + if (file != null) { + json['file'] = file; + } + return json; + } + + /// Returns a new [InlineObject1] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject1 fromJson(Map json) => json == null + ? null + : InlineObject1( + additionalMetadata: json['additionalMetadata'], + file: null, // No support for decoding binary content from JSON + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject1.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject1.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject1-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject1.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart new file mode 100644 index 00000000000..8e746bdb4da --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart @@ -0,0 +1,233 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject2 { + /// Returns a new [InlineObject2] instance. + InlineObject2({ + this.enumFormStringArray = const [], + this.enumFormString = '-efg', + }); + + /// Form parameter enum test (string array) + List enumFormStringArray; + + /// Form parameter enum test (string) + InlineObject2EnumFormStringEnum enumFormString; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject2 && + other.enumFormStringArray == enumFormStringArray && + other.enumFormString == enumFormString; + + @override + int get hashCode => + (enumFormStringArray == null ? 0 : enumFormStringArray.hashCode) + + (enumFormString == null ? 0 : enumFormString.hashCode); + + @override + String toString() => 'InlineObject2[enumFormStringArray=$enumFormStringArray, enumFormString=$enumFormString]'; + + Map toJson() { + final json = {}; + if (enumFormStringArray != null) { + json['enum_form_string_array'] = enumFormStringArray; + } + if (enumFormString != null) { + json['enum_form_string'] = enumFormString; + } + return json; + } + + /// Returns a new [InlineObject2] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject2 fromJson(Map json) => json == null + ? null + : InlineObject2( + enumFormStringArray: InlineObject2EnumFormStringArrayEnum.listFromJson(json['enum_form_string_array']), + enumFormString: InlineObject2EnumFormStringEnum.fromJson(json['enum_form_string']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject2.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject2.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject2-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject2.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + +/// Form parameter enum test (string array) +class InlineObject2EnumFormStringArrayEnum { + /// Instantiate a new enum with the provided [value]. + const InlineObject2EnumFormStringArrayEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is InlineObject2EnumFormStringArrayEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const _ = InlineObject2EnumFormStringArrayEnum._('>'); + static const _ = InlineObject2EnumFormStringArrayEnum._('$'); + + /// List of all possible values in this [enum][InlineObject2EnumFormStringArrayEnum]. + static const values = [ + _, + _, + ]; + + static InlineObject2EnumFormStringArrayEnum fromJson(dynamic value) => + InlineObject2EnumFormStringArrayEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => InlineObject2EnumFormStringArrayEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [InlineObject2EnumFormStringArrayEnum] to List, +/// and [decode] dynamic data back to [InlineObject2EnumFormStringArrayEnum]. +class InlineObject2EnumFormStringArrayEnumTypeTransformer { + const InlineObject2EnumFormStringArrayEnumTypeTransformer._(); + + factory InlineObject2EnumFormStringArrayEnumTypeTransformer() => _instance ??= InlineObject2EnumFormStringArrayEnumTypeTransformer._(); + + String encode(InlineObject2EnumFormStringArrayEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a InlineObject2EnumFormStringArrayEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + InlineObject2EnumFormStringArrayEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case '>': return InlineObject2EnumFormStringArrayEnum._; + case '$': return InlineObject2EnumFormStringArrayEnum._; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [InlineObject2EnumFormStringArrayEnumTypeTransformer] instance. + static InlineObject2EnumFormStringArrayEnumTypeTransformer _instance; +} + +/// Form parameter enum test (string) +class InlineObject2EnumFormStringEnum { + /// Instantiate a new enum with the provided [value]. + const InlineObject2EnumFormStringEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is InlineObject2EnumFormStringEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const abc_ = InlineObject2EnumFormStringEnum._('_abc'); + static const efg_ = InlineObject2EnumFormStringEnum._('-efg'); + static const xyz_ = InlineObject2EnumFormStringEnum._('(xyz)'); + + /// List of all possible values in this [enum][InlineObject2EnumFormStringEnum]. + static const values = [ + abc_, + efg_, + xyz_, + ]; + + static InlineObject2EnumFormStringEnum fromJson(dynamic value) => + InlineObject2EnumFormStringEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => InlineObject2EnumFormStringEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [InlineObject2EnumFormStringEnum] to String, +/// and [decode] dynamic data back to [InlineObject2EnumFormStringEnum]. +class InlineObject2EnumFormStringEnumTypeTransformer { + const InlineObject2EnumFormStringEnumTypeTransformer._(); + + factory InlineObject2EnumFormStringEnumTypeTransformer() => _instance ??= InlineObject2EnumFormStringEnumTypeTransformer._(); + + String encode(InlineObject2EnumFormStringEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a InlineObject2EnumFormStringEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + InlineObject2EnumFormStringEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case '_abc': return InlineObject2EnumFormStringEnum.abc_; + case '-efg': return InlineObject2EnumFormStringEnum.efg_; + case '(xyz)': return InlineObject2EnumFormStringEnum.xyz_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [InlineObject2EnumFormStringEnumTypeTransformer] instance. + static InlineObject2EnumFormStringEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart new file mode 100644 index 00000000000..ad92eb826de --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart @@ -0,0 +1,217 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject3 { + /// Returns a new [InlineObject3] instance. + InlineObject3({ + this.integer, + this.int32, + this.int64, + @required this.number, + this.float, + @required this.double, + this.string, + @required this.patternWithoutDelimiter, + @required this.byte, + this.binary, + this.date, + this.dateTime, + this.password, + this.callback, + }); + + /// None + // minimum: 10 + // maximum: 100 + int integer; + + /// None + // minimum: 20 + // maximum: 200 + int int32; + + /// None + int int64; + + /// None + // minimum: 32.1 + // maximum: 543.2 + num number; + + /// None + // maximum: 987.6 + double float; + + /// None + // minimum: 67.8 + // maximum: 123.4 + double double; + + /// None + String string; + + /// None + String patternWithoutDelimiter; + + /// None + String byte; + + /// None + MultipartFile binary; + + /// None + DateTime date; + + /// None + DateTime dateTime; + + /// None + String password; + + /// None + String callback; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject3 && + other.integer == integer && + other.int32 == int32 && + other.int64 == int64 && + other.number == number && + other.float == float && + other.double == double && + other.string == string && + other.patternWithoutDelimiter == patternWithoutDelimiter && + other.byte == byte && + other.binary == binary && + other.date == date && + other.dateTime == dateTime && + other.password == password && + other.callback == callback; + + @override + int get hashCode => + (integer == null ? 0 : integer.hashCode) + + (int32 == null ? 0 : int32.hashCode) + + (int64 == null ? 0 : int64.hashCode) + + (number == null ? 0 : number.hashCode) + + (float == null ? 0 : float.hashCode) + + (double == null ? 0 : double.hashCode) + + (string == null ? 0 : string.hashCode) + + (patternWithoutDelimiter == null ? 0 : patternWithoutDelimiter.hashCode) + + (byte == null ? 0 : byte.hashCode) + + (binary == null ? 0 : binary.hashCode) + + (date == null ? 0 : date.hashCode) + + (dateTime == null ? 0 : dateTime.hashCode) + + (password == null ? 0 : password.hashCode) + + (callback == null ? 0 : callback.hashCode); + + @override + String toString() => 'InlineObject3[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double=$double, string=$string, patternWithoutDelimiter=$patternWithoutDelimiter, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, password=$password, callback=$callback]'; + + Map toJson() { + final json = {}; + if (integer != null) { + json['integer'] = integer; + } + if (int32 != null) { + json['int32'] = int32; + } + if (int64 != null) { + json['int64'] = int64; + } + if (number != null) { + json['number'] = number; + } + if (float != null) { + json['float'] = float; + } + if (double != null) { + json['double'] = double; + } + if (string != null) { + json['string'] = string; + } + if (patternWithoutDelimiter != null) { + json['pattern_without_delimiter'] = patternWithoutDelimiter; + } + if (byte != null) { + json['byte'] = byte; + } + if (binary != null) { + json['binary'] = binary; + } + if (date != null) { + json['date'] = _dateFormatter.format(date.toUtc()); + } + if (dateTime != null) { + json['dateTime'] = dateTime.toUtc().toIso8601String(); + } + if (password != null) { + json['password'] = password; + } + if (callback != null) { + json['callback'] = callback; + } + return json; + } + + /// Returns a new [InlineObject3] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject3 fromJson(Map json) => json == null + ? null + : InlineObject3( + integer: json['integer'], + int32: json['int32'], + int64: json['int64'], + number: json['number'] == null ? + null : + json['number'].toDouble(), + float: json['float'], + double: json['double'], + string: json['string'], + patternWithoutDelimiter: json['pattern_without_delimiter'], + byte: json['byte'], + binary: null, // No support for decoding binary content from JSON + date: json['date'] == null + ? null + : DateTime.parse(json['date']), + dateTime: json['dateTime'] == null + ? null + : DateTime.parse(json['dateTime']), + password: json['password'], + callback: json['callback'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject3.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject3.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject3-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject3.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object4.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object4.dart new file mode 100644 index 00000000000..5805190b8c2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object4.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject4 { + /// Returns a new [InlineObject4] instance. + InlineObject4({ + @required this.param, + @required this.param2, + }); + + /// field1 + String param; + + /// field2 + String param2; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject4 && + other.param == param && + other.param2 == param2; + + @override + int get hashCode => + (param == null ? 0 : param.hashCode) + + (param2 == null ? 0 : param2.hashCode); + + @override + String toString() => 'InlineObject4[param=$param, param2=$param2]'; + + Map toJson() { + final json = {}; + if (param != null) { + json['param'] = param; + } + if (param2 != null) { + json['param2'] = param2; + } + return json; + } + + /// Returns a new [InlineObject4] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject4 fromJson(Map json) => json == null + ? null + : InlineObject4( + param: json['param'], + param2: json['param2'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject4.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject4.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject4-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject4.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object5.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object5.dart new file mode 100644 index 00000000000..65471e9d460 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object5.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineObject5 { + /// Returns a new [InlineObject5] instance. + InlineObject5({ + this.additionalMetadata, + @required this.requiredFile, + }); + + /// Additional data to pass to server + String additionalMetadata; + + /// file to upload + MultipartFile requiredFile; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineObject5 && + other.additionalMetadata == additionalMetadata && + other.requiredFile == requiredFile; + + @override + int get hashCode => + (additionalMetadata == null ? 0 : additionalMetadata.hashCode) + + (requiredFile == null ? 0 : requiredFile.hashCode); + + @override + String toString() => 'InlineObject5[additionalMetadata=$additionalMetadata, requiredFile=$requiredFile]'; + + Map toJson() { + final json = {}; + if (additionalMetadata != null) { + json['additionalMetadata'] = additionalMetadata; + } + if (requiredFile != null) { + json['requiredFile'] = requiredFile; + } + return json; + } + + /// Returns a new [InlineObject5] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineObject5 fromJson(Map json) => json == null + ? null + : InlineObject5( + additionalMetadata: json['additionalMetadata'], + requiredFile: null, // No support for decoding binary content from JSON + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineObject5.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineObject5.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineObject5-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineObject5.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart new file mode 100644 index 00000000000..c79c9ec29ae --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class InlineResponseDefault { + /// Returns a new [InlineResponseDefault] instance. + InlineResponseDefault({ + this.string, + }); + + + Foo string; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && + other.string == string; + + @override + int get hashCode => + (string == null ? 0 : string.hashCode); + + @override + String toString() => 'InlineResponseDefault[string=$string]'; + + Map toJson() { + final json = {}; + if (string != null) { + json['string'] = string; + } + return json; + } + + /// Returns a new [InlineResponseDefault] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static InlineResponseDefault fromJson(Map json) => json == null + ? null + : InlineResponseDefault( + string: Foo.fromJson(json['string']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => InlineResponseDefault.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = InlineResponseDefault.fromJson(v)); + } + return map; + } + + // maps a json object with a list of InlineResponseDefault-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = InlineResponseDefault.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/list.dart new file mode 100644 index 00000000000..a07b945a788 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/list.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class List { + /// Returns a new [List] instance. + List({ + this.n123list, + }); + + + String n123list; + + @override + bool operator ==(Object other) => identical(this, other) || other is List && + other.n123list == n123list; + + @override + int get hashCode => + (n123list == null ? 0 : n123list.hashCode); + + @override + String toString() => 'List[n123list=$n123list]'; + + Map toJson() { + final json = {}; + if (n123list != null) { + json['123-list'] = n123list; + } + return json; + } + + /// Returns a new [List] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static List fromJson(Map json) => json == null + ? null + : List( + n123list: json['123-list'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => List.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = List.fromJson(v)); + } + return map; + } + + // maps a json object with a list of List-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = List.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart new file mode 100644 index 00000000000..0e8da71d30a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -0,0 +1,184 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class MapTest { + /// Returns a new [MapTest] instance. + MapTest({ + this.mapMapOfString = const {}, + this.mapOfEnumString = const {}, + this.directMap = const {}, + this.indirectMap = const {}, + }); + + + Map> mapMapOfString; + + + Map mapOfEnumString; + + + Map directMap; + + + Map indirectMap; + + @override + bool operator ==(Object other) => identical(this, other) || other is MapTest && + other.mapMapOfString == mapMapOfString && + other.mapOfEnumString == mapOfEnumString && + other.directMap == directMap && + other.indirectMap == indirectMap; + + @override + int get hashCode => + (mapMapOfString == null ? 0 : mapMapOfString.hashCode) + + (mapOfEnumString == null ? 0 : mapOfEnumString.hashCode) + + (directMap == null ? 0 : directMap.hashCode) + + (indirectMap == null ? 0 : indirectMap.hashCode); + + @override + String toString() => 'MapTest[mapMapOfString=$mapMapOfString, mapOfEnumString=$mapOfEnumString, directMap=$directMap, indirectMap=$indirectMap]'; + + Map toJson() { + final json = {}; + if (mapMapOfString != null) { + json['map_map_of_string'] = mapMapOfString; + } + if (mapOfEnumString != null) { + json['map_of_enum_string'] = mapOfEnumString; + } + if (directMap != null) { + json['direct_map'] = directMap; + } + if (indirectMap != null) { + json['indirect_map'] = indirectMap; + } + return json; + } + + /// Returns a new [MapTest] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static MapTest fromJson(Map json) => json == null + ? null + : MapTest( + mapMapOfString: json['map_map_of_string'] == null + ? null + : Map.mapFromJson(json['map_map_of_string']), + mapOfEnumString: json['map_of_enum_string'] == null ? + null : + (json['map_of_enum_string'] as Map).cast(), + directMap: json['direct_map'] == null ? + null : + (json['direct_map'] as Map).cast(), + indirectMap: json['indirect_map'] == null ? + null : + (json['indirect_map'] as Map).cast(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => MapTest.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = MapTest.fromJson(v)); + } + return map; + } + + // maps a json object with a list of MapTest-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = MapTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + + +class MapTestMapOfEnumStringEnum { + /// Instantiate a new enum with the provided [value]. + const MapTestMapOfEnumStringEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is MapTestMapOfEnumStringEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const upper_ = MapTestMapOfEnumStringEnum._('UPPER'); + static const lower_ = MapTestMapOfEnumStringEnum._('lower'); + + /// List of all possible values in this [enum][MapTestMapOfEnumStringEnum]. + static const values = [ + upper_, + lower_, + ]; + + static MapTestMapOfEnumStringEnum fromJson(dynamic value) => + MapTestMapOfEnumStringEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => MapTestMapOfEnumStringEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [MapTestMapOfEnumStringEnum] to Map, +/// and [decode] dynamic data back to [MapTestMapOfEnumStringEnum]. +class MapTestMapOfEnumStringEnumTypeTransformer { + const MapTestMapOfEnumStringEnumTypeTransformer._(); + + factory MapTestMapOfEnumStringEnumTypeTransformer() => _instance ??= MapTestMapOfEnumStringEnumTypeTransformer._(); + + String encode(MapTestMapOfEnumStringEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a MapTestMapOfEnumStringEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + MapTestMapOfEnumStringEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'UPPER': return MapTestMapOfEnumStringEnum.upper_; + case 'lower': return MapTestMapOfEnumStringEnum.lower_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [MapTestMapOfEnumStringEnumTypeTransformer] instance. + static MapTestMapOfEnumStringEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 00000000000..bed4eddb7e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,96 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class MixedPropertiesAndAdditionalPropertiesClass { + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. + MixedPropertiesAndAdditionalPropertiesClass({ + this.uuid, + this.dateTime, + this.map = const {}, + }); + + + String uuid; + + + DateTime dateTime; + + + Map map; + + @override + bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && + other.uuid == uuid && + other.dateTime == dateTime && + other.map == map; + + @override + int get hashCode => + (uuid == null ? 0 : uuid.hashCode) + + (dateTime == null ? 0 : dateTime.hashCode) + + (map == null ? 0 : map.hashCode); + + @override + String toString() => 'MixedPropertiesAndAdditionalPropertiesClass[uuid=$uuid, dateTime=$dateTime, map=$map]'; + + Map toJson() { + final json = {}; + if (uuid != null) { + json['uuid'] = uuid; + } + if (dateTime != null) { + json['dateTime'] = dateTime.toUtc().toIso8601String(); + } + if (map != null) { + json['map'] = map; + } + return json; + } + + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static MixedPropertiesAndAdditionalPropertiesClass fromJson(Map json) => json == null + ? null + : MixedPropertiesAndAdditionalPropertiesClass( + uuid: json['uuid'], + dateTime: json['dateTime'] == null + ? null + : DateTime.parse(json['dateTime']), + map: json['map'] == null + ? null + : Animal.mapFromJson(json['map']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => MixedPropertiesAndAdditionalPropertiesClass.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = MixedPropertiesAndAdditionalPropertiesClass.fromJson(v)); + } + return map; + } + + // maps a json object with a list of MixedPropertiesAndAdditionalPropertiesClass-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart new file mode 100644 index 00000000000..6f1169979de --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + this.name, + this.class_, + }); + + + int name; + + + String class_; + + @override + bool operator ==(Object other) => identical(this, other) || other is Model200Response && + other.name == name && + other.class_ == class_; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (class_ == null ? 0 : class_.hashCode); + + @override + String toString() => 'Model200Response[name=$name, class_=$class_]'; + + Map toJson() { + final json = {}; + if (name != null) { + json['name'] = name; + } + if (class_ != null) { + json['class'] = class_; + } + return json; + } + + /// Returns a new [Model200Response] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Model200Response fromJson(Map json) => json == null + ? null + : Model200Response( + name: json['name'], + class_: json['class'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Model200Response.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Model200Response.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Model200Response-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Model200Response.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart new file mode 100644 index 00000000000..2c0cbeecfa6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ModelReturn { + /// Returns a new [ModelReturn] instance. + ModelReturn({ + this.return_, + }); + + + int return_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelReturn && + other.return_ == return_; + + @override + int get hashCode => + (return_ == null ? 0 : return_.hashCode); + + @override + String toString() => 'ModelReturn[return_=$return_]'; + + Map toJson() { + final json = {}; + if (return_ != null) { + json['return'] = return_; + } + return json; + } + + /// Returns a new [ModelReturn] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ModelReturn fromJson(Map json) => json == null + ? null + : ModelReturn( + return_: json['return'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ModelReturn.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ModelReturn.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ModelReturn-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ModelReturn.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart new file mode 100644 index 00000000000..6500d73996c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart @@ -0,0 +1,102 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Name { + /// Returns a new [Name] instance. + Name({ + @required this.name, + this.snakeCase, + this.property, + this.n123number, + }); + + + int name; + + + int snakeCase; + + + String property; + + + int n123number; + + @override + bool operator ==(Object other) => identical(this, other) || other is Name && + other.name == name && + other.snakeCase == snakeCase && + other.property == property && + other.n123number == n123number; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (snakeCase == null ? 0 : snakeCase.hashCode) + + (property == null ? 0 : property.hashCode) + + (n123number == null ? 0 : n123number.hashCode); + + @override + String toString() => 'Name[name=$name, snakeCase=$snakeCase, property=$property, n123number=$n123number]'; + + Map toJson() { + final json = {}; + if (name != null) { + json['name'] = name; + } + if (snakeCase != null) { + json['snake_case'] = snakeCase; + } + if (property != null) { + json['property'] = property; + } + if (n123number != null) { + json['123Number'] = n123number; + } + return json; + } + + /// Returns a new [Name] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Name fromJson(Map json) => json == null + ? null + : Name( + name: json['name'], + snakeCase: json['snake_case'], + property: json['property'], + n123number: json['123Number'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Name.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Name.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Name-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Name.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart new file mode 100644 index 00000000000..cf9f65e09ef --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart @@ -0,0 +1,194 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class NullableClass { + /// Returns a new [NullableClass] instance. + NullableClass({ + this.integerProp, + this.numberProp, + this.booleanProp, + this.stringProp, + this.dateProp, + this.datetimeProp, + this.arrayNullableProp, + this.arrayAndItemsNullableProp, + this.arrayItemsNullable = const [], + this.objectNullableProp, + this.objectAndItemsNullableProp, + this.objectItemsNullable = const {}, + }); + + + int integerProp; + + + num numberProp; + + + bool booleanProp; + + + String stringProp; + + + DateTime dateProp; + + + DateTime datetimeProp; + + + List arrayNullableProp; + + + List arrayAndItemsNullableProp; + + + List arrayItemsNullable; + + + Map objectNullableProp; + + + Map objectAndItemsNullableProp; + + + Map objectItemsNullable; + + @override + bool operator ==(Object other) => identical(this, other) || other is NullableClass && + other.integerProp == integerProp && + other.numberProp == numberProp && + other.booleanProp == booleanProp && + other.stringProp == stringProp && + other.dateProp == dateProp && + other.datetimeProp == datetimeProp && + other.arrayNullableProp == arrayNullableProp && + other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && + other.arrayItemsNullable == arrayItemsNullable && + other.objectNullableProp == objectNullableProp && + other.objectAndItemsNullableProp == objectAndItemsNullableProp && + other.objectItemsNullable == objectItemsNullable; + + @override + int get hashCode => + (integerProp == null ? 0 : integerProp.hashCode) + + (numberProp == null ? 0 : numberProp.hashCode) + + (booleanProp == null ? 0 : booleanProp.hashCode) + + (stringProp == null ? 0 : stringProp.hashCode) + + (dateProp == null ? 0 : dateProp.hashCode) + + (datetimeProp == null ? 0 : datetimeProp.hashCode) + + (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + + (arrayAndItemsNullableProp == null ? 0 : arrayAndItemsNullableProp.hashCode) + + (arrayItemsNullable == null ? 0 : arrayItemsNullable.hashCode) + + (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + + (objectAndItemsNullableProp == null ? 0 : objectAndItemsNullableProp.hashCode) + + (objectItemsNullable == null ? 0 : objectItemsNullable.hashCode); + + @override + String toString() => 'NullableClass[integerProp=$integerProp, numberProp=$numberProp, booleanProp=$booleanProp, stringProp=$stringProp, dateProp=$dateProp, datetimeProp=$datetimeProp, arrayNullableProp=$arrayNullableProp, arrayAndItemsNullableProp=$arrayAndItemsNullableProp, arrayItemsNullable=$arrayItemsNullable, objectNullableProp=$objectNullableProp, objectAndItemsNullableProp=$objectAndItemsNullableProp, objectItemsNullable=$objectItemsNullable]'; + + Map toJson() { + final json = {}; + if (integerProp != null) { + json['integer_prop'] = integerProp; + } + if (numberProp != null) { + json['number_prop'] = numberProp; + } + if (booleanProp != null) { + json['boolean_prop'] = booleanProp; + } + if (stringProp != null) { + json['string_prop'] = stringProp; + } + if (dateProp != null) { + json['date_prop'] = _dateFormatter.format(dateProp.toUtc()); + } + if (datetimeProp != null) { + json['datetime_prop'] = datetimeProp.toUtc().toIso8601String(); + } + if (arrayNullableProp != null) { + json['array_nullable_prop'] = arrayNullableProp; + } + if (arrayAndItemsNullableProp != null) { + json['array_and_items_nullable_prop'] = arrayAndItemsNullableProp; + } + if (arrayItemsNullable != null) { + json['array_items_nullable'] = arrayItemsNullable; + } + if (objectNullableProp != null) { + json['object_nullable_prop'] = objectNullableProp; + } + if (objectAndItemsNullableProp != null) { + json['object_and_items_nullable_prop'] = objectAndItemsNullableProp; + } + if (objectItemsNullable != null) { + json['object_items_nullable'] = objectItemsNullable; + } + return json; + } + + /// Returns a new [NullableClass] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static NullableClass fromJson(Map json) => json == null + ? null + : NullableClass( + integerProp: json['integer_prop'], + numberProp: json['number_prop'] == null ? + null : + json['number_prop'].toDouble(), + booleanProp: json['boolean_prop'], + stringProp: json['string_prop'], + dateProp: json['date_prop'] == null + ? null + : DateTime.parse(json['date_prop']), + datetimeProp: json['datetime_prop'] == null + ? null + : DateTime.parse(json['datetime_prop']), + arrayNullableProp: Object.listFromJson(json['array_nullable_prop']), + arrayAndItemsNullableProp: Object.listFromJson(json['array_and_items_nullable_prop']), + arrayItemsNullable: Object.listFromJson(json['array_items_nullable']), + objectNullableProp: json['object_nullable_prop'] == null + ? null + : Object.mapFromJson(json['object_nullable_prop']), + objectAndItemsNullableProp: json['object_and_items_nullable_prop'] == null + ? null + : Object.mapFromJson(json['object_and_items_nullable_prop']), + objectItemsNullable: json['object_items_nullable'] == null + ? null + : Object.mapFromJson(json['object_items_nullable']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => NullableClass.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = NullableClass.fromJson(v)); + } + return map; + } + + // maps a json object with a list of NullableClass-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = NullableClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart new file mode 100644 index 00000000000..b0f8e0ef9b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class NumberOnly { + /// Returns a new [NumberOnly] instance. + NumberOnly({ + this.justNumber, + }); + + + num justNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is NumberOnly && + other.justNumber == justNumber; + + @override + int get hashCode => + (justNumber == null ? 0 : justNumber.hashCode); + + @override + String toString() => 'NumberOnly[justNumber=$justNumber]'; + + Map toJson() { + final json = {}; + if (justNumber != null) { + json['JustNumber'] = justNumber; + } + return json; + } + + /// Returns a new [NumberOnly] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static NumberOnly fromJson(Map json) => json == null + ? null + : NumberOnly( + justNumber: json['JustNumber'] == null ? + null : + json['JustNumber'].toDouble(), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => NumberOnly.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = NumberOnly.fromJson(v)); + } + return map; + } + + // maps a json object with a list of NumberOnly-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = NumberOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart new file mode 100644 index 00000000000..67b1b43c7d5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -0,0 +1,201 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Order { + /// Returns a new [Order] instance. + Order({ + this.id, + this.petId, + this.quantity, + this.shipDate, + this.status, + this.complete = false, + }); + + + int id; + + + int petId; + + + int quantity; + + + DateTime shipDate; + + /// Order Status + OrderStatusEnum status; + + + bool complete; + + @override + bool operator ==(Object other) => identical(this, other) || other is Order && + other.id == id && + other.petId == petId && + other.quantity == quantity && + other.shipDate == shipDate && + other.status == status && + other.complete == complete; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (petId == null ? 0 : petId.hashCode) + + (quantity == null ? 0 : quantity.hashCode) + + (shipDate == null ? 0 : shipDate.hashCode) + + (status == null ? 0 : status.hashCode) + + (complete == null ? 0 : complete.hashCode); + + @override + String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; + + Map toJson() { + final 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.toUtc().toIso8601String(); + } + if (status != null) { + json['status'] = status; + } + if (complete != null) { + json['complete'] = complete; + } + return json; + } + + /// Returns a new [Order] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Order fromJson(Map json) => json == null + ? null + : Order( + id: json['id'], + petId: json['petId'], + quantity: json['quantity'], + shipDate: json['shipDate'] == null + ? null + : DateTime.parse(json['shipDate']), + status: OrderStatusEnum.fromJson(json['status']), + complete: json['complete'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Order.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Order.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Order-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Order.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + +/// Order Status +class OrderStatusEnum { + /// Instantiate a new enum with the provided [value]. + const OrderStatusEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is OrderStatusEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const placed_ = OrderStatusEnum._('placed'); + static const approved_ = OrderStatusEnum._('approved'); + static const delivered_ = OrderStatusEnum._('delivered'); + + /// List of all possible values in this [enum][OrderStatusEnum]. + static const values = [ + placed_, + approved_, + delivered_, + ]; + + static OrderStatusEnum fromJson(dynamic value) => + OrderStatusEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => OrderStatusEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, +/// and [decode] dynamic data back to [OrderStatusEnum]. +class OrderStatusEnumTypeTransformer { + const OrderStatusEnumTypeTransformer._(); + + factory OrderStatusEnumTypeTransformer() => _instance ??= OrderStatusEnumTypeTransformer._(); + + String encode(OrderStatusEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a OrderStatusEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OrderStatusEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'placed': return OrderStatusEnum.placed_; + case 'approved': return OrderStatusEnum.approved_; + case 'delivered': return OrderStatusEnum.delivered_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [OrderStatusEnumTypeTransformer] instance. + static OrderStatusEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart new file mode 100644 index 00000000000..c41d59ee3e9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart @@ -0,0 +1,94 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OuterComposite { + /// Returns a new [OuterComposite] instance. + OuterComposite({ + this.myNumber, + this.myString, + this.myBoolean, + }); + + + num myNumber; + + + String myString; + + + bool myBoolean; + + @override + bool operator ==(Object other) => identical(this, other) || other is OuterComposite && + other.myNumber == myNumber && + other.myString == myString && + other.myBoolean == myBoolean; + + @override + int get hashCode => + (myNumber == null ? 0 : myNumber.hashCode) + + (myString == null ? 0 : myString.hashCode) + + (myBoolean == null ? 0 : myBoolean.hashCode); + + @override + String toString() => 'OuterComposite[myNumber=$myNumber, myString=$myString, myBoolean=$myBoolean]'; + + Map toJson() { + final json = {}; + if (myNumber != null) { + json['my_number'] = myNumber; + } + if (myString != null) { + json['my_string'] = myString; + } + if (myBoolean != null) { + json['my_boolean'] = myBoolean; + } + return json; + } + + /// Returns a new [OuterComposite] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static OuterComposite fromJson(Map json) => json == null + ? null + : OuterComposite( + myNumber: json['my_number'] == null ? + null : + json['my_number'].toDouble(), + myString: json['my_string'], + myBoolean: json['my_boolean'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => OuterComposite.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = OuterComposite.fromJson(v)); + } + return map; + } + + // maps a json object with a list of OuterComposite-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = OuterComposite.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart new file mode 100644 index 00000000000..5edeca38ef2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnum { + /// Instantiate a new enum with the provided [value]. + const OuterEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is OuterEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const placed_ = OuterEnum._('placed'); + static const approved_ = OuterEnum._('approved'); + static const delivered_ = OuterEnum._('delivered'); + + /// List of all possible values in this [enum][OuterEnum]. + static const values = [ + placed_, + approved_, + delivered_, + ]; + + static OuterEnum fromJson(dynamic value) => + OuterEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => OuterEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [OuterEnum] to String, +/// and [decode] dynamic data back to [OuterEnum]. +class OuterEnumTypeTransformer { + const OuterEnumTypeTransformer._(); + + factory OuterEnumTypeTransformer() => _instance ??= OuterEnumTypeTransformer._(); + + String encode(OuterEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'placed': return OuterEnum.placed_; + case 'approved': return OuterEnum.approved_; + case 'delivered': return OuterEnum.delivered_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [OuterEnumTypeTransformer] instance. + static OuterEnumTypeTransformer _instance; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart new file mode 100644 index 00000000000..a046a153dbb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnumDefaultValue { + /// Instantiate a new enum with the provided [value]. + const OuterEnumDefaultValue._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is OuterEnumDefaultValue && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const placed_ = OuterEnumDefaultValue._('placed'); + static const approved_ = OuterEnumDefaultValue._('approved'); + static const delivered_ = OuterEnumDefaultValue._('delivered'); + + /// List of all possible values in this [enum][OuterEnumDefaultValue]. + static const values = [ + placed_, + approved_, + delivered_, + ]; + + static OuterEnumDefaultValue fromJson(dynamic value) => + OuterEnumDefaultValueTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => OuterEnumDefaultValue.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [OuterEnumDefaultValue] to String, +/// and [decode] dynamic data back to [OuterEnumDefaultValue]. +class OuterEnumDefaultValueTypeTransformer { + const OuterEnumDefaultValueTypeTransformer._(); + + factory OuterEnumDefaultValueTypeTransformer() => _instance ??= OuterEnumDefaultValueTypeTransformer._(); + + String encode(OuterEnumDefaultValue data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnumDefaultValue. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnumDefaultValue decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'placed': return OuterEnumDefaultValue.placed_; + case 'approved': return OuterEnumDefaultValue.approved_; + case 'delivered': return OuterEnumDefaultValue.delivered_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [OuterEnumDefaultValueTypeTransformer] instance. + static OuterEnumDefaultValueTypeTransformer _instance; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart new file mode 100644 index 00000000000..0bb65d3251e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnumInteger { + /// Instantiate a new enum with the provided [value]. + const OuterEnumInteger._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is OuterEnumInteger && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const number0_ = OuterEnumInteger._(0); + static const number1_ = OuterEnumInteger._(1); + static const number2_ = OuterEnumInteger._(2); + + /// List of all possible values in this [enum][OuterEnumInteger]. + static const values = [ + number0_, + number1_, + number2_, + ]; + + static OuterEnumInteger fromJson(dynamic value) => + OuterEnumIntegerTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => OuterEnumInteger.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [OuterEnumInteger] to int, +/// and [decode] dynamic data back to [OuterEnumInteger]. +class OuterEnumIntegerTypeTransformer { + const OuterEnumIntegerTypeTransformer._(); + + factory OuterEnumIntegerTypeTransformer() => _instance ??= OuterEnumIntegerTypeTransformer._(); + + String encode(OuterEnumInteger data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnumInteger. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnumInteger decode(dynamic data, {bool allowNull}) { + switch (data) { + case 0: return OuterEnumInteger.number0_; + case 1: return OuterEnumInteger.number1_; + case 2: return OuterEnumInteger.number2_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [OuterEnumIntegerTypeTransformer] instance. + static OuterEnumIntegerTypeTransformer _instance; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart new file mode 100644 index 00000000000..506ab94c4af --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnumIntegerDefaultValue { + /// Instantiate a new enum with the provided [value]. + const OuterEnumIntegerDefaultValue._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is OuterEnumIntegerDefaultValue && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value.toString(); + + String toJson() => value; + + static const number0_ = OuterEnumIntegerDefaultValue._(0); + static const number1_ = OuterEnumIntegerDefaultValue._(1); + static const number2_ = OuterEnumIntegerDefaultValue._(2); + + /// List of all possible values in this [enum][OuterEnumIntegerDefaultValue]. + static const values = [ + number0_, + number1_, + number2_, + ]; + + static OuterEnumIntegerDefaultValue fromJson(dynamic value) => + OuterEnumIntegerDefaultValueTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => OuterEnumIntegerDefaultValue.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [OuterEnumIntegerDefaultValue] to int, +/// and [decode] dynamic data back to [OuterEnumIntegerDefaultValue]. +class OuterEnumIntegerDefaultValueTypeTransformer { + const OuterEnumIntegerDefaultValueTypeTransformer._(); + + factory OuterEnumIntegerDefaultValueTypeTransformer() => _instance ??= OuterEnumIntegerDefaultValueTypeTransformer._(); + + String encode(OuterEnumIntegerDefaultValue data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnumIntegerDefaultValue. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnumIntegerDefaultValue decode(dynamic data, {bool allowNull}) { + switch (data) { + case 0: return OuterEnumIntegerDefaultValue.number0_; + case 1: return OuterEnumIntegerDefaultValue.number1_; + case 2: return OuterEnumIntegerDefaultValue.number2_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [OuterEnumIntegerDefaultValueTypeTransformer] instance. + static OuterEnumIntegerDefaultValueTypeTransformer _instance; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart new file mode 100644 index 00000000000..668b567ec4e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -0,0 +1,201 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Pet { + /// Returns a new [Pet] instance. + Pet({ + this.id, + this.category, + @required this.name, + this.photoUrls = const [], + this.tags = const [], + this.status, + }); + + + int id; + + + Category category; + + + String name; + + + List photoUrls; + + + List tags; + + /// pet status in the store + PetStatusEnum status; + + @override + bool operator ==(Object other) => identical(this, other) || other is Pet && + other.id == id && + other.category == category && + other.name == name && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (category == null ? 0 : category.hashCode) + + (name == null ? 0 : name.hashCode) + + (photoUrls == null ? 0 : photoUrls.hashCode) + + (tags == null ? 0 : tags.hashCode) + + (status == null ? 0 : status.hashCode); + + @override + String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; + + Map toJson() { + final 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; + } + + /// Returns a new [Pet] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Pet fromJson(Map json) => json == null + ? null + : Pet( + id: json['id'], + category: Category.fromJson(json['category']), + name: json['name'], + photoUrls: json['photoUrls'] == null + ? null + : (json['photoUrls'] as List).cast(), + tags: Tag.listFromJson(json['tags']), + status: PetStatusEnum.fromJson(json['status']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Pet.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Pet.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Pet-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Pet.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + +/// pet status in the store +class PetStatusEnum { + /// Instantiate a new enum with the provided [value]. + const PetStatusEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + bool operator ==(Object other) => identical(this, other) || + other is PetStatusEnum && other.value == value || + other is String && other == value; + + @override + int get hashCode => toString().hashCode; + + @override + String toString() => value; + + String toJson() => value; + + static const available_ = PetStatusEnum._('available'); + static const pending_ = PetStatusEnum._('pending'); + static const sold_ = PetStatusEnum._('sold'); + + /// List of all possible values in this [enum][PetStatusEnum]. + static const values = [ + available_, + pending_, + sold_, + ]; + + static PetStatusEnum fromJson(dynamic value) => + PetStatusEnumTypeTransformer().decode(value); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json + .map((value) => PetStatusEnum.fromJson(value)) + .toList(growable: true == growable); +} + +/// Transformation class that can [encode] an instance of [PetStatusEnum] to String, +/// and [decode] dynamic data back to [PetStatusEnum]. +class PetStatusEnumTypeTransformer { + const PetStatusEnumTypeTransformer._(); + + factory PetStatusEnumTypeTransformer() => _instance ??= PetStatusEnumTypeTransformer._(); + + String encode(PetStatusEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a PetStatusEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + PetStatusEnum decode(dynamic data, {bool allowNull}) { + switch (data) { + case 'available': return PetStatusEnum.available_; + case 'pending': return PetStatusEnum.pending_; + case 'sold': return PetStatusEnum.sold_; + default: + if (allowNull == false) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + return null; + } + + /// Singleton [PetStatusEnumTypeTransformer] instance. + static PetStatusEnumTypeTransformer _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart new file mode 100644 index 00000000000..46d3bc19d96 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ReadOnlyFirst { + /// Returns a new [ReadOnlyFirst] instance. + ReadOnlyFirst({ + this.bar, + this.baz, + }); + + + String bar; + + + String baz; + + @override + bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && + other.bar == bar && + other.baz == baz; + + @override + int get hashCode => + (bar == null ? 0 : bar.hashCode) + + (baz == null ? 0 : baz.hashCode); + + @override + String toString() => 'ReadOnlyFirst[bar=$bar, baz=$baz]'; + + Map toJson() { + final json = {}; + if (bar != null) { + json['bar'] = bar; + } + if (baz != null) { + json['baz'] = baz; + } + return json; + } + + /// Returns a new [ReadOnlyFirst] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ReadOnlyFirst fromJson(Map json) => json == null + ? null + : ReadOnlyFirst( + bar: json['bar'], + baz: json['baz'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ReadOnlyFirst.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ReadOnlyFirst.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ReadOnlyFirst-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ReadOnlyFirst.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart new file mode 100644 index 00000000000..f3ce82c9aac --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class SpecialModelName { + /// Returns a new [SpecialModelName] instance. + SpecialModelName({ + this.$special[propertyName], + }); + + + int $special[propertyName]; + + @override + bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && + other.$special[propertyName] == $special[propertyName]; + + @override + int get hashCode => + ($special[propertyName] == null ? 0 : $special[propertyName].hashCode); + + @override + String toString() => 'SpecialModelName[$special[propertyName]=$$special[propertyName]]'; + + Map toJson() { + final json = {}; + if ($special[propertyName] != null) { + json['$special[property.name]'] = $special[propertyName]; + } + return json; + } + + /// Returns a new [SpecialModelName] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static SpecialModelName fromJson(Map json) => json == null + ? null + : SpecialModelName( + $special[propertyName]: json['$special[property.name]'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => SpecialModelName.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = SpecialModelName.fromJson(v)); + } + return map; + } + + // maps a json object with a list of SpecialModelName-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = SpecialModelName.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart new file mode 100644 index 00000000000..dd24d1e0cd6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Tag { + /// Returns a new [Tag] instance. + Tag({ + this.id, + this.name, + }); + + + int id; + + + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Tag && + other.id == id && + other.name == name; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode); + + @override + String toString() => 'Tag[id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (id != null) { + json['id'] = id; + } + if (name != null) { + json['name'] = name; + } + return json; + } + + /// Returns a new [Tag] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static Tag fromJson(Map json) => json == null + ? null + : Tag( + id: json['id'], + name: json['name'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => Tag.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = Tag.fromJson(v)); + } + return map; + } + + // maps a json object with a list of Tag-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = Tag.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart new file mode 100644 index 00000000000..3d21b5822c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class User { + /// Returns a new [User] instance. + User({ + this.id, + this.username, + this.firstName, + this.lastName, + this.email, + this.password, + this.phone, + this.userStatus, + }); + + + int id; + + + String username; + + + String firstName; + + + String lastName; + + + String email; + + + String password; + + + String phone; + + /// User Status + int userStatus; + + @override + bool operator ==(Object other) => identical(this, other) || other is User && + other.id == id && + other.username == username && + other.firstName == firstName && + other.lastName == lastName && + other.email == email && + other.password == password && + other.phone == phone && + other.userStatus == userStatus; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (username == null ? 0 : username.hashCode) + + (firstName == null ? 0 : firstName.hashCode) + + (lastName == null ? 0 : lastName.hashCode) + + (email == null ? 0 : email.hashCode) + + (password == null ? 0 : password.hashCode) + + (phone == null ? 0 : phone.hashCode) + + (userStatus == null ? 0 : userStatus.hashCode); + + @override + String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; + + Map toJson() { + final 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; + } + + /// Returns a new [User] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static User fromJson(Map json) => json == null + ? null + : User( + id: json['id'], + username: json['username'], + firstName: json['firstName'], + lastName: json['lastName'], + email: json['email'], + password: json['password'], + phone: json['phone'], + userStatus: json['userStatus'], + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => User.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = User.fromJson(v)); + } + return map; + } + + // maps a json object with a list of User-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = User.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml new file mode 100644 index 00000000000..d09de2749f6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + org.openapitools + Dart2PetstoreClientLibFakeTests + pom + 1.0.0-SNAPSHOT + Dart2 Petstore Client Lib Fake + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + test + + + + + + + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml new file mode 100644 index 00000000000..78ba0e8da82 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml @@ -0,0 +1,18 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# + +name: 'openapi' +version: '1.0.0' +description: 'OpenAPI API client' +authors: + - 'Author ' +homepage: 'homepage' +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.12.0 <0.13.0' + intl: '^0.16.1' + meta: '^1.1.8' +dev_dependencies: + test: '^1.3.0' diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart new file mode 100644 index 00000000000..937fcb45efe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/additional_properties_class_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClass(); + + group('test AdditionalPropertiesClass', () { + // Map mapProperty (default value: const {}) + test('to test the property `mapProperty`', () async { + // TODO + }); + + // Map> mapOfMapProperty (default value: const {}) + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart new file mode 100644 index 00000000000..f8fbea61abc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/animal_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Animal +void main() { + final instance = Animal(); + + group('test Animal', () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart new file mode 100644 index 00000000000..65279abe35d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for AnotherFakeApi +void main() { + final instance = AnotherFakeApi(); + + group('tests for AnotherFakeApi', () { + // To test special tags + // + // To test special tags and operation ID starting with number + // + //Future 123test@$%SpecialTags(Client client) async + test('test 123test@$%SpecialTags', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart new file mode 100644 index 00000000000..ea8360134e8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/api_response_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponse(); + + group('test ApiResponse', () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart new file mode 100644 index 00000000000..a7d4d3a630d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnly(); + + group('test ArrayOfArrayOfNumberOnly', () { + // List> arrayArrayNumber (default value: const []) + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart new file mode 100644 index 00000000000..99d89e84506 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_of_number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnly(); + + group('test ArrayOfNumberOnly', () { + // List arrayNumber (default value: const []) + test('to test the property `arrayNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart new file mode 100644 index 00000000000..c5f4b7a71fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/array_test_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTest(); + + group('test ArrayTest', () { + // List arrayOfString (default value: const []) + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // List> arrayArrayOfInteger (default value: const []) + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // List> arrayArrayOfModel (default value: const []) + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart new file mode 100644 index 00000000000..07f7e7399ed --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Capitalization +void main() { + final instance = Capitalization(); + + group('test Capitalization', () { + // String smallCamel + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart new file mode 100644 index 00000000000..664b629b41a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_all_of_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for CatAllOf +void main() { + final instance = CatAllOf(); + + group('test CatAllOf', () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart new file mode 100644 index 00000000000..a75246ae59a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/cat_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Cat +void main() { + final instance = Cat(); + + group('test Cat', () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart new file mode 100644 index 00000000000..6c0b5190dff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/category_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Category +void main() { + final instance = Category(); + + group('test Category', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart new file mode 100644 index 00000000000..b7593229d61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/class_model_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModel(); + + group('test ClassModel', () { + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/client_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/client_test.dart new file mode 100644 index 00000000000..27a4ac8b3aa --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/client_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Client +void main() { + final instance = Client(); + + group('test Client', () { + // String client + test('to test the property `client`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart new file mode 100644 index 00000000000..2756c463df1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,25 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for DefaultApi +void main() { + final instance = DefaultApi(); + + group('tests for DefaultApi', () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart new file mode 100644 index 00000000000..b8e627159a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_all_of_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for DogAllOf +void main() { + final instance = DogAllOf(); + + group('test DogAllOf', () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart new file mode 100644 index 00000000000..bdcc2e4c73b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/dog_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Dog +void main() { + final instance = Dog(); + + group('test Dog', () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart new file mode 100644 index 00000000000..5f54b232c6b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_arrays_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArrays(); + + group('test EnumArrays', () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // List arrayEnum (default value: const []) + test('to test the property `arrayEnum`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart new file mode 100644 index 00000000000..09cdd468cea --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_class_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumClass +void main() { + + group('test EnumClass', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart new file mode 100644 index 00000000000..50569c6a9d4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/enum_test_test.dart @@ -0,0 +1,52 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTest(); + + group('test EnumTest', () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart new file mode 100644 index 00000000000..42c218b2087 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeApi +void main() { + final instance = FakeApi(); + + group('tests for FakeApi', () { + // Health check endpoint + // + //Future fakeHealthGet() async + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // For this test, the body for this request much reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(Client client) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart new file mode 100644 index 00000000000..1cdf662877b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeClassnameTags123Api +void main() { + final instance = FakeClassnameTags123Api(); + + group('tests for FakeClassnameTags123Api', () { + // To test class name in snake case + // + // To test class name in snake case + // + //Future testClassname(Client client) async + test('test testClassname', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart new file mode 100644 index 00000000000..d9749c91d24 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_schema_test_class_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClass(); + + group('test FileSchemaTestClass', () { + // MultipartFile file + test('to test the property `file`', () async { + // TODO + }); + + // List files (default value: const []) + test('to test the property `files`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_test.dart new file mode 100644 index 00000000000..b838399e08c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/file_test.dart @@ -0,0 +1,18 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for File +void main() { + final instance = File(); + + group('test File', () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart new file mode 100644 index 00000000000..be0fc7717c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Foo +void main() { + final instance = Foo(); + + group('test Foo', () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart new file mode 100644 index 00000000000..53f3fe77562 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart @@ -0,0 +1,94 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTest(); + + group('test FormatTest', () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double + test('to test the property `double`', () async { + // TODO + }); + + // Decimal decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // MultipartFile binary + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart new file mode 100644 index 00000000000..327a4e46d54 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/has_only_read_only_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnly(); + + group('test HasOnlyReadOnly', () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart new file mode 100644 index 00000000000..1e125f539ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/health_check_result_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResult(); + + group('test HealthCheckResult', () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object1_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object1_test.dart new file mode 100644 index 00000000000..0ee5baa0570 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object1_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject1 +void main() { + final instance = InlineObject1(); + + group('test InlineObject1', () { + // Additional data to pass to server + // String additionalMetadata + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // MultipartFile file + test('to test the property `file`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object2_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object2_test.dart new file mode 100644 index 00000000000..0d2ee346dc4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object2_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject2 +void main() { + final instance = InlineObject2(); + + group('test InlineObject2', () { + // Form parameter enum test (string array) + // List enumFormStringArray (default value: const []) + test('to test the property `enumFormStringArray`', () async { + // TODO + }); + + // Form parameter enum test (string) + // String enumFormString (default value: '-efg') + test('to test the property `enumFormString`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart new file mode 100644 index 00000000000..6a87c28a89c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart @@ -0,0 +1,96 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject3 +void main() { + final instance = InlineObject3(); + + group('test InlineObject3', () { + // None + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // None + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // None + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // None + // num number + test('to test the property `number`', () async { + // TODO + }); + + // None + // double float + test('to test the property `float`', () async { + // TODO + }); + + // None + // double double + test('to test the property `double`', () async { + // TODO + }); + + // None + // String string + test('to test the property `string`', () async { + // TODO + }); + + // None + // String patternWithoutDelimiter + test('to test the property `patternWithoutDelimiter`', () async { + // TODO + }); + + // None + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // None + // MultipartFile binary + test('to test the property `binary`', () async { + // TODO + }); + + // None + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // None + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // None + // String password + test('to test the property `password`', () async { + // TODO + }); + + // None + // String callback + test('to test the property `callback`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object4_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object4_test.dart new file mode 100644 index 00000000000..16cd24fa7a6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object4_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject4 +void main() { + final instance = InlineObject4(); + + group('test InlineObject4', () { + // field1 + // String param + test('to test the property `param`', () async { + // TODO + }); + + // field2 + // String param2 + test('to test the property `param2`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object5_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object5_test.dart new file mode 100644 index 00000000000..23af247e903 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object5_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject5 +void main() { + final instance = InlineObject5(); + + group('test InlineObject5', () { + // Additional data to pass to server + // String additionalMetadata + test('to test the property `additionalMetadata`', () async { + // TODO + }); + + // file to upload + // MultipartFile requiredFile + test('to test the property `requiredFile`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object_test.dart new file mode 100644 index 00000000000..f340e52b1d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object_test.dart @@ -0,0 +1,24 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineObject +void main() { + final instance = InlineObject(); + + group('test InlineObject', () { + // Updated name of the pet + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Updated status of the pet + // String status + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart new file mode 100644 index 00000000000..e28e7b64b4c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineResponseDefault +void main() { + final instance = InlineResponseDefault(); + + group('test InlineResponseDefault', () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/list_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/list_test.dart new file mode 100644 index 00000000000..d92eb4cb1b7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/list_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for List +void main() { + final instance = List(); + + group('test List', () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart new file mode 100644 index 00000000000..49018e96b86 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/map_test_test.dart @@ -0,0 +1,32 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for MapTest +void main() { + final instance = MapTest(); + + group('test MapTest', () { + // Map> mapMapOfString (default value: const {}) + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // Map mapOfEnumString (default value: const {}) + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // Map directMap (default value: const {}) + test('to test the property `directMap`', () async { + // TODO + }); + + // Map indirectMap (default value: const {}) + test('to test the property `indirectMap`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 00000000000..4b26cce66bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClass(); + + group('test MixedPropertiesAndAdditionalPropertiesClass', () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // Map map (default value: const {}) + test('to test the property `map`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart new file mode 100644 index 00000000000..6d021088f23 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model200_response_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Model200Response +void main() { + final instance = Model200Response(); + + group('test Model200Response', () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart new file mode 100644 index 00000000000..6936134d6ba --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/model_return_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturn(); + + group('test ModelReturn', () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart new file mode 100644 index 00000000000..156a1944cd1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/name_test.dart @@ -0,0 +1,32 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Name +void main() { + final instance = Name(); + + group('test Name', () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart new file mode 100644 index 00000000000..2506ea04356 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/nullable_class_test.dart @@ -0,0 +1,72 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClass(); + + group('test NullableClass', () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // DateTime dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // List arrayNullableProp (default value: const []) + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // List arrayAndItemsNullableProp (default value: const []) + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // List arrayItemsNullable (default value: const []) + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // Map objectNullableProp (default value: const {}) + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // Map objectAndItemsNullableProp (default value: const {}) + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // Map objectItemsNullable (default value: const {}) + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart new file mode 100644 index 00000000000..d47dae7ca1a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnly(); + + group('test NumberOnly', () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart new file mode 100644 index 00000000000..5d1c4ae1e72 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/order_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Order +void main() { + final instance = Order(); + + group('test Order', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart new file mode 100644 index 00000000000..c503fa5bcf9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_composite_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterComposite(); + + group('test OuterComposite', () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart new file mode 100644 index 00000000000..61bb0a94fd2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_default_value_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group('test OuterEnumDefaultValue', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 00000000000..58b7c6a602d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group('test OuterEnumIntegerDefaultValue', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart new file mode 100644 index 00000000000..80299cf78cb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_integer_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumInteger +void main() { + + group('test OuterEnumInteger', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart new file mode 100644 index 00000000000..0b63d48fad7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_enum_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnum +void main() { + + group('test OuterEnum', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart new file mode 100644 index 00000000000..697fcdfd0c0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for PetApi +void main() { + final instance = PetApi(); + + group('tests for PetApi', () { + // Add a new pet to the store + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(List tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart new file mode 100644 index 00000000000..b91619505ef --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Pet +void main() { + final instance = Pet(); + + group('test Pet', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // List photoUrls (default value: const []) + test('to test the property `photoUrls`', () async { + // TODO + }); + + // List tags (default value: const []) + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart new file mode 100644 index 00000000000..cc66776f643 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/read_only_first_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirst(); + + group('test ReadOnlyFirst', () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart new file mode 100644 index 00000000000..7eb4643f1df --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelName(); + + group('test SpecialModelName', () { + // int $special[propertyName] + test('to test the property `$special[propertyName]`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart new file mode 100644 index 00000000000..4a7ed54abbb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/store_api_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for StoreApi +void main() { + final instance = StoreApi(); + + group('tests for StoreApi', () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart new file mode 100644 index 00000000000..f042b4c9117 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/tag_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Tag +void main() { + final instance = Tag(); + + group('test Tag', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart new file mode 100644 index 00000000000..73ee89a2945 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_api_test.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for UserApi +void main() { + final instance = UserApi(); + + group('tests for UserApi', () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart new file mode 100644 index 00000000000..c14c0b47964 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/user_test.dart @@ -0,0 +1,53 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for User +void main() { + final instance = User(); + + group('test User', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + + + }); + +}