diff --git a/bin/configs/dart-dio-petstore-client-lib-fake-timemachine.yaml b/bin/configs/dart-dio-petstore-client-lib-fake-timemachine.yaml new file mode 100644 index 000000000000..737253e6382d --- /dev/null +++ b/bin/configs/dart-dio-petstore-client-lib-fake-timemachine.yaml @@ -0,0 +1,14 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine +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/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + dateLibrary: "timemachine" +reservedWordsMappings: + class: "classField" diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 81414c5e03bf..402b9f03ebed 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -303,7 +303,7 @@ private void configureDateLibrary(String srcFolder) { imports.put("OffsetDate", "package:time_machine/time_machine.dart"); imports.put("OffsetDateTime", "package:time_machine/time_machine.dart"); if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) { - supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", srcFolder, "local_date_serializer.dart")); + supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", srcFolder, "offset_date_serializer.dart")); } break; default: diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.gitignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.gitignore @@ -0,0 +1,41 @@ +# 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: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.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-timemachine/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator/FILES new file mode 100644 index 000000000000..3fc828deec77 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator/FILES @@ -0,0 +1,128 @@ +.gitignore +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/AllOfWithSingleRef.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/Category.md +doc/ChildWithNullable.md +doc/ClassModel.md +doc/DefaultApi.md +doc/DeprecatedObject.md +doc/Dog.md +doc/EnumArrays.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooGetDefaultResponse.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelClient.md +doc/ModelEnumClass.md +doc/ModelFile.md +doc/ModelList.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/ObjectWithDeprecatedFields.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/ParentWithNullable.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/TestInlineFreeformAdditionalPropertiesRequest.md +doc/User.md +doc/UserApi.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/another_fake_api.dart +lib/src/api/default_api.dart +lib/src/api/fake_api.dart +lib/src/api/fake_classname_tags123_api.dart +lib/src/api/pet_api.dart +lib/src/api/store_api.dart +lib/src/api/user_api.dart +lib/src/api_util.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/model/additional_properties_class.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/category.dart +lib/src/model/child_with_nullable.dart +lib/src/model/class_model.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/fake_big_decimal_map200_response.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_get_default_response.dart +lib/src/model/format_test.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/object_with_deprecated_fields.dart +lib/src/model/order.dart +lib/src/model/outer_composite.dart +lib/src/model/outer_enum.dart +lib/src/model/outer_enum_default_value.dart +lib/src/model/outer_enum_integer.dart +lib/src/model/outer_enum_integer_default_value.dart +lib/src/model/outer_object_with_enum_property.dart +lib/src/model/parent_with_nullable.dart +lib/src/model/pet.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/test_inline_freeform_additional_properties_request.dart +lib/src/model/user.dart +lib/src/offset_date_serializer.dart +lib/src/serializers.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator/VERSION new file mode 100644 index 000000000000..96cfbb19ae28 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.13.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/README.md new file mode 100644 index 000000000000..d657f9bae5e0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/README.md @@ -0,0 +1,212 @@ +# openapi (EXPERIMENTAL) +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 +- Generator version: 7.13.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +* timemachine option currently **DOES NOT** support sound null-safety and may not work + +## Installation & Usage + +### pub.dev +To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml +```yaml +dependencies: + openapi: 1.0.0 +``` + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + git: + url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + #ref: main +``` + +### Local development +To use the package from your local drive, please include the following in pubspec.yaml +```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/openapi.dart'; + + +final api = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = await api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (e) { + print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo | +[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterCompositeSerialize**](doc/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[*FakeApi*](doc/FakeApi.md) | [**testAdditionalPropertiesReference**](doc/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[*FakeApi*](doc/FakeApi.md) | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[*FakeApi*](doc/FakeApi.md) | [**testEndpointParameters**](doc/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[*FakeApi*](doc/FakeApi.md) | [**testEnumParameters**](doc/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[*FakeApi*](doc/FakeApi.md) | [**testGroupParameters**](doc/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[*FakeApi*](doc/FakeApi.md) | [**testInlineAdditionalProperties**](doc/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testInlineFreeformAdditionalProperties**](doc/FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[*FakeApi*](doc/FakeApi.md) | [**testNullable**](doc/FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[*FakeApi*](doc/FakeApi.md) | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[*FakeApi*](doc/FakeApi.md) | [**testStringMapReference**](doc/FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map +[*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[*PetApi*](doc/PetApi.md) | [**updatePet**](doc/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[*PetApi*](doc/PetApi.md) | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[*PetApi*](doc/PetApi.md) | [**uploadFile**](doc/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[*PetApi*](doc/PetApi.md) | [**uploadFileWithRequiredFile**](doc/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[*StoreApi*](doc/StoreApi.md) | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**getInventory**](doc/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[*StoreApi*](doc/StoreApi.md) | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**placeOrder**](doc/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +[*UserApi*](doc/UserApi.md) | [**createUser**](doc/UserApi.md#createuser) | **POST** /user | Create user +[*UserApi*](doc/UserApi.md) | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**deleteUser**](doc/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[*UserApi*](doc/UserApi.md) | [**getUserByName**](doc/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[*UserApi*](doc/UserApi.md) | [**loginUser**](doc/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[*UserApi*](doc/UserApi.md) | [**logoutUser**](doc/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[*UserApi*](doc/UserApi.md) | [**updateUser**](doc/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.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) + - [Category](doc/Category.md) + - [ChildWithNullable](doc/ChildWithNullable.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [FakeBigDecimalMap200Response](doc/FakeBigDecimalMap200Response.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) + - [FormatTest](doc/FormatTest.md) + - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) + - [HealthCheckResult](doc/HealthCheckResult.md) + - [MapTest](doc/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc/Model200Response.md) + - [ModelClient](doc/ModelClient.md) + - [ModelEnumClass](doc/ModelEnumClass.md) + - [ModelFile](doc/ModelFile.md) + - [ModelList](doc/ModelList.md) + - [ModelReturn](doc/ModelReturn.md) + - [Name](doc/Name.md) + - [NullableClass](doc/NullableClass.md) + - [NumberOnly](doc/NumberOnly.md) + - [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.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) + - [OuterObjectWithEnumProperty](doc/OuterObjectWithEnumProperty.md) + - [ParentWithNullable](doc/ParentWithNullable.md) + - [Pet](doc/Pet.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](doc/TestInlineFreeformAdditionalPropertiesRequest.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### 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 + +### 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 + +### http_basic_test + +- **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/analysis_options.yaml new file mode 100644 index 000000000000..16a95850087a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/analysis_options.yaml @@ -0,0 +1,9 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..f9f7857894d0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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] +**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.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/dart-dio/petstore_client_lib_fake-timemachine/doc/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/AllOfWithSingleRef.md @@ -0,0 +1,16 @@ +# openapi.model.AllOfWithSingleRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **String** | | [optional] +**singleRefType** | [**SingleRefType**](SingleRefType.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/dart-dio/petstore_client_lib_fake-timemachine/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..36a94e6bb703 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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 +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +> ModelClient call123testSpecialTags(modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.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/dart-dio/petstore_client_lib_fake-timemachine/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..d1a272ab6023 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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>>**](BuiltList.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/dart-dio/petstore_client_lib_fake-timemachine/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..94b60f272fd4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | **BuiltList<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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ArrayTest.md new file mode 100644 index 000000000000..0813d4fa93c6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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] +**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](BuiltList.md) | | [optional] +**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](BuiltList.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/dart-dio/petstore_client_lib_fake-timemachine/doc/Capitalization.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/Category.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Category.md new file mode 100644 index 000000000000..ae6bc52e89d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/dart-dio/petstore_client_lib_fake-timemachine/doc/ChildWithNullable.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ChildWithNullable.md new file mode 100644 index 000000000000..770494fcf4cc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ChildWithNullable.md @@ -0,0 +1,17 @@ +# openapi.model.ChildWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **String** | | [optional] +**otherProperty** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/ClassModel.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ClassModel.md new file mode 100644 index 000000000000..9b80d4f71eea --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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 +------------ | ------------- | ------------- | ------------- +**classField** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/DefaultApi.md new file mode 100644 index 000000000000..6abd2b44f9c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** +> FooGetDefaultResponse fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.fooGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.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-timemachine/doc/DeprecatedObject.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/DeprecatedObject.md @@ -0,0 +1,15 @@ +# openapi.model.DeprecatedObject + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/dart-dio/petstore_client_lib_fake-timemachine/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/EnumArrays.md new file mode 100644 index 000000000000..06170bb8f51d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | **BuiltList<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/dart-dio/petstore_client_lib_fake-timemachine/doc/EnumTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeApi.md new file mode 100644 index 000000000000..629319d0b037 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeApi.md @@ -0,0 +1,1028 @@ +# 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 +------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[**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 | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[**testAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[**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 +[**testInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[**testNullable**](FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[**testStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map + + +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeBigDecimalMap(); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **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) + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeHealthGet(); + print(response); +} catch on DioException (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 = Openapi().getFakeApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store +final String query1 = query1_example; // String | query parameter +final String header1 = header1_example; // String | header parameter + +try { + api.fakeHttpSignatureTest(pet, query1, header1); +} catch on DioException (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 = Openapi().getFakeApi(); +final bool body = true; // bool | Input boolean as post body + +try { + final response = api.fakeOuterBooleanSerialize(body); + print(response); +} catch on DioException (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 = Openapi().getFakeApi(); +final OuterComposite outerComposite = ; // OuterComposite | Input composite as post body + +try { + final response = api.fakeOuterCompositeSerialize(outerComposite); + print(response); +} catch on DioException (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 = Openapi().getFakeApi(); +final num body = 8.14; // num | Input number as post body + +try { + final response = api.fakeOuterNumberSerialize(body); + print(response); +} catch on DioException (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 = Openapi().getFakeApi(); +final String body = body_example; // String | Input string as post body + +try { + final response = api.fakeOuterStringSerialize(body); + print(response); +} catch on DioException (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) + +# **fakePropertyEnumIntegerSerialize** +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + + + +Test serialization of enum (int) properties with examples + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final OuterObjectWithEnumProperty outerObjectWithEnumProperty = ; // OuterObjectWithEnumProperty | Input enum (int) as post body + +try { + final response = api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.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) + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final BuiltMap requestBody = Object; // BuiltMap | request body + +try { + api.testAdditionalPropertiesReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**BuiltMap<String, JsonObject>**](JsonObject.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) + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload + +try { + api.testBodyWithBinary(body); +} catch on DioException (e) { + print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **MultipartFile**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **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) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | + +try { + api.testBodyWithFileSchema(fileSchemaTestClass); +} catch on DioException (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 = Openapi().getFakeApi(); +final String query = query_example; // String | +final User user = ; // User | + +try { + api.testBodyWithQueryParams(query, user); +} catch on DioException (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** +> ModelClient testClientModel(modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClientModel(modelClient); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->testClientModel: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.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 = Openapi().getFakeApi(); +final num number = 8.14; // num | None +final double double_ = 1.2; // double | None +final String patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final String byte = BYTE_ARRAY_DATA_HERE; // String | None +final int integer = 56; // int | None +final int int32 = 56; // int | None +final int int64 = 789; // int | None +final double float = 3.4; // double | None +final String string = string_example; // String | None +final Uint8List binary = BINARY_DATA_HERE; // Uint8List | None +final OffsetDate date = 2013-10-20; // OffsetDate | None +final OffsetDateTime dateTime = 2013-10-20T19:20:30+01:00; // OffsetDateTime | None +final String password = password_example; // String | None +final String callback = callback_example; // String | None + +try { + api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch on DioException (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** | **Uint8List**| None | [optional] + **date** | **OffsetDate**| None | [optional] + **dateTime** | **OffsetDateTime**| 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, enumQueryModelArray, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final BuiltList enumHeaderStringArray = ; // BuiltList | Header parameter enum test (string array) +final String enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final BuiltList enumQueryStringArray = ; // BuiltList | Query parameter enum test (string array) +final String enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final int enumQueryInteger = 56; // int | Query parameter enum test (double) +final double enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final BuiltList enumQueryModelArray = ; // BuiltList | +final BuiltList enumFormStringArray = ; // BuiltList | Form parameter enum test (string array) +final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString); +} catch on DioException (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**BuiltList<String>**](String.md)| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**BuiltList<String>**](String.md)| Query parameter enum test (string array) | [optional] + **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] + **enumQueryModelArray** | [**BuiltList<ModelEnumClass>**](ModelEnumClass.md)| | [optional] + **enumFormStringArray** | [**BuiltList<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'; + +final api = Openapi().getFakeApi(); +final int requiredStringGroup = 56; // int | Required String in group parameters +final bool requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final int requiredInt64Group = 789; // int | Required Integer in group parameters +final int stringGroup = 56; // int | String in group parameters +final bool booleanGroup = true; // bool | Boolean in group parameters +final int int64Group = 789; // int | Integer in group parameters + +try { + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch on DioException (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 = Openapi().getFakeApi(); +final BuiltMap requestBody = ; // BuiltMap | request body + +try { + api.testInlineAdditionalProperties(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**BuiltMap<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) + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = ; // TestInlineFreeformAdditionalPropertiesRequest | request body + +try { + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineFreeformAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.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 = Openapi().getFakeApi(); +final String param = param_example; // String | field1 +final String param2 = param2_example; // String | field2 + +try { + api.testJsonFormData(param, param2); +} catch on DioException (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) + +# **testNullable** +> testNullable(childWithNullable) + +test nullable parent property + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final ChildWithNullable childWithNullable = ; // ChildWithNullable | request body + +try { + api.testNullable(childWithNullable); +} catch on DioException (e) { + print('Exception when calling FakeApi->testNullable: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.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) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final BuiltList pipe = ; // BuiltList | +final BuiltList ioutil = ; // BuiltList | +final BuiltList http = ; // BuiltList | +final BuiltList url = ; // BuiltList | +final BuiltList context = ; // BuiltList | +final String allowEmpty = allowEmpty_example; // String | +final BuiltMap language = ; // BuiltMap | + +try { + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); +} catch on DioException (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**BuiltList<String>**](String.md)| | + **ioutil** | [**BuiltList<String>**](String.md)| | + **http** | [**BuiltList<String>**](String.md)| | + **url** | [**BuiltList<String>**](String.md)| | + **context** | [**BuiltList<String>**](String.md)| | + **allowEmpty** | **String**| | + **language** | [**BuiltMap<String, String>**](String.md)| | [optional] + +### 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) + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final BuiltMap requestBody = ; // BuiltMap | request body + +try { + api.testStringMapReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testStringMapReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**BuiltMap<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) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 000000000000..cedb487c954d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **BuiltMap<String, 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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..645aebf399f0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** +> ModelClient testClassname(modelClient) + +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 = Openapi().getFakeClassnameTags123Api(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClassname(modelClient); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.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-timemachine/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..105fece87f1d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**BuiltList<ModelFile>**](ModelFile.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/dart-dio/petstore_client_lib_fake-timemachine/doc/Foo.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Foo.md new file mode 100644 index 000000000000..185b76e3f5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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-timemachine/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FooGetDefaultResponse.md new file mode 100644 index 000000000000..10d0133abd95 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## 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/dart-dio/petstore_client_lib_fake-timemachine/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/FormatTest.md new file mode 100644 index 000000000000..4bc682948e31 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**Uint8List**](Uint8List.md) | | [optional] +**date** | [**OffsetDate**](OffsetDate.md) | | +**dateTime** | [**OffsetDateTime**](OffsetDateTime.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/dart-dio/petstore_client_lib_fake-timemachine/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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] +**foo** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/MapTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/MapTest.md new file mode 100644 index 000000000000..4ad87df64232 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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>>**](BuiltMap.md) | | [optional] +**mapOfEnumString** | **BuiltMap<String, String>** | | [optional] +**directMap** | **BuiltMap<String, bool>** | | [optional] +**indirectMap** | **BuiltMap<String, 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/dart-dio/petstore_client_lib_fake-timemachine/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..ef4bc0851911 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**map** | [**BuiltMap<String, Animal>**](Animal.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/dart-dio/petstore_client_lib_fake-timemachine/doc/Model200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Model200Response.md new file mode 100644 index 000000000000..e8b088ca1afa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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] +**classField** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelClient.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## 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/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelEnumClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelEnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.ModelEnumClass + +## 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-timemachine/doc/ModelFile.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## 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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelList.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## 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/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/Name.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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] +**property** | **String** | | [optional] +**n123number** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/NullableClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/NullableClass.md new file mode 100644 index 000000000000..4568760db0ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | [**OffsetDate**](OffsetDate.md) | | [optional] +**datetimeProp** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**arrayNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayItemsNullable** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**objectNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](JsonObject.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/dart-dio/petstore_client_lib_fake-timemachine/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..3e7848d382c2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ObjectWithDeprecatedFields.md @@ -0,0 +1,18 @@ +# openapi.model.ObjectWithDeprecatedFields + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**id** | **num** | | [optional] +**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | **BuiltList<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/dart-dio/petstore_client_lib_fake-timemachine/doc/Order.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Order.md new file mode 100644 index 000000000000..c29c930e738f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**OffsetDateTime**](OffsetDateTime.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/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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-timemachine/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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-timemachine/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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-timemachine/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/OuterObjectWithEnumProperty.md @@ -0,0 +1,15 @@ +# openapi.model.OuterObjectWithEnumProperty + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | + +[[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-timemachine/doc/ParentWithNullable.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ParentWithNullable.md new file mode 100644 index 000000000000..17aa5ca02941 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ParentWithNullable.md @@ -0,0 +1,16 @@ +# openapi.model.ParentWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/Pet.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Pet.md new file mode 100644 index 000000000000..08e0aeedd784 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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** | **BuiltSet<String>** | | +**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] +**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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/PetApi.md new file mode 100644 index 000000000000..2b7766eb60d4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/PetApi.md @@ -0,0 +1,439 @@ +# openapi.api.PetApi + +## 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 +------------- | ------------- | ------------- +[**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(pet) + +Add a new pet to the store + + + +### 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 = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.addPet(pet); +} catch on DioException (e) { + print('Exception when calling PetApi->addPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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 +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | Pet id to delete +final String apiKey = apiKey_example; // String | + +try { + api.deletePet(petId, apiKey); +} catch on DioException (e) { + print('Exception when calling PetApi->deletePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### 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** +> BuiltList 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 +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final BuiltList status = ; // BuiltList | Status values that need to be considered for filter + +try { + final response = api.findPetsByStatus(status); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**BuiltList<Pet>**](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** +> BuiltSet 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 +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final BuiltSet tags = ; // BuiltSet | Tags to filter by + +try { + final response = api.findPetsByTags(tags); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**BuiltSet<String>**](String.md)| Tags to filter by | + +### Return type + +[**BuiltSet<Pet>**](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 +//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'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to return + +try { + final response = api.getPetById(petId); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->getPetById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | + +### 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(pet) + +Update an existing pet + + + +### 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 = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.updatePet(pet); +} catch on DioException (e) { + print('Exception when calling PetApi->updatePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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 +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet that needs to be updated +final String name = name_example; // String | Updated name of the pet +final String status = status_example; // String | Updated status of the pet + +try { + api.updatePetWithForm(petId, name, status); +} catch on DioException (e) { + print('Exception when calling PetApi->updatePetWithForm: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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 + +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 +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final MultipartFile file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + final response = api.uploadFile(petId, additionalMetadata, file); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->uploadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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 = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final MultipartFile requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(response); +} catch on DioException (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 + +[**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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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] +**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/dart-dio/petstore_client_lib_fake-timemachine/doc/SingleRefType.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/SingleRefType.md @@ -0,0 +1,14 @@ +# openapi.model.SingleRefType + +## 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-timemachine/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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 +------------ | ------------- | ------------- | ------------- +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/StoreApi.md new file mode 100644 index 000000000000..3616fd734377 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/StoreApi.md @@ -0,0 +1,188 @@ +# openapi.api.StoreApi + +## 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 +------------- | ------------- | ------------- +[**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** +> 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'; + +final api = Openapi().getStoreApi(); +final String orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api.deleteOrder(orderId); +} catch on DioException (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 | + +### 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** +> BuiltMap 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 +//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'; + +final api = Openapi().getStoreApi(); + +try { + final response = api.getInventory(); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**BuiltMap<String, int>** + +### 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 generate exceptions + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getStoreApi(); +final int orderId = 789; // int | ID of pet that needs to be fetched + +try { + final response = api.getOrderById(orderId); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->getOrderById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | + +### 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(order) + +Place an order for a pet + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getStoreApi(); +final Order order = ; // Order | order placed for purchasing the pet + +try { + final response = api.placeOrder(order); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->placeOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Tag.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/dart-dio/petstore_client_lib_fake-timemachine/doc/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..e2b2f1fd4468 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,15 @@ +# openapi.model.TestInlineFreeformAdditionalPropertiesRequest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someProperty** | **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/dart-dio/petstore_client_lib_fake-timemachine/doc/User.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/UserApi.md new file mode 100644 index 000000000000..571896708968 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/doc/UserApi.md @@ -0,0 +1,359 @@ +# openapi.api.UserApi + +## 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 +------------- | ------------- | ------------- +[**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(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final User user = ; // User | Created user object + +try { + api.createUser(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### 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) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final BuiltList user = ; // BuiltList | List of user object + +try { + api.createUsersWithArrayInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**BuiltList<User>**](User.md)| List of user object | + +### 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) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final BuiltList user = ; // BuiltList | List of user object + +try { + api.createUsersWithListInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**BuiltList<User>**](User.md)| List of user object | + +### 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) + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be deleted + +try { + api.deleteUser(username); +} catch on DioException (e) { + print('Exception when calling UserApi->deleteUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### 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'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + final response = api.getUserByName(username); + print(response); +} catch on DioException (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. | + +### 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'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The user name for login +final String password = password_example; // String | The password for login in clear text + +try { + final response = api.loginUser(username, password); + print(response); +} catch on DioException (e) { + print('Exception when calling UserApi->loginUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### 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'; + +final api = Openapi().getUserApi(); + +try { + api.logoutUser(); +} catch on DioException (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, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | name that need to be deleted +final User user = ; // User | Updated user object + +try { + api.updateUser(username, user); +} catch on DioException (e) { + print('Exception when calling UserApi->updateUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### 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) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/openapi.dart new file mode 100644 index 000000000000..34c14334bb01 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/openapi.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; +export 'package:openapi/src/serializers.dart'; + + +export 'package:openapi/src/api/another_fake_api.dart'; +export 'package:openapi/src/api/default_api.dart'; +export 'package:openapi/src/api/fake_api.dart'; +export 'package:openapi/src/api/fake_classname_tags123_api.dart'; +export 'package:openapi/src/api/pet_api.dart'; +export 'package:openapi/src/api/store_api.dart'; +export 'package:openapi/src/api/user_api.dart'; + +export 'package:openapi/src/model/additional_properties_class.dart'; +export 'package:openapi/src/model/all_of_with_single_ref.dart'; +export 'package:openapi/src/model/animal.dart'; +export 'package:openapi/src/model/api_response.dart'; +export 'package:openapi/src/model/array_of_array_of_number_only.dart'; +export 'package:openapi/src/model/array_of_number_only.dart'; +export 'package:openapi/src/model/array_test.dart'; +export 'package:openapi/src/model/capitalization.dart'; +export 'package:openapi/src/model/cat.dart'; +export 'package:openapi/src/model/category.dart'; +export 'package:openapi/src/model/child_with_nullable.dart'; +export 'package:openapi/src/model/class_model.dart'; +export 'package:openapi/src/model/deprecated_object.dart'; +export 'package:openapi/src/model/dog.dart'; +export 'package:openapi/src/model/enum_arrays.dart'; +export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; +export 'package:openapi/src/model/file_schema_test_class.dart'; +export 'package:openapi/src/model/foo.dart'; +export 'package:openapi/src/model/foo_get_default_response.dart'; +export 'package:openapi/src/model/format_test.dart'; +export 'package:openapi/src/model/has_only_read_only.dart'; +export 'package:openapi/src/model/health_check_result.dart'; +export 'package:openapi/src/model/map_test.dart'; +export 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +export 'package:openapi/src/model/model200_response.dart'; +export 'package:openapi/src/model/model_client.dart'; +export 'package:openapi/src/model/model_enum_class.dart'; +export 'package:openapi/src/model/model_file.dart'; +export 'package:openapi/src/model/model_list.dart'; +export 'package:openapi/src/model/model_return.dart'; +export 'package:openapi/src/model/name.dart'; +export 'package:openapi/src/model/nullable_class.dart'; +export 'package:openapi/src/model/number_only.dart'; +export 'package:openapi/src/model/object_with_deprecated_fields.dart'; +export 'package:openapi/src/model/order.dart'; +export 'package:openapi/src/model/outer_composite.dart'; +export 'package:openapi/src/model/outer_enum.dart'; +export 'package:openapi/src/model/outer_enum_default_value.dart'; +export 'package:openapi/src/model/outer_enum_integer.dart'; +export 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +export 'package:openapi/src/model/outer_object_with_enum_property.dart'; +export 'package:openapi/src/model/parent_with_nullable.dart'; +export 'package:openapi/src/model/pet.dart'; +export 'package:openapi/src/model/read_only_first.dart'; +export 'package:openapi/src/model/single_ref_type.dart'; +export 'package:openapi/src/model/special_model_name.dart'; +export 'package:openapi/src/model/tag.dart'; +export 'package:openapi/src/model/test_inline_freeform_additional_properties_request.dart'; +export 'package:openapi/src/model/user.dart'; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api.dart new file mode 100644 index 000000000000..53d0c5a524bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api.dart @@ -0,0 +1,115 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/serializers.dart'; +import 'package:openapi/src/auth/api_key_auth.dart'; +import 'package:openapi/src/auth/basic_auth.dart'; +import 'package:openapi/src/auth/bearer_auth.dart'; +import 'package:openapi/src/auth/oauth.dart'; +import 'package:openapi/src/api/another_fake_api.dart'; +import 'package:openapi/src/api/default_api.dart'; +import 'package:openapi/src/api/fake_api.dart'; +import 'package:openapi/src/api/fake_classname_tags123_api.dart'; +import 'package:openapi/src/api/pet_api.dart'; +import 'package:openapi/src/api/store_api.dart'; +import 'package:openapi/src/api/user_api.dart'; + +class Openapi { + static const String basePath = r'http://petstore.swagger.io:80/v2'; + + final Dio dio; + final Serializers serializers; + + Openapi({ + Dio? dio, + Serializers? serializers, + String? basePathOverride, + List? interceptors, + }) : this.serializers = serializers ?? standardSerializers, + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + ApiKeyAuthInterceptor(), + ]); + } else { + this.dio.interceptors.addAll(interceptors); + } + } + + void setOAuthToken(String name, String token) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token; + } + } + + void setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token; + } + } + + void setBasicAuth(String name, String username, String password) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); + } + } + + void setApiKey(String name, String apiKey) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) 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-timemachine/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/another_fake_api.dart new file mode 100644 index 000000000000..5d2876183070 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/another_fake_api.dart @@ -0,0 +1,116 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/model_client.dart'; + +class AnotherFakeApi { + + final Dio _dio; + + final Serializers _serializers; + + const AnotherFakeApi(this._dio, this._serializers); + + /// To test special tags + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> call123testSpecialTags({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/another-fake/dummy'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(ModelClient); + _bodyData = _serializers.serialize(modelClient, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ModelClient), + ) as ModelClient; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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-timemachine/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/default_api.dart new file mode 100644 index 000000000000..50fd4f279b5b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/default_api.dart @@ -0,0 +1,94 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/foo_get_default_response.dart'; + +class DefaultApi { + + final Dio _dio; + + final Serializers _serializers; + + const DefaultApi(this._dio, this._serializers); + + /// fooGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooGetDefaultResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(FooGetDefaultResponse), + ) as FooGetDefaultResponse; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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-timemachine/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/fake_api.dart new file mode 100644 index 000000000000..cf230ffccfd4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/fake_api.dart @@ -0,0 +1,1791 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/src/model/child_with_nullable.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_class.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/test_inline_freeform_additional_properties_request.dart'; +import 'package:openapi/src/model/user.dart'; +import 'package:time_machine/time_machine.dart'; + +class FakeApi { + + final Dio _dio; + + final Serializers _serializers; + + const FakeApi(this._dio, this._serializers); + + /// fakeBigDecimalMap + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FakeBigDecimalMap200Response] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeBigDecimalMap({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/BigDecimalMap'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FakeBigDecimalMap200Response? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(FakeBigDecimalMap200Response), + ) as FakeBigDecimalMap200Response; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Health check endpoint + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [HealthCheckResult] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeHealthGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/health'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + HealthCheckResult? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(HealthCheckResult), + ) as HealthCheckResult; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// test http signature authentication + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [query1] - query parameter + /// * [header1] - header parameter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> fakeHttpSignatureTest({ + required Pet pet, + String? query1, + String? header1, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/http-signature-test'; + final _options = Options( + method: r'GET', + headers: { + if (header1 != null) r'header_1': header1, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'signature', + 'name': 'http_signature_test', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (query1 != null) r'query_1': encodeQueryParameter(_serializers, query1, const FullType(String)), + }; + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = _serializers.serialize(pet, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// fakeOuterBooleanSerialize + /// Test serialization of outer boolean types + /// + /// Parameters: + /// * [body] - Input boolean as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [bool] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterBooleanSerialize({ + bool? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/boolean'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + bool? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : rawResponse as bool; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakeOuterCompositeSerialize + /// Test serialization of object with outer number type + /// + /// Parameters: + /// * [outerComposite] - Input composite as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterComposite] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterCompositeSerialize({ + OuterComposite? outerComposite, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/composite'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(OuterComposite); + _bodyData = outerComposite == null ? null : _serializers.serialize(outerComposite, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterComposite? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(OuterComposite), + ) as OuterComposite; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakeOuterNumberSerialize + /// Test serialization of outer number types + /// + /// Parameters: + /// * [body] - Input number as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [num] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterNumberSerialize({ + num? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/number'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + num? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : rawResponse as num; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakeOuterStringSerialize + /// Test serialization of outer string types + /// + /// Parameters: + /// * [body] - Input string as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterStringSerialize({ + String? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/string'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : rawResponse as String; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakePropertyEnumIntegerSerialize + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// * [outerObjectWithEnumProperty] - Input enum (int) as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterObjectWithEnumProperty] as data + /// Throws [DioException] if API call or serialization fails + Future> fakePropertyEnumIntegerSerialize({ + required OuterObjectWithEnumProperty outerObjectWithEnumProperty, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/property/enum-int'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(OuterObjectWithEnumProperty); + _bodyData = _serializers.serialize(outerObjectWithEnumProperty, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterObjectWithEnumProperty? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(OuterObjectWithEnumProperty), + ) as OuterObjectWithEnumProperty; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// test referenced additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testAdditionalPropertiesReference({ + required BuiltMap requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/additionalProperties-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(BuiltMap, [FullType(String), FullType(JsonObject)]); + _bodyData = _serializers.serialize(requestBody, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithBinary + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// * [body] - image to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithBinary({ + MultipartFile? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-binary'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'image/png', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body?.finalize(); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithFileSchema + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// * [fileSchemaTestClass] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithFileSchema({ + required FileSchemaTestClass fileSchemaTestClass, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-file-schema'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(FileSchemaTestClass); + _bodyData = _serializers.serialize(fileSchemaTestClass, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithQueryParams + /// + /// + /// Parameters: + /// * [query] + /// * [user] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithQueryParams({ + required String query, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-query-params'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'query': encodeQueryParameter(_serializers, query, const FullType(String)), + }; + + dynamic _bodyData; + + try { + const _type = FullType(User); + _bodyData = _serializers.serialize(user, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClientModel({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(ModelClient); + _bodyData = _serializers.serialize(modelClient, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ModelClient), + ) as ModelClient; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// * [number] - None + /// * [double_] - None + /// * [patternWithoutDelimiter] - None + /// * [byte] - None + /// * [integer] - None + /// * [int32] - None + /// * [int64] - None + /// * [float] - None + /// * [string] - None + /// * [binary] - None + /// * [date] - None + /// * [dateTime] - None + /// * [password] - None + /// * [callback] - None + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEndpointParameters({ + required num number, + required double double_, + required String patternWithoutDelimiter, + required String byte, + int? integer, + int? int32, + int? int64, + double? float, + String? string, + Uint8List? binary, + OffsetDate? date, + OffsetDateTime? dateTime, + String? password, + String? callback, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'basic', + 'name': 'http_basic_test', + }, + ], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = { + if (integer != null) r'integer': encodeQueryParameter(_serializers, integer, const FullType(int)), + if (int32 != null) r'int32': encodeQueryParameter(_serializers, int32, const FullType(int)), + if (int64 != null) r'int64': encodeQueryParameter(_serializers, int64, const FullType(int)), + r'number': encodeQueryParameter(_serializers, number, const FullType(num)), + if (float != null) r'float': encodeQueryParameter(_serializers, float, const FullType(double)), + r'double': encodeQueryParameter(_serializers, double_, const FullType(double)), + if (string != null) r'string': encodeQueryParameter(_serializers, string, const FullType(String)), + r'pattern_without_delimiter': encodeQueryParameter(_serializers, patternWithoutDelimiter, const FullType(String)), + r'byte': encodeQueryParameter(_serializers, byte, const FullType(String)), + if (binary != null) r'binary': encodeQueryParameter(_serializers, binary, const FullType(Uint8List)), + if (date != null) r'date': encodeQueryParameter(_serializers, date, const FullType(OffsetDate)), + if (dateTime != null) r'dateTime': encodeQueryParameter(_serializers, dateTime, const FullType(OffsetDateTime)), + if (password != null) r'password': encodeQueryParameter(_serializers, password, const FullType(String)), + if (callback != null) r'callback': encodeQueryParameter(_serializers, callback, const FullType(String)), + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test enum parameters + /// To test enum parameters + /// + /// Parameters: + /// * [enumHeaderStringArray] - Header parameter enum test (string array) + /// * [enumHeaderString] - Header parameter enum test (string) + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) + /// * [enumFormString] - Form parameter enum test (string) + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEnumParameters({ + BuiltList? enumHeaderStringArray, + String? enumHeaderString = '-efg', + BuiltList? enumQueryStringArray, + String? enumQueryString = '-efg', + int? enumQueryInteger, + double? enumQueryDouble, + BuiltList? enumQueryModelArray, + BuiltList? enumFormStringArray, + String? enumFormString, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'GET', + headers: { + if (enumHeaderStringArray != null) r'enum_header_string_array': enumHeaderStringArray, + if (enumHeaderString != null) r'enum_header_string': enumHeaderString, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (enumQueryStringArray != null) r'enum_query_string_array': encodeCollectionQueryParameter(_serializers, enumQueryStringArray, const FullType(BuiltList, [FullType(String)]), format: ListFormat.multi,), + if (enumQueryString != null) r'enum_query_string': encodeQueryParameter(_serializers, enumQueryString, const FullType(String)), + if (enumQueryInteger != null) r'enum_query_integer': encodeQueryParameter(_serializers, enumQueryInteger, const FullType(int)), + if (enumQueryDouble != null) r'enum_query_double': encodeQueryParameter(_serializers, enumQueryDouble, const FullType(double)), + if (enumQueryModelArray != null) r'enum_query_model_array': encodeCollectionQueryParameter(_serializers, enumQueryModelArray, const FullType(BuiltList, [FullType(ModelEnumClass)]), format: ListFormat.multi,), + }; + + dynamic _bodyData; + + try { + _bodyData = { + if (enumFormStringArray != null) r'enum_form_string_array': encodeCollectionQueryParameter(_serializers, enumFormStringArray, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,), + if (enumFormString != null) r'enum_form_string': encodeQueryParameter(_serializers, enumFormString, const FullType(String)), + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// * [requiredStringGroup] - Required String in group parameters + /// * [requiredBooleanGroup] - Required Boolean in group parameters + /// * [requiredInt64Group] - Required Integer in group parameters + /// * [stringGroup] - String in group parameters + /// * [booleanGroup] - Boolean in group parameters + /// * [int64Group] - Integer in group parameters + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testGroupParameters({ + required int requiredStringGroup, + required bool requiredBooleanGroup, + required int requiredInt64Group, + int? stringGroup, + bool? booleanGroup, + int? int64Group, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'DELETE', + headers: { + r'required_boolean_group': requiredBooleanGroup, + if (booleanGroup != null) r'boolean_group': booleanGroup, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'bearer_test', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'required_string_group': encodeQueryParameter(_serializers, requiredStringGroup, const FullType(int)), + r'required_int64_group': encodeQueryParameter(_serializers, requiredInt64Group, const FullType(int)), + if (stringGroup != null) r'string_group': encodeQueryParameter(_serializers, stringGroup, const FullType(int)), + if (int64Group != null) r'int64_group': encodeQueryParameter(_serializers, int64Group, const FullType(int)), + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineAdditionalProperties({ + required BuiltMap requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/inline-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(BuiltMap, [FullType(String), FullType(String)]); + _bodyData = _serializers.serialize(requestBody, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline free-form additionalProperties + /// + /// + /// Parameters: + /// * [testInlineFreeformAdditionalPropertiesRequest] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineFreeformAdditionalProperties({ + required TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/inline-freeform-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(TestInlineFreeformAdditionalPropertiesRequest); + _bodyData = _serializers.serialize(testInlineFreeformAdditionalPropertiesRequest, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test json serialization of form data + /// + /// + /// Parameters: + /// * [param] - field1 + /// * [param2] - field2 + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testJsonFormData({ + required String param, + required String param2, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/jsonFormData'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = { + r'param': encodeQueryParameter(_serializers, param, const FullType(String)), + r'param2': encodeQueryParameter(_serializers, param2, const FullType(String)), + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test nullable parent property + /// + /// + /// Parameters: + /// * [childWithNullable] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testNullable({ + required ChildWithNullable childWithNullable, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/nullable'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(ChildWithNullable); + _bodyData = _serializers.serialize(childWithNullable, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testQueryParameterCollectionFormat + /// To test the collection format in query parameters + /// + /// Parameters: + /// * [pipe] + /// * [ioutil] + /// * [http] + /// * [url] + /// * [context] + /// * [allowEmpty] + /// * [language] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testQueryParameterCollectionFormat({ + required BuiltList pipe, + required BuiltList ioutil, + required BuiltList http, + required BuiltList url, + required BuiltList context, + required String allowEmpty, + BuiltMap? language, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/test-query-parameters'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'pipe': encodeCollectionQueryParameter(_serializers, pipe, const FullType(BuiltList, [FullType(String)]), format: ListFormat.pipes,), + r'ioutil': encodeCollectionQueryParameter(_serializers, ioutil, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,), + r'http': encodeCollectionQueryParameter(_serializers, http, const FullType(BuiltList, [FullType(String)]), format: ListFormat.ssv,), + r'url': encodeCollectionQueryParameter(_serializers, url, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,), + r'context': encodeCollectionQueryParameter(_serializers, context, const FullType(BuiltList, [FullType(String)]), format: ListFormat.multi,), + if (language != null) r'language': encodeQueryParameter(_serializers, language, const FullType(BuiltMap, [FullType(String), FullType(String)]), ), + r'allowEmpty': encodeQueryParameter(_serializers, allowEmpty, const FullType(String)), + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test referenced string map + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testStringMapReference({ + required BuiltMap requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/stringMap-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(BuiltMap, [FullType(String), FullType(String)]); + _bodyData = _serializers.serialize(requestBody, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..671ec766ab47 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/fake_classname_tags123_api.dart @@ -0,0 +1,123 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/model_client.dart'; + +class FakeClassnameTags123Api { + + final Dio _dio; + + final Serializers _serializers; + + const FakeClassnameTags123Api(this._dio, this._serializers); + + /// To test class name in snake case + /// To test class name in snake case + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClassname({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake_classname_test'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key_query', + 'keyName': 'api_key_query', + 'where': 'query', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(ModelClient); + _bodyData = _serializers.serialize(modelClient, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ModelClient), + ) as ModelClient; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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-timemachine/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/pet_api.dart new file mode 100644 index 000000000000..a4da1c5ff6db --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/pet_api.dart @@ -0,0 +1,766 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/pet.dart'; + +class PetApi { + + final Dio _dio; + + final Serializers _serializers; + + const PetApi(this._dio, this._serializers); + + /// Add a new pet to the store + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> addPet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = _serializers.serialize(pet, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Deletes a pet + /// + /// + /// Parameters: + /// * [petId] - Pet id to delete + /// * [apiKey] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deletePet({ + required int petId, + String? apiKey, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); + final _options = Options( + method: r'DELETE', + headers: { + if (apiKey != null) r'api_key': apiKey, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Finds Pets by status + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// * [status] - Status values that need to be considered for filter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltList] as data + /// Throws [DioException] if API call or serialization fails + Future>> findPetsByStatus({ + @Deprecated('status is deprecated') required BuiltList status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/findByStatus'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'status': encodeCollectionQueryParameter(_serializers, status, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,), + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltList? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(BuiltList, [FullType(Pet)]), + ) as BuiltList; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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. + /// + /// Parameters: + /// * [tags] - Tags to filter by + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltSet] as data + /// Throws [DioException] if API call or serialization fails + @Deprecated('This operation has been deprecated') + Future>> findPetsByTags({ + required BuiltSet tags, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/findByTags'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'tags': encodeCollectionQueryParameter(_serializers, tags, const FullType(BuiltSet, [FullType(String)]), format: ListFormat.csv,), + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltSet? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(BuiltSet, [FullType(Pet)]), + ) as BuiltSet; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Find pet by ID + /// Returns a single pet + /// + /// Parameters: + /// * [petId] - ID of pet to return + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Pet] as data + /// Throws [DioException] if API call or serialization fails + Future> getPetById({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(Pet), + ) as Pet; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Update an existing pet + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = _serializers.serialize(pet, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updates a pet in the store with form data + /// + /// + /// Parameters: + /// * [petId] - ID of pet that needs to be updated + /// * [name] - Updated name of the pet + /// * [status] - Updated status of the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePetWithForm({ + required int petId, + String? name, + String? status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = { + if (name != null) r'name': encodeQueryParameter(_serializers, name, const FullType(String)), + if (status != null) r'status': encodeQueryParameter(_serializers, status, const FullType(String)), + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// uploads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [additionalMetadata] - Additional data to pass to server + /// * [file] - file to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFile({ + required int petId, + String? additionalMetadata, + MultipartFile? file, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'multipart/form-data', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = FormData.fromMap({ + if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_serializers, additionalMetadata, const FullType(String)), + if (file != null) r'file': file, + }); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ApiResponse), + ) as ApiResponse; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// uploads an image (required) + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [requiredFile] - file to upload + /// * [additionalMetadata] - Additional data to pass to server + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFileWithRequiredFile({ + required int petId, + required MultipartFile requiredFile, + String? additionalMetadata, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'multipart/form-data', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = FormData.fromMap({ + if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_serializers, additionalMetadata, const FullType(String)), + r'requiredFile': requiredFile, + }); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ApiResponse), + ) as ApiResponse; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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-timemachine/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/store_api.dart new file mode 100644 index 000000000000..6f519ff8ee51 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/store_api.dart @@ -0,0 +1,320 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/src/model/order.dart'; + +class StoreApi { + + final Dio _dio; + + final Serializers _serializers; + + const 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 + /// + /// Parameters: + /// * [orderId] - ID of the order that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteOrder({ + required String orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', encodeQueryParameter(_serializers, orderId, const FullType(String)).toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Returns pet inventories by status + /// Returns a map of status codes to quantities + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltMap] as data + /// Throws [DioException] if API call or serialization fails + Future>> getInventory({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/inventory'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltMap? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(int)]), + ) as BuiltMap; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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 generate exceptions + /// + /// Parameters: + /// * [orderId] - ID of pet that needs to be fetched + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> getOrderById({ + required int orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', encodeQueryParameter(_serializers, orderId, const FullType(int)).toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(Order), + ) as Order; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Place an order for a pet + /// + /// + /// Parameters: + /// * [order] - order placed for purchasing the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> placeOrder({ + required Order order, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(Order); + _bodyData = _serializers.serialize(order, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(Order), + ) as Order; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + 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-timemachine/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/user_api.dart new file mode 100644 index 000000000000..e2b79796c10d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api/user_api.dart @@ -0,0 +1,541 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/src/model/user.dart'; +import 'package:time_machine/time_machine.dart'; + +class UserApi { + + final Dio _dio; + + final Serializers _serializers; + + const UserApi(this._dio, this._serializers); + + /// Create user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [user] - Created user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUser({ + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(User); + _bodyData = _serializers.serialize(user, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithArrayInput({ + required BuiltList user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/createWithArray'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(BuiltList, [FullType(User)]); + _bodyData = _serializers.serialize(user, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithListInput({ + required BuiltList user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/createWithList'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(BuiltList, [FullType(User)]); + _bodyData = _serializers.serialize(user, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Delete user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - The name that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteUser({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Get user by user name + /// + /// + /// Parameters: + /// * [username] - The name that needs to be fetched. Use user1 for testing. + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [User] as data + /// Throws [DioException] if API call or serialization fails + Future> getUserByName({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + User? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(User), + ) as User; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logs user into the system + /// + /// + /// Parameters: + /// * [username] - The user name for login + /// * [password] - The password for login in clear text + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> loginUser({ + required String username, + required String password, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/login'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'username': encodeQueryParameter(_serializers, username, const FullType(String)), + r'password': encodeQueryParameter(_serializers, password, const FullType(String)), + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : rawResponse as String; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logs out current logged in user session + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> logoutUser({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/logout'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updated user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - name that need to be deleted + /// * [user] - Updated user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updateUser({ + required String username, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString()); + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(User); + _bodyData = _serializers.serialize(user, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api_util.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api_util.dart new file mode 100644 index 000000000000..ed3bb12f25b8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/api_util.dart @@ -0,0 +1,77 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +/// Format the given form parameter object into something that Dio can handle. +/// Returns primitive or String. +/// Returns List/Map if the value is BuildList/BuiltMap. +dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) { + if (value == null) { + return ''; + } + if (value is String || value is num || value is bool) { + return value; + } + final serialized = serializers.serialize( + value as Object, + specifiedType: type, + ); + if (serialized is String) { + return serialized; + } + if (value is BuiltList || value is BuiltSet || value is BuiltMap) { + return serialized; + } + return json.encode(serialized); +} + +dynamic encodeQueryParameter( + Serializers serializers, + dynamic value, + FullType type, +) { + if (value == null) { + return ''; + } + if (value is String || value is num || value is bool) { + return value; + } + if (value is Uint8List) { + // Currently not sure how to serialize this + return value; + } + final serialized = serializers.serialize( + value as Object, + specifiedType: type, + ); + if (serialized == null) { + return ''; + } + if (serialized is String) { + return serialized; + } + return serialized; +} + +ListParam encodeCollectionQueryParameter( + Serializers serializers, + dynamic value, + FullType type, { + ListFormat format = ListFormat.multi, +}) { + final serialized = serializers.serialize( + value as Object, + specifiedType: type, + ); + if (value is BuiltList || value is BuiltSet) { + return ListParam(List.of((serialized as Iterable).cast()), format); + } + throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/api_key_auth.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); + for (final info in authInfo) { + final authName = info['name'] as String; + final authKeyName = info['keyName'] as String; + final authWhere = info['where'] as String; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/auth.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /// Get auth information on given route for the given type. + /// Can return an empty list if type is not present on auth data or + /// if route doesn't need authentication. + List> getAuthInfo(RequestOptions route, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/basic_auth.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + final Map authInfo = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'basic') || secure['type'] == 'basic'); + for (final info in metadataAuthInfo) { + final authName = info['name'] as String; + final basicAuthInfo = authInfo[authName]; + if (basicAuthInfo != null) { + final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + options.headers['Authorization'] = basicAuth; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/bearer_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'bearer'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/auth/oauth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..3fdac6d5a44f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/additional_properties_class.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// AdditionalPropertiesClass +/// +/// Properties: +/// * [mapProperty] +/// * [mapOfMapProperty] +@BuiltValue() +abstract class AdditionalPropertiesClass implements Built { + @BuiltValueField(wireName: r'map_property') + BuiltMap? get mapProperty; + + @BuiltValueField(wireName: r'map_of_map_property') + BuiltMap>? get mapOfMapProperty; + + AdditionalPropertiesClass._(); + + factory AdditionalPropertiesClass([void updates(AdditionalPropertiesClassBuilder b)]) = _$AdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AdditionalPropertiesClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AdditionalPropertiesClassSerializer(); +} + +class _$AdditionalPropertiesClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AdditionalPropertiesClass, _$AdditionalPropertiesClass]; + + @override + final String wireName = r'AdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapProperty != null) { + yield r'map_property'; + yield serializers.serialize( + object.mapProperty, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(String)]), + ); + } + if (object.mapOfMapProperty != null) { + yield r'map_of_map_property'; + yield serializers.serialize( + object.mapOfMapProperty, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(String)]), + ) as BuiltMap; + result.mapProperty.replace(valueDes); + break; + case r'map_of_map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ) as BuiltMap>; + result.mapOfMapProperty.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/all_of_with_single_ref.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..5bcd7d9dee8a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,128 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'all_of_with_single_ref.g.dart'; + +/// AllOfWithSingleRef +/// +/// Properties: +/// * [username] +/// * [singleRefType] +@BuiltValue() +abstract class AllOfWithSingleRef implements Built { + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'SingleRefType') + SingleRefType? get singleRefType; + // enum singleRefTypeEnum { admin, user, }; + + AllOfWithSingleRef._(); + + factory AllOfWithSingleRef([void updates(AllOfWithSingleRefBuilder b)]) = _$AllOfWithSingleRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AllOfWithSingleRefBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AllOfWithSingleRefSerializer(); +} + +class _$AllOfWithSingleRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AllOfWithSingleRef, _$AllOfWithSingleRef]; + + @override + final String wireName = r'AllOfWithSingleRef'; + + Iterable _serializeProperties( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.singleRefType != null) { + yield r'SingleRefType'; + yield serializers.serialize( + object.singleRefType, + specifiedType: const FullType(SingleRefType), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AllOfWithSingleRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'SingleRefType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(SingleRefType), + ) as SingleRefType; + result.singleRefType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AllOfWithSingleRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AllOfWithSingleRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/animal.dart new file mode 100644 index 000000000000..20b3f9f50b71 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/animal.dart @@ -0,0 +1,205 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'animal.g.dart'; + +/// Animal +/// +/// Properties: +/// * [className] +/// * [color] +@BuiltValue(instantiable: false) +abstract class Animal { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + static const String discriminatorFieldName = r'className'; + + static const Map discriminatorMapping = { + r'CAT': Cat, + r'DOG': Dog, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AnimalSerializer(); +} + +extension AnimalDiscriminatorExt on Animal { + String? get discriminatorValue { + if (this is Cat) { + return r'CAT'; + } + if (this is Dog) { + return r'DOG'; + } + return null; + } +} +extension AnimalBuilderDiscriminatorExt on AnimalBuilder { + String? get discriminatorValue { + if (this is CatBuilder) { + return r'CAT'; + } + if (this is DogBuilder) { + return r'DOG'; + } + return null; + } +} + +class _$AnimalSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Animal]; + + @override + final String wireName = r'Animal'; + + Iterable _serializeProperties( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is Cat) { + return serializers.serialize(object, specifiedType: FullType(Cat))!; + } + if (object is Dog) { + return serializers.serialize(object, specifiedType: FullType(Dog))!; + } + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Animal.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + case r'CAT': + return serializers.deserialize(serialized, specifiedType: FullType(Cat)) as Cat; + case r'DOG': + return serializers.deserialize(serialized, specifiedType: FullType(Dog)) as Dog; + default: + return serializers.deserialize(serialized, specifiedType: FullType($Animal)) as $Animal; + } + } +} + +/// a concrete implementation of [Animal], since [Animal] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Animal implements Animal, Built<$Animal, $AnimalBuilder> { + $Animal._(); + + factory $Animal([void Function($AnimalBuilder)? updates]) = _$$Animal; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($AnimalBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Animal> get serializer => _$$AnimalSerializer(); +} + +class _$$AnimalSerializer implements PrimitiveSerializer<$Animal> { + @override + final Iterable types = const [$Animal, _$$Animal]; + + @override + final String wireName = r'$Animal'; + + @override + Object serialize( + Serializers serializers, + $Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Animal))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AnimalBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $AnimalBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/api_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/api_response.dart new file mode 100644 index 000000000000..aadcd792e2bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/api_response.dart @@ -0,0 +1,144 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +/// ApiResponse +/// +/// Properties: +/// * [code] +/// * [type] +/// * [message] +@BuiltValue() +abstract class ApiResponse implements Built { + @BuiltValueField(wireName: r'code') + int? get code; + + @BuiltValueField(wireName: r'type') + String? get type; + + @BuiltValueField(wireName: r'message') + String? get message; + + ApiResponse._(); + + factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ApiResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ApiResponseSerializer(); +} + +class _$ApiResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ApiResponse, _$ApiResponse]; + + @override + final String wireName = r'ApiResponse'; + + Iterable _serializeProperties( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.code != null) { + yield r'code'; + yield serializers.serialize( + object.code, + specifiedType: const FullType(int), + ); + } + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } + if (object.message != null) { + yield r'message'; + yield serializers.serialize( + object.message, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ApiResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'code': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.code = valueDes; + break; + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; + case r'message': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.message = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ApiResponse deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ApiResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..5bc0982b8ab0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// ArrayOfArrayOfNumberOnly +/// +/// Properties: +/// * [arrayArrayNumber] +@BuiltValue() +abstract class ArrayOfArrayOfNumberOnly implements Built { + @BuiltValueField(wireName: r'ArrayArrayNumber') + BuiltList>? get arrayArrayNumber; + + ArrayOfArrayOfNumberOnly._(); + + factory ArrayOfArrayOfNumberOnly([void updates(ArrayOfArrayOfNumberOnlyBuilder b)]) = _$ArrayOfArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayOfArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfArrayOfNumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayOfArrayOfNumberOnly, _$ArrayOfArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayArrayNumber != null) { + yield r'ArrayArrayNumber'; + yield serializers.serialize( + object.arrayArrayNumber, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(num)])]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(num)])]), + ) as BuiltList>; + result.arrayArrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..72239924f5ec --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_of_number_only.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// ArrayOfNumberOnly +/// +/// Properties: +/// * [arrayNumber] +@BuiltValue() +abstract class ArrayOfNumberOnly implements Built { + @BuiltValueField(wireName: r'ArrayNumber') + BuiltList? get arrayNumber; + + ArrayOfNumberOnly._(); + + factory ArrayOfNumberOnly([void updates(ArrayOfNumberOnlyBuilder b)]) = _$ArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfNumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayOfNumberOnly, _$ArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayNumber != null) { + yield r'ArrayNumber'; + yield serializers.serialize( + object.arrayNumber, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ) as BuiltList; + result.arrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_test.dart new file mode 100644 index 000000000000..21f3a5a4c2d5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/array_test.dart @@ -0,0 +1,146 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_test.g.dart'; + +/// ArrayTest +/// +/// Properties: +/// * [arrayOfString] +/// * [arrayArrayOfInteger] +/// * [arrayArrayOfModel] +@BuiltValue() +abstract class ArrayTest implements Built { + @BuiltValueField(wireName: r'array_of_string') + BuiltList? get arrayOfString; + + @BuiltValueField(wireName: r'array_array_of_integer') + BuiltList>? get arrayArrayOfInteger; + + @BuiltValueField(wireName: r'array_array_of_model') + BuiltList>? get arrayArrayOfModel; + + ArrayTest._(); + + factory ArrayTest([void updates(ArrayTestBuilder b)]) = _$ArrayTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayTestSerializer(); +} + +class _$ArrayTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayTest, _$ArrayTest]; + + @override + final String wireName = r'ArrayTest'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayOfString != null) { + yield r'array_of_string'; + yield serializers.serialize( + object.arrayOfString, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + if (object.arrayArrayOfInteger != null) { + yield r'array_array_of_integer'; + yield serializers.serialize( + object.arrayArrayOfInteger, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(int)])]), + ); + } + if (object.arrayArrayOfModel != null) { + yield r'array_array_of_model'; + yield serializers.serialize( + object.arrayArrayOfModel, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(ReadOnlyFirst)])]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'array_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.arrayOfString.replace(valueDes); + break; + case r'array_array_of_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(int)])]), + ) as BuiltList>; + result.arrayArrayOfInteger.replace(valueDes); + break; + case r'array_array_of_model': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(ReadOnlyFirst)])]), + ) as BuiltList>; + result.arrayArrayOfModel.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/capitalization.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..75827b9a429e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/capitalization.dart @@ -0,0 +1,199 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'capitalization.g.dart'; + +/// Capitalization +/// +/// Properties: +/// * [smallCamel] +/// * [capitalCamel] +/// * [smallSnake] +/// * [capitalSnake] +/// * [sCAETHFlowPoints] +/// * [ATT_NAME] - Name of the pet +@BuiltValue() +abstract class Capitalization implements Built { + @BuiltValueField(wireName: r'smallCamel') + String? get smallCamel; + + @BuiltValueField(wireName: r'CapitalCamel') + String? get capitalCamel; + + @BuiltValueField(wireName: r'small_Snake') + String? get smallSnake; + + @BuiltValueField(wireName: r'Capital_Snake') + String? get capitalSnake; + + @BuiltValueField(wireName: r'SCA_ETH_Flow_Points') + String? get sCAETHFlowPoints; + + /// Name of the pet + @BuiltValueField(wireName: r'ATT_NAME') + String? get ATT_NAME; + + Capitalization._(); + + factory Capitalization([void updates(CapitalizationBuilder b)]) = _$Capitalization; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CapitalizationBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CapitalizationSerializer(); +} + +class _$CapitalizationSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Capitalization, _$Capitalization]; + + @override + final String wireName = r'Capitalization'; + + Iterable _serializeProperties( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.smallCamel != null) { + yield r'smallCamel'; + yield serializers.serialize( + object.smallCamel, + specifiedType: const FullType(String), + ); + } + if (object.capitalCamel != null) { + yield r'CapitalCamel'; + yield serializers.serialize( + object.capitalCamel, + specifiedType: const FullType(String), + ); + } + if (object.smallSnake != null) { + yield r'small_Snake'; + yield serializers.serialize( + object.smallSnake, + specifiedType: const FullType(String), + ); + } + if (object.capitalSnake != null) { + yield r'Capital_Snake'; + yield serializers.serialize( + object.capitalSnake, + specifiedType: const FullType(String), + ); + } + if (object.sCAETHFlowPoints != null) { + yield r'SCA_ETH_Flow_Points'; + yield serializers.serialize( + object.sCAETHFlowPoints, + specifiedType: const FullType(String), + ); + } + if (object.ATT_NAME != null) { + yield r'ATT_NAME'; + yield serializers.serialize( + object.ATT_NAME, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CapitalizationBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'smallCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallCamel = valueDes; + break; + case r'CapitalCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalCamel = valueDes; + break; + case r'small_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallSnake = valueDes; + break; + case r'Capital_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalSnake = valueDes; + break; + case r'SCA_ETH_Flow_Points': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sCAETHFlowPoints = valueDes; + break; + case r'ATT_NAME': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.ATT_NAME = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Capitalization deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CapitalizationBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/cat.dart new file mode 100644 index 000000000000..af1faeef25cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/cat.dart @@ -0,0 +1,138 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat.g.dart'; + +/// Cat +/// +/// Properties: +/// * [className] +/// * [color] +/// * [declawed] +@BuiltValue() +abstract class Cat implements Animal, Built { + @BuiltValueField(wireName: r'declawed') + bool? get declawed; + + Cat._(); + + factory Cat([void updates(CatBuilder b)]) = _$Cat; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CatBuilder b) => b..className=b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatSerializer(); +} + +class _$CatSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Cat, _$Cat]; + + @override + final String wireName = r'Cat'; + + Iterable _serializeProperties( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.declawed != null) { + yield r'declawed'; + yield serializers.serialize( + object.declawed, + specifiedType: const FullType(bool), + ); + } + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CatBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'declawed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.declawed = valueDes; + break; + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Cat deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CatBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/category.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/category.dart new file mode 100644 index 000000000000..3a541dd1fa92 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/category.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +/// Category +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Category implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String get name; + + Category._(); + + factory Category([void updates(CategoryBuilder b)]) = _$Category; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CategoryBuilder b) => b + ..name = 'default-name'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CategorySerializer(); +} + +class _$CategorySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Category, _$Category]; + + @override + final String wireName = r'Category'; + + Iterable _serializeProperties( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CategoryBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Category deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CategoryBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/child_with_nullable.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/child_with_nullable.dart new file mode 100644 index 000000000000..8e40eb1d2371 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/child_with_nullable.dart @@ -0,0 +1,156 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/parent_with_nullable.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'child_with_nullable.g.dart'; + +/// ChildWithNullable +/// +/// Properties: +/// * [type] +/// * [nullableProperty] +/// * [otherProperty] +@BuiltValue() +abstract class ChildWithNullable implements ParentWithNullable, Built { + @BuiltValueField(wireName: r'otherProperty') + String? get otherProperty; + + ChildWithNullable._(); + + factory ChildWithNullable([void updates(ChildWithNullableBuilder b)]) = _$ChildWithNullable; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ChildWithNullableBuilder b) => b..type=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ChildWithNullableSerializer(); +} + +class _$ChildWithNullableSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ChildWithNullable, _$ChildWithNullable]; + + @override + final String wireName = r'ChildWithNullable'; + + Iterable _serializeProperties( + Serializers serializers, + ChildWithNullable object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(ParentWithNullableTypeEnum), + ); + } + if (object.nullableProperty != null) { + yield r'nullableProperty'; + yield serializers.serialize( + object.nullableProperty, + specifiedType: const FullType.nullable(String), + ); + } + if (object.otherProperty != null) { + yield r'otherProperty'; + yield serializers.serialize( + object.otherProperty, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ChildWithNullable object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ChildWithNullableBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ParentWithNullableTypeEnum), + ) as ParentWithNullableTypeEnum; + result.type = valueDes; + break; + case r'nullableProperty': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.nullableProperty = valueDes; + break; + case r'otherProperty': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.otherProperty = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ChildWithNullable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ChildWithNullableBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class ChildWithNullableTypeEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'ChildWithNullable') + static const ChildWithNullableTypeEnum childWithNullable = _$childWithNullableTypeEnum_childWithNullable; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ChildWithNullableTypeEnum unknownDefaultOpenApi = _$childWithNullableTypeEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$childWithNullableTypeEnumSerializer; + + const ChildWithNullableTypeEnum._(String name): super(name); + + static BuiltSet get values => _$childWithNullableTypeEnumValues; + static ChildWithNullableTypeEnum valueOf(String name) => _$childWithNullableTypeEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/class_model.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/class_model.dart new file mode 100644 index 000000000000..51166943c6cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/class_model.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'class_model.g.dart'; + +/// Model for testing model with \"_class\" property +/// +/// Properties: +/// * [classField] +@BuiltValue() +abstract class ClassModel implements Built { + @BuiltValueField(wireName: r'_class') + String? get classField; + + ClassModel._(); + + factory ClassModel([void updates(ClassModelBuilder b)]) = _$ClassModel; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ClassModelBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ClassModelSerializer(); +} + +class _$ClassModelSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ClassModel, _$ClassModel]; + + @override + final String wireName = r'ClassModel'; + + Iterable _serializeProperties( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.classField != null) { + yield r'_class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ClassModelBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'_class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ClassModel deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ClassModelBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..57f089c899c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/deprecated_object.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'deprecated_object.g.dart'; + +/// DeprecatedObject +/// +/// Properties: +/// * [name] +@Deprecated('DeprecatedObject has been deprecated') +@BuiltValue() +abstract class DeprecatedObject implements Built { + @BuiltValueField(wireName: r'name') + String? get name; + + DeprecatedObject._(); + + factory DeprecatedObject([void updates(DeprecatedObjectBuilder b)]) = _$DeprecatedObject; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DeprecatedObjectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DeprecatedObjectSerializer(); +} + +class _$DeprecatedObjectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DeprecatedObject, _$DeprecatedObject]; + + @override + final String wireName = r'DeprecatedObject'; + + Iterable _serializeProperties( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DeprecatedObjectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DeprecatedObject deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DeprecatedObjectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/dog.dart new file mode 100644 index 000000000000..8d3d3e27a17f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/dog.dart @@ -0,0 +1,138 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog.g.dart'; + +/// Dog +/// +/// Properties: +/// * [className] +/// * [color] +/// * [breed] +@BuiltValue() +abstract class Dog implements Animal, Built { + @BuiltValueField(wireName: r'breed') + String? get breed; + + Dog._(); + + factory Dog([void updates(DogBuilder b)]) = _$Dog; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DogBuilder b) => b..className=b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogSerializer(); +} + +class _$DogSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Dog, _$Dog]; + + @override + final String wireName = r'Dog'; + + Iterable _serializeProperties( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.breed != null) { + yield r'breed'; + yield serializers.serialize( + object.breed, + specifiedType: const FullType(String), + ); + } + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DogBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'breed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.breed = valueDes; + break; + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Dog deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DogBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..b79a175e833c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/enum_arrays.dart @@ -0,0 +1,163 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// EnumArrays +/// +/// Properties: +/// * [justSymbol] +/// * [arrayEnum] +@BuiltValue() +abstract class EnumArrays implements Built { + @BuiltValueField(wireName: r'just_symbol') + EnumArraysJustSymbolEnum? get justSymbol; + // enum justSymbolEnum { >=, $, }; + + @BuiltValueField(wireName: r'array_enum') + BuiltList? get arrayEnum; + // enum arrayEnumEnum { fish, crab, }; + + EnumArrays._(); + + factory EnumArrays([void updates(EnumArraysBuilder b)]) = _$EnumArrays; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumArraysBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumArraysSerializer(); +} + +class _$EnumArraysSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumArrays, _$EnumArrays]; + + @override + final String wireName = r'EnumArrays'; + + Iterable _serializeProperties( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justSymbol != null) { + yield r'just_symbol'; + yield serializers.serialize( + object.justSymbol, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ); + } + if (object.arrayEnum != null) { + yield r'array_enum'; + yield serializers.serialize( + object.arrayEnum, + specifiedType: const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumArraysBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'just_symbol': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ) as EnumArraysJustSymbolEnum; + result.justSymbol = valueDes; + break; + case r'array_enum': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ) as BuiltList; + result.arrayEnum.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumArrays deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumArraysBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class EnumArraysJustSymbolEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'>=') + static const EnumArraysJustSymbolEnum greaterThanEqual = _$enumArraysJustSymbolEnum_greaterThanEqual; + @BuiltValueEnumConst(wireName: r'$') + static const EnumArraysJustSymbolEnum dollar = _$enumArraysJustSymbolEnum_dollar; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysJustSymbolEnum unknownDefaultOpenApi = _$enumArraysJustSymbolEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumArraysJustSymbolEnumSerializer; + + const EnumArraysJustSymbolEnum._(String name): super(name); + + static BuiltSet get values => _$enumArraysJustSymbolEnumValues; + static EnumArraysJustSymbolEnum valueOf(String name) => _$enumArraysJustSymbolEnumValueOf(name); +} + +class EnumArraysArrayEnumEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'fish') + static const EnumArraysArrayEnumEnum fish = _$enumArraysArrayEnumEnum_fish; + @BuiltValueEnumConst(wireName: r'crab') + static const EnumArraysArrayEnumEnum crab = _$enumArraysArrayEnumEnum_crab; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysArrayEnumEnum unknownDefaultOpenApi = _$enumArraysArrayEnumEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumArraysArrayEnumEnumSerializer; + + const EnumArraysArrayEnumEnum._(String name): super(name); + + static BuiltSet get values => _$enumArraysArrayEnumEnumValues; + static EnumArraysArrayEnumEnum valueOf(String name) => _$enumArraysArrayEnumEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..831f5b9d6d2d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/enum_test.dart @@ -0,0 +1,318 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_test.g.dart'; + +/// EnumTest +/// +/// Properties: +/// * [enumString] +/// * [enumStringRequired] +/// * [enumInteger] +/// * [enumNumber] +/// * [outerEnum] +/// * [outerEnumInteger] +/// * [outerEnumDefaultValue] +/// * [outerEnumIntegerDefaultValue] +@BuiltValue() +abstract class EnumTest implements Built { + @BuiltValueField(wireName: r'enum_string') + EnumTestEnumStringEnum? get enumString; + // enum enumStringEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_string_required') + EnumTestEnumStringRequiredEnum get enumStringRequired; + // enum enumStringRequiredEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_integer') + EnumTestEnumIntegerEnum? get enumInteger; + // enum enumIntegerEnum { 1, -1, }; + + @BuiltValueField(wireName: r'enum_number') + EnumTestEnumNumberEnum? get enumNumber; + // enum enumNumberEnum { 1.1, -1.2, }; + + @BuiltValueField(wireName: r'outerEnum') + OuterEnum? get outerEnum; + // enum outerEnumEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumInteger') + OuterEnumInteger? get outerEnumInteger; + // enum outerEnumIntegerEnum { 0, 1, 2, }; + + @BuiltValueField(wireName: r'outerEnumDefaultValue') + OuterEnumDefaultValue? get outerEnumDefaultValue; + // enum outerEnumDefaultValueEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumIntegerDefaultValue') + OuterEnumIntegerDefaultValue? get outerEnumIntegerDefaultValue; + // enum outerEnumIntegerDefaultValueEnum { 0, 1, 2, }; + + EnumTest._(); + + factory EnumTest([void updates(EnumTestBuilder b)]) = _$EnumTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumTestSerializer(); +} + +class _$EnumTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumTest, _$EnumTest]; + + @override + final String wireName = r'EnumTest'; + + Iterable _serializeProperties( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.enumString != null) { + yield r'enum_string'; + yield serializers.serialize( + object.enumString, + specifiedType: const FullType(EnumTestEnumStringEnum), + ); + } + yield r'enum_string_required'; + yield serializers.serialize( + object.enumStringRequired, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ); + if (object.enumInteger != null) { + yield r'enum_integer'; + yield serializers.serialize( + object.enumInteger, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ); + } + if (object.enumNumber != null) { + yield r'enum_number'; + yield serializers.serialize( + object.enumNumber, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ); + } + if (object.outerEnum != null) { + yield r'outerEnum'; + yield serializers.serialize( + object.outerEnum, + specifiedType: const FullType.nullable(OuterEnum), + ); + } + if (object.outerEnumInteger != null) { + yield r'outerEnumInteger'; + yield serializers.serialize( + object.outerEnumInteger, + specifiedType: const FullType(OuterEnumInteger), + ); + } + if (object.outerEnumDefaultValue != null) { + yield r'outerEnumDefaultValue'; + yield serializers.serialize( + object.outerEnumDefaultValue, + specifiedType: const FullType(OuterEnumDefaultValue), + ); + } + if (object.outerEnumIntegerDefaultValue != null) { + yield r'outerEnumIntegerDefaultValue'; + yield serializers.serialize( + object.outerEnumIntegerDefaultValue, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringEnum), + ) as EnumTestEnumStringEnum; + result.enumString = valueDes; + break; + case r'enum_string_required': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ) as EnumTestEnumStringRequiredEnum; + result.enumStringRequired = valueDes; + break; + case r'enum_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ) as EnumTestEnumIntegerEnum; + result.enumInteger = valueDes; + break; + case r'enum_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ) as EnumTestEnumNumberEnum; + result.enumNumber = valueDes; + break; + case r'outerEnum': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(OuterEnum), + ) as OuterEnum?; + if (valueDes == null) continue; + result.outerEnum = valueDes; + break; + case r'outerEnumInteger': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.outerEnumInteger = valueDes; + break; + case r'outerEnumDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumDefaultValue), + ) as OuterEnumDefaultValue; + result.outerEnumDefaultValue = valueDes; + break; + case r'outerEnumIntegerDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ) as OuterEnumIntegerDefaultValue; + result.outerEnumIntegerDefaultValue = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class EnumTestEnumStringEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringEnum UPPER = _$enumTestEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringEnum lower = _$enumTestEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringEnum empty = _$enumTestEnumStringEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringEnum unknownDefaultOpenApi = _$enumTestEnumStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumTestEnumStringEnumSerializer; + + const EnumTestEnumStringEnum._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumStringEnumValues; + static EnumTestEnumStringEnum valueOf(String name) => _$enumTestEnumStringEnumValueOf(name); +} + +class EnumTestEnumStringRequiredEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringRequiredEnum UPPER = _$enumTestEnumStringRequiredEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringRequiredEnum lower = _$enumTestEnumStringRequiredEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringRequiredEnum empty = _$enumTestEnumStringRequiredEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringRequiredEnum unknownDefaultOpenApi = _$enumTestEnumStringRequiredEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumTestEnumStringRequiredEnumSerializer; + + const EnumTestEnumStringRequiredEnum._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumStringRequiredEnumValues; + static EnumTestEnumStringRequiredEnum valueOf(String name) => _$enumTestEnumStringRequiredEnumValueOf(name); +} + +class EnumTestEnumIntegerEnum extends EnumClass { + + @BuiltValueEnumConst(wireNumber: 1) + static const EnumTestEnumIntegerEnum number1 = _$enumTestEnumIntegerEnum_number1; + @BuiltValueEnumConst(wireNumber: -1) + static const EnumTestEnumIntegerEnum numberNegative1 = _$enumTestEnumIntegerEnum_numberNegative1; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const EnumTestEnumIntegerEnum unknownDefaultOpenApi = _$enumTestEnumIntegerEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumTestEnumIntegerEnumSerializer; + + const EnumTestEnumIntegerEnum._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumIntegerEnumValues; + static EnumTestEnumIntegerEnum valueOf(String name) => _$enumTestEnumIntegerEnumValueOf(name); +} + +class EnumTestEnumNumberEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'1.1') + static const EnumTestEnumNumberEnum number1Period1 = _$enumTestEnumNumberEnum_number1Period1; + @BuiltValueEnumConst(wireName: r'-1.2') + static const EnumTestEnumNumberEnum numberNegative1Period2 = _$enumTestEnumNumberEnum_numberNegative1Period2; + @BuiltValueEnumConst(wireName: r'11184809', fallback: true) + static const EnumTestEnumNumberEnum unknownDefaultOpenApi = _$enumTestEnumNumberEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumTestEnumNumberEnumSerializer; + + const EnumTestEnumNumberEnum._(String name): super(name); + + static BuiltSet get values => _$enumTestEnumNumberEnumValues; + static EnumTestEnumNumberEnum valueOf(String name) => _$enumTestEnumNumberEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/fake_big_decimal_map200_response.dart new file mode 100644 index 000000000000..ddfab9d2b56b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'fake_big_decimal_map200_response.g.dart'; + +/// FakeBigDecimalMap200Response +/// +/// Properties: +/// * [someId] +/// * [someMap] +@BuiltValue() +abstract class FakeBigDecimalMap200Response implements Built { + @BuiltValueField(wireName: r'someId') + num? get someId; + + @BuiltValueField(wireName: r'someMap') + BuiltMap? get someMap; + + FakeBigDecimalMap200Response._(); + + factory FakeBigDecimalMap200Response([void updates(FakeBigDecimalMap200ResponseBuilder b)]) = _$FakeBigDecimalMap200Response; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FakeBigDecimalMap200ResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FakeBigDecimalMap200ResponseSerializer(); +} + +class _$FakeBigDecimalMap200ResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FakeBigDecimalMap200Response, _$FakeBigDecimalMap200Response]; + + @override + final String wireName = r'FakeBigDecimalMap200Response'; + + Iterable _serializeProperties( + Serializers serializers, + FakeBigDecimalMap200Response object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.someId != null) { + yield r'someId'; + yield serializers.serialize( + object.someId, + specifiedType: const FullType(num), + ); + } + if (object.someMap != null) { + yield r'someMap'; + yield serializers.serialize( + object.someMap, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(num)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FakeBigDecimalMap200Response object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FakeBigDecimalMap200ResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'someId': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.someId = valueDes; + break; + case r'someMap': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(num)]), + ) as BuiltMap; + result.someMap.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FakeBigDecimalMap200Response deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FakeBigDecimalMap200ResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..5ab41d14f437 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,128 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'file_schema_test_class.g.dart'; + +/// FileSchemaTestClass +/// +/// Properties: +/// * [file] +/// * [files] +@BuiltValue() +abstract class FileSchemaTestClass implements Built { + @BuiltValueField(wireName: r'file') + ModelFile? get file; + + @BuiltValueField(wireName: r'files') + BuiltList? get files; + + FileSchemaTestClass._(); + + factory FileSchemaTestClass([void updates(FileSchemaTestClassBuilder b)]) = _$FileSchemaTestClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FileSchemaTestClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FileSchemaTestClassSerializer(); +} + +class _$FileSchemaTestClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FileSchemaTestClass, _$FileSchemaTestClass]; + + @override + final String wireName = r'FileSchemaTestClass'; + + Iterable _serializeProperties( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.file != null) { + yield r'file'; + yield serializers.serialize( + object.file, + specifiedType: const FullType(ModelFile), + ); + } + if (object.files != null) { + yield r'files'; + yield serializers.serialize( + object.files, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FileSchemaTestClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'file': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ModelFile), + ) as ModelFile; + result.file.replace(valueDes); + break; + case r'files': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ) as BuiltList; + result.files.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FileSchemaTestClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FileSchemaTestClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/foo.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/foo.dart new file mode 100644 index 000000000000..57e0992c67cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/foo.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo.g.dart'; + +/// Foo +/// +/// Properties: +/// * [bar] +@BuiltValue() +abstract class Foo implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + Foo._(); + + factory Foo([void updates(FooBuilder b)]) = _$Foo; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooBuilder b) => b + ..bar = 'bar'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooSerializer(); +} + +class _$FooSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Foo, _$Foo]; + + @override + final String wireName = r'Foo'; + + Iterable _serializeProperties( + Serializers serializers, + Foo object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Foo object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Foo deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/foo_get_default_response.dart new file mode 100644 index 000000000000..b5903ebd5dbf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/foo_get_default_response.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo_get_default_response.g.dart'; + +/// FooGetDefaultResponse +/// +/// Properties: +/// * [string] +@BuiltValue() +abstract class FooGetDefaultResponse implements Built { + @BuiltValueField(wireName: r'string') + Foo? get string; + + FooGetDefaultResponse._(); + + factory FooGetDefaultResponse([void updates(FooGetDefaultResponseBuilder b)]) = _$FooGetDefaultResponse; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooGetDefaultResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooGetDefaultResponseSerializer(); +} + +class _$FooGetDefaultResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FooGetDefaultResponse, _$FooGetDefaultResponse]; + + @override + final String wireName = r'FooGetDefaultResponse'; + + Iterable _serializeProperties( + Serializers serializers, + FooGetDefaultResponse object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.string != null) { + yield r'string'; + yield serializers.serialize( + object.string, + specifiedType: const FullType(Foo), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FooGetDefaultResponse object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooGetDefaultResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Foo), + ) as Foo; + result.string.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FooGetDefaultResponse deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooGetDefaultResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/format_test.dart new file mode 100644 index 000000000000..15cbfbca8b24 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/format_test.dart @@ -0,0 +1,374 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'dart:typed_data'; +import 'package:time_machine/time_machine.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'format_test.g.dart'; + +/// FormatTest +/// +/// Properties: +/// * [integer] +/// * [int32] +/// * [int64] +/// * [number] +/// * [float] +/// * [double_] +/// * [decimal] +/// * [string] +/// * [byte] +/// * [binary] +/// * [date] +/// * [dateTime] +/// * [uuid] +/// * [password] +/// * [patternWithDigits] - A string that is a 10 digit number. Can have leading zeros. +/// * [patternWithDigitsAndDelimiter] - A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. +@BuiltValue() +abstract class FormatTest implements Built { + @BuiltValueField(wireName: r'integer') + int? get integer; + + @BuiltValueField(wireName: r'int32') + int? get int32; + + @BuiltValueField(wireName: r'int64') + int? get int64; + + @BuiltValueField(wireName: r'number') + num get number; + + @BuiltValueField(wireName: r'float') + double? get float; + + @BuiltValueField(wireName: r'double') + double? get double_; + + @BuiltValueField(wireName: r'decimal') + double? get decimal; + + @BuiltValueField(wireName: r'string') + String? get string; + + @BuiltValueField(wireName: r'byte') + String get byte; + + @BuiltValueField(wireName: r'binary') + Uint8List? get binary; + + @BuiltValueField(wireName: r'date') + OffsetDate get date; + + @BuiltValueField(wireName: r'dateTime') + OffsetDateTime? get dateTime; + + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'password') + String get password; + + /// A string that is a 10 digit number. Can have leading zeros. + @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. + @BuiltValueField(wireName: r'pattern_with_digits_and_delimiter') + String? get patternWithDigitsAndDelimiter; + + FormatTest._(); + + factory FormatTest([void updates(FormatTestBuilder b)]) = _$FormatTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FormatTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FormatTestSerializer(); +} + +class _$FormatTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FormatTest, _$FormatTest]; + + @override + final String wireName = r'FormatTest'; + + Iterable _serializeProperties( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integer != null) { + yield r'integer'; + yield serializers.serialize( + object.integer, + specifiedType: const FullType(int), + ); + } + if (object.int32 != null) { + yield r'int32'; + yield serializers.serialize( + object.int32, + specifiedType: const FullType(int), + ); + } + if (object.int64 != null) { + yield r'int64'; + yield serializers.serialize( + object.int64, + specifiedType: const FullType(int), + ); + } + yield r'number'; + yield serializers.serialize( + object.number, + specifiedType: const FullType(num), + ); + if (object.float != null) { + yield r'float'; + yield serializers.serialize( + object.float, + specifiedType: const FullType(double), + ); + } + if (object.double_ != null) { + yield r'double'; + yield serializers.serialize( + object.double_, + specifiedType: const FullType(double), + ); + } + if (object.decimal != null) { + yield r'decimal'; + yield serializers.serialize( + object.decimal, + specifiedType: const FullType(double), + ); + } + if (object.string != null) { + yield r'string'; + yield serializers.serialize( + object.string, + specifiedType: const FullType(String), + ); + } + yield r'byte'; + yield serializers.serialize( + object.byte, + specifiedType: const FullType(String), + ); + if (object.binary != null) { + yield r'binary'; + yield serializers.serialize( + object.binary, + specifiedType: const FullType(Uint8List), + ); + } + yield r'date'; + yield serializers.serialize( + object.date, + specifiedType: const FullType(OffsetDate), + ); + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(OffsetDateTime), + ); + } + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + if (object.patternWithDigits != null) { + yield r'pattern_with_digits'; + yield serializers.serialize( + object.patternWithDigits, + specifiedType: const FullType(String), + ); + } + if (object.patternWithDigitsAndDelimiter != null) { + yield r'pattern_with_digits_and_delimiter'; + yield serializers.serialize( + object.patternWithDigitsAndDelimiter, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FormatTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.integer = valueDes; + break; + case r'int32': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int32 = valueDes; + break; + case r'int64': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int64 = valueDes; + break; + case r'number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.number = valueDes; + break; + case r'float': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.float = valueDes; + break; + case r'double': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.double_ = valueDes; + break; + case r'decimal': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.decimal = valueDes; + break; + case r'string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.string = valueDes; + break; + case r'byte': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.byte = valueDes; + break; + case r'binary': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Uint8List), + ) as Uint8List; + result.binary = valueDes; + break; + case r'date': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OffsetDate), + ) as OffsetDate; + result.date = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OffsetDateTime), + ) as OffsetDateTime; + result.dateTime = valueDes; + break; + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'pattern_with_digits': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigits = valueDes; + break; + case r'pattern_with_digits_and_delimiter': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigitsAndDelimiter = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FormatTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FormatTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..9683985cf198 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/has_only_read_only.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'has_only_read_only.g.dart'; + +/// HasOnlyReadOnly +/// +/// Properties: +/// * [bar] +/// * [foo] +@BuiltValue() +abstract class HasOnlyReadOnly implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'foo') + String? get foo; + + HasOnlyReadOnly._(); + + factory HasOnlyReadOnly([void updates(HasOnlyReadOnlyBuilder b)]) = _$HasOnlyReadOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HasOnlyReadOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$HasOnlyReadOnlySerializer(); +} + +class _$HasOnlyReadOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [HasOnlyReadOnly, _$HasOnlyReadOnly]; + + @override + final String wireName = r'HasOnlyReadOnly'; + + Iterable _serializeProperties( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HasOnlyReadOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.foo = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HasOnlyReadOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HasOnlyReadOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/health_check_result.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..c092a535f2fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/health_check_result.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'health_check_result.g.dart'; + +/// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +/// +/// Properties: +/// * [nullableMessage] +@BuiltValue() +abstract class HealthCheckResult implements Built { + @BuiltValueField(wireName: r'NullableMessage') + String? get nullableMessage; + + HealthCheckResult._(); + + factory HealthCheckResult([void updates(HealthCheckResultBuilder b)]) = _$HealthCheckResult; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HealthCheckResultBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$HealthCheckResultSerializer(); +} + +class _$HealthCheckResultSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [HealthCheckResult, _$HealthCheckResult]; + + @override + final String wireName = r'HealthCheckResult'; + + Iterable _serializeProperties( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.nullableMessage != null) { + yield r'NullableMessage'; + yield serializers.serialize( + object.nullableMessage, + specifiedType: const FullType.nullable(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HealthCheckResultBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'NullableMessage': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.nullableMessage = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HealthCheckResult deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HealthCheckResultBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/map_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/map_test.dart new file mode 100644 index 000000000000..9fa58677a84a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/map_test.dart @@ -0,0 +1,181 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// MapTest +/// +/// Properties: +/// * [mapMapOfString] +/// * [mapOfEnumString] +/// * [directMap] +/// * [indirectMap] +@BuiltValue() +abstract class MapTest implements Built { + @BuiltValueField(wireName: r'map_map_of_string') + BuiltMap>? get mapMapOfString; + + @BuiltValueField(wireName: r'map_of_enum_string') + BuiltMap? get mapOfEnumString; + // enum mapOfEnumStringEnum { UPPER, lower, }; + + @BuiltValueField(wireName: r'direct_map') + BuiltMap? get directMap; + + @BuiltValueField(wireName: r'indirect_map') + BuiltMap? get indirectMap; + + MapTest._(); + + factory MapTest([void updates(MapTestBuilder b)]) = _$MapTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MapTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MapTestSerializer(); +} + +class _$MapTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [MapTest, _$MapTest]; + + @override + final String wireName = r'MapTest'; + + Iterable _serializeProperties( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapMapOfString != null) { + yield r'map_map_of_string'; + yield serializers.serialize( + object.mapMapOfString, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ); + } + if (object.mapOfEnumString != null) { + yield r'map_of_enum_string'; + yield serializers.serialize( + object.mapOfEnumString, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ); + } + if (object.directMap != null) { + yield r'direct_map'; + yield serializers.serialize( + object.directMap, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + if (object.indirectMap != null) { + yield r'indirect_map'; + yield serializers.serialize( + object.indirectMap, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MapTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_map_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ) as BuiltMap>; + result.mapMapOfString.replace(valueDes); + break; + case r'map_of_enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ) as BuiltMap; + result.mapOfEnumString.replace(valueDes); + break; + case r'direct_map': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.directMap.replace(valueDes); + break; + case r'indirect_map': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.indirectMap.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MapTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MapTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class MapTestMapOfEnumStringEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'UPPER') + static const MapTestMapOfEnumStringEnum UPPER = _$mapTestMapOfEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const MapTestMapOfEnumStringEnum lower = _$mapTestMapOfEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const MapTestMapOfEnumStringEnum unknownDefaultOpenApi = _$mapTestMapOfEnumStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$mapTestMapOfEnumStringEnumSerializer; + + const MapTestMapOfEnumStringEnum._(String name): super(name); + + static BuiltSet get values => _$mapTestMapOfEnumStringEnumValues; + static MapTestMapOfEnumStringEnum valueOf(String name) => _$mapTestMapOfEnumStringEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..27bd51cf1abc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,147 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:time_machine/time_machine.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +/// MixedPropertiesAndAdditionalPropertiesClass +/// +/// Properties: +/// * [uuid] +/// * [dateTime] +/// * [map] +@BuiltValue() +abstract class MixedPropertiesAndAdditionalPropertiesClass implements Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'dateTime') + OffsetDateTime? get dateTime; + + @BuiltValueField(wireName: r'map') + BuiltMap? get map; + + MixedPropertiesAndAdditionalPropertiesClass._(); + + factory MixedPropertiesAndAdditionalPropertiesClass([void updates(MixedPropertiesAndAdditionalPropertiesClassBuilder b)]) = _$MixedPropertiesAndAdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MixedPropertiesAndAdditionalPropertiesClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MixedPropertiesAndAdditionalPropertiesClassSerializer(); +} + +class _$MixedPropertiesAndAdditionalPropertiesClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [MixedPropertiesAndAdditionalPropertiesClass, _$MixedPropertiesAndAdditionalPropertiesClass]; + + @override + final String wireName = r'MixedPropertiesAndAdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(OffsetDateTime), + ); + } + if (object.map != null) { + yield r'map'; + yield serializers.serialize( + object.map, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MixedPropertiesAndAdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OffsetDateTime), + ) as OffsetDateTime; + result.dateTime = valueDes; + break; + case r'map': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ) as BuiltMap; + result.map.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MixedPropertiesAndAdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..0a2cfb4411ac --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model200_response.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model200_response.g.dart'; + +/// Model for testing model name starting with number +/// +/// Properties: +/// * [name] +/// * [classField] +@BuiltValue() +abstract class Model200Response implements Built { + @BuiltValueField(wireName: r'name') + int? get name; + + @BuiltValueField(wireName: r'class') + String? get classField; + + Model200Response._(); + + factory Model200Response([void updates(Model200ResponseBuilder b)]) = _$Model200Response; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(Model200ResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$Model200ResponseSerializer(); +} + +class _$Model200ResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Model200Response, _$Model200Response]; + + @override + final String wireName = r'Model200Response'; + + Iterable _serializeProperties( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + } + if (object.classField != null) { + yield r'class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required Model200ResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Model200Response deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = Model200ResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_client.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_client.dart new file mode 100644 index 000000000000..36690977421b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_client.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_client.g.dart'; + +/// ModelClient +/// +/// Properties: +/// * [client] +@BuiltValue() +abstract class ModelClient implements Built { + @BuiltValueField(wireName: r'client') + String? get client; + + ModelClient._(); + + factory ModelClient([void updates(ModelClientBuilder b)]) = _$ModelClient; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelClientBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelClientSerializer(); +} + +class _$ModelClientSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelClient, _$ModelClient]; + + @override + final String wireName = r'ModelClient'; + + Iterable _serializeProperties( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.client != null) { + yield r'client'; + yield serializers.serialize( + object.client, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelClientBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'client': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.client = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelClient deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelClientBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_enum_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..ac609bfd15ad --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_enum_class.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_enum_class.g.dart'; + +class ModelEnumClass extends EnumClass { + + @BuiltValueEnumConst(wireName: r'_abc') + static const ModelEnumClass abc = _$abc; + @BuiltValueEnumConst(wireName: r'-efg') + static const ModelEnumClass efg = _$efg; + @BuiltValueEnumConst(wireName: r'(xyz)') + static const ModelEnumClass leftParenthesisXyzRightParenthesis = _$leftParenthesisXyzRightParenthesis; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ModelEnumClass unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$modelEnumClassSerializer; + + const ModelEnumClass._(String name): super(name); + + static BuiltSet get values => _$values; + static ModelEnumClass 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 ModelEnumClassMixin = Object with _$ModelEnumClassMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_file.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_file.dart new file mode 100644 index 000000000000..2702c21d36f2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_file.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_file.g.dart'; + +/// Must be named `File` for test. +/// +/// Properties: +/// * [sourceURI] - Test capitalization +@BuiltValue() +abstract class ModelFile implements Built { + /// Test capitalization + @BuiltValueField(wireName: r'sourceURI') + String? get sourceURI; + + ModelFile._(); + + factory ModelFile([void updates(ModelFileBuilder b)]) = _$ModelFile; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelFileBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelFileSerializer(); +} + +class _$ModelFileSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelFile, _$ModelFile]; + + @override + final String wireName = r'ModelFile'; + + Iterable _serializeProperties( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.sourceURI != null) { + yield r'sourceURI'; + yield serializers.serialize( + object.sourceURI, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelFileBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'sourceURI': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sourceURI = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelFile deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelFileBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_list.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_list.dart new file mode 100644 index 000000000000..579853258f8e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_list.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_list.g.dart'; + +/// ModelList +/// +/// Properties: +/// * [n123list] +@BuiltValue() +abstract class ModelList implements Built { + @BuiltValueField(wireName: r'123-list') + String? get n123list; + + ModelList._(); + + factory ModelList([void updates(ModelListBuilder b)]) = _$ModelList; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelListBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelListSerializer(); +} + +class _$ModelListSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelList, _$ModelList]; + + @override + final String wireName = r'ModelList'; + + Iterable _serializeProperties( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.n123list != null) { + yield r'123-list'; + yield serializers.serialize( + object.n123list, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelListBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'123-list': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.n123list = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelList deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelListBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_return.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_return.dart new file mode 100644 index 000000000000..45a2f67f8a40 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/model_return.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_return.g.dart'; + +/// Model for testing reserved words +/// +/// Properties: +/// * [return_] +@BuiltValue() +abstract class ModelReturn implements Built { + @BuiltValueField(wireName: r'return') + int? get return_; + + ModelReturn._(); + + factory ModelReturn([void updates(ModelReturnBuilder b)]) = _$ModelReturn; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelReturnBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelReturnSerializer(); +} + +class _$ModelReturnSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelReturn, _$ModelReturn]; + + @override + final String wireName = r'ModelReturn'; + + Iterable _serializeProperties( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.return_ != null) { + yield r'return'; + yield serializers.serialize( + object.return_, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelReturnBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'return': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.return_ = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelReturn deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelReturnBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/name.dart new file mode 100644 index 000000000000..10fa99e6a5f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/name.dart @@ -0,0 +1,160 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'name.g.dart'; + +/// Model for testing model name same as property name +/// +/// Properties: +/// * [name] +/// * [snakeCase] +/// * [property] +/// * [n123number] +@BuiltValue() +abstract class Name implements Built { + @BuiltValueField(wireName: r'name') + int get name; + + @BuiltValueField(wireName: r'snake_case') + int? get snakeCase; + + @BuiltValueField(wireName: r'property') + String? get property; + + @BuiltValueField(wireName: r'123Number') + int? get n123number; + + Name._(); + + factory Name([void updates(NameBuilder b)]) = _$Name; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NameSerializer(); +} + +class _$NameSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Name, _$Name]; + + @override + final String wireName = r'Name'; + + Iterable _serializeProperties( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + if (object.snakeCase != null) { + yield r'snake_case'; + yield serializers.serialize( + object.snakeCase, + specifiedType: const FullType(int), + ); + } + if (object.property != null) { + yield r'property'; + yield serializers.serialize( + object.property, + specifiedType: const FullType(String), + ); + } + if (object.n123number != null) { + yield r'123Number'; + yield serializers.serialize( + object.n123number, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'snake_case': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.snakeCase = valueDes; + break; + case r'property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.property = valueDes; + break; + case r'123Number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.n123number = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Name deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/nullable_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..4f791962630e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/nullable_class.dart @@ -0,0 +1,319 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:time_machine/time_machine.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'; + +/// NullableClass +/// +/// Properties: +/// * [integerProp] +/// * [numberProp] +/// * [booleanProp] +/// * [stringProp] +/// * [dateProp] +/// * [datetimeProp] +/// * [arrayNullableProp] +/// * [arrayAndItemsNullableProp] +/// * [arrayItemsNullable] +/// * [objectNullableProp] +/// * [objectAndItemsNullableProp] +/// * [objectItemsNullable] +@BuiltValue() +abstract class NullableClass implements Built { + @BuiltValueField(wireName: r'integer_prop') + int? get integerProp; + + @BuiltValueField(wireName: r'number_prop') + num? get numberProp; + + @BuiltValueField(wireName: r'boolean_prop') + bool? get booleanProp; + + @BuiltValueField(wireName: r'string_prop') + String? get stringProp; + + @BuiltValueField(wireName: r'date_prop') + OffsetDate? get dateProp; + + @BuiltValueField(wireName: r'datetime_prop') + OffsetDateTime? get datetimeProp; + + @BuiltValueField(wireName: r'array_nullable_prop') + BuiltList? get arrayNullableProp; + + @BuiltValueField(wireName: r'array_and_items_nullable_prop') + BuiltList? get arrayAndItemsNullableProp; + + @BuiltValueField(wireName: r'array_items_nullable') + BuiltList? get arrayItemsNullable; + + @BuiltValueField(wireName: r'object_nullable_prop') + BuiltMap? get objectNullableProp; + + @BuiltValueField(wireName: r'object_and_items_nullable_prop') + BuiltMap? get objectAndItemsNullableProp; + + @BuiltValueField(wireName: r'object_items_nullable') + BuiltMap? get objectItemsNullable; + + NullableClass._(); + + factory NullableClass([void updates(NullableClassBuilder b)]) = _$NullableClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NullableClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NullableClassSerializer(); +} + +class _$NullableClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NullableClass, _$NullableClass]; + + @override + final String wireName = r'NullableClass'; + + Iterable _serializeProperties( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integerProp != null) { + yield r'integer_prop'; + yield serializers.serialize( + object.integerProp, + specifiedType: const FullType.nullable(int), + ); + } + if (object.numberProp != null) { + yield r'number_prop'; + yield serializers.serialize( + object.numberProp, + specifiedType: const FullType.nullable(num), + ); + } + if (object.booleanProp != null) { + yield r'boolean_prop'; + yield serializers.serialize( + object.booleanProp, + specifiedType: const FullType.nullable(bool), + ); + } + if (object.stringProp != null) { + yield r'string_prop'; + yield serializers.serialize( + object.stringProp, + specifiedType: const FullType.nullable(String), + ); + } + if (object.dateProp != null) { + yield r'date_prop'; + yield serializers.serialize( + object.dateProp, + specifiedType: const FullType.nullable(OffsetDate), + ); + } + if (object.datetimeProp != null) { + yield r'datetime_prop'; + yield serializers.serialize( + object.datetimeProp, + specifiedType: const FullType.nullable(OffsetDateTime), + ); + } + if (object.arrayNullableProp != null) { + yield r'array_nullable_prop'; + yield serializers.serialize( + object.arrayNullableProp, + specifiedType: const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ); + } + if (object.arrayAndItemsNullableProp != null) { + yield r'array_and_items_nullable_prop'; + yield serializers.serialize( + object.arrayAndItemsNullableProp, + specifiedType: const FullType.nullable(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.arrayItemsNullable != null) { + yield r'array_items_nullable'; + yield serializers.serialize( + object.arrayItemsNullable, + specifiedType: const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.objectNullableProp != null) { + yield r'object_nullable_prop'; + yield serializers.serialize( + object.objectNullableProp, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType(JsonObject)]), + ); + } + if (object.objectAndItemsNullableProp != null) { + yield r'object_and_items_nullable_prop'; + yield serializers.serialize( + object.objectAndItemsNullableProp, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + if (object.objectItemsNullable != null) { + yield r'object_items_nullable'; + yield serializers.serialize( + object.objectItemsNullable, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NullableClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(int), + ) as int?; + if (valueDes == null) continue; + result.integerProp = valueDes; + break; + case r'number_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(num), + ) as num?; + if (valueDes == null) continue; + result.numberProp = valueDes; + break; + case r'boolean_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(bool), + ) as bool?; + if (valueDes == null) continue; + result.booleanProp = valueDes; + break; + case r'string_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.stringProp = valueDes; + break; + case r'date_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(OffsetDate), + ) as OffsetDate?; + if (valueDes == null) continue; + result.dateProp = valueDes; + break; + case r'datetime_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(OffsetDateTime), + ) as OffsetDateTime?; + if (valueDes == null) continue; + result.datetimeProp = valueDes; + break; + case r'array_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayNullableProp.replace(valueDes); + break; + case r'array_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayAndItemsNullableProp.replace(valueDes); + break; + case r'array_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList; + result.arrayItemsNullable.replace(valueDes); + break; + case r'object_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectNullableProp.replace(valueDes); + break; + case r'object_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectAndItemsNullableProp.replace(valueDes); + break; + case r'object_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap; + result.objectItemsNullable.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NullableClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NullableClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/number_only.dart new file mode 100644 index 000000000000..482a95f3e521 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/number_only.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'number_only.g.dart'; + +/// NumberOnly +/// +/// Properties: +/// * [justNumber] +@BuiltValue() +abstract class NumberOnly implements Built { + @BuiltValueField(wireName: r'JustNumber') + num? get justNumber; + + NumberOnly._(); + + factory NumberOnly([void updates(NumberOnlyBuilder b)]) = _$NumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NumberOnlySerializer(); +} + +class _$NumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NumberOnly, _$NumberOnly]; + + @override + final String wireName = r'NumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justNumber != null) { + yield r'JustNumber'; + yield serializers.serialize( + object.justNumber, + specifiedType: const FullType(num), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'JustNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.justNumber = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..4e0ae04ae50d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,167 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'object_with_deprecated_fields.g.dart'; + +/// ObjectWithDeprecatedFields +/// +/// Properties: +/// * [uuid] +/// * [id] +/// * [deprecatedRef] +/// * [bars] +@BuiltValue() +abstract class ObjectWithDeprecatedFields implements Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @Deprecated('id has been deprecated') + @BuiltValueField(wireName: r'id') + num? get id; + + @Deprecated('deprecatedRef has been deprecated') + @BuiltValueField(wireName: r'deprecatedRef') + DeprecatedObject? get deprecatedRef; + + @Deprecated('bars has been deprecated') + @BuiltValueField(wireName: r'bars') + BuiltList? get bars; + + ObjectWithDeprecatedFields._(); + + factory ObjectWithDeprecatedFields([void updates(ObjectWithDeprecatedFieldsBuilder b)]) = _$ObjectWithDeprecatedFields; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ObjectWithDeprecatedFieldsBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ObjectWithDeprecatedFieldsSerializer(); +} + +class _$ObjectWithDeprecatedFieldsSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ObjectWithDeprecatedFields, _$ObjectWithDeprecatedFields]; + + @override + final String wireName = r'ObjectWithDeprecatedFields'; + + Iterable _serializeProperties( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(num), + ); + } + if (object.deprecatedRef != null) { + yield r'deprecatedRef'; + yield serializers.serialize( + object.deprecatedRef, + specifiedType: const FullType(DeprecatedObject), + ); + } + if (object.bars != null) { + yield r'bars'; + yield serializers.serialize( + object.bars, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ObjectWithDeprecatedFieldsBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.id = valueDes; + break; + case r'deprecatedRef': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DeprecatedObject), + ) as DeprecatedObject; + result.deprecatedRef.replace(valueDes); + break; + case r'bars': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.bars.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ObjectWithDeprecatedFields deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectWithDeprecatedFieldsBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/order.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/order.dart new file mode 100644 index 000000000000..b8b8c93fdd3c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/order.dart @@ -0,0 +1,226 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:time_machine/time_machine.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +/// Order +/// +/// Properties: +/// * [id] +/// * [petId] +/// * [quantity] +/// * [shipDate] +/// * [status] - Order Status +/// * [complete] +@BuiltValue() +abstract class Order implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'petId') + int? get petId; + + @BuiltValueField(wireName: r'quantity') + int? get quantity; + + @BuiltValueField(wireName: r'shipDate') + OffsetDateTime? get shipDate; + + /// Order Status + @BuiltValueField(wireName: r'status') + OrderStatusEnum? get status; + // enum statusEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'complete') + bool? get complete; + + Order._(); + + factory Order([void updates(OrderBuilder b)]) = _$Order; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OrderBuilder b) => b + ..complete = false; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OrderSerializer(); +} + +class _$OrderSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Order, _$Order]; + + @override + final String wireName = r'Order'; + + Iterable _serializeProperties( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.petId != null) { + yield r'petId'; + yield serializers.serialize( + object.petId, + specifiedType: const FullType(int), + ); + } + if (object.quantity != null) { + yield r'quantity'; + yield serializers.serialize( + object.quantity, + specifiedType: const FullType(int), + ); + } + if (object.shipDate != null) { + yield r'shipDate'; + yield serializers.serialize( + object.shipDate, + specifiedType: const FullType(OffsetDateTime), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(OrderStatusEnum), + ); + } + if (object.complete != null) { + yield r'complete'; + yield serializers.serialize( + object.complete, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OrderBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'petId': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.petId = valueDes; + break; + case r'quantity': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.quantity = valueDes; + break; + case r'shipDate': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OffsetDateTime), + ) as OffsetDateTime; + result.shipDate = valueDes; + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OrderStatusEnum), + ) as OrderStatusEnum; + result.status = valueDes; + break; + case r'complete': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.complete = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Order deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OrderBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class OrderStatusEnum extends EnumClass { + + /// Order Status + @BuiltValueEnumConst(wireName: r'placed') + static const OrderStatusEnum placed = _$orderStatusEnum_placed; + /// Order Status + @BuiltValueEnumConst(wireName: r'approved') + static const OrderStatusEnum approved = _$orderStatusEnum_approved; + /// Order Status + @BuiltValueEnumConst(wireName: r'delivered') + static const OrderStatusEnum delivered = _$orderStatusEnum_delivered; + /// Order Status + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OrderStatusEnum unknownDefaultOpenApi = _$orderStatusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$orderStatusEnumSerializer; + + const OrderStatusEnum._(String name): super(name); + + static BuiltSet get values => _$orderStatusEnumValues; + static OrderStatusEnum valueOf(String name) => _$orderStatusEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_composite.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..0d6341cc1299 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_composite.dart @@ -0,0 +1,144 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_composite.g.dart'; + +/// OuterComposite +/// +/// Properties: +/// * [myNumber] +/// * [myString] +/// * [myBoolean] +@BuiltValue() +abstract class OuterComposite implements Built { + @BuiltValueField(wireName: r'my_number') + num? get myNumber; + + @BuiltValueField(wireName: r'my_string') + String? get myString; + + @BuiltValueField(wireName: r'my_boolean') + bool? get myBoolean; + + OuterComposite._(); + + factory OuterComposite([void updates(OuterCompositeBuilder b)]) = _$OuterComposite; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterCompositeBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OuterCompositeSerializer(); +} + +class _$OuterCompositeSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [OuterComposite, _$OuterComposite]; + + @override + final String wireName = r'OuterComposite'; + + Iterable _serializeProperties( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.myNumber != null) { + yield r'my_number'; + yield serializers.serialize( + object.myNumber, + specifiedType: const FullType(num), + ); + } + if (object.myString != null) { + yield r'my_string'; + yield serializers.serialize( + object.myString, + specifiedType: const FullType(String), + ); + } + if (object.myBoolean != null) { + yield r'my_boolean'; + yield serializers.serialize( + object.myBoolean, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterCompositeBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'my_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.myNumber = valueDes; + break; + case r'my_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.myString = valueDes; + break; + case r'my_boolean': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.myBoolean = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterComposite deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterCompositeBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..5ad5d8009bdf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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: r'placed') + static const OuterEnum placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnum approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnum delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnum unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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-timemachine/lib/src/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..62c3cefe8456 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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: r'placed') + static const OuterEnumDefaultValue placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnumDefaultValue approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnumDefaultValue delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnumDefaultValue unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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-timemachine/lib/src/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..988b30785d30 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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(wireNumber: 0) + static const OuterEnumInteger number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumInteger number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumInteger number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumInteger unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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-timemachine/lib/src/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..3fe792cedbe9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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(wireNumber: 0) + static const OuterEnumIntegerDefaultValue number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumIntegerDefaultValue number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumIntegerDefaultValue number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumIntegerDefaultValue unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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-timemachine/lib/src/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..173329856452 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_object_with_enum_property.g.dart'; + +/// OuterObjectWithEnumProperty +/// +/// Properties: +/// * [value] +@BuiltValue() +abstract class OuterObjectWithEnumProperty implements Built { + @BuiltValueField(wireName: r'value') + OuterEnumInteger get value; + // enum valueEnum { 0, 1, 2, }; + + OuterObjectWithEnumProperty._(); + + factory OuterObjectWithEnumProperty([void updates(OuterObjectWithEnumPropertyBuilder b)]) = _$OuterObjectWithEnumProperty; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterObjectWithEnumPropertyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OuterObjectWithEnumPropertySerializer(); +} + +class _$OuterObjectWithEnumPropertySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [OuterObjectWithEnumProperty, _$OuterObjectWithEnumProperty]; + + @override + final String wireName = r'OuterObjectWithEnumProperty'; + + Iterable _serializeProperties( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'value'; + yield serializers.serialize( + object.value, + specifiedType: const FullType(OuterEnumInteger), + ); + } + + @override + Object serialize( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterObjectWithEnumPropertyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'value': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.value = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterObjectWithEnumProperty deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterObjectWithEnumPropertyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/parent_with_nullable.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/parent_with_nullable.dart new file mode 100644 index 000000000000..bf1252135cd9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/parent_with_nullable.dart @@ -0,0 +1,212 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/child_with_nullable.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'parent_with_nullable.g.dart'; + +/// ParentWithNullable +/// +/// Properties: +/// * [type] +/// * [nullableProperty] +@BuiltValue(instantiable: false) +abstract class ParentWithNullable { + @BuiltValueField(wireName: r'type') + ParentWithNullableTypeEnum? get type; + // enum typeEnum { ChildWithNullable, }; + + @BuiltValueField(wireName: r'nullableProperty') + String? get nullableProperty; + + static const String discriminatorFieldName = r'type'; + + static const Map discriminatorMapping = { + r'ChildWithNullable': ChildWithNullable, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ParentWithNullableSerializer(); +} + +extension ParentWithNullableDiscriminatorExt on ParentWithNullable { + String? get discriminatorValue { + if (this is ChildWithNullable) { + return r'ChildWithNullable'; + } + return null; + } +} +extension ParentWithNullableBuilderDiscriminatorExt on ParentWithNullableBuilder { + String? get discriminatorValue { + if (this is ChildWithNullableBuilder) { + return r'ChildWithNullable'; + } + return null; + } +} + +class _$ParentWithNullableSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ParentWithNullable]; + + @override + final String wireName = r'ParentWithNullable'; + + Iterable _serializeProperties( + Serializers serializers, + ParentWithNullable object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(ParentWithNullableTypeEnum), + ); + } + if (object.nullableProperty != null) { + yield r'nullableProperty'; + yield serializers.serialize( + object.nullableProperty, + specifiedType: const FullType.nullable(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ParentWithNullable object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is ChildWithNullable) { + return serializers.serialize(object, specifiedType: FullType(ChildWithNullable))!; + } + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + ParentWithNullable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ParentWithNullable.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + case r'ChildWithNullable': + return serializers.deserialize(serialized, specifiedType: FullType(ChildWithNullable)) as ChildWithNullable; + default: + return serializers.deserialize(serialized, specifiedType: FullType($ParentWithNullable)) as $ParentWithNullable; + } + } +} + +/// a concrete implementation of [ParentWithNullable], since [ParentWithNullable] is not instantiable +@BuiltValue(instantiable: true) +abstract class $ParentWithNullable implements ParentWithNullable, Built<$ParentWithNullable, $ParentWithNullableBuilder> { + $ParentWithNullable._(); + + factory $ParentWithNullable([void Function($ParentWithNullableBuilder)? updates]) = _$$ParentWithNullable; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($ParentWithNullableBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$ParentWithNullable> get serializer => _$$ParentWithNullableSerializer(); +} + +class _$$ParentWithNullableSerializer implements PrimitiveSerializer<$ParentWithNullable> { + @override + final Iterable types = const [$ParentWithNullable, _$$ParentWithNullable]; + + @override + final String wireName = r'$ParentWithNullable'; + + @override + Object serialize( + Serializers serializers, + $ParentWithNullable object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(ParentWithNullable))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ParentWithNullableBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ParentWithNullableTypeEnum), + ) as ParentWithNullableTypeEnum; + result.type = valueDes; + break; + case r'nullableProperty': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.nullableProperty = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $ParentWithNullable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $ParentWithNullableBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class ParentWithNullableTypeEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'ChildWithNullable') + static const ParentWithNullableTypeEnum childWithNullable = _$parentWithNullableTypeEnum_childWithNullable; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ParentWithNullableTypeEnum unknownDefaultOpenApi = _$parentWithNullableTypeEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$parentWithNullableTypeEnumSerializer; + + const ParentWithNullableTypeEnum._(String name): super(name); + + static BuiltSet get values => _$parentWithNullableTypeEnumValues; + static ParentWithNullableTypeEnum valueOf(String name) => _$parentWithNullableTypeEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/pet.dart new file mode 100644 index 000000000000..d9270be88935 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/pet.dart @@ -0,0 +1,225 @@ +sdlkfj;alkdsj + +slkdlfj;aldskjf +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pet.g.dart'; + +/// Pet +/// +/// Properties: +/// * [id] +/// * [category] +/// * [name] +/// * [photoUrls] +/// * [tags] +/// * [status] - pet status in the store +@BuiltValue() +abstract class Pet implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'category') + Category? get category; + + @BuiltValueField(wireName: r'name') + String get name; + + @BuiltValueField(wireName: r'photoUrls') + BuiltSet get photoUrls; + + @BuiltValueField(wireName: r'tags') + BuiltList? get tags; + + /// pet status in the store + @BuiltValueField(wireName: r'status') + PetStatusEnum? get status; + // enum statusEnum { available, pending, sold, }; + + Pet._(); + + factory Pet([void updates(PetBuilder b)]) = _$Pet; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PetBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PetSerializer(); +} + +class _$PetSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pet, _$Pet]; + + @override + final String wireName = r'Pet'; + + Iterable _serializeProperties( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.category != null) { + yield r'category'; + yield serializers.serialize( + object.category, + specifiedType: const FullType(Category), + ); + } + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + yield r'photoUrls'; + yield serializers.serialize( + object.photoUrls, + specifiedType: const FullType(BuiltSet, [FullType(String)]), + ); + if (object.tags != null) { + yield r'tags'; + yield serializers.serialize( + object.tags, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(PetStatusEnum), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PetBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'category': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Category), + ) as Category; + result.category.replace(valueDes); + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'photoUrls': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltSet, [FullType(String)]), + ) as BuiltSet; + result.photoUrls.replace(valueDes); + break; + case r'tags': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ) as BuiltList; + result.tags.replace(valueDes); + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(PetStatusEnum), + ) as PetStatusEnum; + result.status = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Pet deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PetBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class PetStatusEnum extends EnumClass { + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'available') + static const PetStatusEnum available = _$petStatusEnum_available; + /// pet status in the store + @BuiltValueEnumConst(wireName: r'pending') + static const PetStatusEnum pending = _$petStatusEnum_pending; + /// pet status in the store + @BuiltValueEnumConst(wireName: r'sold') + static const PetStatusEnum sold = _$petStatusEnum_sold; + /// pet status in the store + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const PetStatusEnum unknownDefaultOpenApi = _$petStatusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$petStatusEnumSerializer; + + const PetStatusEnum._(String name): super(name); + + static BuiltSet get values => _$petStatusEnumValues; + static PetStatusEnum valueOf(String name) => _$petStatusEnumValueOf(name); +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/read_only_first.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..b619217ab3cb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/read_only_first.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'read_only_first.g.dart'; + +/// ReadOnlyFirst +/// +/// Properties: +/// * [bar] +/// * [baz] +@BuiltValue() +abstract class ReadOnlyFirst implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'baz') + String? get baz; + + ReadOnlyFirst._(); + + factory ReadOnlyFirst([void updates(ReadOnlyFirstBuilder b)]) = _$ReadOnlyFirst; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ReadOnlyFirstBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ReadOnlyFirstSerializer(); +} + +class _$ReadOnlyFirstSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ReadOnlyFirst, _$ReadOnlyFirst]; + + @override + final String wireName = r'ReadOnlyFirst'; + + Iterable _serializeProperties( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.baz != null) { + yield r'baz'; + yield serializers.serialize( + object.baz, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ReadOnlyFirstBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'baz': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.baz = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ReadOnlyFirst deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ReadOnlyFirstBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/single_ref_type.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..b51e77292e8e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/single_ref_type.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'single_ref_type.g.dart'; + +class SingleRefType extends EnumClass { + + @BuiltValueEnumConst(wireName: r'admin') + static const SingleRefType admin = _$admin; + @BuiltValueEnumConst(wireName: r'user') + static const SingleRefType user = _$user; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const SingleRefType unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$singleRefTypeSerializer; + + const SingleRefType._(String name): super(name); + + static BuiltSet get values => _$values; + static SingleRefType 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 SingleRefTypeMixin = Object with _$SingleRefTypeMixin; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/special_model_name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..fa860056b45d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/special_model_name.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'special_model_name.g.dart'; + +/// SpecialModelName +/// +/// Properties: +/// * [dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket] +@BuiltValue() +abstract class SpecialModelName implements Built { + @BuiltValueField(wireName: r'$special[property.name]') + int? get dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + SpecialModelName._(); + + factory SpecialModelName([void updates(SpecialModelNameBuilder b)]) = _$SpecialModelName; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(SpecialModelNameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$SpecialModelNameSerializer(); +} + +class _$SpecialModelNameSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [SpecialModelName, _$SpecialModelName]; + + @override + final String wireName = r'SpecialModelName'; + + Iterable _serializeProperties( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { + yield r'$special[property.name]'; + yield serializers.serialize( + object.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required SpecialModelNameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'$special[property.name]': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + SpecialModelName deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = SpecialModelNameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/tag.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/tag.dart new file mode 100644 index 000000000000..3be220d8188e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/tag.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +/// Tag +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Tag implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Tag._(); + + factory Tag([void updates(TagBuilder b)]) = _$Tag; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(TagBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$TagSerializer(); +} + +class _$TagSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Tag, _$Tag]; + + @override + final String wireName = r'Tag'; + + Iterable _serializeProperties( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TagBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Tag deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = TagBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/test_inline_freeform_additional_properties_request.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/test_inline_freeform_additional_properties_request.dart new file mode 100644 index 000000000000..3bc31dc96e6b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/test_inline_freeform_additional_properties_request.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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 'test_inline_freeform_additional_properties_request.g.dart'; + +/// TestInlineFreeformAdditionalPropertiesRequest +/// +/// Properties: +/// * [someProperty] +@BuiltValue() +abstract class TestInlineFreeformAdditionalPropertiesRequest implements Built { + @BuiltValueField(wireName: r'someProperty') + String? get someProperty; + + TestInlineFreeformAdditionalPropertiesRequest._(); + + factory TestInlineFreeformAdditionalPropertiesRequest([void updates(TestInlineFreeformAdditionalPropertiesRequestBuilder b)]) = _$TestInlineFreeformAdditionalPropertiesRequest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(TestInlineFreeformAdditionalPropertiesRequestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$TestInlineFreeformAdditionalPropertiesRequestSerializer(); +} + +class _$TestInlineFreeformAdditionalPropertiesRequestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [TestInlineFreeformAdditionalPropertiesRequest, _$TestInlineFreeformAdditionalPropertiesRequest]; + + @override + final String wireName = r'TestInlineFreeformAdditionalPropertiesRequest'; + + Iterable _serializeProperties( + Serializers serializers, + TestInlineFreeformAdditionalPropertiesRequest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.someProperty != null) { + yield r'someProperty'; + yield serializers.serialize( + object.someProperty, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + TestInlineFreeformAdditionalPropertiesRequest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TestInlineFreeformAdditionalPropertiesRequestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'someProperty': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.someProperty = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + TestInlineFreeformAdditionalPropertiesRequest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = TestInlineFreeformAdditionalPropertiesRequestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/user.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/user.dart new file mode 100644 index 000000000000..f7577d7e1ee9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/model/user.dart @@ -0,0 +1,235 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +/// User +/// +/// Properties: +/// * [id] +/// * [username] +/// * [firstName] +/// * [lastName] +/// * [email] +/// * [password] +/// * [phone] +/// * [userStatus] - User Status +@BuiltValue() +abstract class User implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'firstName') + String? get firstName; + + @BuiltValueField(wireName: r'lastName') + String? get lastName; + + @BuiltValueField(wireName: r'email') + String? get email; + + @BuiltValueField(wireName: r'password') + String? get password; + + @BuiltValueField(wireName: r'phone') + String? get phone; + + /// User Status + @BuiltValueField(wireName: r'userStatus') + int? get userStatus; + + User._(); + + factory User([void updates(UserBuilder b)]) = _$User; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(UserBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$UserSerializer(); +} + +class _$UserSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [User, _$User]; + + @override + final String wireName = r'User'; + + Iterable _serializeProperties( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.firstName != null) { + yield r'firstName'; + yield serializers.serialize( + object.firstName, + specifiedType: const FullType(String), + ); + } + if (object.lastName != null) { + yield r'lastName'; + yield serializers.serialize( + object.lastName, + specifiedType: const FullType(String), + ); + } + if (object.email != null) { + yield r'email'; + yield serializers.serialize( + object.email, + specifiedType: const FullType(String), + ); + } + if (object.password != null) { + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + } + if (object.phone != null) { + yield r'phone'; + yield serializers.serialize( + object.phone, + specifiedType: const FullType(String), + ); + } + if (object.userStatus != null) { + yield r'userStatus'; + yield serializers.serialize( + object.userStatus, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required UserBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'firstName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.firstName = valueDes; + break; + case r'lastName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.lastName = valueDes; + break; + case r'email': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.email = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'phone': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.phone = valueDes; + break; + case r'userStatus': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.userStatus = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + User deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = UserBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/offset_date_serializer.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/offset_date_serializer.dart new file mode 100644 index 000000000000..496961deab40 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/offset_date_serializer.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:time_machine/time_machine.dart'; + +class OffsetDateSerializer implements PrimitiveSerializer { + + const OffsetDateSerializer(); + + @override + Iterable get types => BuiltList.of([OffsetDate]); + + @override + String get wireName => 'OffsetDate'; + + @override + OffsetDate deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) { + final local = LocalDate.dateTime(DateTime.parse(serialized as String)); + return OffsetDate(local, Offset(0)); + } + + @override + Object serialize(Serializers serializers, OffsetDate offsetDate, + {FullType specifiedType = FullType.unspecified}) { + return offsetDate.toString('yyyy-MM-dd'); + } +} + +class OffsetDateTimeSerializer implements PrimitiveSerializer { + + const OffsetDateTimeSerializer(); + + @override + Iterable get types => BuiltList([OffsetDateTime]); + + @override + String get wireName => 'OffsetDateTime'; + + @override + OffsetDateTime deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) { + final local = LocalDateTime.dateTime(DateTime.parse(serialized as String)); + return OffsetDateTime(local, Offset(0)); + } + + @override + Object serialize(Serializers serializers, OffsetDateTime offsetDateTime, + {FullType specifiedType = FullType.unspecified}) { + return offsetDateTime.toString(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/serializers.dart new file mode 100644 index 000000000000..54cbf4c04ef6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/lib/src/serializers.dart @@ -0,0 +1,167 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_import + +import 'package:one_of_serializer/any_of_serializer.dart'; +import 'package:one_of_serializer/one_of_serializer.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; + +import 'package:time_machine/time_machine.dart'; +import 'package:openapi/src/offset_date_serializer.dart'; +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/all_of_with_single_ref.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/child_with_nullable.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_get_default_response.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/map_test.dart'; +import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/src/model/model200_response.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_class.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:openapi/src/model/model_list.dart'; +import 'package:openapi/src/model/model_return.dart'; +import 'package:openapi/src/model/name.dart'; +import 'package:openapi/src/model/nullable_class.dart'; +import 'package:openapi/src/model/number_only.dart'; +import 'package:openapi/src/model/object_with_deprecated_fields.dart'; +import 'package:openapi/src/model/order.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/parent_with_nullable.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/test_inline_freeform_additional_properties_request.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'serializers.g.dart'; + +@SerializersFor([ + AdditionalPropertiesClass, + AllOfWithSingleRef, + Animal,$Animal, + ApiResponse, + ArrayOfArrayOfNumberOnly, + ArrayOfNumberOnly, + ArrayTest, + Capitalization, + Cat, + Category, + ChildWithNullable, + ClassModel, + DeprecatedObject, + Dog, + EnumArrays, + EnumTest, + FakeBigDecimalMap200Response, + FileSchemaTestClass, + Foo, + FooGetDefaultResponse, + FormatTest, + HasOnlyReadOnly, + HealthCheckResult, + MapTest, + MixedPropertiesAndAdditionalPropertiesClass, + Model200Response, + ModelClient, + ModelEnumClass, + ModelFile, + ModelList, + ModelReturn, + Name, + NullableClass, + NumberOnly, + ObjectWithDeprecatedFields, + Order, + OuterComposite, + OuterEnum, + OuterEnumDefaultValue, + OuterEnumInteger, + OuterEnumIntegerDefaultValue, + OuterObjectWithEnumProperty, + ParentWithNullable,$ParentWithNullable, + Pet, + ReadOnlyFirst, + SingleRefType, + SpecialModelName, + Tag, + TestInlineFreeformAdditionalPropertiesRequest, + User, +]) +Serializers serializers = (_$serializers.toBuilder() + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(String)]), + () => MapBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(User)]), + () => ListBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltSet, [FullType(String)]), + () => SetBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltSet, [FullType(Pet)]), + () => SetBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(Pet)]), + () => ListBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + () => MapBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(int)]), + () => MapBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(ModelEnumClass)]), + () => ListBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(String)]), + () => ListBuilder(), + ) + ..add(Animal.serializer) + ..add(ParentWithNullable.serializer) + ..add(const OneOfSerializer()) + ..add(const AnyOfSerializer()) + ..add(const OffsetDateSerializer()) + ..add(const OffsetDateTimeSerializer()) + ).build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/pubspec.yaml new file mode 100644 index 000000000000..3b461454cc96 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/pubspec.yaml @@ -0,0 +1,21 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '>=2.18.0 <4.0.0' + +dependencies: + dio: '^5.7.0' + one_of: '>=1.5.0 <2.0.0' + one_of_serializer: '>=1.5.0 <2.0.0' + built_value: '>=8.4.0 <9.0.0' + built_collection: '>=5.1.1 <6.0.0' + time_machine: ^0.9.17 + +dev_dependencies: + built_value_generator: '>=8.4.0 <9.0.0' + build_runner: any + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..c231e6dc2807 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/additional_properties_class_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(AdditionalPropertiesClass, () { + // BuiltMap mapProperty + test('to test the property `mapProperty`', () async { + // TODO + }); + + // BuiltMap> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/all_of_with_single_ref_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..64e241a4dce3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/all_of_with_single_ref_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AllOfWithSingleRef +void main() { + final instance = AllOfWithSingleRefBuilder(); + // TODO add properties to the builder and call build() + + group(AllOfWithSingleRef, () { + // String username + test('to test the property `username`', () async { + // TODO + }); + + // SingleRefType singleRefType + test('to test the property `singleRefType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/animal_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/animal_test.dart new file mode 100644 index 000000000000..39b8b59cdf51 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/animal_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + //final instance = AnimalBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/another_fake_api_test.dart new file mode 100644 index 000000000000..ddafef2a831b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/another_fake_api_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.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 call123testSpecialTags(ModelClient modelClient) async + test('test call123testSpecialTags', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/api_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/api_response_test.dart new file mode 100644 index 000000000000..cf1a744cd629 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/api_response_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponseBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..a679a6c4223d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfArrayOfNumberOnly, () { + // BuiltList> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..cc648bc115c5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_of_number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfNumberOnly, () { + // BuiltList arrayNumber + test('to test the property `arrayNumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_test_test.dart new file mode 100644 index 000000000000..210216f224b5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/array_test_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTestBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayTest, () { + // BuiltList arrayOfString + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/capitalization_test.dart new file mode 100644 index 000000000000..23e04b0001bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/capitalization_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final instance = CapitalizationBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/cat_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/cat_test.dart new file mode 100644 index 000000000000..b8fc252acc60 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/cat_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final instance = CatBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/category_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/category_test.dart new file mode 100644 index 000000000000..70f5fb5e02ac --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/category_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final instance = CategoryBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/child_with_nullable_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/child_with_nullable_test.dart new file mode 100644 index 000000000000..88361dff20e1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/child_with_nullable_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ChildWithNullable +void main() { + final instance = ChildWithNullableBuilder(); + // TODO add properties to the builder and call build() + + group(ChildWithNullable, () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableProperty + test('to test the property `nullableProperty`', () async { + // TODO + }); + + // String otherProperty + test('to test the property `otherProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/class_model_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/class_model_test.dart new file mode 100644 index 000000000000..89f1d35e556b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/class_model_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModelBuilder(); + // TODO add properties to the builder and call build() + + group(ClassModel, () { + // String classField + test('to test the property `classField`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/default_api_test.dart new file mode 100644 index 000000000000..f079565f9785 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/default_api_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.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-timemachine/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/deprecated_object_test.dart new file mode 100644 index 000000000000..98ab991b2b14 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/deprecated_object_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DeprecatedObject +void main() { + final instance = DeprecatedObjectBuilder(); + // TODO add properties to the builder and call build() + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/dog_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/dog_test.dart new file mode 100644 index 000000000000..f57fcdc413df --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/dog_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final instance = DogBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/enum_arrays_test.dart new file mode 100644 index 000000000000..438c36db0745 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/enum_arrays_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArraysBuilder(); + // TODO add properties to the builder and call build() + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // BuiltList arrayEnum + test('to test the property `arrayEnum`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/enum_test_test.dart new file mode 100644 index 000000000000..b5f3aeb7fbdd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/enum_test_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTestBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_api_test.dart new file mode 100644 index 000000000000..8aeae0320988 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_api_test.dart @@ -0,0 +1,183 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for FakeApi +void main() { + final instance = Openapi().getFakeApi(); + + group(FakeApi, () { + // for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + // + //Future fakeBigDecimalMap() async + test('test fakeBigDecimalMap', () async { + // TODO + }); + + // 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 + }); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async + test('test fakePropertyEnumIntegerSerialize', () async { + // TODO + }); + + // test referenced additionalProperties + // + // + // + //Future testAdditionalPropertiesReference(BuiltMap requestBody) async + test('test testAdditionalPropertiesReference', () async { + // TODO + }); + + // For this test, the body has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + // TODO + }); + + // For this test, the body for this request must 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(ModelClient modelClient) 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, OffsetDate date, OffsetDateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ BuiltList enumHeaderStringArray, String enumHeaderString, BuiltList enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, BuiltList enumQueryModelArray, BuiltList 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(BuiltMap requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test inline free-form additionalProperties + // + // + // + //Future testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) async + test('test testInlineFreeformAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + // + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // test nullable parent property + // + // + // + //Future testNullable(ChildWithNullable childWithNullable) async + test('test testNullable', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(BuiltList pipe, BuiltList ioutil, BuiltList http, BuiltList url, BuiltList context, String allowEmpty, { BuiltMap language }) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + + // test referenced string map + // + // + // + //Future testStringMapReference(BuiltMap requestBody) async + test('test testStringMapReference', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 000000000000..f316fc6038bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + final instance = FakeBigDecimalMap200ResponseBuilder(); + // TODO add properties to the builder and call build() + + group(FakeBigDecimalMap200Response, () { + // num someId + test('to test the property `someId`', () async { + // TODO + }); + + // BuiltMap someMap + test('to test the property `someMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..3075147f52fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.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(ModelClient modelClient) async + test('test testClassname', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..ca8695bd4a47 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/file_schema_test_class_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClassBuilder(); + // TODO add properties to the builder and call build() + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // BuiltList files + test('to test the property `files`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/foo_get_default_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/foo_get_default_response_test.dart new file mode 100644 index 000000000000..c64cbb8034c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/foo_get_default_response_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooGetDefaultResponse +void main() { + final instance = FooGetDefaultResponseBuilder(); + // TODO add properties to the builder and call build() + + group(FooGetDefaultResponse, () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/foo_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/foo_test.dart new file mode 100644 index 000000000000..205237788aeb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/foo_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final instance = FooBuilder(); + // TODO add properties to the builder and call build() + + 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-timemachine/test/format_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/format_test_test.dart new file mode 100644 index 000000000000..448724b95af1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/format_test_test.dart @@ -0,0 +1,93 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTestBuilder(); + // TODO add properties to the builder and call build() + + group(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 + }); + + // double 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 + }); + + // Uint8List binary + test('to test the property `binary`', () async { + // TODO + }); + + // OffsetDate date + test('to test the property `date`', () async { + // TODO + }); + + // OffsetDateTime 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/dart-dio/petstore_client_lib_fake-timemachine/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..c34522214751 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/has_only_read_only_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/health_check_result_test.dart new file mode 100644 index 000000000000..fda0c9218217 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/health_check_result_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResultBuilder(); + // TODO add properties to the builder and call build() + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/map_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/map_test_test.dart new file mode 100644 index 000000000000..56a27610ee5a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/map_test_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final instance = MapTestBuilder(); + // TODO add properties to the builder and call build() + + group(MapTest, () { + // BuiltMap> mapMapOfString + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // BuiltMap mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // BuiltMap directMap + test('to test the property `directMap`', () async { + // TODO + }); + + // BuiltMap indirectMap + test('to test the property `indirectMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..efb2dbe0ff7a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // OffsetDateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // BuiltMap map + test('to test the property `map`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model200_response_test.dart new file mode 100644 index 000000000000..11bac07fafb8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final instance = Model200ResponseBuilder(); + // TODO add properties to the builder and call build() + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String classField + test('to test the property `classField`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_client_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_client_test.dart new file mode 100644 index 000000000000..f494dfd08499 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_client_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final instance = ModelClientBuilder(); + // TODO add properties to the builder and call build() + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_enum_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_enum_class_test.dart new file mode 100644 index 000000000000..03e5855bf004 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_enum_class_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + + group(ModelEnumClass, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_file_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_file_test.dart new file mode 100644 index 000000000000..4f1397726226 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_file_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final instance = ModelFileBuilder(); + // TODO add properties to the builder and call build() + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_list_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_list_test.dart new file mode 100644 index 000000000000..d35e02fe0c9a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_list_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final instance = ModelListBuilder(); + // TODO add properties to the builder and call build() + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_return_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_return_test.dart new file mode 100644 index 000000000000..eedfe7eb281a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/model_return_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturnBuilder(); + // TODO add properties to the builder and call build() + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/name_test.dart new file mode 100644 index 000000000000..6b2329bb0819 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/name_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final instance = NameBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/nullable_class_test.dart new file mode 100644 index 000000000000..229e5d86cf19 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/nullable_class_test.dart @@ -0,0 +1,71 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClassBuilder(); + // TODO add properties to the builder and call build() + + group(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 + }); + + // OffsetDate dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // OffsetDateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // BuiltList arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // BuiltList arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltList arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // BuiltMap objectNullableProp + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // BuiltMap objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltMap objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/number_only_test.dart new file mode 100644 index 000000000000..7167d78a4962 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..cd04ed4d48e0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + final instance = ObjectWithDeprecatedFieldsBuilder(); + // TODO add properties to the builder and call build() + + group(ObjectWithDeprecatedFields, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // num id + test('to test the property `id`', () async { + // TODO + }); + + // DeprecatedObject deprecatedRef + test('to test the property `deprecatedRef`', () async { + // TODO + }); + + // BuiltList bars + test('to test the property `bars`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/order_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/order_test.dart new file mode 100644 index 000000000000..285d0a67e2ba --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/order_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final instance = OrderBuilder(); + // TODO add properties to the builder and call build() + + group(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 + }); + + // OffsetDateTime 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/dart-dio/petstore_client_lib_fake-timemachine/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_composite_test.dart new file mode 100644 index 000000000000..dac257d9a0d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_composite_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterCompositeBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..502c8326be58 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_default_value_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group(OuterEnumDefaultValue, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..c535fe8ac354 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group(OuterEnumIntegerDefaultValue, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..d945bc8c489d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_integer_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + + group(OuterEnumInteger, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_test.dart new file mode 100644 index 000000000000..8e11eb02fb8a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_enum_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + + group(OuterEnum, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..d6d763c5d93a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final instance = OuterObjectWithEnumPropertyBuilder(); + // TODO add properties to the builder and call build() + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/parent_with_nullable_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/parent_with_nullable_test.dart new file mode 100644 index 000000000000..68edeb52bc26 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/parent_with_nullable_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ParentWithNullable +void main() { + //final instance = ParentWithNullableBuilder(); + // TODO add properties to the builder and call build() + + group(ParentWithNullable, () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableProperty + test('to test the property `nullableProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/pet_api_test.dart new file mode 100644 index 000000000000..bd23e2e9e73d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/pet_api_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.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(BuiltList 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(BuiltSet 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/dart-dio/petstore_client_lib_fake-timemachine/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/pet_test.dart new file mode 100644 index 000000000000..b2bac5351d2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/pet_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final instance = PetBuilder(); + // TODO add properties to the builder and call build() + + group(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 + }); + + // BuiltSet photoUrls + test('to test the property `photoUrls`', () async { + // TODO + }); + + // BuiltList tags + 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/dart-dio/petstore_client_lib_fake-timemachine/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/read_only_first_test.dart new file mode 100644 index 000000000000..550d3d793ec6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/read_only_first_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirstBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/single_ref_type_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/single_ref_type_test.dart new file mode 100644 index 000000000000..5cd85add393e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/single_ref_type_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + + group(SingleRefType, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/special_model_name_test.dart new file mode 100644 index 000000000000..08a4592a1ed7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/special_model_name_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelNameBuilder(); + // TODO add properties to the builder and call build() + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/store_api_test.dart new file mode 100644 index 000000000000..77b3d9f00224 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/store_api_test.dart @@ -0,0 +1,47 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.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 generate 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-timemachine/test/tag_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/tag_test.dart new file mode 100644 index 000000000000..6f7c63b8f0c2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/tag_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final instance = TagBuilder(); + // TODO add properties to the builder and call build() + + group(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/dart-dio/petstore_client_lib_fake-timemachine/test/test_inline_freeform_additional_properties_request_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/test_inline_freeform_additional_properties_request_test.dart new file mode 100644 index 000000000000..4dddb899f218 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/test_inline_freeform_additional_properties_request_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestInlineFreeformAdditionalPropertiesRequest +void main() { + final instance = TestInlineFreeformAdditionalPropertiesRequestBuilder(); + // TODO add properties to the builder and call build() + + group(TestInlineFreeformAdditionalPropertiesRequest, () { + // String someProperty + test('to test the property `someProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/user_api_test.dart new file mode 100644 index 000000000000..29f63ba073ba --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/user_api_test.dart @@ -0,0 +1,83 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.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(BuiltList user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithListInput(BuiltList 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-timemachine/test/user_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/user_test.dart new file mode 100644 index 000000000000..1e6a1bc23faa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-timemachine/test/user_test.dart @@ -0,0 +1,52 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final instance = UserBuilder(); + // TODO add properties to the builder and call build() + + group(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 + }); + + }); +}