From 11eedc86dc04a55fd36857fa9e07e2668248143e Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Mon, 5 Apr 2021 16:59:14 +0200 Subject: [PATCH] [dart] Remove OS2 samples which have OAS3 counter parts (#9177) These samples are the same as their OAS3 counterparts and don't give any additional benefits. This should speed up CI builds by a good amount. --- .../dart-dio-petstore-client-lib-oas2.yaml | 6 - .../dart-petstore-client-lib-oas2.yaml | 6 - .../dart-dio/petstore_client_lib/.gitignore | 37 - .../.openapi-generator-ignore | 23 - .../.openapi-generator/FILES | 29 - .../.openapi-generator/VERSION | 1 - .../dart-dio/petstore_client_lib/README.md | 115 ---- .../petstore_client_lib/analysis_options.yaml | 9 - .../petstore_client_lib/doc/ApiResponse.md | 17 - .../petstore_client_lib/doc/Category.md | 16 - .../dart-dio/petstore_client_lib/doc/Order.md | 20 - .../dart-dio/petstore_client_lib/doc/Pet.md | 20 - .../petstore_client_lib/doc/PetApi.md | 379 ----------- .../petstore_client_lib/doc/StoreApi.md | 186 ------ .../dart-dio/petstore_client_lib/doc/Tag.md | 16 - .../dart-dio/petstore_client_lib/doc/User.md | 22 - .../petstore_client_lib/doc/UserApi.md | 349 ---------- .../dart-dio/petstore_client_lib/lib/api.dart | 94 --- .../petstore_client_lib/lib/api/pet_api.dart | 494 -------------- .../lib/api/store_api.dart | 245 ------- .../petstore_client_lib/lib/api/user_api.dart | 402 ----------- .../petstore_client_lib/lib/api_util.dart | 31 - .../lib/auth/api_key_auth.dart | 33 - .../petstore_client_lib/lib/auth/auth.dart | 27 - .../lib/auth/basic_auth.dart | 38 -- .../petstore_client_lib/lib/auth/oauth.dart | 27 - .../lib/model/api_response.dart | 97 --- .../lib/model/category.dart | 83 --- .../petstore_client_lib/lib/model/order.dart | 162 ----- .../petstore_client_lib/lib/model/pet.dart | 158 ----- .../petstore_client_lib/lib/model/tag.dart | 83 --- .../petstore_client_lib/lib/model/user.dart | 168 ----- .../petstore_client_lib/lib/serializers.dart | 50 -- .../dart-dio/petstore_client_lib/pom.xml | 104 --- .../dart-dio/petstore_client_lib/pubspec.yaml | 13 - .../test/api_response_test.dart | 35 - .../test/category_test.dart | 30 - .../petstore_client_lib/test/order_test.dart | 51 -- .../test/pet_api_test.dart | 81 --- .../petstore_client_lib/test/pet_test.dart | 51 -- .../test/store_api_test.dart | 53 -- .../petstore_client_lib/test/tag_test.dart | 30 - .../test/user_api_test.dart | 81 --- .../petstore_client_lib/test/user_test.dart | 61 -- .../petstore/dart2/petstore/.analysis_options | 2 - .../client/petstore/dart2/petstore/README.md | 37 - .../client/petstore/dart2/petstore/pom.xml | 73 -- .../petstore/dart2/petstore/pubspec.yaml | 13 - .../dart2/petstore/test/fake_client.dart | 133 ---- .../petstore/test/file_upload_response.json | 1 - .../petstore/test/inventory_response.json | 1 - .../dart2/petstore/test/order_model_test.dart | 9 - .../petstore/test/pet_faked_client_test.dart | 240 ------- .../dart2/petstore/test/pet_test.dart | 104 --- .../dart2/petstore/test/random_id.dart | 7 - .../test/store_faked_client_test.dart | 89 --- .../dart2/petstore/test/store_test.dart | 44 -- .../petstore/test/user_faked_client_test.dart | 174 ----- .../dart2/petstore/test/user_test.dart | 80 --- .../dart2/petstore_client_lib/.gitignore | 27 - .../.openapi-generator-ignore | 23 - .../.openapi-generator/FILES | 32 - .../.openapi-generator/VERSION | 1 - .../dart2/petstore_client_lib/.travis.yml | 14 - .../dart2/petstore_client_lib/README.md | 117 ---- .../petstore_client_lib/doc/ApiResponse.md | 17 - .../dart2/petstore_client_lib/doc/Category.md | 16 - .../dart2/petstore_client_lib/doc/Order.md | 20 - .../dart2/petstore_client_lib/doc/Pet.md | 20 - .../dart2/petstore_client_lib/doc/PetApi.md | 379 ----------- .../dart2/petstore_client_lib/doc/StoreApi.md | 186 ------ .../dart2/petstore_client_lib/doc/Tag.md | 16 - .../dart2/petstore_client_lib/doc/User.md | 22 - .../dart2/petstore_client_lib/doc/UserApi.md | 349 ---------- .../dart2/petstore_client_lib/git_push.sh | 58 -- .../dart2/petstore_client_lib/lib/api.dart | 48 -- .../petstore_client_lib/lib/api/pet_api.dart | 631 ------------------ .../lib/api/store_api.dart | 289 -------- .../petstore_client_lib/lib/api/user_api.dart | 556 --------------- .../petstore_client_lib/lib/api_client.dart | 272 -------- .../lib/api_exception.dart | 31 - .../petstore_client_lib/lib/api_helper.dart | 71 -- .../lib/auth/api_key_auth.dart | 35 - .../lib/auth/authentication.dart | 15 - .../lib/auth/http_basic_auth.dart | 21 - .../lib/auth/http_bearer_auth.dart | 38 -- .../petstore_client_lib/lib/auth/oauth.dart | 23 - .../lib/model/api_response.dart | 89 --- .../lib/model/category.dart | 80 --- .../petstore_client_lib/lib/model/order.dart | 188 ------ .../petstore_client_lib/lib/model/pet.dart | 184 ----- .../petstore_client_lib/lib/model/tag.dart | 80 --- .../petstore_client_lib/lib/model/user.dart | 135 ---- .../dart2/petstore_client_lib/pom.xml | 73 -- .../dart2/petstore_client_lib/pubspec.yaml | 20 - .../test/api_response_test.dart | 36 - .../test/category_test.dart | 31 - .../petstore_client_lib/test/order_test.dart | 52 -- .../test/pet_api_test.dart | 82 --- .../petstore_client_lib/test/pet_test.dart | 52 -- .../test/store_api_test.dart | 54 -- .../petstore_client_lib/test/tag_test.dart | 31 - .../test/user_api_test.dart | 82 --- .../petstore_client_lib/test/user_test.dart | 62 -- 104 files changed, 9698 deletions(-) delete mode 100644 bin/configs/dart-dio-petstore-client-lib-oas2.yaml delete mode 100644 bin/configs/dart-petstore-client-lib-oas2.yaml delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/.gitignore delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/README.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/Category.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/Order.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/User.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/pom.xml delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart delete mode 100644 samples/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/.analysis_options delete mode 100644 samples/client/petstore/dart2/petstore/README.md delete mode 100644 samples/client/petstore/dart2/petstore/pom.xml delete mode 100644 samples/client/petstore/dart2/petstore/pubspec.yaml delete mode 100644 samples/client/petstore/dart2/petstore/test/fake_client.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/file_upload_response.json delete mode 100644 samples/client/petstore/dart2/petstore/test/inventory_response.json delete mode 100644 samples/client/petstore/dart2/petstore/test/order_model_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/pet_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/random_id.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/store_faked_client_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/store_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/user_faked_client_test.dart delete mode 100644 samples/client/petstore/dart2/petstore/test/user_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/.gitignore delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/.travis.yml delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/README.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/Category.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/Order.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/User.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/git_push.sh delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/pom.xml delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart delete mode 100644 samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart diff --git a/bin/configs/dart-dio-petstore-client-lib-oas2.yaml b/bin/configs/dart-dio-petstore-client-lib-oas2.yaml deleted file mode 100644 index 447136518a8a..000000000000 --- a/bin/configs/dart-dio-petstore-client-lib-oas2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -generatorName: dart-dio -outputDir: samples/client/petstore/dart-dio/petstore_client_lib -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml -templateDir: modules/openapi-generator/src/main/resources/dart-dio -additionalProperties: - hideGenerationTimestamp: "true" diff --git a/bin/configs/dart-petstore-client-lib-oas2.yaml b/bin/configs/dart-petstore-client-lib-oas2.yaml deleted file mode 100644 index 861a829ac4f4..000000000000 --- a/bin/configs/dart-petstore-client-lib-oas2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -generatorName: dart -outputDir: samples/client/petstore/dart2/petstore_client_lib -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml -templateDir: modules/openapi-generator/src/main/resources/dart2 -additionalProperties: - hideGenerationTimestamp: "true" diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/.gitignore b/samples/client/petstore/dart-dio/petstore_client_lib/.gitignore deleted file mode 100644 index 8092a49d5152..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -# See https://dart.dev/guides/libraries/private-files - -# Files and directories created by pub -.dart_tool/ -.buildlog -.packages -.project -.pub/ -build/ -**/packages/ - -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc -doc/api/ - -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock - -# Don’t commit files and directories created by other development environments. -# For example, if your development environment creates any of the following files, -# consider putting them in a global ignore file: -*.iml // IntelliJ -*.ipr // IntelliJ -*.iws // IntelliJ -.idea/ // IntelliJ -.DS_Store // Mac diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES deleted file mode 100644 index b14eb44e2a0f..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/FILES +++ /dev/null @@ -1,29 +0,0 @@ -.gitignore -README.md -analysis_options.yaml -doc/ApiResponse.md -doc/Category.md -doc/Order.md -doc/Pet.md -doc/PetApi.md -doc/StoreApi.md -doc/Tag.md -doc/User.md -doc/UserApi.md -lib/api.dart -lib/api/pet_api.dart -lib/api/store_api.dart -lib/api/user_api.dart -lib/api_util.dart -lib/auth/api_key_auth.dart -lib/auth/auth.dart -lib/auth/basic_auth.dart -lib/auth/oauth.dart -lib/model/api_response.dart -lib/model/category.dart -lib/model/order.dart -lib/model/pet.dart -lib/model/tag.dart -lib/model/user.dart -lib/serializers.dart -pubspec.yaml diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION b/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION deleted file mode 100644 index d509cc92aa80..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/README.md b/samples/client/petstore/dart-dio/petstore_client_lib/README.md deleted file mode 100644 index 5c483353f35f..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# openapi -This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - -This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Build package: org.openapitools.codegen.languages.DartDioClientCodegen - -## Requirements - -Dart 2.7.0 or later OR Flutter 1.12 or later - -## Installation & Usage - -### Github -If this Dart package is published to Github, please include the following in pubspec.yaml -``` -name: openapi -version: 1.0.0 -description: OpenAPI API client -dependencies: - openapi: - git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git - version: 'any' -``` - -### Local -To use the package in your local drive, please include the following in pubspec.yaml -``` -dependencies: - openapi: - path: /path/to/openapi -``` - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -```dart -import 'package:openapi/api.dart'; - - -final api = PetApi(); -final body = Pet(); // Pet | Pet object that needs to be added to the store - -try { - api.addPet(body); -} catch (e) { - print("Exception when calling PetApi->addPet: $e\n"); -} - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*PetApi* | [**addPet**](doc/PetApi.md#addpet) | **post** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc/PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc/PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc/PetApi.md#updatepet) | **put** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc/PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image -*StoreApi* | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc/StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc/StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc/UserApi.md#createuser) | **post** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc/UserApi.md#deleteuser) | **delete** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc/UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc/UserApi.md#loginuser) | **get** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc/UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc/UserApi.md#updateuser) | **put** /user/{username} | Updated user - - -## Documentation For Models - - - [ApiResponse](doc/ApiResponse.md) - - [Category](doc/Category.md) - - [Order](doc/Order.md) - - [Pet](doc/Pet.md) - - [Tag](doc/Tag.md) - - [User](doc/User.md) - - -## Documentation For Authorization - - -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - -## Author - - - - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml b/samples/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml deleted file mode 100644 index a611887d3acf..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/analysis_options.yaml +++ /dev/null @@ -1,9 +0,0 @@ -analyzer: - language: - strict-inference: true - strict-raw-types: true - strong-mode: - implicit-dynamic: false - implicit-casts: false - exclude: - - test/*.dart diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md deleted file mode 100644 index 7ad5da0f89e4..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] -**type** | **String** | | [optional] -**message** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Category.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Category.md deleted file mode 100644 index 98d0b14be7b1..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Category.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Category - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**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/client/petstore/dart-dio/petstore_client_lib/doc/Order.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Order.md deleted file mode 100644 index bde5ffe51a2c..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Order.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Order - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**petId** | **int** | | [optional] -**quantity** | **int** | | [optional] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] -**status** | **String** | Order Status | [optional] -**complete** | **bool** | | [optional] [default to false] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md deleted file mode 100644 index 3a8dd5b8996b..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**category** | [**Category**](Category.md) | | [optional] -**name** | **String** | | -**photoUrls** | **BuiltList** | | -**tags** | [**BuiltList**](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/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md deleted file mode 100644 index 215f67f8aef0..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md +++ /dev/null @@ -1,379 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addpet) | **post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatepet) | **put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image - - -# **addPet** -> addPet(body) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(body); -} catch (e) { - print('Exception when calling PetApi->addPet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deletePet** -> deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | Pet id to delete -var apiKey = apiKey_example; // String | - -try { - api_instance.deletePet(petId, apiKey); -} catch (e) { - print('Exception when calling PetApi->deletePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | - **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'; - -var api_instance = new PetApi(); -var status = []; // BuiltList | Status values that need to be considered for filter - -try { - var result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByStatus: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**BuiltList**](String.md)| Status values that need to be considered for filter | - -### Return type - -[**BuiltList**](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** -> BuiltList 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'; - -var api_instance = new PetApi(); -var tags = []; // BuiltList | Tags to filter by - -try { - var result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByTags: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**BuiltList**](String.md)| Tags to filter by | - -### Return type - -[**BuiltList**](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'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to return - -try { - var result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print('Exception when calling PetApi->getPetById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePet** -> updatePet(body) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.updatePet(body); -} catch (e) { - print('Exception when calling PetApi->updatePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePetWithForm** -> updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet that needs to be updated -var name = name_example; // String | Updated name of the pet -var status = status_example; // String | Updated status of the pet - -try { - api_instance.updatePetWithForm(petId, name, status); -} catch (e) { - print('Exception when calling PetApi->updatePetWithForm: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | - **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'; - -var api_instance = new PetApi(); -var petId = 789; // int | ID of pet to update -var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -var file = BINARY_DATA_HERE; // Uint8List | file to upload - -try { - var result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print('Exception when calling PetApi->uploadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] - **file** | **Uint8List**| 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) - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md deleted file mode 100644 index 89d99ff78b92..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md +++ /dev/null @@ -1,186 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - api_instance.deleteOrder(orderId); -} catch (e) { - print('Exception when calling StoreApi->deleteOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | - -### 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'; - -var api_instance = new StoreApi(); - -try { - var result = api_instance.getInventory(); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getInventory: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**BuiltMap** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var orderId = 789; // int | ID of pet that needs to be fetched - -try { - var result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getOrderById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(body) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new StoreApi(); -var body = new Order(); // Order | order placed for purchasing the pet - -try { - var result = api_instance.placeOrder(body); - print(result); -} catch (e) { - print('Exception when calling StoreApi->placeOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md deleted file mode 100644 index c219f987c19c..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/Tag.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Tag - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**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/client/petstore/dart-dio/petstore_client_lib/doc/User.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/User.md deleted file mode 100644 index fa87e64d8595..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**username** | **String** | | [optional] -**firstName** | **String** | | [optional] -**lastName** | **String** | | [optional] -**email** | **String** | | [optional] -**password** | **String** | | [optional] -**phone** | **String** | | [optional] -**userStatus** | **int** | User Status | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md deleted file mode 100644 index fa7bae08b773..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md +++ /dev/null @@ -1,349 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createuser) | **post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteuser) | **delete** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginuser) | **get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateuser) | **put** /user/{username} | Updated user - - -# **createUser** -> createUser(body) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = new User(); // User | Created user object - -try { - api_instance.createUser(body); -} catch (e) { - print('Exception when calling UserApi->createUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithArrayInput** -> createUsersWithArrayInput(body) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = [new BuiltList()]; // BuiltList | List of user object - -try { - api_instance.createUsersWithArrayInput(body); -} catch (e) { - print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**BuiltList**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithListInput** -> createUsersWithListInput(body) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var body = [new BuiltList()]; // BuiltList | List of user object - -try { - api_instance.createUsersWithListInput(body); -} catch (e) { - print('Exception when calling UserApi->createUsersWithListInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**BuiltList**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The name that needs to be deleted - -try { - api_instance.deleteUser(username); -} catch (e) { - print('Exception when calling UserApi->deleteUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - var result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print('Exception when calling UserApi->getUserByName: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | The user name for login -var password = password_example; // String | The password for login in clear text - -try { - var result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print('Exception when calling UserApi->loginUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **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'; - -var api_instance = new UserApi(); - -try { - api_instance.logoutUser(); -} catch (e) { - print('Exception when calling UserApi->logoutUser: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> updateUser(username, body) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -var api_instance = new UserApi(); -var username = username_example; // String | name that need to be deleted -var body = new User(); // User | Updated user object - -try { - api_instance.updateUser(username, body); -} catch (e) { - print('Exception when calling UserApi->updateUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart deleted file mode 100644 index cf014e6029f2..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart +++ /dev/null @@ -1,94 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -library openapi.api; - -import 'package:dio/dio.dart'; -import 'package:built_value/serializer.dart'; -import 'package:openapi/serializers.dart'; -import 'package:openapi/auth/api_key_auth.dart'; -import 'package:openapi/auth/basic_auth.dart'; -import 'package:openapi/auth/oauth.dart'; -import 'package:openapi/api/pet_api.dart'; -import 'package:openapi/api/store_api.dart'; -import 'package:openapi/api/user_api.dart'; - - -final _defaultInterceptors = [ - OAuthInterceptor(), - BasicAuthInterceptor(), - ApiKeyAuthInterceptor(), -]; - -class Openapi { - - static const String basePath = r'http://petstore.swagger.io/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: 5000, - receiveTimeout: 3000, - )) { - if (interceptors == null) { - this.dio.interceptors.addAll(_defaultInterceptors); - } else { - this.dio.interceptors.addAll(interceptors); - } - } - - void setOAuthToken(String name, String token) { - (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor, orElse: null) as OAuthInterceptor)?.tokens[name] = token; - } - - void setBasicAuth(String name, String username, String password) { - (this.dio.interceptors.firstWhere((element) => element is BasicAuthInterceptor, orElse: null) as BasicAuthInterceptor)?.authInfo[name] = BasicAuthInfo(username, password); - } - - void setApiKey(String name, String apiKey) { - (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor, orElse: null) as ApiKeyAuthInterceptor)?.apiKeys[name] = apiKey; - } - - - /** - * Get PetApi instance, base route and serializer can be overridden by a given but be careful, - * by doing that all interceptors will not be executed - */ - PetApi getPetApi() { - return PetApi(dio, serializers); - } - - - /** - * Get StoreApi instance, base route and serializer can be overridden by a given but be careful, - * by doing that all interceptors will not be executed - */ - StoreApi getStoreApi() { - return StoreApi(dio, serializers); - } - - - /** - * Get UserApi instance, base route and serializer can be overridden by a given but be careful, - * by doing that all interceptors will not be executed - */ - UserApi getUserApi() { - return UserApi(dio, serializers); - } - - -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart deleted file mode 100644 index 1f381cee198b..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ /dev/null @@ -1,494 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:async'; -import 'package:dio/dio.dart'; -import 'package:built_value/serializer.dart'; - -import 'package:openapi/model/pet.dart'; -import 'package:openapi/model/api_response.dart'; -import 'dart:typed_data'; -import 'package:built_collection/built_collection.dart'; -import 'package:openapi/api_util.dart'; - -class PetApi { - - final Dio _dio; - - final Serializers _serializers; - - const PetApi(this._dio, this._serializers); - - /// Add a new pet to the store - /// - /// - Future> addPet( - Pet body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet', - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - 'application/xml', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(Pet); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Deletes a pet - /// - /// - Future> deletePet( - int petId, { - String apiKey, - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()), - method: 'DELETE', - headers: { - if (apiKey != null) r'api_key': apiKey, - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - Future>> findPetsByStatus( - BuiltList status, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet/findByStatus', - method: 'GET', - headers: { - ...?headers, - }, - queryParameters: { - r'status': status, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(BuiltList, [FullType(Pet)]); - final BuiltList _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as BuiltList; - - return Response>( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future>> findPetsByTags( - BuiltList tags, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet/findByTags', - method: 'GET', - headers: { - ...?headers, - }, - queryParameters: { - r'tags': tags, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(BuiltList, [FullType(Pet)]); - final BuiltList _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as BuiltList; - - return Response>( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Find pet by ID - /// - /// Returns a single pet - Future> getPetById( - int petId, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()), - method: 'GET', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'apiKey', - 'name': 'api_key', - 'keyName': 'api_key', - 'where': 'header', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(Pet); - final _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as Pet; - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Update an existing pet - /// - /// - Future> updatePet( - Pet body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet', - method: 'PUT', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - 'application/xml', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(Pet); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Updates a pet in the store with form data - /// - /// - Future> updatePetWithForm( - int petId, { - String name, - String status, - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()), - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/x-www-form-urlencoded', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - _bodyData = { - if (name != null) r'name': encodeFormParameter(_serializers, name, const FullType(String)), - if (status != null) r'status': encodeFormParameter(_serializers, status, const FullType(String)), - }; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// uploads an image - /// - /// - Future> uploadFile( - int petId, { - String additionalMetadata, - Uint8List file, - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()), - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'multipart/form-data', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - _bodyData = FormData.fromMap({ - if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_serializers, additionalMetadata, const FullType(String)), - if (file != null) r'file': MultipartFile.fromBytes(file, filename: r'file'), - }); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(ApiResponse); - final _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as ApiResponse; - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart deleted file mode 100644 index f9f5862f143d..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ /dev/null @@ -1,245 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:async'; -import 'package:dio/dio.dart'; -import 'package:built_value/serializer.dart'; - -import 'package:openapi/model/order.dart'; -import 'package:built_collection/built_collection.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 - Future> deleteOrder( - String orderId, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()), - method: 'DELETE', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - Future>> getInventory({ - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/store/inventory', - method: 'GET', - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'apiKey', - 'name': 'api_key', - 'keyName': 'api_key', - 'where': 'header', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(BuiltMap, [FullType(String), FullType(int)]); - final BuiltMap _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as BuiltMap; - - return Response>( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - Future> getOrderById( - int orderId, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()), - method: 'GET', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(Order); - final _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as Order; - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Place an order for a pet - /// - /// - Future> placeOrder( - Order body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/store/order', - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(Order); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(Order); - final _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as Order; - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart deleted file mode 100644 index e91afb8655e5..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ /dev/null @@ -1,402 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:async'; -import 'package:dio/dio.dart'; -import 'package:built_value/serializer.dart'; - -import 'package:openapi/model/user.dart'; -import 'package:built_collection/built_collection.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. - Future> createUser( - User body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user', - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(User); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Creates list of users with given input array - /// - /// - Future> createUsersWithArrayInput( - BuiltList body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/createWithArray', - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(BuiltList, [FullType(User)]); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Creates list of users with given input array - /// - /// - Future> createUsersWithListInput( - BuiltList body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/createWithList', - method: 'POST', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(BuiltList, [FullType(User)]); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Delete user - /// - /// This can only be done by the logged in user. - Future> deleteUser( - String username, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()), - method: 'DELETE', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Get user by user name - /// - /// - Future> getUserByName( - String username, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()), - method: 'GET', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - const _responseType = FullType(User); - final _responseData = _serializers.deserialize( - _response.data, - specifiedType: _responseType, - ) as User; - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Logs user into the system - /// - /// - Future> loginUser( - String username, - String password, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/login', - method: 'GET', - headers: { - ...?headers, - }, - queryParameters: { - r'username': username, - r'password': password, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - final String _responseData = _response.data as String; - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - request: _response.request, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// Logs out current logged in user session - /// - /// - Future> logoutUser({ - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/logout', - method: 'GET', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - - /// Updated user - /// - /// This can only be done by the logged in user. - Future> updateUser( - String username, - User body, { - CancelToken cancelToken, - Map headers, - Map extra, - ValidateStatus validateStatus, - ProgressCallback onSendProgress, - ProgressCallback onReceiveProgress, - }) async { - final _request = RequestOptions( - path: r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()), - method: 'PUT', - headers: { - ...?headers, - }, - extra: { - 'secure': >[], - ...?extra, - }, - validateStatus: validateStatus, - contentType: [ - 'application/json', - ].first, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - dynamic _bodyData; - - const _type = FullType(User); - _bodyData = _serializers.serialize(body, specifiedType: _type); - - final _response = await _dio.request( - _request.path, - data: _bodyData, - options: _request, - ); - - return _response; - } - -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart deleted file mode 100644 index a6ce78558cf0..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api_util.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:convert'; - -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/serializer.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, specifiedType: type); - if (serialized is String) { - return serialized; - } - if (value is BuiltList || value is BuiltMap) { - return serialized; - } - return json.encode(serialized); -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart deleted file mode 100644 index 2aa45a85802c..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/api_key_auth.dart +++ /dev/null @@ -1,33 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:async'; -import 'package:openapi/auth/auth.dart'; -import 'package:dio/dio.dart'; - -class ApiKeyAuthInterceptor extends AuthInterceptor { - Map apiKeys = {}; - - @override - Future onRequest(RequestOptions options) { - final authInfo = getAuthInfo(options, 'apiKey'); - for (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; - } - } - } - return super.onRequest(options); - } -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart deleted file mode 100644 index de1ee79ca206..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/auth.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -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, String type) { - if (route.extra.containsKey('secure')) { - final auth = route.extra['secure'] as List>; - final results = >[]; - for (final info in auth) { - if (info['type'] == type) { - results.add(info); - } - } - return results; - } - return []; - } -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart deleted file mode 100644 index 37a65cb34d3b..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/basic_auth.dart +++ /dev/null @@ -1,38 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:async'; -import 'dart:convert'; -import 'package:openapi/auth/auth.dart'; -import 'package:dio/dio.dart'; - -class BasicAuthInfo { - final String username; - final String password; - - const BasicAuthInfo(this.username, this.password); -} - -class BasicAuthInterceptor extends AuthInterceptor { - Map authInfo = {}; - - @override - Future onRequest(RequestOptions options) { - final metadataAuthInfo = getAuthInfo(options, 'basic'); - for (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; - } - } - - return super.onRequest(options); - } -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart deleted file mode 100644 index 1768dcb69113..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/auth/oauth.dart +++ /dev/null @@ -1,27 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'dart:async'; -import 'package:openapi/auth/auth.dart'; -import 'package:dio/dio.dart'; - -class OAuthInterceptor extends AuthInterceptor { - Map tokens = {}; - - @override - Future onRequest(RequestOptions options) { - final authInfo = getAuthInfo(options, 'oauth'); - for (final info in authInfo) { - final token = tokens[info['name']]; - if (token != null) { - options.headers['Authorization'] = 'Bearer ${token}'; - break; - } - } - return super.onRequest(options); - } -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart deleted file mode 100644 index d1b4f0f3800c..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/api_response.dart +++ /dev/null @@ -1,97 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:built_value/built_value.dart'; -import 'package:built_value/serializer.dart'; - -part 'api_response.g.dart'; - -abstract class ApiResponse implements Built { - - @nullable - @BuiltValueField(wireName: r'code') - int get code; - - @nullable - @BuiltValueField(wireName: r'type') - String get type; - - @nullable - @BuiltValueField(wireName: r'message') - String get message; - - ApiResponse._(); - - static void _initializeBuilder(ApiResponseBuilder b) => b; - - factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$ApiResponseSerializer(); -} - -class _$ApiResponseSerializer implements StructuredSerializer { - - @override - final Iterable types = const [ApiResponse, _$ApiResponse]; - @override - final String wireName = r'ApiResponse'; - - @override - Iterable serialize(Serializers serializers, ApiResponse object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - if (object.code != null) { - result - ..add(r'code') - ..add(serializers.serialize(object.code, - specifiedType: const FullType(int))); - } - if (object.type != null) { - result - ..add(r'type') - ..add(serializers.serialize(object.type, - specifiedType: const FullType(String))); - } - if (object.message != null) { - result - ..add(r'message') - ..add(serializers.serialize(object.message, - specifiedType: const FullType(String))); - } - return result; - } - - @override - ApiResponse deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = ApiResponseBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final dynamic value = iterator.current; - switch (key) { - case r'code': - result.code = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'type': - result.type = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'message': - result.message = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - } - } - return result.build(); - } -} - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart deleted file mode 100644 index ddf1cf619b5c..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/category.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:built_value/built_value.dart'; -import 'package:built_value/serializer.dart'; - -part 'category.g.dart'; - -abstract class Category implements Built { - - @nullable - @BuiltValueField(wireName: r'id') - int get id; - - @nullable - @BuiltValueField(wireName: r'name') - String get name; - - Category._(); - - static void _initializeBuilder(CategoryBuilder b) => b; - - factory Category([void updates(CategoryBuilder b)]) = _$Category; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$CategorySerializer(); -} - -class _$CategorySerializer implements StructuredSerializer { - - @override - final Iterable types = const [Category, _$Category]; - @override - final String wireName = r'Category'; - - @override - Iterable serialize(Serializers serializers, Category object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - if (object.id != null) { - result - ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(int))); - } - if (object.name != null) { - result - ..add(r'name') - ..add(serializers.serialize(object.name, - specifiedType: const FullType(String))); - } - return result; - } - - @override - Category deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = CategoryBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final dynamic value = iterator.current; - switch (key) { - case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'name': - result.name = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - } - } - return result.build(); - } -} - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart deleted file mode 100644 index a599897e9377..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/order.dart +++ /dev/null @@ -1,162 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/built_value.dart'; -import 'package:built_value/serializer.dart'; - -part 'order.g.dart'; - -abstract class Order implements Built { - - @nullable - @BuiltValueField(wireName: r'id') - int get id; - - @nullable - @BuiltValueField(wireName: r'petId') - int get petId; - - @nullable - @BuiltValueField(wireName: r'quantity') - int get quantity; - - @nullable - @BuiltValueField(wireName: r'shipDate') - DateTime get shipDate; - - /// Order Status - @nullable - @BuiltValueField(wireName: r'status') - OrderStatusEnum get status; - // enum statusEnum { placed, approved, delivered, }; - - @BuiltValueField(wireName: r'complete') - bool get complete; - - Order._(); - - static void _initializeBuilder(OrderBuilder b) => b - ..complete = false; - - factory Order([void updates(OrderBuilder b)]) = _$Order; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$OrderSerializer(); -} - -class _$OrderSerializer implements StructuredSerializer { - - @override - final Iterable types = const [Order, _$Order]; - @override - final String wireName = r'Order'; - - @override - Iterable serialize(Serializers serializers, Order object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - if (object.id != null) { - result - ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(int))); - } - if (object.petId != null) { - result - ..add(r'petId') - ..add(serializers.serialize(object.petId, - specifiedType: const FullType(int))); - } - if (object.quantity != null) { - result - ..add(r'quantity') - ..add(serializers.serialize(object.quantity, - specifiedType: const FullType(int))); - } - if (object.shipDate != null) { - result - ..add(r'shipDate') - ..add(serializers.serialize(object.shipDate, - specifiedType: const FullType(DateTime))); - } - if (object.status != null) { - result - ..add(r'status') - ..add(serializers.serialize(object.status, - specifiedType: const FullType(OrderStatusEnum))); - } - if (object.complete != null) { - result - ..add(r'complete') - ..add(serializers.serialize(object.complete, - specifiedType: const FullType(bool))); - } - return result; - } - - @override - Order deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = OrderBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final dynamic value = iterator.current; - switch (key) { - case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'petId': - result.petId = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'quantity': - result.quantity = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'shipDate': - result.shipDate = serializers.deserialize(value, - specifiedType: const FullType(DateTime)) as DateTime; - break; - case r'status': - result.status = serializers.deserialize(value, - specifiedType: const FullType(OrderStatusEnum)) as OrderStatusEnum; - break; - case r'complete': - result.complete = serializers.deserialize(value, - specifiedType: const FullType(bool)) as bool; - break; - } - } - 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; - - 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/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart deleted file mode 100644 index e18fe54222c6..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/pet.dart +++ /dev/null @@ -1,158 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/tag.dart'; -import 'package:built_collection/built_collection.dart'; -import 'package:openapi/model/category.dart'; -import 'package:built_value/built_value.dart'; -import 'package:built_value/serializer.dart'; - -part 'pet.g.dart'; - -abstract class Pet implements Built { - - @nullable - @BuiltValueField(wireName: r'id') - int get id; - - @nullable - @BuiltValueField(wireName: r'category') - Category get category; - - @BuiltValueField(wireName: r'name') - String get name; - - @BuiltValueField(wireName: r'photoUrls') - BuiltList get photoUrls; - - @nullable - @BuiltValueField(wireName: r'tags') - BuiltList get tags; - - /// pet status in the store - @nullable - @BuiltValueField(wireName: r'status') - PetStatusEnum get status; - // enum statusEnum { available, pending, sold, }; - - Pet._(); - - static void _initializeBuilder(PetBuilder b) => b; - - factory Pet([void updates(PetBuilder b)]) = _$Pet; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$PetSerializer(); -} - -class _$PetSerializer implements StructuredSerializer { - - @override - final Iterable types = const [Pet, _$Pet]; - @override - final String wireName = r'Pet'; - - @override - Iterable serialize(Serializers serializers, Pet object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - if (object.id != null) { - result - ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(int))); - } - if (object.category != null) { - result - ..add(r'category') - ..add(serializers.serialize(object.category, - specifiedType: const FullType(Category))); - } - result - ..add(r'name') - ..add(serializers.serialize(object.name, - specifiedType: const FullType(String))); - result - ..add(r'photoUrls') - ..add(serializers.serialize(object.photoUrls, - specifiedType: const FullType(BuiltList, [FullType(String)]))); - if (object.tags != null) { - result - ..add(r'tags') - ..add(serializers.serialize(object.tags, - specifiedType: const FullType(BuiltList, [FullType(Tag)]))); - } - if (object.status != null) { - result - ..add(r'status') - ..add(serializers.serialize(object.status, - specifiedType: const FullType(PetStatusEnum))); - } - return result; - } - - @override - Pet deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = PetBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final dynamic value = iterator.current; - switch (key) { - case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'category': - result.category.replace(serializers.deserialize(value, - specifiedType: const FullType(Category)) as Category); - break; - case r'name': - result.name = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'photoUrls': - result.photoUrls.replace(serializers.deserialize(value, - specifiedType: const FullType(BuiltList, [FullType(String)])) as BuiltList); - break; - case r'tags': - result.tags.replace(serializers.deserialize(value, - specifiedType: const FullType(BuiltList, [FullType(Tag)])) as BuiltList); - break; - case r'status': - result.status = serializers.deserialize(value, - specifiedType: const FullType(PetStatusEnum)) as PetStatusEnum; - break; - } - } - 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; - - 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/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart deleted file mode 100644 index d612fdd0024e..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/tag.dart +++ /dev/null @@ -1,83 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:built_value/built_value.dart'; -import 'package:built_value/serializer.dart'; - -part 'tag.g.dart'; - -abstract class Tag implements Built { - - @nullable - @BuiltValueField(wireName: r'id') - int get id; - - @nullable - @BuiltValueField(wireName: r'name') - String get name; - - Tag._(); - - static void _initializeBuilder(TagBuilder b) => b; - - factory Tag([void updates(TagBuilder b)]) = _$Tag; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$TagSerializer(); -} - -class _$TagSerializer implements StructuredSerializer { - - @override - final Iterable types = const [Tag, _$Tag]; - @override - final String wireName = r'Tag'; - - @override - Iterable serialize(Serializers serializers, Tag object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - if (object.id != null) { - result - ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(int))); - } - if (object.name != null) { - result - ..add(r'name') - ..add(serializers.serialize(object.name, - specifiedType: const FullType(String))); - } - return result; - } - - @override - Tag deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = TagBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final dynamic value = iterator.current; - switch (key) { - case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'name': - result.name = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - } - } - return result.build(); - } -} - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart deleted file mode 100644 index a13b71072c21..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/model/user.dart +++ /dev/null @@ -1,168 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:built_value/built_value.dart'; -import 'package:built_value/serializer.dart'; - -part 'user.g.dart'; - -abstract class User implements Built { - - @nullable - @BuiltValueField(wireName: r'id') - int get id; - - @nullable - @BuiltValueField(wireName: r'username') - String get username; - - @nullable - @BuiltValueField(wireName: r'firstName') - String get firstName; - - @nullable - @BuiltValueField(wireName: r'lastName') - String get lastName; - - @nullable - @BuiltValueField(wireName: r'email') - String get email; - - @nullable - @BuiltValueField(wireName: r'password') - String get password; - - @nullable - @BuiltValueField(wireName: r'phone') - String get phone; - - /// User Status - @nullable - @BuiltValueField(wireName: r'userStatus') - int get userStatus; - - User._(); - - static void _initializeBuilder(UserBuilder b) => b; - - factory User([void updates(UserBuilder b)]) = _$User; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$UserSerializer(); -} - -class _$UserSerializer implements StructuredSerializer { - - @override - final Iterable types = const [User, _$User]; - @override - final String wireName = r'User'; - - @override - Iterable serialize(Serializers serializers, User object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - if (object.id != null) { - result - ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(int))); - } - if (object.username != null) { - result - ..add(r'username') - ..add(serializers.serialize(object.username, - specifiedType: const FullType(String))); - } - if (object.firstName != null) { - result - ..add(r'firstName') - ..add(serializers.serialize(object.firstName, - specifiedType: const FullType(String))); - } - if (object.lastName != null) { - result - ..add(r'lastName') - ..add(serializers.serialize(object.lastName, - specifiedType: const FullType(String))); - } - if (object.email != null) { - result - ..add(r'email') - ..add(serializers.serialize(object.email, - specifiedType: const FullType(String))); - } - if (object.password != null) { - result - ..add(r'password') - ..add(serializers.serialize(object.password, - specifiedType: const FullType(String))); - } - if (object.phone != null) { - result - ..add(r'phone') - ..add(serializers.serialize(object.phone, - specifiedType: const FullType(String))); - } - if (object.userStatus != null) { - result - ..add(r'userStatus') - ..add(serializers.serialize(object.userStatus, - specifiedType: const FullType(int))); - } - return result; - } - - @override - User deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = UserBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final dynamic value = iterator.current; - switch (key) { - case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - case r'username': - result.username = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'firstName': - result.firstName = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'lastName': - result.lastName = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'email': - result.email = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'password': - result.password = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'phone': - result.phone = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case r'userStatus': - result.userStatus = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; - break; - } - } - return result.build(); - } -} - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart deleted file mode 100644 index 2a0ebdc9af6d..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/serializers.dart +++ /dev/null @@ -1,50 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -library serializers; - -import 'package:built_value/iso_8601_date_time_serializer.dart'; -import 'package:built_value/serializer.dart'; -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/json_object.dart'; -import 'package:built_value/standard_json_plugin.dart'; - -import 'package:openapi/model/api_response.dart'; -import 'package:openapi/model/category.dart'; -import 'package:openapi/model/order.dart'; -import 'package:openapi/model/pet.dart'; -import 'package:openapi/model/tag.dart'; -import 'package:openapi/model/user.dart'; - -part 'serializers.g.dart'; - -@SerializersFor(const [ - ApiResponse, - Category, - Order, - Pet, - Tag, - User, -]) -Serializers serializers = (_$serializers.toBuilder() - ..addBuilderFactory( - const FullType(BuiltList, [FullType(Pet)]), - () => ListBuilder(), - ) - ..addBuilderFactory( - const FullType(BuiltMap, [FullType(String), FullType(int)]), - () => MapBuilder(), - ) - ..addBuilderFactory( - const FullType(BuiltList, [FullType(User)]), - () => ListBuilder(), - ) - ..add(Iso8601DateTimeSerializer())) - .build(); - -Serializers standardSerializers = - (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/pom.xml b/samples/client/petstore/dart-dio/petstore_client_lib/pom.xml deleted file mode 100644 index 3b0a69b823f4..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - 4.0.0 - org.openapitools - DartDioPetstoreClientLibOAS2Tests - pom - 1.0.0-SNAPSHOT - DartDio Petstore Client Lib OAS2 - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-run-build-runner - pre-integration-test - - exec - - - pub - - run - build_runner - build - - - - - dartanalyzer - integration-test - - exec - - - dartanalyzer - - --fatal-infos - --options - analysis_options.yaml - . - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml b/samples/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml deleted file mode 100644 index 0db393df2b7c..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/pubspec.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: openapi -version: 1.0.0 -description: OpenAPI API client -environment: - sdk: '>=2.7.0 <3.0.0' -dependencies: - dio: '^3.0.9' - built_value: '>=7.1.0 <8.0.0' - built_collection: '>=4.3.2 <5.0.0' -dev_dependencies: - built_value_generator: '>=7.1.0 <8.0.0' - build_runner: any - test: '>=1.3.0 <1.16.0' diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart deleted file mode 100644 index ae5d7fd6338d..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/api_response_test.dart +++ /dev/null @@ -1,35 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/api_response.dart'; -import 'package:test/test.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/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart deleted file mode 100644 index ce6d4e00e28a..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/category_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/category.dart'; -import 'package:test/test.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 - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart deleted file mode 100644 index 50510dbb3bb9..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/order_test.dart +++ /dev/null @@ -1,51 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/order.dart'; -import 'package:test/test.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 - }); - - // DateTime shipDate - test('to test the property `shipDate`', () async { - // TODO - }); - - // Order Status - // String status - test('to test the property `status`', () async { - // TODO - }); - - // bool complete (default value: false) - test('to test the property `complete`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart deleted file mode 100644 index 30d55c267fa6..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_api_test.dart +++ /dev/null @@ -1,81 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/api.dart'; -import 'package:openapi/api/pet_api.dart'; -import 'package:test/test.dart'; - - -/// tests for PetApi -void main() { - final instance = Openapi().getPetApi(); - - group(PetApi, () { - // Add a new pet to the store - // - //Future addPet(Pet body) 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(BuiltList 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 body) async - test('test updatePet', () async { - // TODO - }); - - // Updates a pet in the store with form data - // - //Future updatePetWithForm(int petId, { String name, String status }) async - test('test updatePetWithForm', () async { - // TODO - }); - - // uploads an image - // - //Future uploadFile(int petId, { String additionalMetadata, Uint8List file }) async - test('test uploadFile', () async { - // TODO - }); - - }); -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart deleted file mode 100644 index 289614ec5a02..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/pet_test.dart +++ /dev/null @@ -1,51 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/pet.dart'; -import 'package:test/test.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 - }); - - // BuiltList 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/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart deleted file mode 100644 index ea9c35cfa706..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/store_api_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/api.dart'; -import 'package:openapi/api/store_api.dart'; -import 'package:test/test.dart'; - - -/// tests for StoreApi -void main() { - final instance = Openapi().getStoreApi(); - - group(StoreApi, () { - // Delete purchase order by ID - // - // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - // - //Future deleteOrder(String orderId) async - test('test deleteOrder', () async { - // TODO - }); - - // Returns pet inventories by status - // - // Returns a map of status codes to quantities - // - //Future> getInventory() async - test('test getInventory', () async { - // TODO - }); - - // Find purchase order by ID - // - // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - // - //Future getOrderById(int orderId) async - test('test getOrderById', () async { - // TODO - }); - - // Place an order for a pet - // - //Future placeOrder(Order body) async - test('test placeOrder', () async { - // TODO - }); - - }); -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart deleted file mode 100644 index 0c8f000ee345..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/tag_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/tag.dart'; -import 'package:test/test.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/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart deleted file mode 100644 index 3e36ba981215..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/user_api_test.dart +++ /dev/null @@ -1,81 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/api.dart'; -import 'package:openapi/api/user_api.dart'; -import 'package:test/test.dart'; - - -/// tests for UserApi -void main() { - final instance = Openapi().getUserApi(); - - group(UserApi, () { - // Create user - // - // This can only be done by the logged in user. - // - //Future createUser(User body) async - test('test createUser', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithArrayInput(BuiltList body) async - test('test createUsersWithArrayInput', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithListInput(BuiltList body) 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 body) async - test('test updateUser', () async { - // TODO - }); - - }); -} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart b/samples/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart deleted file mode 100644 index 2dc6cb1fcaaa..000000000000 --- a/samples/client/petstore/dart-dio/petstore_client_lib/test/user_test.dart +++ /dev/null @@ -1,61 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.7 - -// ignore_for_file: unused_import - -import 'package:openapi/model/user.dart'; -import 'package:test/test.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 - }); - - - }); - -} diff --git a/samples/client/petstore/dart2/petstore/.analysis_options b/samples/client/petstore/dart2/petstore/.analysis_options deleted file mode 100644 index a10d4c5a05c9..000000000000 --- a/samples/client/petstore/dart2/petstore/.analysis_options +++ /dev/null @@ -1,2 +0,0 @@ -analyzer: - strong-mode: true diff --git a/samples/client/petstore/dart2/petstore/README.md b/samples/client/petstore/dart2/petstore/README.md deleted file mode 100644 index 2139c301745c..000000000000 --- a/samples/client/petstore/dart2/petstore/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Background - -## Current state of tests - -TL;DR currently the only tests are e2e tests that were adapted to use a faked http client. While pushing data around as a smoke test has some value, more testing is required. In particular we need comprehensive unit/integration tests. - -- an old set of e2e tests are skipped for CI, as they hit a live endpoint and so are inherently flaky - - `pet_test.dart` - - `store_test.dart` - - `user_test.dart` -- the above set of tests were adapted to use a faked http client - - the tests are not really well suited to being used with a stubbed client, many are basically just testing the endpoint logic - - while not a great set of tests, they do have some value as a smoke test for template changes -- the adapted tests and files that contain test data: - - `pet_test_fake_client.dart` - - `store_test_fake_client.dart` - - `user_test_fake_client.dart` - - `fake_client.dart` - - `file_upload_response.json` - -## Assumptions - -- the tests will be run as part of CI and so have access to dart:io - -# Running - -## If not already done, resolve dependencies - -`pub get` - -## To run tests in a single file: - -`pub run test test/pet_test.dart` - -## To run all tests in the test folder: - -`pub run test` diff --git a/samples/client/petstore/dart2/petstore/pom.xml b/samples/client/petstore/dart2/petstore/pom.xml deleted file mode 100644 index a14b4717c61f..000000000000 --- a/samples/client/petstore/dart2/petstore/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientOAS2Tests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client OAS2 - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/client/petstore/dart2/petstore/pubspec.yaml b/samples/client/petstore/dart2/petstore/pubspec.yaml deleted file mode 100644 index f26301750933..000000000000 --- a/samples/client/petstore/dart2/petstore/pubspec.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: petstore_client -version: 1.0.0 -description: Petstore client using OpenAPI library -environment: - sdk: '>=2.5.0 <3.0.0' -dependencies: - openapi: - path: ../petstore_client_lib -dev_dependencies: - test: ^1.8.0 - mockito: ^4.1.1 - http: ^0.12.0 - collection: ^1.14.12 diff --git a/samples/client/petstore/dart2/petstore/test/fake_client.dart b/samples/client/petstore/dart2/petstore/test/fake_client.dart deleted file mode 100644 index 95c735deb38c..000000000000 --- a/samples/client/petstore/dart2/petstore/test/fake_client.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'dart:convert'; - -import 'package:collection/collection.dart'; -import 'package:http/http.dart'; -import 'package:mockito/mockito.dart'; - -/// A fake client that checks for expected values and returns given responses -/// -/// Checks for the expected values (url, headers, body) and throws if not found -/// -/// If exception is non-null the request will throw the exception, after other -/// checks are performed -class FakeClient extends Fake implements Client { - FakeClient({ - this.throwException, - this.expectedPostRequestBody, - this.postResponseBody, - this.expectedGetRequestBody, - this.getResponseBody, - this.deleteResponseBody, - this.expectedPutRequestBody, - this.putResponseBody, - this.sendResponseBody, - this.expectedUrl, - this.expectedHeaders = null, - }); - - Exception throwException; - Object expectedPostRequestBody; - String postResponseBody; - String expectedGetRequestBody; - String getResponseBody; - String deleteResponseBody; - String expectedPutRequestBody; - String putResponseBody; - String sendResponseBody; - String expectedUrl; - Map expectedHeaders; - - @override - Future post(url, - {Map headers, body, Encoding encoding}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'POST was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'POST was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - // currently we only expect Map (and subtypes) or Strings - if (body is Map) { - if (!MapEquality().equals(body, expectedPostRequestBody)) { - throw StateError( - 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}'); - } - } else if (body != expectedPostRequestBody) { - throw StateError( - 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(postResponseBody, 200); - } - - @override - Future get(url, {Map headers}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'GET was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'GET was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(getResponseBody, 200); - } - - @override - Future delete(url, {Map headers}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'DELETE was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'DELETE was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(deleteResponseBody, 200); - } - - @override - Future put(url, - {Map headers, body, Encoding encoding}) async { - // check that the request was made with expected values - if (url != expectedUrl) { - throw StateError( - 'PUT was called with unexpected url: ${url} should be ${expectedUrl}'); - } - if (!MapEquality().equals(headers, expectedHeaders)) { - throw StateError( - 'PUT was called with unexpected headers: ${headers} should be ${expectedHeaders}'); - } - if (body != expectedPutRequestBody) { - throw StateError( - 'PUT was called with unexpected body: ${body} should be ${expectedPutRequestBody}'); - } - - // throw if set to throw - if (throwException != null) throw throwException; - - return Response(putResponseBody, 200); - } - - @override - Future send(BaseRequest request) async { - List bytes = utf8.encode(sendResponseBody); - return StreamedResponse(Stream.fromIterable([bytes]), 200); - } -} diff --git a/samples/client/petstore/dart2/petstore/test/file_upload_response.json b/samples/client/petstore/dart2/petstore/test/file_upload_response.json deleted file mode 100644 index 8855b00d9e38..000000000000 --- a/samples/client/petstore/dart2/petstore/test/file_upload_response.json +++ /dev/null @@ -1 +0,0 @@ -{"code":200,"type":"unknown","message":"additionalMetadata: \nFile uploaded to ./null, 4 bytes"} \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore/test/inventory_response.json b/samples/client/petstore/dart2/petstore/test/inventory_response.json deleted file mode 100644 index b4388d1e7b35..000000000000 --- a/samples/client/petstore/dart2/petstore/test/inventory_response.json +++ /dev/null @@ -1 +0,0 @@ -{"mine":1,"sold":18,"string":568,"Dead":2,"test":2,"Nonavailable":1,"custom":3,"pending":20,"available":2212,"notAvailable":26,"avaiflable":1,"AVAILABLE":1,"swimming":1,"availablee":2,"success":1,"105":1,"missing":11,"disabled":1,"Available":1,"]]>":1} \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore/test/order_model_test.dart b/samples/client/petstore/dart2/petstore/test/order_model_test.dart deleted file mode 100644 index 9cdc65fe52dc..000000000000 --- a/samples/client/petstore/dart2/petstore/test/order_model_test.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -void main() { - test('Check if default value is generated', () async { - var order = Order(); - expect(order.complete, equals(false)); - }); -} diff --git a/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart deleted file mode 100644 index 7d18af8762b2..000000000000 --- a/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart +++ /dev/null @@ -1,240 +0,0 @@ -import 'dart:io'; - -import 'package:http/http.dart'; -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'fake_client.dart'; -import 'random_id.dart'; - -void main() { - final petApi = PetApi(); - - Pet makePet({ - int id = 1234, - String name = 'Fluffy', - String status = '', - }) { - final category = Category() - ..id = 1234 - ..name = 'eyeColor'; - final tags = [ - Tag() - ..id = 1234 - ..name = 'New York', - Tag() - ..id = 124321 - ..name = 'Jose' - ]; - return Pet() - ..id = id - ..category = category - ..tags = tags - ..name = name - ..status = PetStatusEnum.fromJson(status) - ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; - } - - /// Setup the fake client then call [petApi.addPet] - Future addPet(Pet pet) { - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: await petApi.apiClient.serializeAsync(pet), - postResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - return petApi.addPet(pet); - } - - group('Pet API with faked client', () { - test('adds a new pet and gets it by id', () async { - final id = newId(); - final newPet = makePet(id: id); - - // use the pet api to add a pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), - postResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // retrieve the same pet by id - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - getResponseBody: await petApi.apiClient.serializeAsync(newPet), - ); - final retrievedPet = await petApi.getPetById(id); - - // check that the retrieved id is as expected - expect(retrievedPet.id, equals(id)); - }); - - test('doesn\'t get non-existing pet by id', () { - final id = newId(); - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - throwException: ApiException(400, 'not found'), - ); - expect( - petApi.getPetById(id), throwsA(equals(TypeMatcher()))); - }); - - test('deletes existing pet by id', () async { - final id = newId(); - Pet newPet = makePet(id: id); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), - postResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // delete the pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - expectedHeaders: {'api_key': 'special-key'}, - deleteResponseBody: '', - ); - await petApi.deletePet(id, apiKey: 'special-key'); - - // check for the deleted pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - throwException: ApiException(400, 'Not found'), - ); - expect( - petApi.getPetById(id), throwsA(equals(TypeMatcher()))); - }); - - test('updates pet with form', () async { - final id = newId(); - final newPet = makePet(id: id, name: 'Snowy'); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), - postResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - final multipartRequest = MultipartRequest(null, null); - multipartRequest.fields['name'] = 'Doge'; - multipartRequest.fields['status'] = ''; - - // update with form - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - expectedHeaders: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - expectedPostRequestBody: {'name': 'Doge', 'status': ''}, - postResponseBody: '', - ); - await petApi.updatePetWithForm(id, name: 'Doge', status: ''); - - // check update worked - newPet.name = 'Doge'; - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - getResponseBody: await petApi.apiClient.serializeAsync(newPet), - ); - final pet = await petApi.getPetById(id); - expect(pet.name, equals('Doge')); - }); - - test('updates existing pet', () async { - final id = newId(); - final name = 'Snowy'; - final newPet = makePet(id: id); - final updatePet = makePet(id: id, name: name); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), - postResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - // update the same pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPutRequestBody: - await petApi.apiClient.serializeAsync(updatePet), - putResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.updatePet(updatePet); - - // check update worked - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - getResponseBody: await petApi.apiClient.serializeAsync(updatePet), - ); - final pet = await petApi.getPetById(id); - expect(pet.name, equals(name)); - }); - - test('finds pets by status', () async { - final id1 = newId(); - final id2 = newId(); - final id3 = newId(); - final status = '${PetStatusEnum.available}'; - final pet1 = makePet(id: id1, status: status); - final pet2 = makePet(id: id2, status: status); - final pet3 = makePet(id: id3, status: '${PetStatusEnum.sold}'); - - await addPet(pet1); - await addPet(pet2); - await addPet(pet3); - - // retrieve pets by status - petApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/pet/findByStatus?status=$status', - getResponseBody: await petApi.apiClient.serializeAsync([pet1, pet2]), - ); - final pets = await petApi.findPetsByStatus([status]); - - // tests serialisation and deserialisation of enum - final petsByStatus = - pets.where((p) => p.status == PetStatusEnum.available); - expect(petsByStatus.length, equals(2)); - final petIds = pets.map((pet) => pet.id).toList(); - expect(petIds, contains(id1)); - expect(petIds, contains(id2)); - expect(petIds, isNot(contains(id3))); - }); - - test('uploads a pet image', () async { - final id = newId(); - final newPet = makePet(id: id); - // get some test data (recorded from live response) - final uploadResponse = - await File('test/file_upload_response.json').readAsString(); - - // add a new pet - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: - await petApi.apiClient.serializeAsync(newPet), - postResponseBody: '', - expectedHeaders: {'Content-Type': 'application/json'}); - await petApi.addPet(newPet); - - petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - sendResponseBody: uploadResponse, - ); - final file = - new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); - await petApi.uploadFile(id, additionalMetadata: '', file: file); - }); - }); -} diff --git a/samples/client/petstore/dart2/petstore/test/pet_test.dart b/samples/client/petstore/dart2/petstore/test/pet_test.dart deleted file mode 100644 index 72126ba6a904..000000000000 --- a/samples/client/petstore/dart2/petstore/test/pet_test.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'dart:async'; - -import 'package:http/http.dart'; -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'random_id.dart'; - -void main() { - var petApi = PetApi(); - - Pet makePet({ - int id = 1234, - String name = 'Fluffy', - String status = '', - }) { - final category = Category() - ..id = 1234 - ..name = 'eyeColor'; - final tags = [ - Tag() - ..id = 1234 - ..name = 'New York', - Tag() - ..id = 124321 - ..name = 'Jose' - ]; - - return Pet( - id: id, - category: category, - name: name, //required field - tags: tags, - photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field - ) - ..status = PetStatusEnum.fromJson(status) - ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; - } - - group('Pet API with live client', () { - test('adds a new pet and gets it by id', () async { - var id = newId(); - await petApi.addPet(makePet(id: id)); - var pet = await petApi.getPetById(id); - expect(pet.id, equals(id)); - }); - - test('doesn\'t get non-existing pet by id', () { - expect(petApi.getPetById(newId()), - throwsA(equals(TypeMatcher()))); - }); - - test('deletes existing pet by id', () async { - var id = newId(); - await petApi.addPet(makePet(id: id)); - await petApi.deletePet(id, apiKey: 'special-key'); - expect( - petApi.getPetById(id), throwsA(equals(TypeMatcher()))); - }); - - test('updates pet with form', () async { - var id = newId(); - - await petApi.addPet(makePet(id: id, name: 'Snowy')); - await petApi.updatePetWithForm(id, name: 'Doge', status: ''); - var pet = await petApi.getPetById(id); - expect(pet.name, equals('Doge')); - }); - - test('updates existing pet', () async { - var id = newId(); - var name = 'Snowy'; - - await petApi.addPet(makePet(id: id)); - await petApi.updatePet(makePet(id: id, name: name)); - var pet = await petApi.getPetById(id); - expect(pet.name, equals(name)); - }); - - test('finds pets by status', () async { - var id1 = newId(); - var id2 = newId(); - var id3 = newId(); - var status = '${PetStatusEnum.available}'; - - await petApi.addPet(makePet(id: id1, status: status)); - await petApi.addPet(makePet(id: id2, status: status)); - await petApi.addPet(makePet(id: id3, status: '${PetStatusEnum.sold}')); - - var pets = await petApi.findPetsByStatus([status]); - var petIds = pets.map((pet) => pet.id).toList(); - expect(petIds, contains(id1)); - expect(petIds, contains(id2)); - expect(petIds, isNot(contains(id3))); - }); - - test('uploads a pet image', () async { - var id = newId(); - await petApi.addPet(makePet(id: id)); - var file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); - await petApi.uploadFile(id, additionalMetadata: '', file: file); - }); - }, skip: 'e2e tests for CI'); -} diff --git a/samples/client/petstore/dart2/petstore/test/random_id.dart b/samples/client/petstore/dart2/petstore/test/random_id.dart deleted file mode 100644 index 0457428c7dd4..000000000000 --- a/samples/client/petstore/dart2/petstore/test/random_id.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'dart:math'; - -final _random = new Random(); - -int newId() { - return _random.nextInt(999999); -} \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore/test/store_faked_client_test.dart b/samples/client/petstore/dart2/petstore/test/store_faked_client_test.dart deleted file mode 100644 index 9f75fd55d863..000000000000 --- a/samples/client/petstore/dart2/petstore/test/store_faked_client_test.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'dart:io'; - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'fake_client.dart'; -import 'random_id.dart'; - -void main() { - var storeApi = new StoreApi(); - - Order makeOrder({int id}) { - return Order() - ..id = id - ..petId = 1234 - ..quantity = 1 - ..shipDate = DateTime.now() - ..status - ..complete = false; - } - - group('Store API with faked client', () { - test('places an order and gets it by id', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // final id = newId(); - // final newOrder = makeOrder(id: id); - - // // use the store api to add an order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order', - // expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), - // postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - // expectedHeaders: {"Content-Type": "application/json"} - // ); - // await storeApi.placeOrder(newOrder); - - // // retrieve the same order by id - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - // getResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - // ); - // final placedOrder = await storeApi.getOrderById(id); - // expect(placedOrder.id, equals(id)); - }); - - test('deletes an order', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // final id = newId(); - // final newOrder = makeOrder(id: id); - - // // use the store api to add an order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order', - // expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder), - // postResponseBody: await storeApi.apiClient.serializeAsync(newOrder), - // expectedHeaders: {"Content-Type": "application/json"} - // ); - // await storeApi.placeOrder(newOrder); - - // // delete the same order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - // deleteResponseBody: '', - // ); - // await storeApi.deleteOrder(id.toString()); - - // // try and retrieve the order - // storeApi.apiClient.client = FakeClient( - // expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id', - // throwException: ApiException(400, 'Not found'), - // ); - // expect(storeApi.getOrderById(id), - // throwsA(equals(TypeMatcher()))); - }); - - test('gets the store inventory', () async { - // get some test data (recorded from live response) - final inventoryResponse = - await File('test/inventory_response.json').readAsString(); - // use the store api to get the inventory - storeApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/store/inventory', - getResponseBody: inventoryResponse, - ); - Map inventory = await storeApi.getInventory(); - expect(inventory.length, isNot(equals(0))); - }); - }); -} diff --git a/samples/client/petstore/dart2/petstore/test/store_test.dart b/samples/client/petstore/dart2/petstore/test/store_test.dart deleted file mode 100644 index b2175238819c..000000000000 --- a/samples/client/petstore/dart2/petstore/test/store_test.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'random_id.dart'; - -void main() { - var storeApi = new StoreApi(); - - Order makeOrder({int id}) { - return Order() - ..id = id - ..petId = 1234 - ..quantity = 1 - ..shipDate = DateTime.now() - ..status - ..complete = false; - } - - group('Store API with live client', () { - test('places an order and gets it by id', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // var id = newId(); - - // await storeApi.placeOrder(makeOrder(id: id)); - // var order = await storeApi.getOrderById(id); - // expect(order.id, equals(id)); - }); - - test('deletes an order', () async { - // TODO: Please uncomment this after a content type of the petstore order in petstore.yaml is fixed. - // var id = newId(); - - // await storeApi.placeOrder(makeOrder(id: id)); - // await storeApi.deleteOrder(id.toString()); - // expect(storeApi.getOrderById(id), - // throwsA(equals(TypeMatcher()))); - }); - - test('gets the store inventory', () async { - Map inventory = await storeApi.getInventory(); - expect(inventory.length, isNot(equals(0))); - }); - }); // , skip: 'e2e tests for CI' -} diff --git a/samples/client/petstore/dart2/petstore/test/user_faked_client_test.dart b/samples/client/petstore/dart2/petstore/test/user_faked_client_test.dart deleted file mode 100644 index 53cc659a8f25..000000000000 --- a/samples/client/petstore/dart2/petstore/test/user_faked_client_test.dart +++ /dev/null @@ -1,174 +0,0 @@ -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'fake_client.dart'; -import 'random_id.dart'; - -void main() { - var userApi = new UserApi(); - - User makeUser( - {int id, String userName = 'username', String password = 'password'}) { - return User() - ..id = id - ..username = userName - ..firstName = 'firstname' - ..lastName = 'lastname' - ..email = 'email' - ..password = password - ..phone = 'phone' - ..userStatus = 0; - } - - group('User API with faked client', () { - test('creates a user', () async { - final id = newId(); - final username = 'Mally45'; - final newUser = makeUser(id: id, userName: username); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - - // retrieve the same user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/$username', - getResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - var user = await userApi.getUserByName(username); - expect(user.id, equals(id)); - }); - - test('creates users with list input', () async { - final firstId = newId(); - final joe = 'Joe'; - - final sally = 'Sally'; - final secondId = newId(); - - final users = [ - makeUser(id: firstId, userName: joe), - makeUser(id: secondId, userName: sally), - ]; - - // use the user api to create a list of users - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/createWithList', - expectedPostRequestBody: await userApi.apiClient.serializeAsync(users), - postResponseBody: await userApi.apiClient.serializeAsync(users), - ); - await userApi.createUsersWithListInput(users); - - // retrieve the users - userApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/user/${users.elementAt(0).username}', - getResponseBody: await userApi.apiClient.serializeAsync( - users.elementAt(0), - ), - ); - final firstUser = await userApi.getUserByName(joe); - userApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/user/${users.elementAt(1).username}', - getResponseBody: await userApi.apiClient.serializeAsync( - users.elementAt(1), - ), - ); - final secondUser = await userApi.getUserByName(sally); - expect(firstUser.id, equals(firstId)); - expect(secondUser.id, equals(secondId)); - }); - - test('updates a user', () async { - final username = 'Arkjam89'; - final email = 'test@example.com'; - final newUser = makeUser(id: newId(), userName: username); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - newUser.email = email; - - // use the user api to update the user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - expectedPutRequestBody: await userApi.apiClient.serializeAsync(newUser), - putResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.updateUser(username, newUser); - - // retrieve the same user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - getResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - var foundUser = await userApi.getUserByName(username); - expect(foundUser.email, equals(email)); - }); - - test('deletes a user', () async { - final username = 'Riddlem325'; - final newUser = makeUser(id: newId(), userName: username); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - - // delete the same user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - deleteResponseBody: '', - ); - await userApi.deleteUser(username); - - // try and retrieve the user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}', - throwException: ApiException(400, 'Not found'), - ); - expect(userApi.getUserByName(username), - throwsA(TypeMatcher())); - }); - - test('logs a user in', () async { - final username = 'sgarad625'; - final password = 'lokimoki1'; - final newUser = - makeUser(id: newId(), userName: username, password: password); - - // use the user api to create a user - userApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/user', - expectedPostRequestBody: - await userApi.apiClient.serializeAsync(newUser), - postResponseBody: await userApi.apiClient.serializeAsync(newUser), - ); - await userApi.createUser(newUser); - - // use the user api to login - userApi.apiClient.client = FakeClient( - expectedUrl: - 'http://petstore.swagger.io/v2/user/login?username=${newUser.username}&password=${newUser.password}', - getResponseBody: 'logged in user session:', - ); - final result = await userApi.loginUser(username, password); - expect(result, contains('logged in user session:')); - }); - }); -} diff --git a/samples/client/petstore/dart2/petstore/test/user_test.dart b/samples/client/petstore/dart2/petstore/test/user_test.dart deleted file mode 100644 index ea34b3713fa7..000000000000 --- a/samples/client/petstore/dart2/petstore/test/user_test.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -import 'random_id.dart'; - -void main() { - var userApi = new UserApi(); - - User makeUser( - {int id, String userName = 'username', String password = 'password'}) { - return User() - ..id = id - ..username = userName - ..firstName = 'firstname' - ..lastName = 'lastname' - ..email = 'email' - ..password = password - ..phone = 'phone' - ..userStatus = 0; - } - - group('User API with live client', () { - test('creates a user', () async { - var id = newId(); - var username = 'Mally45'; - await userApi.createUser(makeUser(id: id, userName: username)); - var user = await userApi.getUserByName(username); - expect(user.id, equals(id)); - }); - - test('creates users with list input', () async { - var firstId = newId(); - var joe = 'Joe'; - - var sally = 'Sally'; - var secondId = newId(); - - var users = [ - makeUser(id: firstId, userName: joe), - makeUser(id: secondId, userName: sally), - ]; - - await userApi.createUsersWithListInput(users); - var firstUser = await userApi.getUserByName(joe); - var secondUser = await userApi.getUserByName(sally); - expect(firstUser.id, equals(firstId)); - expect(secondUser.id, equals(secondId)); - }); - - test('updates a user', () async { - var username = 'Arkjam89'; - var email = 'test@example.com'; - var user = makeUser(id: newId(), userName: username); - - await userApi.createUser(user); - user.email = email; - await userApi.updateUser(username, user); - var foundUser = await userApi.getUserByName(username); - expect(foundUser.email, equals(email)); - }); - - test('deletes a user', () async { - var username = 'Riddlem325'; - await userApi.createUser(makeUser(id: newId(), userName: username)); - await userApi.deleteUser(username); - expect(userApi.getUserByName(username), - throwsA(TypeMatcher())); - }); - - test('logs a user in', () async { - var username = 'sgarad625'; - var password = 'lokimoki1'; - var user = makeUser(id: newId(), userName: username, password: password); - - await userApi.createUser(user); - var result = await userApi.loginUser(username, password); - expect(result, contains('logged in user session:')); - }); - }, skip: 'e2e tests for CI'); -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/.gitignore b/samples/client/petstore/dart2/petstore_client_lib/.gitignore deleted file mode 100644 index 7c2804416498..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# See https://www.dartlang.org/tools/private-files.html - -# Files and directories created by pub -.buildlog -.packages -.project -.pub/ -build/ -**/packages/ - -# Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these -# rules if you intend to use dart2js directly -# Convention is to use extension '.dart.js' for Dart compiled to Javascript to -# differentiate from explicit Javascript files) -*.dart.js -*.part.js -*.js.deps -*.js.map -*.info.json - -# Directory created by dartdoc -doc/api/ - -# Don't commit pubspec lock file -# (Library packages only! Remove pattern if developing an application package) -pubspec.lock diff --git a/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore b/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES b/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES deleted file mode 100644 index 7cc5afea8214..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES +++ /dev/null @@ -1,32 +0,0 @@ -.gitignore -.travis.yml -README.md -doc/ApiResponse.md -doc/Category.md -doc/Order.md -doc/Pet.md -doc/PetApi.md -doc/StoreApi.md -doc/Tag.md -doc/User.md -doc/UserApi.md -git_push.sh -lib/api.dart -lib/api/pet_api.dart -lib/api/store_api.dart -lib/api/user_api.dart -lib/api_client.dart -lib/api_exception.dart -lib/api_helper.dart -lib/auth/api_key_auth.dart -lib/auth/authentication.dart -lib/auth/http_basic_auth.dart -lib/auth/http_bearer_auth.dart -lib/auth/oauth.dart -lib/model/api_response.dart -lib/model/category.dart -lib/model/order.dart -lib/model/pet.dart -lib/model/tag.dart -lib/model/user.dart -pubspec.yaml diff --git a/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION b/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION deleted file mode 100644 index d509cc92aa80..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore_client_lib/.travis.yml b/samples/client/petstore/dart2/petstore_client_lib/.travis.yml deleted file mode 100644 index 1a3af66d54c7..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# -# AUTO-GENERATED FILE, DO NOT MODIFY! -# -# https://docs.travis-ci.com/user/languages/dart/ -# -language: dart -dart: -# Install a specific stable release -- "2.2.0" -install: -- pub get - -script: -- pub run test diff --git a/samples/client/petstore/dart2/petstore_client_lib/README.md b/samples/client/petstore/dart2/petstore_client_lib/README.md deleted file mode 100644 index 0ebc02a14a66..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# openapi -This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - -This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Build package: org.openapitools.codegen.languages.DartClientCodegen - -## Requirements - -Dart 2.0 or later - -## Installation & Usage - -### Github -If this Dart package is published to Github, add the following dependency to your pubspec.yaml -``` -dependencies: - openapi: - git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git -``` - -### Local -To use the package in your local drive, add the following dependency to your pubspec.yaml -``` -dependencies: - openapi: - path: /path/to/openapi -``` - -## Tests - -TODO - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -```dart -import 'package:openapi/api.dart'; - -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final body = Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(body); -} catch (e) { - print('Exception when calling PetApi->addPet: $e\n'); -} - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - -## Documentation For Models - - - [ApiResponse](doc//ApiResponse.md) - - [Category](doc//Category.md) - - [Order](doc//Order.md) - - [Pet](doc//Pet.md) - - [Tag](doc//Tag.md) - - [User](doc//User.md) - - -## Documentation For Authorization - - -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - -## Author - - - - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md b/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md deleted file mode 100644 index 7ad5da0f89e4..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# openapi.model.ApiResponse - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] -**type** | **String** | | [optional] -**message** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md deleted file mode 100644 index 98d0b14be7b1..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Category - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**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/client/petstore/dart2/petstore_client_lib/doc/Order.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md deleted file mode 100644 index bde5ffe51a2c..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Order - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**petId** | **int** | | [optional] -**quantity** | **int** | | [optional] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] -**status** | **String** | Order Status | [optional] -**complete** | **bool** | | [optional] [default to false] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md deleted file mode 100644 index 88512ee37035..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md +++ /dev/null @@ -1,20 +0,0 @@ -# openapi.model.Pet - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**category** | [**Category**](Category.md) | | [optional] -**name** | **String** | | -**photoUrls** | **List** | | [default to const []] -**tags** | [**List**](Tag.md) | | [optional] [default to const []] -**status** | **String** | pet status in the store | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md deleted file mode 100644 index 04c78f1b4271..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md +++ /dev/null @@ -1,379 +0,0 @@ -# openapi.api.PetApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image - - -# **addPet** -> addPet(body) - -Add a new pet to the store - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final body = Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.addPet(body); -} catch (e) { - print('Exception when calling PetApi->addPet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deletePet** -> deletePet(petId, apiKey) - -Deletes a pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | Pet id to delete -final apiKey = apiKey_example; // String | - -try { - api_instance.deletePet(petId, apiKey); -} catch (e) { - print('Exception when calling PetApi->deletePet: $e\n'); -} -``` - -### 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** -> List findPetsByStatus(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final status = []; // List | Status values that need to be considered for filter - -try { - final result = api_instance.findPetsByStatus(status); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByStatus: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findPetsByTags** -> List findPetsByTags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final tags = []; // List | Tags to filter by - -try { - final result = api_instance.findPetsByTags(tags); - print(result); -} catch (e) { - print('Exception when calling PetApi->findPetsByTags: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**List**](String.md)| Tags to filter by | [default to const []] - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getPetById** -> Pet getPetById(petId) - -Find pet by ID - -Returns a single pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//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_instance = PetApi(); -final petId = 789; // int | ID of pet to return - -try { - final result = api_instance.getPetById(petId); - print(result); -} catch (e) { - print('Exception when calling PetApi->getPetById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePet** -> updatePet(body) - -Update an existing pet - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final body = Pet(); // Pet | Pet object that needs to be added to the store - -try { - api_instance.updatePet(body); -} catch (e) { - print('Exception when calling PetApi->updatePet: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updatePetWithForm** -> updatePetWithForm(petId, name, status) - -Updates a pet in the store with form data - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet that needs to be updated -final name = name_example; // String | Updated name of the pet -final status = status_example; // String | Updated status of the pet - -try { - api_instance.updatePetWithForm(petId, name, status); -} catch (e) { - print('Exception when calling PetApi->updatePetWithForm: $e\n'); -} -``` - -### 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_instance = PetApi(); -final petId = 789; // int | ID of pet to update -final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server -final file = BINARY_DATA_HERE; // MultipartFile | file to upload - -try { - final result = api_instance.uploadFile(petId, additionalMetadata, file); - print(result); -} catch (e) { - print('Exception when calling PetApi->uploadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - **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) - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md deleted file mode 100644 index a8bd976dc5a3..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md +++ /dev/null @@ -1,186 +0,0 @@ -# openapi.api.StoreApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final orderId = orderId_example; // String | ID of the order that needs to be deleted - -try { - api_instance.deleteOrder(orderId); -} catch (e) { - print('Exception when calling StoreApi->deleteOrder: $e\n'); -} -``` - -### 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** -> Map getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: api_key -//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_instance = StoreApi(); - -try { - final result = api_instance.getInventory(); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getInventory: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final orderId = 789; // int | ID of pet that needs to be fetched - -try { - final result = api_instance.getOrderById(orderId); - print(result); -} catch (e) { - print('Exception when calling StoreApi->getOrderById: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **placeOrder** -> Order placeOrder(body) - -Place an order for a pet - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = StoreApi(); -final body = Order(); // Order | order placed for purchasing the pet - -try { - final result = api_instance.placeOrder(body); - print(result); -} catch (e) { - print('Exception when calling StoreApi->placeOrder: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md deleted file mode 100644 index c219f987c19c..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md +++ /dev/null @@ -1,16 +0,0 @@ -# openapi.model.Tag - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**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/client/petstore/dart2/petstore_client_lib/doc/User.md b/samples/client/petstore/dart2/petstore_client_lib/doc/User.md deleted file mode 100644 index fa87e64d8595..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/User.md +++ /dev/null @@ -1,22 +0,0 @@ -# openapi.model.User - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**username** | **String** | | [optional] -**firstName** | **String** | | [optional] -**lastName** | **String** | | [optional] -**email** | **String** | | [optional] -**password** | **String** | | [optional] -**phone** | **String** | | [optional] -**userStatus** | **int** | User Status | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md deleted file mode 100644 index e480f7e2aaec..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md +++ /dev/null @@ -1,349 +0,0 @@ -# openapi.api.UserApi - -## Load the API package -```dart -import 'package:openapi/api.dart'; -``` - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createuser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - -# **createUser** -> createUser(body) - -Create user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final body = User(); // User | Created user object - -try { - api_instance.createUser(body); -} catch (e) { - print('Exception when calling UserApi->createUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithArrayInput** -> createUsersWithArrayInput(body) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final body = [List()]; // List | List of user object - -try { - api_instance.createUsersWithArrayInput(body); -} catch (e) { - print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **createUsersWithListInput** -> createUsersWithListInput(body) - -Creates list of users with given input array - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final body = [List()]; // List | List of user object - -try { - api_instance.createUsersWithListInput(body); -} catch (e) { - print('Exception when calling UserApi->createUsersWithListInput: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | The name that needs to be deleted - -try { - api_instance.deleteUser(username); -} catch (e) { - print('Exception when calling UserApi->deleteUser: $e\n'); -} -``` - -### 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_instance = UserApi(); -final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. - -try { - final result = api_instance.getUserByName(username); - print(result); -} catch (e) { - print('Exception when calling UserApi->getUserByName: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | - -### 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_instance = UserApi(); -final username = username_example; // String | The user name for login -final password = password_example; // String | The password for login in clear text - -try { - final result = api_instance.loginUser(username, password); - print(result); -} catch (e) { - print('Exception when calling UserApi->loginUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **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_instance = UserApi(); - -try { - api_instance.logoutUser(); -} catch (e) { - print('Exception when calling UserApi->logoutUser: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **updateUser** -> updateUser(username, body) - -Updated user - -This can only be done by the logged in user. - -### Example -```dart -import 'package:openapi/api.dart'; - -final api_instance = UserApi(); -final username = username_example; // String | name that need to be deleted -final body = User(); // User | Updated user object - -try { - api_instance.updateUser(username, body); -} catch (e) { - print('Exception when calling UserApi->updateUser: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/dart2/petstore_client_lib/git_push.sh b/samples/client/petstore/dart2/petstore_client_lib/git_push.sh deleted file mode 100644 index ced3be2b0c7b..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/git_push.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart deleted file mode 100644 index f6bf3e75908d..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart +++ /dev/null @@ -1,48 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -library openapi.api; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:http/http.dart'; -import 'package:intl/intl.dart'; -import 'package:meta/meta.dart'; - -part 'api_client.dart'; -part 'api_helper.dart'; -part 'api_exception.dart'; -part 'auth/authentication.dart'; -part 'auth/api_key_auth.dart'; -part 'auth/oauth.dart'; -part 'auth/http_basic_auth.dart'; -part 'auth/http_bearer_auth.dart'; - -part 'api/pet_api.dart'; -part 'api/store_api.dart'; -part 'api/user_api.dart'; - -part 'model/api_response.dart'; -part 'model/category.dart'; -part 'model/order.dart'; -part 'model/pet.dart'; -part 'model/tag.dart'; -part 'model/user.dart'; - - -const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; -const _dateEpochMarker = 'epoch'; -final _dateFormatter = DateFormat('yyyy-MM-dd'); -final _regList = RegExp(r'^List<(.*)>$'); -final _regSet = RegExp(r'^Set<(.*)>$'); -final _regMap = RegExp(r'^Map$'); - -ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart deleted file mode 100644 index b38cbce1d3a1..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ /dev/null @@ -1,631 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class PetApi { - PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Add a new pet to the store - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] body (required): - /// Pet object that needs to be added to the store - Future addPetWithHttpInfo(Pet body) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/pet'; - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = ['application/json', 'application/xml']; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Add a new pet to the store - /// - /// Parameters: - /// - /// * [Pet] body (required): - /// Pet object that needs to be added to the store - Future addPet(Pet body) async { - final response = await addPetWithHttpInfo(body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Deletes a pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// Pet id to delete - /// - /// * [String] apiKey: - Future deletePetWithHttpInfo(int petId, { String apiKey }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - final path = r'/pet/{petId}' - .replaceAll('{' + 'petId' + '}', petId.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - if (apiKey != null) { - headerParams[r'api_key'] = parameterToString(apiKey); - } - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Deletes a pet - /// - /// Parameters: - /// - /// * [int] petId (required): - /// Pet id to delete - /// - /// * [String] apiKey: - Future deletePet(int petId, { String apiKey }) async { - final response = await deletePetWithHttpInfo(petId, apiKey: apiKey ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] status (required): - /// Status values that need to be considered for filter - Future findPetsByStatusWithHttpInfo(List status) async { - // Verify required params are set. - if (status == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); - } - - final path = r'/pet/findByStatus'; - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Finds Pets by status - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Parameters: - /// - /// * [List] status (required): - /// Status values that need to be considered for filter - Future> findPetsByStatus(List status) async { - final response = await findPetsByStatusWithHttpInfo(status); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List') as List) - .cast() - .toList(growable: false); - } - return Future>.value(null); - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] tags (required): - /// Tags to filter by - Future findPetsByTagsWithHttpInfo(List tags) async { - // Verify required params are set. - if (tags == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); - } - - final path = r'/pet/findByTags'; - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Parameters: - /// - /// * [List] tags (required): - /// Tags to filter by - Future> findPetsByTags(List tags) async { - final response = await findPetsByTagsWithHttpInfo(tags); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List') as List) - .cast() - .toList(growable: false); - } - return Future>.value(null); - } - - /// Find pet by ID - /// - /// Returns a single pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to return - Future getPetByIdWithHttpInfo(int petId) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - final path = r'/pet/{petId}' - .replaceAll('{' + 'petId' + '}', petId.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['api_key']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Find pet by ID - /// - /// Returns a single pet - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to return - Future getPetById(int petId) async { - final response = await getPetByIdWithHttpInfo(petId); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; - } - return Future.value(null); - } - - /// Update an existing pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Pet] body (required): - /// Pet object that needs to be added to the store - Future updatePetWithHttpInfo(Pet body) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/pet'; - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = ['application/json', 'application/xml']; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Update an existing pet - /// - /// Parameters: - /// - /// * [Pet] body (required): - /// Pet object that needs to be added to the store - Future updatePet(Pet body) async { - final response = await updatePetWithHttpInfo(body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Updates a pet in the store with form data - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet that needs to be updated - /// - /// * [String] name: - /// Updated name of the pet - /// - /// * [String] status: - /// Updated status of the pet - Future updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - final path = r'/pet/{petId}' - .replaceAll('{' + 'petId' + '}', petId.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = ['application/x-www-form-urlencoded']; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (name != null) { - hasFields = true; - mp.fields[r'name'] = parameterToString(name); - } - if (status != null) { - hasFields = true; - mp.fields[r'status'] = parameterToString(status); - } - if (hasFields) { - postBody = mp; - } - } else { - if (name != null) { - formParams[r'name'] = parameterToString(name); - } - if (status != null) { - formParams[r'status'] = parameterToString(status); - } - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Updates a pet in the store with form data - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet that needs to be updated - /// - /// * [String] name: - /// Updated name of the pet - /// - /// * [String] status: - /// Updated status of the pet - Future updatePetWithForm(int petId, { String name, String status }) async { - final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// uploads an image - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - /// - /// * [MultipartFile] file: - /// file to upload - Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async { - // Verify required params are set. - if (petId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); - } - - final path = r'/pet/{petId}/uploadImage' - .replaceAll('{' + 'petId' + '}', petId.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = ['multipart/form-data']; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['petstore_auth']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (additionalMetadata != null) { - hasFields = true; - mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - if (file != null) { - hasFields = true; - mp.fields[r'file'] = file.field; - mp.files.add(file); - } - if (hasFields) { - postBody = mp; - } - } else { - if (additionalMetadata != null) { - formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); - } - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// uploads an image - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - /// - /// * [String] additionalMetadata: - /// Additional data to pass to server - /// - /// * [MultipartFile] file: - /// file to upload - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { - final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file ); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; - } - return Future.value(null); - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart deleted file mode 100644 index 836d4ca8b0b9..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart +++ /dev/null @@ -1,289 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class StoreApi { - StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] orderId (required): - /// ID of the order that needs to be deleted - Future deleteOrderWithHttpInfo(String orderId) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - - final path = r'/store/order/{orderId}' - .replaceAll('{' + 'orderId' + '}', orderId.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Delete purchase order by ID - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Parameters: - /// - /// * [String] orderId (required): - /// ID of the order that needs to be deleted - Future deleteOrder(String orderId) async { - final response = await deleteOrderWithHttpInfo(orderId); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - /// - /// Note: This method returns the HTTP [Response]. - Future getInventoryWithHttpInfo() async { - final path = r'/store/inventory'; - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = ['api_key']; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - Future> getInventory() async { - final response = await getInventoryWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); - } - return Future>.value(null); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] orderId (required): - /// ID of pet that needs to be fetched - Future getOrderByIdWithHttpInfo(int orderId) async { - // Verify required params are set. - if (orderId == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); - } - - final path = r'/store/order/{orderId}' - .replaceAll('{' + 'orderId' + '}', orderId.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Parameters: - /// - /// * [int] orderId (required): - /// ID of pet that needs to be fetched - Future getOrderById(int orderId) async { - final response = await getOrderByIdWithHttpInfo(orderId); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; - } - return Future.value(null); - } - - /// Place an order for a pet - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [Order] body (required): - /// order placed for purchasing the pet - Future placeOrderWithHttpInfo(Order body) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/store/order'; - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Place an order for a pet - /// - /// Parameters: - /// - /// * [Order] body (required): - /// order placed for purchasing the pet - Future placeOrder(Order body) async { - final response = await placeOrderWithHttpInfo(body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; - } - return Future.value(null); - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart deleted file mode 100644 index 93b55fd2c41a..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart +++ /dev/null @@ -1,556 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - - -class UserApi { - UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - final ApiClient apiClient; - - /// Create user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [User] body (required): - /// Created user object - Future createUserWithHttpInfo(User body) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/user'; - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Create user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [User] body (required): - /// Created user object - Future createUser(User body) async { - final response = await createUserWithHttpInfo(body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Creates list of users with given input array - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] body (required): - /// List of user object - Future createUsersWithArrayInputWithHttpInfo(List body) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/user/createWithArray'; - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Creates list of users with given input array - /// - /// Parameters: - /// - /// * [List] body (required): - /// List of user object - Future createUsersWithArrayInput(List body) async { - final response = await createUsersWithArrayInputWithHttpInfo(body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Creates list of users with given input array - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [List] body (required): - /// List of user object - Future createUsersWithListInputWithHttpInfo(List body) async { - // Verify required params are set. - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/user/createWithList'; - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Creates list of users with given input array - /// - /// Parameters: - /// - /// * [List] body (required): - /// List of user object - Future createUsersWithListInput(List body) async { - final response = await createUsersWithListInputWithHttpInfo(body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Delete user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be deleted - Future deleteUserWithHttpInfo(String username) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - - final path = r'/user/{username}' - .replaceAll('{' + 'username' + '}', username.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Delete user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be deleted - Future deleteUser(String username) async { - final response = await deleteUserWithHttpInfo(username); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Get user by user name - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be fetched. Use user1 for testing. - Future getUserByNameWithHttpInfo(String username) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - - final path = r'/user/{username}' - .replaceAll('{' + 'username' + '}', username.toString()); - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Get user by user name - /// - /// Parameters: - /// - /// * [String] username (required): - /// The name that needs to be fetched. Use user1 for testing. - Future getUserByName(String username) async { - final response = await getUserByNameWithHttpInfo(username); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; - } - return Future.value(null); - } - - /// Logs user into the system - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// The user name for login - /// - /// * [String] password (required): - /// The password for login in clear text - Future loginUserWithHttpInfo(String username, String password) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (password == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); - } - - final path = r'/user/login'; - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); - queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Logs user into the system - /// - /// Parameters: - /// - /// * [String] username (required): - /// The user name for login - /// - /// * [String] password (required): - /// The password for login in clear text - Future loginUser(String username, String password) async { - final response = await loginUserWithHttpInfo(username, password); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body != null && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; - } - return Future.value(null); - } - - /// Logs out current logged in user session - /// - /// Note: This method returns the HTTP [Response]. - Future logoutUserWithHttpInfo() async { - final path = r'/user/logout'; - - Object postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Logs out current logged in user session - Future logoutUser() async { - final response = await logoutUserWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - - /// Updated user - /// - /// This can only be done by the logged in user. - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [String] username (required): - /// name that need to be deleted - /// - /// * [User] body (required): - /// Updated user object - Future updateUserWithHttpInfo(String username, User body) async { - // Verify required params are set. - if (username == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); - } - if (body == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: body'); - } - - final path = r'/user/{username}' - .replaceAll('{' + 'username' + '}', username.toString()); - - Object postBody = body; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - final contentTypes = []; - final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; - final authNames = []; - - if ( - nullableContentType != null && - nullableContentType.toLowerCase().startsWith('multipart/form-data') - ) { - bool hasFields = false; - final mp = MultipartRequest(null, null); - if (hasFields) { - postBody = mp; - } - } else { - } - - return await apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - nullableContentType, - authNames, - ); - } - - /// Updated user - /// - /// This can only be done by the logged in user. - /// - /// Parameters: - /// - /// * [String] username (required): - /// name that need to be deleted - /// - /// * [User] body (required): - /// Updated user object - Future updateUser(String username, User body) async { - final response = await updateUserWithHttpInfo(username, body); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart deleted file mode 100644 index c847d27f60b1..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ /dev/null @@ -1,272 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiClient { - ApiClient({this.basePath = 'http://petstore.swagger.io/v2'}) { - // Setup authentications (key: authentication name, value: authentication). - _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); - _authentications[r'petstore_auth'] = OAuth(); - } - - final String basePath; - - var _client = Client(); - - /// Returns the current HTTP [Client] instance to use in this class. - /// - /// The return value is guaranteed to never be null. - Client get client => _client; - - /// Requests to use a new HTTP [Client] in this class. - /// - /// If the [newClient] is null, an [ArgumentError] is thrown. - set client(Client newClient) { - if (newClient == null) { - throw ArgumentError('New client instance cannot be null.'); - } - _client = newClient; - } - - final _defaultHeaderMap = {}; - final _authentications = {}; - - void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; - } - - Map get defaultHeaderMap => _defaultHeaderMap; - - /// Returns an unmodifiable [Map] of the authentications, since none should be added - /// or deleted. - Map get authentications => Map.unmodifiable(_authentications); - - T getAuthentication(String name) { - final authentication = _authentications[name]; - return authentication is T ? authentication : null; - } - - // We don't use a Map for queryParams. - // If collectionFormat is 'multi', a key might appear multiple times. - Future invokeAPI( - String path, - String method, - Iterable queryParams, - Object body, - Map headerParams, - Map formParams, - String nullableContentType, - List authNames, - ) async { - _updateParamsForAuth(authNames, queryParams, headerParams); - - headerParams.addAll(_defaultHeaderMap); - - final urlEncodedQueryParams = queryParams - .where((param) => param.value != null) - .map((param) => '$param'); - - final queryString = urlEncodedQueryParams.isNotEmpty - ? '?${urlEncodedQueryParams.join('&')}' - : ''; - - final url = '$basePath$path$queryString'; - - if (nullableContentType != null) { - headerParams['Content-Type'] = nullableContentType; - } - - try { - // Special case for uploading a single file which isn't a 'multipart/form-data'. - if ( - body is MultipartFile && (nullableContentType == null || - !nullableContentType.toLowerCase().startsWith('multipart/form-data')) - ) { - final request = StreamedRequest(method, Uri.parse(url)); - request.headers.addAll(headerParams); - request.contentLength = body.length; - body.finalize().listen( - request.sink.add, - onDone: request.sink.close, - onError: (error, trace) => request.sink.close(), - cancelOnError: true, - ); - final response = await _client.send(request); - return Response.fromStream(response); - } - - if (body is MultipartRequest) { - final request = MultipartRequest(method, Uri.parse(url)); - request.fields.addAll(body.fields); - request.files.addAll(body.files); - request.headers.addAll(body.headers); - request.headers.addAll(headerParams); - final response = await _client.send(request); - return Response.fromStream(response); - } - - final msgBody = nullableContentType == 'application/x-www-form-urlencoded' - ? formParams - : await serializeAsync(body); - final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; - - switch(method) { - case 'POST': return await _client.post(url, headers: nullableHeaderParams, body: msgBody,); - case 'PUT': return await _client.put(url, headers: nullableHeaderParams, body: msgBody,); - case 'DELETE': return await _client.delete(url, headers: nullableHeaderParams,); - case 'PATCH': return await _client.patch(url, headers: nullableHeaderParams, body: msgBody,); - case 'HEAD': return await _client.head(url, headers: nullableHeaderParams,); - case 'GET': return await _client.get(url, headers: nullableHeaderParams,); - } - } on SocketException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); - } on TlsException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); - } on IOException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); - } on ClientException catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); - } on Exception catch (e, trace) { - throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); - } - - throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); - } - - Future deserializeAsync(String json, String targetType, {bool growable}) async => - // ignore: deprecated_member_use_from_same_package - deserialize(json, targetType, growable: growable); - - @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') - dynamic deserialize(String json, String targetType, {bool growable}) { - // Remove all spaces. Necessary for regular expressions as well. - targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments - - // If the expected target type is String, nothing to do... - return targetType == 'String' - ? json - : _deserialize(jsonDecode(json), targetType, growable: growable == true); - } - - // ignore: deprecated_member_use_from_same_package - Future serializeAsync(Object value) async => serialize(value); - - @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') - String serialize(Object value) => value == null ? '' : json.encode(value); - - /// Update query and header parameters based on authentication settings. - /// @param authNames The authentications to apply - void _updateParamsForAuth( - List authNames, - List queryParams, - Map headerParams, - ) { - authNames.forEach((authName) { - final auth = _authentications[authName]; - if (auth == null) { - throw ArgumentError('Authentication undefined: $authName'); - } - auth.applyToParams(queryParams, headerParams); - }); - } - - static dynamic _deserialize(dynamic value, String targetType, {bool growable}) { - try { - switch (targetType) { - case 'String': - return '$value'; - case 'int': - return value is int ? value : int.parse('$value'); - case 'bool': - if (value is bool) { - return value; - } - final valueString = '$value'.toLowerCase(); - return valueString == 'true' || valueString == '1'; - break; - case 'double': - return value is double ? value : double.parse('$value'); - case 'ApiResponse': - return ApiResponse.fromJson(value); - case 'Category': - return Category.fromJson(value); - case 'Order': - return Order.fromJson(value); - case 'Pet': - return Pet.fromJson(value); - case 'Tag': - return Tag.fromJson(value); - case 'User': - return User.fromJson(value); - default: - Match match; - if (value is List && (match = _regList.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments - return value - .map((v) => _deserialize(v, targetType, growable: growable)) - .toList(growable: growable); - } - if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments - return value - .map((v) => _deserialize(v, targetType, growable: growable)) - .toSet(); - } - if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match[1]; // ignore: parameter_assignments - return Map.fromIterables( - value.keys, - value.values.map((v) => _deserialize(v, targetType, growable: growable)), - ); - } - break; - } - } catch (error, trace) { - throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,); - } - throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); - } -} - -/// Primarily intended for use in an isolate. -class DeserializationMessage { - const DeserializationMessage({ - @required this.json, - @required this.targetType, - this.growable, - }); - - /// The JSON value to deserialize. - final String json; - - /// Target type to deserialize to. - final String targetType; - - /// Whether to make deserialized lists or maps growable. - final bool growable; -} - -/// Primarily intended for use in an isolate. -Future deserializeAsync(DeserializationMessage message) async { - // Remove all spaces. Necessary for regular expressions as well. - final targetType = message.targetType.replaceAll(' ', ''); - - // If the expected target type is String, nothing to do... - return targetType == 'String' - ? message.json - : ApiClient._deserialize( - jsonDecode(message.json), - targetType, - growable: message.growable == true, - ); -} - -/// Primarily intended for use in an isolate. -Future serializeAsync(Object value) async => value == null ? '' : json.encode(value); diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart deleted file mode 100644 index 1537c9769b21..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiException implements Exception { - ApiException(this.code, this.message); - - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); - - int code = 0; - String message; - Exception innerException; - StackTrace stackTrace; - - String toString() { - if (message == null) { - return 'ApiException'; - } - if (innerException == null) { - return 'ApiException $code: $message'; - } - return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart deleted file mode 100644 index 4135dcf95b26..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart +++ /dev/null @@ -1,71 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class QueryParam { - const QueryParam(this.name, this.value); - - final String name; - final String value; - - @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; -} - -// Ported from the Java version. -Iterable _convertParametersForCollectionFormat( - String collectionFormat, - String name, - dynamic value, -) { - final params = []; - - // preconditions - if (name != null && !name.isEmpty && value != null) { - if (value is List) { - // get the collection format, default: csv - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) - ? 'csv' - : collectionFormat; - - if (collectionFormat == 'multi') { - return value.map((v) => QueryParam(name, parameterToString(v))); - } - - final delimiter = _delimiters[collectionFormat] ?? ','; - - params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter))); - } else { - params.add(QueryParam(name, parameterToString(value))); - } - } - - return params; -} - -/// Format the given parameter object into a [String]. -String parameterToString(dynamic value) { - if (value == null) { - return ''; - } - if (value is DateTime) { - return value.toUtc().toIso8601String(); - } - return value.toString(); -} - -/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' -/// content type. Otherwise, returns the decoded body as decoded by dart:http package. -Future _decodeBodyBytes(Response response) async { - final contentType = response.headers['content-type']; - return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) - : response.body; -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart deleted file mode 100644 index 41a4afd85d90..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart +++ /dev/null @@ -1,35 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiKeyAuth implements Authentication { - ApiKeyAuth(this.location, this.paramName); - - final String location; - final String paramName; - - String apiKeyPrefix; - String apiKey; - - @override - void applyToParams(List queryParams, Map headerParams) { - final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; - - if (location == 'query' && value != null) { - queryParams.add(QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } else if (location == 'cookie' && value != null) { - headerParams.update('Cookie', (String existingCookie) { - return '$existingCookie; $paramName=$value'; - }, ifAbsent: () => '$paramName=$value'); - } - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart deleted file mode 100644 index 5ca198d41fdb..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart +++ /dev/null @@ -1,15 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -abstract class Authentication { - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart deleted file mode 100644 index 6dc36a13f497..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart +++ /dev/null @@ -1,21 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class HttpBasicAuth implements Authentication { - String username; - String password; - - @override - void applyToParams(List queryParams, Map headerParams) { - final credentials = (username ?? '') + ':' + (password ?? ''); - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart deleted file mode 100644 index a23b65fac5ed..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart +++ /dev/null @@ -1,38 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -typedef HttpBearerAuthProvider = String Function(); - -class HttpBearerAuth implements Authentication { - HttpBearerAuth(); - - dynamic _accessToken; - - dynamic get accessToken => _accessToken; - - set accessToken(dynamic accessToken) { - if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); - } - this._accessToken = accessToken; - } - - @override - void applyToParams(List queryParams, Map headerParams) { - if (_accessToken is String) { - headerParams['Authorization'] = 'Bearer $_accessToken'; - } else if (_accessToken is HttpBearerAuthProvider) { - headerParams['Authorization'] = 'Bearer ${_accessToken()}'; - } else { - throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); - } - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart deleted file mode 100644 index c0463ad39008..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart +++ /dev/null @@ -1,23 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class OAuth implements Authentication { - OAuth({this.accessToken}); - - String accessToken; - - @override - void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams['Authorization'] = 'Bearer $accessToken'; - } - } -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart deleted file mode 100644 index bd80caff35c7..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart +++ /dev/null @@ -1,89 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class ApiResponse { - /// Returns a new [ApiResponse] instance. - ApiResponse({ - this.code, - this.type, - this.message, - }); - - int code; - - String type; - - String message; - - @override - bool operator ==(Object other) => identical(this, other) || other is ApiResponse && - other.code == code && - other.type == type && - other.message == message; - - @override - int get hashCode => - (code == null ? 0 : code.hashCode) + - (type == null ? 0 : type.hashCode) + - (message == null ? 0 : message.hashCode); - - @override - String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; - - Map toJson() { - final json = {}; - if (code != null) { - json[r'code'] = code; - } - if (type != null) { - json[r'type'] = type; - } - if (message != null) { - json[r'message'] = message; - } - return json; - } - - /// Returns a new [ApiResponse] instance and imports its values from - /// [json] if it's non-null, null if [json] is null. - static ApiResponse fromJson(Map json) => json == null - ? null - : ApiResponse( - code: json[r'code'], - type: json[r'type'], - message: json[r'message'], - ); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json.map((v) => ApiResponse.fromJson(v)).toList(growable: true == growable); - - static Map mapFromJson(Map json) { - final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ApiResponse.fromJson(v)); - } - return map; - } - - // maps a json object with a list of ApiResponse-objects as value to a dart map - static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { - final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ApiResponse.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); - }); - } - return map; - } -} - diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart deleted file mode 100644 index c63ffb1734fd..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart +++ /dev/null @@ -1,80 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class Category { - /// Returns a new [Category] instance. - Category({ - this.id, - this.name, - }); - - int id; - - String name; - - @override - bool operator ==(Object other) => identical(this, other) || other is Category && - other.id == id && - other.name == name; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); - - @override - String toString() => 'Category[id=$id, name=$name]'; - - Map toJson() { - final json = {}; - if (id != null) { - json[r'id'] = id; - } - if (name != null) { - json[r'name'] = name; - } - return json; - } - - /// Returns a new [Category] instance and imports its values from - /// [json] if it's non-null, null if [json] is null. - static Category fromJson(Map json) => json == null - ? null - : Category( - id: json[r'id'], - name: json[r'name'], - ); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json.map((v) => Category.fromJson(v)).toList(growable: true == growable); - - static Map mapFromJson(Map json) { - final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Category.fromJson(v)); - } - return map; - } - - // maps a json object with a list of Category-objects as value to a dart map - static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { - final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Category.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); - }); - } - return map; - } -} - diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart deleted file mode 100644 index a7b01582664c..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ /dev/null @@ -1,188 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class Order { - /// Returns a new [Order] instance. - Order({ - this.id, - this.petId, - this.quantity, - this.shipDate, - this.status, - this.complete = false, - }); - - int id; - - int petId; - - int quantity; - - DateTime shipDate; - - /// Order Status - OrderStatusEnum status; - - bool complete; - - @override - bool operator ==(Object other) => identical(this, other) || other is Order && - other.id == id && - other.petId == petId && - other.quantity == quantity && - other.shipDate == shipDate && - other.status == status && - other.complete == complete; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (petId == null ? 0 : petId.hashCode) + - (quantity == null ? 0 : quantity.hashCode) + - (shipDate == null ? 0 : shipDate.hashCode) + - (status == null ? 0 : status.hashCode) + - (complete == null ? 0 : complete.hashCode); - - @override - String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; - - Map toJson() { - final json = {}; - if (id != null) { - json[r'id'] = id; - } - if (petId != null) { - json[r'petId'] = petId; - } - if (quantity != null) { - json[r'quantity'] = quantity; - } - if (shipDate != null) { - json[r'shipDate'] = shipDate.toUtc().toIso8601String(); - } - if (status != null) { - json[r'status'] = status; - } - if (complete != null) { - json[r'complete'] = complete; - } - return json; - } - - /// Returns a new [Order] instance and imports its values from - /// [json] if it's non-null, null if [json] is null. - static Order fromJson(Map json) => json == null - ? null - : Order( - id: json[r'id'], - petId: json[r'petId'], - quantity: json[r'quantity'], - shipDate: json[r'shipDate'] == null - ? null - : DateTime.parse(json[r'shipDate']), - status: OrderStatusEnum.fromJson(json[r'status']), - complete: json[r'complete'], - ); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json.map((v) => Order.fromJson(v)).toList(growable: true == growable); - - static Map mapFromJson(Map json) { - final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Order.fromJson(v)); - } - return map; - } - - // maps a json object with a list of Order-objects as value to a dart map - static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { - final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Order.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); - }); - } - return map; - } -} - -/// Order Status -class OrderStatusEnum { - /// Instantiate a new enum with the provided [value]. - const OrderStatusEnum._(this.value); - - /// The underlying value of this enum member. - final String value; - - @override - String toString() => value; - - String toJson() => value; - - static const placed = OrderStatusEnum._(r'placed'); - static const approved = OrderStatusEnum._(r'approved'); - static const delivered = OrderStatusEnum._(r'delivered'); - - /// List of all possible values in this [enum][OrderStatusEnum]. - static const values = [ - placed, - approved, - delivered, - ]; - - static OrderStatusEnum fromJson(dynamic value) => - OrderStatusEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json - .map((value) => OrderStatusEnum.fromJson(value)) - .toList(growable: true == growable); -} - -/// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, -/// and [decode] dynamic data back to [OrderStatusEnum]. -class OrderStatusEnumTypeTransformer { - const OrderStatusEnumTypeTransformer._(); - - factory OrderStatusEnumTypeTransformer() => _instance ??= OrderStatusEnumTypeTransformer._(); - - String encode(OrderStatusEnum data) => data.value; - - /// Decodes a [dynamic value][data] to a OrderStatusEnum. - /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - OrderStatusEnum decode(dynamic data, {bool allowNull}) { - switch (data) { - case r'placed': return OrderStatusEnum.placed; - case r'approved': return OrderStatusEnum.approved; - case r'delivered': return OrderStatusEnum.delivered; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } - return null; - } - - /// Singleton [OrderStatusEnumTypeTransformer] instance. - static OrderStatusEnumTypeTransformer _instance; -} - diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart deleted file mode 100644 index ee8c76159861..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ /dev/null @@ -1,184 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class Pet { - /// Returns a new [Pet] instance. - Pet({ - this.id, - this.category, - @required this.name, - this.photoUrls = const [], - this.tags = const [], - this.status, - }); - - int id; - - Category category; - - String name; - - List photoUrls; - - List tags; - - /// pet status in the store - PetStatusEnum status; - - @override - bool operator ==(Object other) => identical(this, other) || other is Pet && - other.id == id && - other.category == category && - other.name == name && - other.photoUrls == photoUrls && - other.tags == tags && - other.status == status; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (category == null ? 0 : category.hashCode) + - (name == null ? 0 : name.hashCode) + - (photoUrls == null ? 0 : photoUrls.hashCode) + - (tags == null ? 0 : tags.hashCode) + - (status == null ? 0 : status.hashCode); - - @override - String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; - - Map toJson() { - final json = {}; - if (id != null) { - json[r'id'] = id; - } - if (category != null) { - json[r'category'] = category; - } - json[r'name'] = name; - json[r'photoUrls'] = photoUrls; - if (tags != null) { - json[r'tags'] = tags; - } - if (status != null) { - json[r'status'] = status; - } - return json; - } - - /// Returns a new [Pet] instance and imports its values from - /// [json] if it's non-null, null if [json] is null. - static Pet fromJson(Map json) => json == null - ? null - : Pet( - id: json[r'id'], - category: Category.fromJson(json[r'category']), - name: json[r'name'], - photoUrls: json[r'photoUrls'] == null - ? null - : (json[r'photoUrls'] as List).cast(), - tags: Tag.listFromJson(json[r'tags']), - status: PetStatusEnum.fromJson(json[r'status']), - ); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json.map((v) => Pet.fromJson(v)).toList(growable: true == growable); - - static Map mapFromJson(Map json) { - final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Pet.fromJson(v)); - } - return map; - } - - // maps a json object with a list of Pet-objects as value to a dart map - static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { - final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Pet.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); - }); - } - return map; - } -} - -/// pet status in the store -class PetStatusEnum { - /// Instantiate a new enum with the provided [value]. - const PetStatusEnum._(this.value); - - /// The underlying value of this enum member. - final String value; - - @override - String toString() => value; - - String toJson() => value; - - static const available = PetStatusEnum._(r'available'); - static const pending = PetStatusEnum._(r'pending'); - static const sold = PetStatusEnum._(r'sold'); - - /// List of all possible values in this [enum][PetStatusEnum]. - static const values = [ - available, - pending, - sold, - ]; - - static PetStatusEnum fromJson(dynamic value) => - PetStatusEnumTypeTransformer().decode(value); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json - .map((value) => PetStatusEnum.fromJson(value)) - .toList(growable: true == growable); -} - -/// Transformation class that can [encode] an instance of [PetStatusEnum] to String, -/// and [decode] dynamic data back to [PetStatusEnum]. -class PetStatusEnumTypeTransformer { - const PetStatusEnumTypeTransformer._(); - - factory PetStatusEnumTypeTransformer() => _instance ??= PetStatusEnumTypeTransformer._(); - - String encode(PetStatusEnum data) => data.value; - - /// Decodes a [dynamic value][data] to a PetStatusEnum. - /// - /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, - /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] - /// cannot be decoded successfully, then an [UnimplementedError] is thrown. - /// - /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, - /// and users are still using an old app with the old code. - PetStatusEnum decode(dynamic data, {bool allowNull}) { - switch (data) { - case r'available': return PetStatusEnum.available; - case r'pending': return PetStatusEnum.pending; - case r'sold': return PetStatusEnum.sold; - default: - if (allowNull == false) { - throw ArgumentError('Unknown enum value to decode: $data'); - } - } - return null; - } - - /// Singleton [PetStatusEnumTypeTransformer] instance. - static PetStatusEnumTypeTransformer _instance; -} - diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart deleted file mode 100644 index 63132f08a3a7..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart +++ /dev/null @@ -1,80 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class Tag { - /// Returns a new [Tag] instance. - Tag({ - this.id, - this.name, - }); - - int id; - - String name; - - @override - bool operator ==(Object other) => identical(this, other) || other is Tag && - other.id == id && - other.name == name; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (name == null ? 0 : name.hashCode); - - @override - String toString() => 'Tag[id=$id, name=$name]'; - - Map toJson() { - final json = {}; - if (id != null) { - json[r'id'] = id; - } - if (name != null) { - json[r'name'] = name; - } - return json; - } - - /// Returns a new [Tag] instance and imports its values from - /// [json] if it's non-null, null if [json] is null. - static Tag fromJson(Map json) => json == null - ? null - : Tag( - id: json[r'id'], - name: json[r'name'], - ); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json.map((v) => Tag.fromJson(v)).toList(growable: true == growable); - - static Map mapFromJson(Map json) { - final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Tag.fromJson(v)); - } - return map; - } - - // maps a json object with a list of Tag-objects as value to a dart map - static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { - final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Tag.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); - }); - } - return map; - } -} - diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart deleted file mode 100644 index bb512af491fc..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart +++ /dev/null @@ -1,135 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -part of openapi.api; - -class User { - /// Returns a new [User] instance. - User({ - this.id, - this.username, - this.firstName, - this.lastName, - this.email, - this.password, - this.phone, - this.userStatus, - }); - - int id; - - String username; - - String firstName; - - String lastName; - - String email; - - String password; - - String phone; - - /// User Status - int userStatus; - - @override - bool operator ==(Object other) => identical(this, other) || other is User && - other.id == id && - other.username == username && - other.firstName == firstName && - other.lastName == lastName && - other.email == email && - other.password == password && - other.phone == phone && - other.userStatus == userStatus; - - @override - int get hashCode => - (id == null ? 0 : id.hashCode) + - (username == null ? 0 : username.hashCode) + - (firstName == null ? 0 : firstName.hashCode) + - (lastName == null ? 0 : lastName.hashCode) + - (email == null ? 0 : email.hashCode) + - (password == null ? 0 : password.hashCode) + - (phone == null ? 0 : phone.hashCode) + - (userStatus == null ? 0 : userStatus.hashCode); - - @override - String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; - - Map toJson() { - final json = {}; - if (id != null) { - json[r'id'] = id; - } - if (username != null) { - json[r'username'] = username; - } - if (firstName != null) { - json[r'firstName'] = firstName; - } - if (lastName != null) { - json[r'lastName'] = lastName; - } - if (email != null) { - json[r'email'] = email; - } - if (password != null) { - json[r'password'] = password; - } - if (phone != null) { - json[r'phone'] = phone; - } - if (userStatus != null) { - json[r'userStatus'] = userStatus; - } - return json; - } - - /// Returns a new [User] instance and imports its values from - /// [json] if it's non-null, null if [json] is null. - static User fromJson(Map json) => json == null - ? null - : User( - id: json[r'id'], - username: json[r'username'], - firstName: json[r'firstName'], - lastName: json[r'lastName'], - email: json[r'email'], - password: json[r'password'], - phone: json[r'phone'], - userStatus: json[r'userStatus'], - ); - - static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => - json == null || json.isEmpty - ? true == emptyIsNull ? null : [] - : json.map((v) => User.fromJson(v)).toList(growable: true == growable); - - static Map mapFromJson(Map json) { - final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = User.fromJson(v)); - } - return map; - } - - // maps a json object with a list of User-objects as value to a dart map - static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { - final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = User.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); - }); - } - return map; - } -} - diff --git a/samples/client/petstore/dart2/petstore_client_lib/pom.xml b/samples/client/petstore/dart2/petstore_client_lib/pom.xml deleted file mode 100644 index e1f8ce7d3cbb..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - org.openapitools - Dart2PetstoreClientLibOAS2Tests - pom - 1.0.0-SNAPSHOT - Dart2 Petstore Client Lib OAS2 - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - export-dartfmt - pre-install-test - - exec - - - export - - DART_FMT_PATH=/usr/local/bin/dartfmt - - - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-test - integration-test - - exec - - - pub - - run - test - - - - - - - - diff --git a/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml b/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml deleted file mode 100644 index 06e772631725..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# -# AUTO-GENERATED FILE, DO NOT MODIFY! -# - -name: 'openapi' -version: '1.0.0' -description: 'OpenAPI API client' -authors: - - 'Author ' -homepage: 'homepage' -environment: - sdk: '>=2.0.0 <3.0.0' -dependencies: - http: '>=0.12.0 <0.13.0' - intl: '^0.16.1' - meta: '^1.1.8' - -dev_dependencies: - test: '>=1.3.0 <1.16.0' - diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart deleted file mode 100644 index b0c30615b926..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/api_response_test.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for ApiResponse -void main() { - final instance = ApiResponse(); - - group('test ApiResponse', () { - // int code - test('to test the property `code`', () async { - // TODO - }); - - // String type - test('to test the property `type`', () async { - // TODO - }); - - // String message - test('to test the property `message`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart deleted file mode 100644 index 1849d609ebb2..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/category_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Category -void main() { - final instance = Category(); - - group('test Category', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart deleted file mode 100644 index 614a14e42bb9..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/order_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Order -void main() { - final instance = Order(); - - group('test Order', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // int petId - test('to test the property `petId`', () async { - // TODO - }); - - // int quantity - test('to test the property `quantity`', () async { - // TODO - }); - - // DateTime shipDate - test('to test the property `shipDate`', () async { - // TODO - }); - - // Order Status - // String status - test('to test the property `status`', () async { - // TODO - }); - - // bool complete (default value: false) - test('to test the property `complete`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart deleted file mode 100644 index cdaf1b2fd8fe..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/pet_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for PetApi -void main() { - final instance = PetApi(); - - group('tests for PetApi', () { - // Add a new pet to the store - // - //Future addPet(Pet body) async - test('test addPet', () async { - // TODO - }); - - // Deletes a pet - // - //Future deletePet(int petId, { String apiKey }) async - test('test deletePet', () async { - // TODO - }); - - // Finds Pets by status - // - // Multiple status values can be provided with comma separated strings - // - //Future> findPetsByStatus(List status) async - test('test findPetsByStatus', () async { - // TODO - }); - - // Finds Pets by tags - // - // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - // - //Future> findPetsByTags(List tags) async - test('test findPetsByTags', () async { - // TODO - }); - - // Find pet by ID - // - // Returns a single pet - // - //Future getPetById(int petId) async - test('test getPetById', () async { - // TODO - }); - - // Update an existing pet - // - //Future updatePet(Pet body) async - test('test updatePet', () async { - // TODO - }); - - // Updates a pet in the store with form data - // - //Future updatePetWithForm(int petId, { String name, String status }) async - test('test updatePetWithForm', () async { - // TODO - }); - - // uploads an image - // - //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async - test('test uploadFile', () async { - // TODO - }); - - }); -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart deleted file mode 100644 index a3b16fbd7abd..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/pet_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Pet -void main() { - final instance = Pet(); - - group('test Pet', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // Category category - test('to test the property `category`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - // List photoUrls (default value: const []) - test('to test the property `photoUrls`', () async { - // TODO - }); - - // List tags (default value: const []) - test('to test the property `tags`', () async { - // TODO - }); - - // pet status in the store - // String status - test('to test the property `status`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart deleted file mode 100644 index 22ca5e8354c8..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/store_api_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for StoreApi -void main() { - final instance = StoreApi(); - - group('tests for StoreApi', () { - // Delete purchase order by ID - // - // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - // - //Future deleteOrder(String orderId) async - test('test deleteOrder', () async { - // TODO - }); - - // Returns pet inventories by status - // - // Returns a map of status codes to quantities - // - //Future> getInventory() async - test('test getInventory', () async { - // TODO - }); - - // Find purchase order by ID - // - // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - // - //Future getOrderById(int orderId) async - test('test getOrderById', () async { - // TODO - }); - - // Place an order for a pet - // - //Future placeOrder(Order body) async - test('test placeOrder', () async { - // TODO - }); - - }); -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart deleted file mode 100644 index 66ecdfe488dc..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/tag_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for Tag -void main() { - final instance = Tag(); - - group('test Tag', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String name - test('to test the property `name`', () async { - // TODO - }); - - - }); - -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart deleted file mode 100644 index 5f3e029c83f8..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/user_api_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - - -/// tests for UserApi -void main() { - final instance = UserApi(); - - group('tests for UserApi', () { - // Create user - // - // This can only be done by the logged in user. - // - //Future createUser(User body) async - test('test createUser', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithArrayInput(List body) async - test('test createUsersWithArrayInput', () async { - // TODO - }); - - // Creates list of users with given input array - // - //Future createUsersWithListInput(List body) 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 body) async - test('test updateUser', () async { - // TODO - }); - - }); -} diff --git a/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart b/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart deleted file mode 100644 index b89cd360489d..000000000000 --- a/samples/client/petstore/dart2/petstore_client_lib/test/user_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// -// @dart=2.0 - -// ignore_for_file: unused_element, unused_import -// ignore_for_file: always_put_required_named_parameters_first -// ignore_for_file: lines_longer_than_80_chars - -import 'package:openapi/api.dart'; -import 'package:test/test.dart'; - -// tests for User -void main() { - final instance = User(); - - group('test User', () { - // int id - test('to test the property `id`', () async { - // TODO - }); - - // String username - test('to test the property `username`', () async { - // TODO - }); - - // String firstName - test('to test the property `firstName`', () async { - // TODO - }); - - // String lastName - test('to test the property `lastName`', () async { - // TODO - }); - - // String email - test('to test the property `email`', () async { - // TODO - }); - - // String password - test('to test the property `password`', () async { - // TODO - }); - - // String phone - test('to test the property `phone`', () async { - // TODO - }); - - // User Status - // int userStatus - test('to test the property `userStatus`', () async { - // TODO - }); - - - }); - -}