From c47789f899fbdd20d9575491d88d95f61a377ab5 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Tue, 14 Nov 2023 07:02:33 +0100 Subject: [PATCH] feat(dynamite_petstore_example): Init Signed-off-by: jld3103 --- .github/workflows/generate.yaml | 8 + .gitmodules | 3 + commitlint.yaml | 1 + external/swagger-petstore | 1 + .../dynamite_petstore_example/LICENSE | 1 + .../dynamite_petstore_example/README.md | 5 + .../dynamite_petstore_example/build.yaml | 18 + .../lib/petstore.openapi.dart | 1899 +++++++++++++++++ .../lib/petstore.openapi.g.dart | 1829 ++++++++++++++++ .../lib/petstore.openapi.json | 1230 +++++++++++ .../dynamite_petstore_example/patch.json | 16 + .../dynamite_petstore_example/pubspec.yaml | 23 + .../pubspec_overrides.yaml | 6 + tool/generate-dynamite-petstore-example.sh | 15 + 14 files changed, 5055 insertions(+) create mode 160000 external/swagger-petstore create mode 120000 packages/dynamite/dynamite_petstore_example/LICENSE create mode 100644 packages/dynamite/dynamite_petstore_example/README.md create mode 100644 packages/dynamite/dynamite_petstore_example/build.yaml create mode 100644 packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart create mode 100644 packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.g.dart create mode 100644 packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.json create mode 100644 packages/dynamite/dynamite_petstore_example/patch.json create mode 100644 packages/dynamite/dynamite_petstore_example/pubspec.yaml create mode 100644 packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml create mode 100755 tool/generate-dynamite-petstore-example.sh diff --git a/.github/workflows/generate.yaml b/.github/workflows/generate.yaml index f11ec6f6bb2..332875ccf29 100644 --- a/.github/workflows/generate.yaml +++ b/.github/workflows/generate.yaml @@ -51,6 +51,14 @@ jobs: exit 1 fi + - name: Generate dynamite petstore example + run: | + ./tool/generate-dynamite-petstore-example.sh + if [ -n "$(git status --porcelain)" ]; then + git --no-pager diff + exit 1 + fi + - name: Generate nextcloud run: | ./tool/generate-nextcloud.sh diff --git a/.gitmodules b/.gitmodules index e2a2b56daf5..8b8e6fd950b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "external/nextcloud-notes"] path = external/nextcloud-notes url = https://github.com/nextcloud/notes +[submodule "external/swagger-petstore"] + path = external/swagger-petstore + url = https://github.com/swagger-api/swagger-petstore.git diff --git a/commitlint.yaml b/commitlint.yaml index 0efcb504435..ee82dc00e8f 100644 --- a/commitlint.yaml +++ b/commitlint.yaml @@ -13,6 +13,7 @@ rules: - tool - app - dynamite + - dynamite_petstore_example - dynamite_runtime - dynamite_end_to_end_test - file_icons diff --git a/external/swagger-petstore b/external/swagger-petstore new file mode 160000 index 00000000000..b8e2f32236d --- /dev/null +++ b/external/swagger-petstore @@ -0,0 +1 @@ +Subproject commit b8e2f32236d4332a131bf01e16e39f7c9e6323bd diff --git a/packages/dynamite/dynamite_petstore_example/LICENSE b/packages/dynamite/dynamite_petstore_example/LICENSE new file mode 120000 index 00000000000..c50ad9ade80 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/LICENSE @@ -0,0 +1 @@ +../../../assets/AGPL-3.0.txt \ No newline at end of file diff --git a/packages/dynamite/dynamite_petstore_example/README.md b/packages/dynamite/dynamite_petstore_example/README.md new file mode 100644 index 00000000000..8cdf15999a8 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/README.md @@ -0,0 +1,5 @@ +# dynamite petstore example + +An example showcasing the [dynamite generator](../dynamite) for OpenAPI using the [Swagger Petstore](https://github.com/swagger-api/swagger-petstore). + +Because dynamite does not support dynamic authentication yet a [patch](patch.json) is applied to the specification to make it work. It will be removed once dynamite supports API key and Oauth 2.0 authentication. diff --git a/packages/dynamite/dynamite_petstore_example/build.yaml b/packages/dynamite/dynamite_petstore_example/build.yaml new file mode 100644 index 00000000000..b27024ed137 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/build.yaml @@ -0,0 +1,18 @@ +targets: + $default: + builders: + built_value_generator|built_value: + enabled: true + dynamite: + options: + pageWidth: 120 + analyzer_ignores: + - camel_case_types + - discarded_futures + - public_member_api_docs + - unreachable_switch_case + coverage_ignores: + - 'const .*\._\(\);' + - 'factory .*\.fromJson\(Map json\) => _jsonSerializers\.deserializeWith\(serializer, json\)!;' + - 'Map toJson\(\) => _jsonSerializers\.serializeWith\(serializer, this\)! as Map;' + - 'static BuiltSet<.*> get values => _\$.*Values;' diff --git a/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart new file mode 100644 index 00000000000..571aea94e21 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart @@ -0,0 +1,1899 @@ +// ignore_for_file: camel_case_types +// ignore_for_file: discarded_futures +// ignore_for_file: public_member_api_docs +// ignore_for_file: unreachable_switch_case +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; +import 'package:collection/collection.dart'; +import 'package:dynamite_runtime/built_value.dart'; +import 'package:dynamite_runtime/http_client.dart'; +import 'package:meta/meta.dart'; +import 'package:universal_io/io.dart'; + +part 'petstore.openapi.g.dart'; + +class Client extends DynamiteClient { + Client( + super.baseURL, { + super.baseHeaders, + super.userAgent, + super.httpClient, + super.cookieJar, + super.authentications, + }); + + Client.fromClient(DynamiteClient client) + : super( + client.baseURL, + baseHeaders: client.baseHeaders, + httpClient: client.httpClient, + cookieJar: client.cookieJar, + authentications: client.authentications, + ); + + PetClient get pet => PetClient(this); + + StoreClient get store => StoreClient(this); + + UserClient get user => UserClient(this); +} + +/// Everything about your Pets. +class PetClient { + PetClient(this._rootClient); + + final Client _rootClient; + + /// Update an existing pet. + /// + /// Update an existing pet by Id. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Successful operation + /// * 400: Invalid ID supplied + /// * 404: Pet not found + /// * 405: Validation exception + /// + /// See: + /// * [updatePetRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> updatePet({required Pet pet}) async { + final rawResponse = updatePetRaw( + pet: pet, + ); + + return rawResponse.future; + } + + /// Update an existing pet. + /// + /// Update an existing pet by Id. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Successful operation + /// * 400: Invalid ID supplied + /// * 404: Pet not found + /// * 405: Validation exception + /// + /// See: + /// * [updatePet] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse updatePetRaw({required Pet pet}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + _headers['Content-Type'] = 'application/json'; + _body = utf8.encode(json.encode(_jsonSerializers.serialize(pet, specifiedType: const FullType(Pet)))) as Uint8List; + final _path = '/pet'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'put', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(Pet), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Add a new pet to the store. + /// + /// Add a new pet to the store. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Successful operation + /// * 405: Invalid input + /// + /// See: + /// * [addPetRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> addPet({required Pet pet}) async { + final rawResponse = addPetRaw( + pet: pet, + ); + + return rawResponse.future; + } + + /// Add a new pet to the store. + /// + /// Add a new pet to the store. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Successful operation + /// * 405: Invalid input + /// + /// See: + /// * [addPet] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse addPetRaw({required Pet pet}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + _headers['Content-Type'] = 'application/json'; + _body = utf8.encode(json.encode(_jsonSerializers.serialize(pet, specifiedType: const FullType(Pet)))) as Uint8List; + final _path = '/pet'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'post', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(Pet), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Finds Pets by status. + /// + /// Multiple status values can be provided with comma separated strings. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [status] Status values that need to be considered for filter. Defaults to `available`. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid status value + /// + /// See: + /// * [findPetsByStatusRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future, void>> findPetsByStatus( + {FindPetsByStatusStatus status = FindPetsByStatusStatus.available}) async { + final rawResponse = findPetsByStatusRaw( + status: status, + ); + + return rawResponse.future; + } + + /// Finds Pets by status. + /// + /// Multiple status values can be provided with comma separated strings. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [status] Status values that need to be considered for filter. Defaults to `available`. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid status value + /// + /// See: + /// * [findPetsByStatus] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse, void> findPetsByStatusRaw( + {FindPetsByStatusStatus status = FindPetsByStatusStatus.available}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + if (status != FindPetsByStatusStatus.available) { + _queryParameters['status'] = status.name; + } + final _path = '/pet/findByStatus'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse, void>( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(BuiltList, [FullType(Pet)]), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Finds Pets by tags. + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [tags] Tags to filter by. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid tag value + /// + /// See: + /// * [findPetsByTagsRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future, void>> findPetsByTags({List? tags}) async { + final rawResponse = findPetsByTagsRaw( + tags: tags, + ); + + return rawResponse.future; + } + + /// Finds Pets by tags. + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [tags] Tags to filter by. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid tag value + /// + /// See: + /// * [findPetsByTags] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse, void> findPetsByTagsRaw({List? tags}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + if (tags != null) { + _queryParameters['tags'] = tags.map((final e) => e); + } + final _path = '/pet/findByTags'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse, void>( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(BuiltList, [FullType(Pet)]), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Find pet by ID. + /// + /// Returns a single pet. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [petId] ID of pet to return. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid ID supplied + /// * 404: Pet not found + /// + /// See: + /// * [getPetByIdRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> getPetById({required int petId}) async { + final rawResponse = getPetByIdRaw( + petId: petId, + ); + + return rawResponse.future; + } + + /// Find pet by ID. + /// + /// Returns a single pet. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [petId] ID of pet to return. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid ID supplied + /// * 404: Pet not found + /// + /// See: + /// * [getPetById] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse getPetByIdRaw({required int petId}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() || DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for api_key or petstore_auth'); + } + +// coverage:ignore-end + final _petId = Uri.encodeQueryComponent(petId.toString()); + final _path = '/pet/$_petId'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(Pet), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Updates a pet in the store with form data. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [petId] ID of pet that needs to be updated. + /// * [name] Name of pet that needs to be updated. + /// * [status] Status of pet that needs to be updated. + /// + /// Status codes: + /// * 405: Invalid input + /// + /// See: + /// * [updatePetWithFormRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> updatePetWithForm({ + required int petId, + String? name, + String? status, + }) async { + final rawResponse = updatePetWithFormRaw( + petId: petId, + name: name, + status: status, + ); + + return rawResponse.future; + } + + /// Updates a pet in the store with form data. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [petId] ID of pet that needs to be updated. + /// * [name] Name of pet that needs to be updated. + /// * [status] Status of pet that needs to be updated. + /// + /// Status codes: + /// * 405: Invalid input + /// + /// See: + /// * [updatePetWithForm] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse updatePetWithFormRaw({ + required int petId, + String? name, + String? status, + }) { + final _queryParameters = {}; + final _headers = {}; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + final _petId = Uri.encodeQueryComponent(petId.toString()); + if (name != null) { + _queryParameters['name'] = name; + } + if (status != null) { + _queryParameters['status'] = status; + } + final _path = '/pet/$_petId'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'post', + _uri, + _headers, + _body, + const {405}, + ), + bodyType: null, + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Deletes a pet. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [apiKey] . + /// * [petId] Pet id to delete. + /// + /// Status codes: + /// * 400: Invalid pet value + /// + /// See: + /// * [deletePetRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> deletePet({ + required int petId, + String? apiKey, + }) async { + final rawResponse = deletePetRaw( + petId: petId, + apiKey: apiKey, + ); + + return rawResponse.future; + } + + /// Deletes a pet. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [apiKey] . + /// * [petId] Pet id to delete. + /// + /// Status codes: + /// * 400: Invalid pet value + /// + /// See: + /// * [deletePet] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse deletePetRaw({ + required int petId, + String? apiKey, + }) { + final _queryParameters = {}; + final _headers = {}; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + final _petId = Uri.encodeQueryComponent(petId.toString()); + if (apiKey != null) { + _headers['api_key'] = apiKey; + } + final _path = '/pet/$_petId'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'delete', + _uri, + _headers, + _body, + const {400}, + ), + bodyType: null, + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// uploads an image. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [petId] ID of pet to update. + /// * [additionalMetadata] Additional Metadata. + /// + /// Status codes: + /// * 200: successful operation + /// + /// See: + /// * [uploadFileRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> uploadFile({ + required int petId, + String? additionalMetadata, + Uint8List? uint8List, + }) async { + final rawResponse = uploadFileRaw( + petId: petId, + additionalMetadata: additionalMetadata, + uint8List: uint8List, + ); + + return rawResponse.future; + } + + /// uploads an image. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [petId] ID of pet to update. + /// * [additionalMetadata] Additional Metadata. + /// + /// Status codes: + /// * 200: successful operation + /// + /// See: + /// * [uploadFile] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse uploadFileRaw({ + required int petId, + String? additionalMetadata, + Uint8List? uint8List, + }) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for petstore_auth'); + } + +// coverage:ignore-end + final _petId = Uri.encodeQueryComponent(petId.toString()); + if (additionalMetadata != null) { + _queryParameters['additionalMetadata'] = additionalMetadata; + } + _headers['Content-Type'] = 'application/octet-stream'; + if (uint8List != null) { + _body = uint8List; + } + final _path = '/pet/$_petId/uploadImage'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'post', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(ApiResponse), + headersType: null, + serializers: _jsonSerializers, + ); + } +} + +/// Access to Petstore orders. +class StoreClient { + StoreClient(this._rootClient); + + final Client _rootClient; + + /// Returns pet inventories by status. + /// + /// Returns a map of status codes to quantities. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: successful operation + /// + /// See: + /// * [getInventoryRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future, void>> getInventory() async { + final rawResponse = getInventoryRaw(); + + return rawResponse.future; + } + + /// Returns pet inventories by status. + /// + /// Returns a map of status codes to quantities. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: successful operation + /// + /// See: + /// * [getInventory] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse, void> getInventoryRaw() { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/json', + }; + Uint8List? _body; + +// coverage:ignore-start + final authentication = _rootClient.authentications.firstWhereOrNull( + (final auth) => switch (auth) { + DynamiteHttpBasicAuthentication() => true, + _ => false, + }, + ); + + if (authentication != null) { + _headers.addAll( + authentication.headers, + ); + } else { + throw Exception('Missing authentication for api_key'); + } + +// coverage:ignore-end + final _path = '/store/inventory'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse, void>( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(BuiltMap, [FullType(String), FullType(int)]), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Place an order for a pet. + /// + /// Place a new order in the store. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: successful operation + /// * 405: Invalid input + /// + /// See: + /// * [placeOrderRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> placeOrder({Order? order}) async { + final rawResponse = placeOrderRaw( + order: order, + ); + + return rawResponse.future; + } + + /// Place an order for a pet. + /// + /// Place a new order in the store. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: successful operation + /// * 405: Invalid input + /// + /// See: + /// * [placeOrder] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse placeOrderRaw({Order? order}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/json', + }; + Uint8List? _body; + + _headers['Content-Type'] = 'application/json'; + if (order != null) { + _body = utf8.encode(json.encode(_jsonSerializers.serialize(order, specifiedType: const FullType(Order)))) + as Uint8List; + } + final _path = '/store/order'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'post', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(Order), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Find purchase order by ID. + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [orderId] ID of order that needs to be fetched. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid ID supplied + /// * 404: Order not found + /// + /// See: + /// * [getOrderByIdRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> getOrderById({required int orderId}) async { + final rawResponse = getOrderByIdRaw( + orderId: orderId, + ); + + return rawResponse.future; + } + + /// Find purchase order by ID. + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [orderId] ID of order that needs to be fetched. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid ID supplied + /// * 404: Order not found + /// + /// See: + /// * [getOrderById] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse getOrderByIdRaw({required int orderId}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + + final _orderId = Uri.encodeQueryComponent(orderId.toString()); + final _path = '/store/order/$_orderId'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(Order), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Delete purchase order by ID. + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [orderId] ID of the order that needs to be deleted. + /// + /// Status codes: + /// * 400: Invalid ID supplied + /// * 404: Order not found + /// + /// See: + /// * [deleteOrderRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> deleteOrder({required int orderId}) async { + final rawResponse = deleteOrderRaw( + orderId: orderId, + ); + + return rawResponse.future; + } + + /// Delete purchase order by ID. + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [orderId] ID of the order that needs to be deleted. + /// + /// Status codes: + /// * 400: Invalid ID supplied + /// * 404: Order not found + /// + /// See: + /// * [deleteOrder] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse deleteOrderRaw({required int orderId}) { + final _queryParameters = {}; + final _headers = {}; + Uint8List? _body; + + final _orderId = Uri.encodeQueryComponent(orderId.toString()); + final _path = '/store/order/$_orderId'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'delete', + _uri, + _headers, + _body, + const {400, 404}, + ), + bodyType: null, + headersType: null, + serializers: _jsonSerializers, + ); + } +} + +/// Operations about user. +class UserClient { + UserClient(this._rootClient); + + final Client _rootClient; + + /// Create user. + /// + /// This can only be done by the logged in user. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * default: successful operation + /// + /// See: + /// * [createUserRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> createUser({User? user}) async { + final rawResponse = createUserRaw( + user: user, + ); + + return rawResponse.future; + } + + /// Create user. + /// + /// This can only be done by the logged in user. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * default: successful operation + /// + /// See: + /// * [createUser] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse createUserRaw({User? user}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/json,application/xml', + }; + Uint8List? _body; + + _headers['Content-Type'] = 'application/json'; + if (user != null) { + _body = + utf8.encode(json.encode(_jsonSerializers.serialize(user, specifiedType: const FullType(User)))) as Uint8List; + } + final _path = '/user'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'post', + _uri, + _headers, + _body, + null, + ), + bodyType: FullType(User), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Creates list of users with given input array. + /// + /// Creates list of users with given input array. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Successful operation + /// * default: successful operation + /// + /// See: + /// * [createUsersWithListInputRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> createUsersWithListInput({BuiltList? builtListUser}) async { + final rawResponse = createUsersWithListInputRaw( + builtListUser: builtListUser, + ); + + return rawResponse.future; + } + + /// Creates list of users with given input array. + /// + /// Creates list of users with given input array. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * 200: Successful operation + /// * default: successful operation + /// + /// See: + /// * [createUsersWithListInput] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse createUsersWithListInputRaw({BuiltList? builtListUser}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + + _headers['Content-Type'] = 'application/json'; + if (builtListUser != null) { + _body = utf8.encode(json.encode( + _jsonSerializers.serialize(builtListUser, specifiedType: const FullType(BuiltList, [FullType(User)])))) + as Uint8List; + } + final _path = '/user/createWithList'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'post', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(User), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Logs user into the system. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] The user name for login. + /// * [password] The password for login in clear text. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid username/password supplied + /// + /// See: + /// * [loginUserRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> loginUser({ + String? username, + String? password, + }) async { + final rawResponse = loginUserRaw( + username: username, + password: password, + ); + + return rawResponse.future; + } + + /// Logs user into the system. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] The user name for login. + /// * [password] The password for login in clear text. + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid username/password supplied + /// + /// See: + /// * [loginUser] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse loginUserRaw({ + String? username, + String? password, + }) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + + if (username != null) { + _queryParameters['username'] = username; + } + if (password != null) { + _queryParameters['password'] = password; + } + final _path = '/user/login'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(String), + headersType: FullType(UserLoginUserHeaders), + serializers: _jsonSerializers, + ); + } + + /// Logs out current logged in user session. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * default: successful operation + /// + /// See: + /// * [logoutUserRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> logoutUser() async { + final rawResponse = logoutUserRaw(); + + return rawResponse.future; + } + + /// Logs out current logged in user session. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Status codes: + /// * default: successful operation + /// + /// See: + /// * [logoutUser] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse logoutUserRaw() { + final _queryParameters = {}; + final _headers = {}; + Uint8List? _body; + + final _path = '/user/logout'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + null, + ), + bodyType: null, + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Get user by user name. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] The name that needs to be fetched. Use user1 for testing. . + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid username supplied + /// * 404: User not found + /// + /// See: + /// * [getUserByNameRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> getUserByName({required String username}) async { + final rawResponse = getUserByNameRaw( + username: username, + ); + + return rawResponse.future; + } + + /// Get user by user name. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] The name that needs to be fetched. Use user1 for testing. . + /// + /// Status codes: + /// * 200: successful operation + /// * 400: Invalid username supplied + /// * 404: User not found + /// + /// See: + /// * [getUserByName] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse getUserByNameRaw({required String username}) { + final _queryParameters = {}; + final _headers = { + 'Accept': 'application/xml,application/json', + }; + Uint8List? _body; + + final _username = Uri.encodeQueryComponent(username); + final _path = '/user/$_username'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'get', + _uri, + _headers, + _body, + const {200}, + ), + bodyType: FullType(User), + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Update user. + /// + /// This can only be done by the logged in user. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] name that needs to be updated. + /// + /// Status codes: + /// * default: successful operation + /// + /// See: + /// * [updateUserRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> updateUser({ + required String username, + User? user, + }) async { + final rawResponse = updateUserRaw( + username: username, + user: user, + ); + + return rawResponse.future; + } + + /// Update user. + /// + /// This can only be done by the logged in user. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] name that needs to be updated. + /// + /// Status codes: + /// * default: successful operation + /// + /// See: + /// * [updateUser] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse updateUserRaw({ + required String username, + User? user, + }) { + final _queryParameters = {}; + final _headers = {}; + Uint8List? _body; + + final _username = Uri.encodeQueryComponent(username); + _headers['Content-Type'] = 'application/json'; + if (user != null) { + _body = + utf8.encode(json.encode(_jsonSerializers.serialize(user, specifiedType: const FullType(User)))) as Uint8List; + } + final _path = '/user/$_username'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'put', + _uri, + _headers, + _body, + null, + ), + bodyType: null, + headersType: null, + serializers: _jsonSerializers, + ); + } + + /// Delete user. + /// + /// This can only be done by the logged in user. + /// + /// Returns a [Future] containing a [DynamiteResponse] with the status code, deserialized body and headers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] The name that needs to be deleted. + /// + /// Status codes: + /// * 400: Invalid username supplied + /// * 404: User not found + /// + /// See: + /// * [deleteUserRaw] for an experimental operation that returns a [DynamiteRawResponse] that can be serialized. + Future> deleteUser({required String username}) async { + final rawResponse = deleteUserRaw( + username: username, + ); + + return rawResponse.future; + } + + /// Delete user. + /// + /// This can only be done by the logged in user. + /// + /// This method and the response it returns is experimental. The API might change without a major version bump. + /// + /// Returns a [Future] containing a [DynamiteRawResponse] with the raw [HttpClientResponse] and serialization helpers. + /// Throws a [DynamiteApiException] if the API call does not return an expected status code. + /// + /// Parameters: + /// * [username] The name that needs to be deleted. + /// + /// Status codes: + /// * 400: Invalid username supplied + /// * 404: User not found + /// + /// See: + /// * [deleteUser] for an operation that returns a [DynamiteResponse] with a stable API. + @experimental + DynamiteRawResponse deleteUserRaw({required String username}) { + final _queryParameters = {}; + final _headers = {}; + Uint8List? _body; + + final _username = Uri.encodeQueryComponent(username); + final _path = '/user/$_username'; + final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _queryParameters : null); + + return DynamiteRawResponse( + response: _rootClient.executeRequest( + 'delete', + _uri, + _headers, + _body, + const {400, 404}, + ), + bodyType: null, + headersType: null, + serializers: _jsonSerializers, + ); + } +} + +@BuiltValue(instantiable: false) +abstract interface class CategoryInterface { + int? get id; + String? get name; +} + +abstract class Category implements CategoryInterface, Built { + factory Category([void Function(CategoryBuilder)? b]) = _$Category; + + // coverage:ignore-start + const Category._(); + // coverage:ignore-end + + // coverage:ignore-start + factory Category.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$categorySerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class TagInterface { + int? get id; + String? get name; +} + +abstract class Tag implements TagInterface, Built { + factory Tag([void Function(TagBuilder)? b]) = _$Tag; + + // coverage:ignore-start + const Tag._(); + // coverage:ignore-end + + // coverage:ignore-start + factory Tag.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$tagSerializer; +} + +class Pet_Status extends EnumClass { + const Pet_Status._(super.name); + + static const Pet_Status available = _$petStatusAvailable; + + static const Pet_Status pending = _$petStatusPending; + + static const Pet_Status sold = _$petStatusSold; + + // coverage:ignore-start + static BuiltSet get values => _$petStatusValues; + // coverage:ignore-end + + static Pet_Status valueOf(String name) => _$valueOfPet_Status(name); + + static Serializer get serializer => _$petStatusSerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class PetInterface { + int? get id; + String get name; + Category? get category; + BuiltList get photoUrls; + BuiltList? get tags; + + /// pet status in the store. + Pet_Status? get status; +} + +abstract class Pet implements PetInterface, Built { + factory Pet([void Function(PetBuilder)? b]) = _$Pet; + + // coverage:ignore-start + const Pet._(); + // coverage:ignore-end + + // coverage:ignore-start + factory Pet.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$petSerializer; +} + +class FindPetsByStatusStatus extends EnumClass { + const FindPetsByStatusStatus._(super.name); + + static const FindPetsByStatusStatus available = _$findPetsByStatusStatusAvailable; + + static const FindPetsByStatusStatus pending = _$findPetsByStatusStatusPending; + + static const FindPetsByStatusStatus sold = _$findPetsByStatusStatusSold; + + // coverage:ignore-start + static BuiltSet get values => _$findPetsByStatusStatusValues; + // coverage:ignore-end + + static FindPetsByStatusStatus valueOf(String name) => _$valueOfFindPetsByStatusStatus(name); + + static Serializer get serializer => _$findPetsByStatusStatusSerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class ApiResponseInterface { + int? get code; + String? get type; + String? get message; +} + +abstract class ApiResponse implements ApiResponseInterface, Built { + factory ApiResponse([void Function(ApiResponseBuilder)? b]) = _$ApiResponse; + + // coverage:ignore-start + const ApiResponse._(); + // coverage:ignore-end + + // coverage:ignore-start + factory ApiResponse.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$apiResponseSerializer; +} + +class Order_Status extends EnumClass { + const Order_Status._(super.name); + + static const Order_Status placed = _$orderStatusPlaced; + + static const Order_Status approved = _$orderStatusApproved; + + static const Order_Status delivered = _$orderStatusDelivered; + + // coverage:ignore-start + static BuiltSet get values => _$orderStatusValues; + // coverage:ignore-end + + static Order_Status valueOf(String name) => _$valueOfOrder_Status(name); + + static Serializer get serializer => _$orderStatusSerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class OrderInterface { + int? get id; + int? get petId; + int? get quantity; + String? get shipDate; + + /// Order Status. + Order_Status? get status; + bool? get complete; +} + +abstract class Order implements OrderInterface, Built { + factory Order([void Function(OrderBuilder)? b]) = _$Order; + + // coverage:ignore-start + const Order._(); + // coverage:ignore-end + + // coverage:ignore-start + factory Order.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$orderSerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class UserInterface { + int? get id; + String? get username; + String? get firstName; + String? get lastName; + String? get email; + String? get password; + String? get phone; + + /// User Status. + int? get userStatus; +} + +abstract class User implements UserInterface, Built { + factory User([void Function(UserBuilder)? b]) = _$User; + + // coverage:ignore-start + const User._(); + // coverage:ignore-end + + // coverage:ignore-start + factory User.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$userSerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class UserLoginUserHeadersInterface { + @BuiltValueField(wireName: 'x-rate-limit') + int? get xRateLimit; + @BuiltValueField(wireName: 'x-expires-after') + String? get xExpiresAfter; +} + +abstract class UserLoginUserHeaders + implements UserLoginUserHeadersInterface, Built { + factory UserLoginUserHeaders([void Function(UserLoginUserHeadersBuilder)? b]) = _$UserLoginUserHeaders; + + // coverage:ignore-start + const UserLoginUserHeaders._(); + // coverage:ignore-end + + // coverage:ignore-start + factory UserLoginUserHeaders.fromJson(Map json) => + _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$UserLoginUserHeadersSerializer(); +} + +class _$UserLoginUserHeadersSerializer implements StructuredSerializer { + @override + final Iterable types = const [UserLoginUserHeaders, _$UserLoginUserHeaders]; + + @override + final String wireName = r'UserLoginUserHeaders'; + + @override + Iterable serialize( + Serializers serializers, + UserLoginUserHeaders object, { + FullType specifiedType = FullType.unspecified, + }) { + throw UnimplementedError(); + } + + @override + UserLoginUserHeaders deserialize( + Serializers serializers, + Iterable serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = UserLoginUserHeadersBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current! as String; + switch (key) { + case 'x-rate-limit': + result.xRateLimit = + (_jsonSerializers.deserialize(json.decode(value), specifiedType: const FullType(int))! as int); + case 'x-expires-after': + result.xExpiresAfter = value; + } + } + + return result.build(); + } +} + +@BuiltValue(instantiable: false) +abstract interface class AddressInterface { + String? get street; + String? get city; + String? get state; + String? get zip; +} + +abstract class Address implements AddressInterface, Built { + factory Address([void Function(AddressBuilder)? b]) = _$Address; + + // coverage:ignore-start + const Address._(); + // coverage:ignore-end + + // coverage:ignore-start + factory Address.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer
get serializer => _$addressSerializer; +} + +@BuiltValue(instantiable: false) +abstract interface class CustomerInterface { + int? get id; + String? get username; + BuiltList
? get address; +} + +abstract class Customer implements CustomerInterface, Built { + factory Customer([void Function(CustomerBuilder)? b]) = _$Customer; + + // coverage:ignore-start + const Customer._(); + // coverage:ignore-end + + // coverage:ignore-start + factory Customer.fromJson(Map json) => _jsonSerializers.deserializeWith(serializer, json)!; + // coverage:ignore-end + + // coverage:ignore-start + Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; + // coverage:ignore-end + + static Serializer get serializer => _$customerSerializer; +} + +// coverage:ignore-start +final Serializers _serializers = (Serializers().toBuilder() + ..addBuilderFactory(FullType(Pet), Pet.new) + ..add(Pet.serializer) + ..addBuilderFactory(FullType(Category), Category.new) + ..add(Category.serializer) + ..addBuilderFactory(FullType(BuiltList, [FullType(String)]), ListBuilder.new) + ..addBuilderFactory(FullType(Tag), Tag.new) + ..add(Tag.serializer) + ..addBuilderFactory(FullType(BuiltList, [FullType(Tag)]), ListBuilder.new) + ..add(Pet_Status.serializer) + ..add(FindPetsByStatusStatus.serializer) + ..addBuilderFactory(FullType(BuiltList, [FullType(Pet)]), ListBuilder.new) + ..addBuilderFactory(FullType(ApiResponse), ApiResponse.new) + ..add(ApiResponse.serializer) + ..addBuilderFactory(FullType(BuiltMap, [FullType(String), FullType(int)]), MapBuilder.new) + ..addBuilderFactory(FullType(Order), Order.new) + ..add(Order.serializer) + ..add(Order_Status.serializer) + ..addBuilderFactory(FullType(User), User.new) + ..add(User.serializer) + ..addBuilderFactory(FullType(BuiltList, [FullType(User)]), ListBuilder.new) + ..addBuilderFactory(FullType(UserLoginUserHeaders), UserLoginUserHeaders.new) + ..add(UserLoginUserHeaders.serializer) + ..addBuilderFactory(FullType(Customer), Customer.new) + ..add(Customer.serializer) + ..addBuilderFactory(FullType(Address), Address.new) + ..add(Address.serializer) + ..addBuilderFactory(FullType(BuiltList, [FullType(Address)]), ListBuilder
.new)) + .build(); + +final Serializers _jsonSerializers = (_serializers.toBuilder() + ..add(DynamiteDoubleSerializer()) + ..addPlugin(StandardJsonPlugin()) + ..addPlugin(const ContentStringPlugin())) + .build(); +// coverage:ignore-end diff --git a/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.g.dart b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.g.dart new file mode 100644 index 00000000000..e08831b3228 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.g.dart @@ -0,0 +1,1829 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'petstore.openapi.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +const Pet_Status _$petStatusAvailable = Pet_Status._('available'); +const Pet_Status _$petStatusPending = Pet_Status._('pending'); +const Pet_Status _$petStatusSold = Pet_Status._('sold'); + +Pet_Status _$valueOfPet_Status(String name) { + switch (name) { + case 'available': + return _$petStatusAvailable; + case 'pending': + return _$petStatusPending; + case 'sold': + return _$petStatusSold; + default: + throw ArgumentError(name); + } +} + +final BuiltSet _$petStatusValues = BuiltSet(const [ + _$petStatusAvailable, + _$petStatusPending, + _$petStatusSold, +]); + +const FindPetsByStatusStatus _$findPetsByStatusStatusAvailable = FindPetsByStatusStatus._('available'); +const FindPetsByStatusStatus _$findPetsByStatusStatusPending = FindPetsByStatusStatus._('pending'); +const FindPetsByStatusStatus _$findPetsByStatusStatusSold = FindPetsByStatusStatus._('sold'); + +FindPetsByStatusStatus _$valueOfFindPetsByStatusStatus(String name) { + switch (name) { + case 'available': + return _$findPetsByStatusStatusAvailable; + case 'pending': + return _$findPetsByStatusStatusPending; + case 'sold': + return _$findPetsByStatusStatusSold; + default: + throw ArgumentError(name); + } +} + +final BuiltSet _$findPetsByStatusStatusValues = + BuiltSet(const [ + _$findPetsByStatusStatusAvailable, + _$findPetsByStatusStatusPending, + _$findPetsByStatusStatusSold, +]); + +const Order_Status _$orderStatusPlaced = Order_Status._('placed'); +const Order_Status _$orderStatusApproved = Order_Status._('approved'); +const Order_Status _$orderStatusDelivered = Order_Status._('delivered'); + +Order_Status _$valueOfOrder_Status(String name) { + switch (name) { + case 'placed': + return _$orderStatusPlaced; + case 'approved': + return _$orderStatusApproved; + case 'delivered': + return _$orderStatusDelivered; + default: + throw ArgumentError(name); + } +} + +final BuiltSet _$orderStatusValues = BuiltSet(const [ + _$orderStatusPlaced, + _$orderStatusApproved, + _$orderStatusDelivered, +]); + +Serializer _$categorySerializer = _$CategorySerializer(); +Serializer _$tagSerializer = _$TagSerializer(); +Serializer _$petStatusSerializer = _$Pet_StatusSerializer(); +Serializer _$petSerializer = _$PetSerializer(); +Serializer _$findPetsByStatusStatusSerializer = _$FindPetsByStatusStatusSerializer(); +Serializer _$apiResponseSerializer = _$ApiResponseSerializer(); +Serializer _$orderStatusSerializer = _$Order_StatusSerializer(); +Serializer _$orderSerializer = _$OrderSerializer(); +Serializer _$userSerializer = _$UserSerializer(); +Serializer
_$addressSerializer = _$AddressSerializer(); +Serializer _$customerSerializer = _$CustomerSerializer(); + +class _$CategorySerializer implements StructuredSerializer { + @override + final Iterable types = const [Category, _$Category]; + @override + final String wireName = 'Category'; + + @override + Iterable serialize(Serializers serializers, Category object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.id; + if (value != null) { + result + ..add('id') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.name; + if (value != null) { + result + ..add('name') + ..add(serializers.serialize(value, 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 Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'name': + result.name = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + } + } + + return result.build(); + } +} + +class _$TagSerializer implements StructuredSerializer { + @override + final Iterable types = const [Tag, _$Tag]; + @override + final String wireName = 'Tag'; + + @override + Iterable serialize(Serializers serializers, Tag object, {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.id; + if (value != null) { + result + ..add('id') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.name; + if (value != null) { + result + ..add('name') + ..add(serializers.serialize(value, 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 Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'name': + result.name = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + } + } + + return result.build(); + } +} + +class _$Pet_StatusSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pet_Status]; + @override + final String wireName = 'Pet_Status'; + + @override + Object serialize(Serializers serializers, Pet_Status object, {FullType specifiedType = FullType.unspecified}) => + object.name; + + @override + Pet_Status deserialize(Serializers serializers, Object serialized, {FullType specifiedType = FullType.unspecified}) => + Pet_Status.valueOf(serialized as String); +} + +class _$PetSerializer implements StructuredSerializer { + @override + final Iterable types = const [Pet, _$Pet]; + @override + final String wireName = 'Pet'; + + @override + Iterable serialize(Serializers serializers, Pet object, {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'name', + serializers.serialize(object.name, specifiedType: const FullType(String)), + 'photoUrls', + serializers.serialize(object.photoUrls, specifiedType: const FullType(BuiltList, [FullType(String)])), + ]; + Object? value; + value = object.id; + if (value != null) { + result + ..add('id') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.category; + if (value != null) { + result + ..add('category') + ..add(serializers.serialize(value, specifiedType: const FullType(Category))); + } + value = object.tags; + if (value != null) { + result + ..add('tags') + ..add(serializers.serialize(value, specifiedType: const FullType(BuiltList, [FullType(Tag)]))); + } + value = object.status; + if (value != null) { + result + ..add('status') + ..add(serializers.serialize(value, specifiedType: const FullType(Pet_Status))); + } + 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 Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'name': + result.name = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + break; + case 'category': + result.category.replace(serializers.deserialize(value, specifiedType: const FullType(Category))! as Category); + break; + case 'photoUrls': + result.photoUrls.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [FullType(String)]))! as BuiltList); + break; + case 'tags': + result.tags.replace(serializers.deserialize(value, specifiedType: const FullType(BuiltList, [FullType(Tag)]))! + as BuiltList); + break; + case 'status': + result.status = serializers.deserialize(value, specifiedType: const FullType(Pet_Status)) as Pet_Status?; + break; + } + } + + return result.build(); + } +} + +class _$FindPetsByStatusStatusSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FindPetsByStatusStatus]; + @override + final String wireName = 'FindPetsByStatusStatus'; + + @override + Object serialize(Serializers serializers, FindPetsByStatusStatus object, + {FullType specifiedType = FullType.unspecified}) => + object.name; + + @override + FindPetsByStatusStatus deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) => + FindPetsByStatusStatus.valueOf(serialized as String); +} + +class _$ApiResponseSerializer implements StructuredSerializer { + @override + final Iterable types = const [ApiResponse, _$ApiResponse]; + @override + final String wireName = 'ApiResponse'; + + @override + Iterable serialize(Serializers serializers, ApiResponse object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.code; + if (value != null) { + result + ..add('code') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.type; + if (value != null) { + result + ..add('type') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.message; + if (value != null) { + result + ..add('message') + ..add(serializers.serialize(value, 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 Object? value = iterator.current; + switch (key) { + case 'code': + result.code = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'type': + result.type = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'message': + result.message = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + } + } + + return result.build(); + } +} + +class _$Order_StatusSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Order_Status]; + @override + final String wireName = 'Order_Status'; + + @override + Object serialize(Serializers serializers, Order_Status object, {FullType specifiedType = FullType.unspecified}) => + object.name; + + @override + Order_Status deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) => + Order_Status.valueOf(serialized as String); +} + +class _$OrderSerializer implements StructuredSerializer { + @override + final Iterable types = const [Order, _$Order]; + @override + final String wireName = 'Order'; + + @override + Iterable serialize(Serializers serializers, Order object, {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.id; + if (value != null) { + result + ..add('id') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.petId; + if (value != null) { + result + ..add('petId') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.quantity; + if (value != null) { + result + ..add('quantity') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.shipDate; + if (value != null) { + result + ..add('shipDate') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.status; + if (value != null) { + result + ..add('status') + ..add(serializers.serialize(value, specifiedType: const FullType(Order_Status))); + } + value = object.complete; + if (value != null) { + result + ..add('complete') + ..add(serializers.serialize(value, 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 Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'petId': + result.petId = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'quantity': + result.quantity = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'shipDate': + result.shipDate = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'status': + result.status = serializers.deserialize(value, specifiedType: const FullType(Order_Status)) as Order_Status?; + break; + case 'complete': + result.complete = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?; + break; + } + } + + return result.build(); + } +} + +class _$UserSerializer implements StructuredSerializer { + @override + final Iterable types = const [User, _$User]; + @override + final String wireName = 'User'; + + @override + Iterable serialize(Serializers serializers, User object, {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.id; + if (value != null) { + result + ..add('id') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.username; + if (value != null) { + result + ..add('username') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.firstName; + if (value != null) { + result + ..add('firstName') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.lastName; + if (value != null) { + result + ..add('lastName') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.email; + if (value != null) { + result + ..add('email') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.password; + if (value != null) { + result + ..add('password') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.phone; + if (value != null) { + result + ..add('phone') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.userStatus; + if (value != null) { + result + ..add('userStatus') + ..add(serializers.serialize(value, 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 Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'username': + result.username = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'firstName': + result.firstName = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'lastName': + result.lastName = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'email': + result.email = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'password': + result.password = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'phone': + result.phone = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'userStatus': + result.userStatus = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + } + } + + return result.build(); + } +} + +class _$AddressSerializer implements StructuredSerializer
{ + @override + final Iterable types = const [Address, _$Address]; + @override + final String wireName = 'Address'; + + @override + Iterable serialize(Serializers serializers, Address object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.street; + if (value != null) { + result + ..add('street') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.city; + if (value != null) { + result + ..add('city') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.state; + if (value != null) { + result + ..add('state') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.zip; + if (value != null) { + result + ..add('zip') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + return result; + } + + @override + Address deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = AddressBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'street': + result.street = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'city': + result.city = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'state': + result.state = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'zip': + result.zip = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + } + } + + return result.build(); + } +} + +class _$CustomerSerializer implements StructuredSerializer { + @override + final Iterable types = const [Customer, _$Customer]; + @override + final String wireName = 'Customer'; + + @override + Iterable serialize(Serializers serializers, Customer object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.id; + if (value != null) { + result + ..add('id') + ..add(serializers.serialize(value, specifiedType: const FullType(int))); + } + value = object.username; + if (value != null) { + result + ..add('username') + ..add(serializers.serialize(value, specifiedType: const FullType(String))); + } + value = object.address; + if (value != null) { + result + ..add('address') + ..add(serializers.serialize(value, specifiedType: const FullType(BuiltList, [FullType(Address)]))); + } + return result; + } + + @override + Customer deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = CustomerBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'id': + result.id = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; + break; + case 'username': + result.username = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; + break; + case 'address': + result.address.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [FullType(Address)]))! as BuiltList); + break; + } + } + + return result.build(); + } +} + +abstract mixin class CategoryInterfaceBuilder { + void replace(CategoryInterface other); + void update(void Function(CategoryInterfaceBuilder) updates); + int? get id; + set id(int? id); + + String? get name; + set name(String? name); +} + +class _$Category extends Category { + @override + final int? id; + @override + final String? name; + + factory _$Category([void Function(CategoryBuilder)? updates]) => (CategoryBuilder()..update(updates))._build(); + + _$Category._({this.id, this.name}) : super._(); + + @override + Category rebuild(void Function(CategoryBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + CategoryBuilder toBuilder() => CategoryBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is Category && id == other.id && name == other.name; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'Category') + ..add('id', id) + ..add('name', name)) + .toString(); + } +} + +class CategoryBuilder implements Builder, CategoryInterfaceBuilder { + _$Category? _$v; + + int? _id; + int? get id => _$this._id; + set id(covariant int? id) => _$this._id = id; + + String? _name; + String? get name => _$this._name; + set name(covariant String? name) => _$this._name = name; + + CategoryBuilder(); + + CategoryBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _name = $v.name; + _$v = null; + } + return this; + } + + @override + void replace(covariant Category other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$Category; + } + + @override + void update(void Function(CategoryBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + Category build() => _build(); + + _$Category _build() { + final _$result = _$v ?? _$Category._(id: id, name: name); + replace(_$result); + return _$result; + } +} + +abstract mixin class TagInterfaceBuilder { + void replace(TagInterface other); + void update(void Function(TagInterfaceBuilder) updates); + int? get id; + set id(int? id); + + String? get name; + set name(String? name); +} + +class _$Tag extends Tag { + @override + final int? id; + @override + final String? name; + + factory _$Tag([void Function(TagBuilder)? updates]) => (TagBuilder()..update(updates))._build(); + + _$Tag._({this.id, this.name}) : super._(); + + @override + Tag rebuild(void Function(TagBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + TagBuilder toBuilder() => TagBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is Tag && id == other.id && name == other.name; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'Tag') + ..add('id', id) + ..add('name', name)) + .toString(); + } +} + +class TagBuilder implements Builder, TagInterfaceBuilder { + _$Tag? _$v; + + int? _id; + int? get id => _$this._id; + set id(covariant int? id) => _$this._id = id; + + String? _name; + String? get name => _$this._name; + set name(covariant String? name) => _$this._name = name; + + TagBuilder(); + + TagBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _name = $v.name; + _$v = null; + } + return this; + } + + @override + void replace(covariant Tag other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$Tag; + } + + @override + void update(void Function(TagBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + Tag build() => _build(); + + _$Tag _build() { + final _$result = _$v ?? _$Tag._(id: id, name: name); + replace(_$result); + return _$result; + } +} + +abstract mixin class PetInterfaceBuilder { + void replace(PetInterface other); + void update(void Function(PetInterfaceBuilder) updates); + int? get id; + set id(int? id); + + String? get name; + set name(String? name); + + CategoryBuilder get category; + set category(CategoryBuilder? category); + + ListBuilder get photoUrls; + set photoUrls(ListBuilder? photoUrls); + + ListBuilder get tags; + set tags(ListBuilder? tags); + + Pet_Status? get status; + set status(Pet_Status? status); +} + +class _$Pet extends Pet { + @override + final int? id; + @override + final String name; + @override + final Category? category; + @override + final BuiltList photoUrls; + @override + final BuiltList? tags; + @override + final Pet_Status? status; + + factory _$Pet([void Function(PetBuilder)? updates]) => (PetBuilder()..update(updates))._build(); + + _$Pet._({this.id, required this.name, this.category, required this.photoUrls, this.tags, this.status}) : super._() { + BuiltValueNullFieldError.checkNotNull(name, r'Pet', 'name'); + BuiltValueNullFieldError.checkNotNull(photoUrls, r'Pet', 'photoUrls'); + } + + @override + Pet rebuild(void Function(PetBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + PetBuilder toBuilder() => PetBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is Pet && + id == other.id && + name == other.name && + category == other.category && + photoUrls == other.photoUrls && + tags == other.tags && + status == other.status; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, category.hashCode); + _$hash = $jc(_$hash, photoUrls.hashCode); + _$hash = $jc(_$hash, tags.hashCode); + _$hash = $jc(_$hash, status.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'Pet') + ..add('id', id) + ..add('name', name) + ..add('category', category) + ..add('photoUrls', photoUrls) + ..add('tags', tags) + ..add('status', status)) + .toString(); + } +} + +class PetBuilder implements Builder, PetInterfaceBuilder { + _$Pet? _$v; + + int? _id; + int? get id => _$this._id; + set id(covariant int? id) => _$this._id = id; + + String? _name; + String? get name => _$this._name; + set name(covariant String? name) => _$this._name = name; + + CategoryBuilder? _category; + CategoryBuilder get category => _$this._category ??= CategoryBuilder(); + set category(covariant CategoryBuilder? category) => _$this._category = category; + + ListBuilder? _photoUrls; + ListBuilder get photoUrls => _$this._photoUrls ??= ListBuilder(); + set photoUrls(covariant ListBuilder? photoUrls) => _$this._photoUrls = photoUrls; + + ListBuilder? _tags; + ListBuilder get tags => _$this._tags ??= ListBuilder(); + set tags(covariant ListBuilder? tags) => _$this._tags = tags; + + Pet_Status? _status; + Pet_Status? get status => _$this._status; + set status(covariant Pet_Status? status) => _$this._status = status; + + PetBuilder(); + + PetBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _name = $v.name; + _category = $v.category?.toBuilder(); + _photoUrls = $v.photoUrls.toBuilder(); + _tags = $v.tags?.toBuilder(); + _status = $v.status; + _$v = null; + } + return this; + } + + @override + void replace(covariant Pet other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$Pet; + } + + @override + void update(void Function(PetBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + Pet build() => _build(); + + _$Pet _build() { + _$Pet _$result; + try { + _$result = _$v ?? + _$Pet._( + id: id, + name: BuiltValueNullFieldError.checkNotNull(name, r'Pet', 'name'), + category: _category?.build(), + photoUrls: photoUrls.build(), + tags: _tags?.build(), + status: status); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'category'; + _category?.build(); + _$failedField = 'photoUrls'; + photoUrls.build(); + _$failedField = 'tags'; + _tags?.build(); + } catch (e) { + throw BuiltValueNestedFieldError(r'Pet', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +abstract mixin class ApiResponseInterfaceBuilder { + void replace(ApiResponseInterface other); + void update(void Function(ApiResponseInterfaceBuilder) updates); + int? get code; + set code(int? code); + + String? get type; + set type(String? type); + + String? get message; + set message(String? message); +} + +class _$ApiResponse extends ApiResponse { + @override + final int? code; + @override + final String? type; + @override + final String? message; + + factory _$ApiResponse([void Function(ApiResponseBuilder)? updates]) => + (ApiResponseBuilder()..update(updates))._build(); + + _$ApiResponse._({this.code, this.type, this.message}) : super._(); + + @override + ApiResponse rebuild(void Function(ApiResponseBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + ApiResponseBuilder toBuilder() => ApiResponseBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is ApiResponse && code == other.code && type == other.type && message == other.message; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, code.hashCode); + _$hash = $jc(_$hash, type.hashCode); + _$hash = $jc(_$hash, message.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'ApiResponse') + ..add('code', code) + ..add('type', type) + ..add('message', message)) + .toString(); + } +} + +class ApiResponseBuilder implements Builder, ApiResponseInterfaceBuilder { + _$ApiResponse? _$v; + + int? _code; + int? get code => _$this._code; + set code(covariant int? code) => _$this._code = code; + + String? _type; + String? get type => _$this._type; + set type(covariant String? type) => _$this._type = type; + + String? _message; + String? get message => _$this._message; + set message(covariant String? message) => _$this._message = message; + + ApiResponseBuilder(); + + ApiResponseBuilder get _$this { + final $v = _$v; + if ($v != null) { + _code = $v.code; + _type = $v.type; + _message = $v.message; + _$v = null; + } + return this; + } + + @override + void replace(covariant ApiResponse other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$ApiResponse; + } + + @override + void update(void Function(ApiResponseBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + ApiResponse build() => _build(); + + _$ApiResponse _build() { + final _$result = _$v ?? _$ApiResponse._(code: code, type: type, message: message); + replace(_$result); + return _$result; + } +} + +abstract mixin class OrderInterfaceBuilder { + void replace(OrderInterface other); + void update(void Function(OrderInterfaceBuilder) updates); + int? get id; + set id(int? id); + + int? get petId; + set petId(int? petId); + + int? get quantity; + set quantity(int? quantity); + + String? get shipDate; + set shipDate(String? shipDate); + + Order_Status? get status; + set status(Order_Status? status); + + bool? get complete; + set complete(bool? complete); +} + +class _$Order extends Order { + @override + final int? id; + @override + final int? petId; + @override + final int? quantity; + @override + final String? shipDate; + @override + final Order_Status? status; + @override + final bool? complete; + + factory _$Order([void Function(OrderBuilder)? updates]) => (OrderBuilder()..update(updates))._build(); + + _$Order._({this.id, this.petId, this.quantity, this.shipDate, this.status, this.complete}) : super._(); + + @override + Order rebuild(void Function(OrderBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + OrderBuilder toBuilder() => OrderBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is Order && + id == other.id && + petId == other.petId && + quantity == other.quantity && + shipDate == other.shipDate && + status == other.status && + complete == other.complete; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, petId.hashCode); + _$hash = $jc(_$hash, quantity.hashCode); + _$hash = $jc(_$hash, shipDate.hashCode); + _$hash = $jc(_$hash, status.hashCode); + _$hash = $jc(_$hash, complete.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'Order') + ..add('id', id) + ..add('petId', petId) + ..add('quantity', quantity) + ..add('shipDate', shipDate) + ..add('status', status) + ..add('complete', complete)) + .toString(); + } +} + +class OrderBuilder implements Builder, OrderInterfaceBuilder { + _$Order? _$v; + + int? _id; + int? get id => _$this._id; + set id(covariant int? id) => _$this._id = id; + + int? _petId; + int? get petId => _$this._petId; + set petId(covariant int? petId) => _$this._petId = petId; + + int? _quantity; + int? get quantity => _$this._quantity; + set quantity(covariant int? quantity) => _$this._quantity = quantity; + + String? _shipDate; + String? get shipDate => _$this._shipDate; + set shipDate(covariant String? shipDate) => _$this._shipDate = shipDate; + + Order_Status? _status; + Order_Status? get status => _$this._status; + set status(covariant Order_Status? status) => _$this._status = status; + + bool? _complete; + bool? get complete => _$this._complete; + set complete(covariant bool? complete) => _$this._complete = complete; + + OrderBuilder(); + + OrderBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _petId = $v.petId; + _quantity = $v.quantity; + _shipDate = $v.shipDate; + _status = $v.status; + _complete = $v.complete; + _$v = null; + } + return this; + } + + @override + void replace(covariant Order other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$Order; + } + + @override + void update(void Function(OrderBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + Order build() => _build(); + + _$Order _build() { + final _$result = _$v ?? + _$Order._(id: id, petId: petId, quantity: quantity, shipDate: shipDate, status: status, complete: complete); + replace(_$result); + return _$result; + } +} + +abstract mixin class UserInterfaceBuilder { + void replace(UserInterface other); + void update(void Function(UserInterfaceBuilder) updates); + int? get id; + set id(int? id); + + String? get username; + set username(String? username); + + String? get firstName; + set firstName(String? firstName); + + String? get lastName; + set lastName(String? lastName); + + String? get email; + set email(String? email); + + String? get password; + set password(String? password); + + String? get phone; + set phone(String? phone); + + int? get userStatus; + set userStatus(int? userStatus); +} + +class _$User extends User { + @override + final int? id; + @override + final String? username; + @override + final String? firstName; + @override + final String? lastName; + @override + final String? email; + @override + final String? password; + @override + final String? phone; + @override + final int? userStatus; + + factory _$User([void Function(UserBuilder)? updates]) => (UserBuilder()..update(updates))._build(); + + _$User._( + {this.id, this.username, this.firstName, this.lastName, this.email, this.password, this.phone, this.userStatus}) + : super._(); + + @override + User rebuild(void Function(UserBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + UserBuilder toBuilder() => UserBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is User && + id == other.id && + username == other.username && + firstName == other.firstName && + lastName == other.lastName && + email == other.email && + password == other.password && + phone == other.phone && + userStatus == other.userStatus; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, username.hashCode); + _$hash = $jc(_$hash, firstName.hashCode); + _$hash = $jc(_$hash, lastName.hashCode); + _$hash = $jc(_$hash, email.hashCode); + _$hash = $jc(_$hash, password.hashCode); + _$hash = $jc(_$hash, phone.hashCode); + _$hash = $jc(_$hash, userStatus.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'User') + ..add('id', id) + ..add('username', username) + ..add('firstName', firstName) + ..add('lastName', lastName) + ..add('email', email) + ..add('password', password) + ..add('phone', phone) + ..add('userStatus', userStatus)) + .toString(); + } +} + +class UserBuilder implements Builder, UserInterfaceBuilder { + _$User? _$v; + + int? _id; + int? get id => _$this._id; + set id(covariant int? id) => _$this._id = id; + + String? _username; + String? get username => _$this._username; + set username(covariant String? username) => _$this._username = username; + + String? _firstName; + String? get firstName => _$this._firstName; + set firstName(covariant String? firstName) => _$this._firstName = firstName; + + String? _lastName; + String? get lastName => _$this._lastName; + set lastName(covariant String? lastName) => _$this._lastName = lastName; + + String? _email; + String? get email => _$this._email; + set email(covariant String? email) => _$this._email = email; + + String? _password; + String? get password => _$this._password; + set password(covariant String? password) => _$this._password = password; + + String? _phone; + String? get phone => _$this._phone; + set phone(covariant String? phone) => _$this._phone = phone; + + int? _userStatus; + int? get userStatus => _$this._userStatus; + set userStatus(covariant int? userStatus) => _$this._userStatus = userStatus; + + UserBuilder(); + + UserBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _username = $v.username; + _firstName = $v.firstName; + _lastName = $v.lastName; + _email = $v.email; + _password = $v.password; + _phone = $v.phone; + _userStatus = $v.userStatus; + _$v = null; + } + return this; + } + + @override + void replace(covariant User other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$User; + } + + @override + void update(void Function(UserBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + User build() => _build(); + + _$User _build() { + final _$result = _$v ?? + _$User._( + id: id, + username: username, + firstName: firstName, + lastName: lastName, + email: email, + password: password, + phone: phone, + userStatus: userStatus); + replace(_$result); + return _$result; + } +} + +abstract mixin class UserLoginUserHeadersInterfaceBuilder { + void replace(UserLoginUserHeadersInterface other); + void update(void Function(UserLoginUserHeadersInterfaceBuilder) updates); + int? get xRateLimit; + set xRateLimit(int? xRateLimit); + + String? get xExpiresAfter; + set xExpiresAfter(String? xExpiresAfter); +} + +class _$UserLoginUserHeaders extends UserLoginUserHeaders { + @override + final int? xRateLimit; + @override + final String? xExpiresAfter; + + factory _$UserLoginUserHeaders([void Function(UserLoginUserHeadersBuilder)? updates]) => + (UserLoginUserHeadersBuilder()..update(updates))._build(); + + _$UserLoginUserHeaders._({this.xRateLimit, this.xExpiresAfter}) : super._(); + + @override + UserLoginUserHeaders rebuild(void Function(UserLoginUserHeadersBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + UserLoginUserHeadersBuilder toBuilder() => UserLoginUserHeadersBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is UserLoginUserHeaders && xRateLimit == other.xRateLimit && xExpiresAfter == other.xExpiresAfter; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, xRateLimit.hashCode); + _$hash = $jc(_$hash, xExpiresAfter.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'UserLoginUserHeaders') + ..add('xRateLimit', xRateLimit) + ..add('xExpiresAfter', xExpiresAfter)) + .toString(); + } +} + +class UserLoginUserHeadersBuilder + implements Builder, UserLoginUserHeadersInterfaceBuilder { + _$UserLoginUserHeaders? _$v; + + int? _xRateLimit; + int? get xRateLimit => _$this._xRateLimit; + set xRateLimit(covariant int? xRateLimit) => _$this._xRateLimit = xRateLimit; + + String? _xExpiresAfter; + String? get xExpiresAfter => _$this._xExpiresAfter; + set xExpiresAfter(covariant String? xExpiresAfter) => _$this._xExpiresAfter = xExpiresAfter; + + UserLoginUserHeadersBuilder(); + + UserLoginUserHeadersBuilder get _$this { + final $v = _$v; + if ($v != null) { + _xRateLimit = $v.xRateLimit; + _xExpiresAfter = $v.xExpiresAfter; + _$v = null; + } + return this; + } + + @override + void replace(covariant UserLoginUserHeaders other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$UserLoginUserHeaders; + } + + @override + void update(void Function(UserLoginUserHeadersBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + UserLoginUserHeaders build() => _build(); + + _$UserLoginUserHeaders _build() { + final _$result = _$v ?? _$UserLoginUserHeaders._(xRateLimit: xRateLimit, xExpiresAfter: xExpiresAfter); + replace(_$result); + return _$result; + } +} + +abstract mixin class AddressInterfaceBuilder { + void replace(AddressInterface other); + void update(void Function(AddressInterfaceBuilder) updates); + String? get street; + set street(String? street); + + String? get city; + set city(String? city); + + String? get state; + set state(String? state); + + String? get zip; + set zip(String? zip); +} + +class _$Address extends Address { + @override + final String? street; + @override + final String? city; + @override + final String? state; + @override + final String? zip; + + factory _$Address([void Function(AddressBuilder)? updates]) => (AddressBuilder()..update(updates))._build(); + + _$Address._({this.street, this.city, this.state, this.zip}) : super._(); + + @override + Address rebuild(void Function(AddressBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + AddressBuilder toBuilder() => AddressBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is Address && street == other.street && city == other.city && state == other.state && zip == other.zip; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, street.hashCode); + _$hash = $jc(_$hash, city.hashCode); + _$hash = $jc(_$hash, state.hashCode); + _$hash = $jc(_$hash, zip.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'Address') + ..add('street', street) + ..add('city', city) + ..add('state', state) + ..add('zip', zip)) + .toString(); + } +} + +class AddressBuilder implements Builder, AddressInterfaceBuilder { + _$Address? _$v; + + String? _street; + String? get street => _$this._street; + set street(covariant String? street) => _$this._street = street; + + String? _city; + String? get city => _$this._city; + set city(covariant String? city) => _$this._city = city; + + String? _state; + String? get state => _$this._state; + set state(covariant String? state) => _$this._state = state; + + String? _zip; + String? get zip => _$this._zip; + set zip(covariant String? zip) => _$this._zip = zip; + + AddressBuilder(); + + AddressBuilder get _$this { + final $v = _$v; + if ($v != null) { + _street = $v.street; + _city = $v.city; + _state = $v.state; + _zip = $v.zip; + _$v = null; + } + return this; + } + + @override + void replace(covariant Address other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$Address; + } + + @override + void update(void Function(AddressBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + Address build() => _build(); + + _$Address _build() { + final _$result = _$v ?? _$Address._(street: street, city: city, state: state, zip: zip); + replace(_$result); + return _$result; + } +} + +abstract mixin class CustomerInterfaceBuilder { + void replace(CustomerInterface other); + void update(void Function(CustomerInterfaceBuilder) updates); + int? get id; + set id(int? id); + + String? get username; + set username(String? username); + + ListBuilder
get address; + set address(ListBuilder
? address); +} + +class _$Customer extends Customer { + @override + final int? id; + @override + final String? username; + @override + final BuiltList
? address; + + factory _$Customer([void Function(CustomerBuilder)? updates]) => (CustomerBuilder()..update(updates))._build(); + + _$Customer._({this.id, this.username, this.address}) : super._(); + + @override + Customer rebuild(void Function(CustomerBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + CustomerBuilder toBuilder() => CustomerBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is Customer && id == other.id && username == other.username && address == other.address; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, username.hashCode); + _$hash = $jc(_$hash, address.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'Customer') + ..add('id', id) + ..add('username', username) + ..add('address', address)) + .toString(); + } +} + +class CustomerBuilder implements Builder, CustomerInterfaceBuilder { + _$Customer? _$v; + + int? _id; + int? get id => _$this._id; + set id(covariant int? id) => _$this._id = id; + + String? _username; + String? get username => _$this._username; + set username(covariant String? username) => _$this._username = username; + + ListBuilder
? _address; + ListBuilder
get address => _$this._address ??= ListBuilder
(); + set address(covariant ListBuilder
? address) => _$this._address = address; + + CustomerBuilder(); + + CustomerBuilder get _$this { + final $v = _$v; + if ($v != null) { + _id = $v.id; + _username = $v.username; + _address = $v.address?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(covariant Customer other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$Customer; + } + + @override + void update(void Function(CustomerBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + Customer build() => _build(); + + _$Customer _build() { + _$Customer _$result; + try { + _$result = _$v ?? _$Customer._(id: id, username: username, address: _address?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'address'; + _address?.build(); + } catch (e) { + throw BuiltValueNestedFieldError(r'Customer', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.json b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.json new file mode 100644 index 00000000000..fcf2448f6c7 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.json @@ -0,0 +1,1230 @@ +{ + "openapi": "3.0.2", + "servers": [ + { + "url": "/v3" + } + ], + "info": { + "description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)", + "version": "1.0.17", + "title": "Swagger Petstore - OpenAPI 3.0", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "email": "apiteam@swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "tags": [ + { + "name": "pet", + "description": "Everything about your Pets", + "externalDocs": { + "description": "Find out more", + "url": "http://swagger.io" + } + }, + { + "name": "store", + "description": "Access to Petstore orders", + "externalDocs": { + "description": "Find out more about our store", + "url": "http://swagger.io" + } + }, + { + "name": "user", + "description": "Operations about user" + } + ], + "paths": { + "/pet": { + "post": { + "tags": [ + "pet" + ], + "summary": "Add a new pet to the store", + "description": "Add a new pet to the store", + "operationId": "addPet", + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "405": { + "description": "Invalid input" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ], + "requestBody": { + "description": "Create a new pet in the store", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "put": { + "tags": [ + "pet" + ], + "summary": "Update an existing pet", + "description": "Update an existing pet by Id", + "operationId": "updatePet", + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Pet not found" + }, + "405": { + "description": "Validation exception" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ], + "requestBody": { + "description": "Update an existent pet in the store", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + } + }, + "/pet/findByStatus": { + "get": { + "tags": [ + "pet" + ], + "summary": "Finds Pets by status", + "description": "Multiple status values can be provided with comma separated strings", + "operationId": "findPetsByStatus", + "parameters": [ + { + "name": "status", + "in": "query", + "description": "Status values that need to be considered for filter", + "required": false, + "explode": true, + "schema": { + "type": "string", + "enum": [ + "available", + "pending", + "sold" + ], + "default": "available" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/xml": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "400": { + "description": "Invalid status value" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + } + }, + "/pet/findByTags": { + "get": { + "tags": [ + "pet" + ], + "summary": "Finds Pets by tags", + "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId": "findPetsByTags", + "parameters": [ + { + "name": "tags", + "in": "query", + "description": "Tags to filter by", + "required": false, + "explode": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/xml": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "400": { + "description": "Invalid tag value" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + } + }, + "/pet/{petId}": { + "get": { + "tags": [ + "pet" + ], + "summary": "Find pet by ID", + "description": "Returns a single pet", + "operationId": "getPetById", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet to return", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Pet not found" + } + }, + "security": [ + { + "api_key": [] + }, + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + }, + "post": { + "tags": [ + "pet" + ], + "summary": "Updates a pet in the store with form data", + "description": "", + "operationId": "updatePetWithForm", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be updated", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "name", + "in": "query", + "description": "Name of pet that needs to be updated", + "schema": { + "type": "string" + } + }, + { + "name": "status", + "in": "query", + "description": "Status of pet that needs to be updated", + "schema": { + "type": "string" + } + } + ], + "responses": { + "405": { + "description": "Invalid input" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + }, + "delete": { + "tags": [ + "pet" + ], + "summary": "Deletes a pet", + "description": "", + "operationId": "deletePet", + "parameters": [ + { + "name": "api_key", + "in": "header", + "description": "", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "petId", + "in": "path", + "description": "Pet id to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "400": { + "description": "Invalid pet value" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + } + }, + "/pet/{petId}/uploadImage": { + "post": { + "tags": [ + "pet" + ], + "summary": "uploads an image", + "description": "", + "operationId": "uploadFile", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet to update", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "additionalMetadata", + "in": "query", + "description": "Additional Metadata", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ], + "requestBody": { + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + }, + "/store/inventory": { + "get": { + "tags": [ + "store" + ], + "summary": "Returns pet inventories by status", + "description": "Returns a map of status codes to quantities", + "operationId": "getInventory", + "x-swagger-router-controller": "OrderController", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/store/order": { + "post": { + "tags": [ + "store" + ], + "summary": "Place an order for a pet", + "description": "Place a new order in the store", + "operationId": "placeOrder", + "x-swagger-router-controller": "OrderController", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Order" + } + } + } + }, + "405": { + "description": "Invalid input" + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Order" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Order" + } + }, + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Order" + } + } + } + } + } + }, + "/store/order/{orderId}": { + "get": { + "tags": [ + "store" + ], + "summary": "Find purchase order by ID", + "x-swagger-router-controller": "OrderController", + "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.", + "operationId": "getOrderById", + "parameters": [ + { + "name": "orderId", + "in": "path", + "description": "ID of order that needs to be fetched", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Order" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Order" + } + } + } + }, + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Order not found" + } + } + }, + "delete": { + "tags": [ + "store" + ], + "summary": "Delete purchase order by ID", + "x-swagger-router-controller": "OrderController", + "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId": "deleteOrder", + "parameters": [ + { + "name": "orderId", + "in": "path", + "description": "ID of the order that needs to be deleted", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "400": { + "description": "Invalid ID supplied" + }, + "404": { + "description": "Order not found" + } + } + } + }, + "/user": { + "post": { + "tags": [ + "user" + ], + "summary": "Create user", + "description": "This can only be done by the logged in user.", + "operationId": "createUser", + "responses": { + "default": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + }, + "description": "Created user object" + } + } + }, + "/user/createWithList": { + "post": { + "tags": [ + "user" + ], + "summary": "Creates list of users with given input array", + "description": "Creates list of users with given input array", + "x-swagger-router-controller": "UserController", + "operationId": "createUsersWithListInput", + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "default": { + "description": "successful operation" + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + } + } + } + } + } + }, + "/user/login": { + "get": { + "tags": [ + "user" + ], + "summary": "Logs user into the system", + "description": "", + "operationId": "loginUser", + "parameters": [ + { + "name": "username", + "in": "query", + "description": "The user name for login", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "password", + "in": "query", + "description": "The password for login in clear text", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "X-Rate-Limit": { + "description": "calls per hour allowed by the user", + "schema": { + "type": "integer", + "format": "int32" + } + }, + "X-Expires-After": { + "description": "date in UTC when token expires", + "schema": { + "type": "string", + "format": "date-time" + } + } + }, + "content": { + "application/xml": { + "schema": { + "type": "string" + } + }, + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid username/password supplied" + } + } + } + }, + "/user/logout": { + "get": { + "tags": [ + "user" + ], + "summary": "Logs out current logged in user session", + "description": "", + "operationId": "logoutUser", + "parameters": [], + "responses": { + "default": { + "description": "successful operation" + } + } + } + }, + "/user/{username}": { + "get": { + "tags": [ + "user" + ], + "summary": "Get user by user name", + "description": "", + "operationId": "getUserByName", + "parameters": [ + { + "name": "username", + "in": "path", + "description": "The name that needs to be fetched. Use user1 for testing. ", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "400": { + "description": "Invalid username supplied" + }, + "404": { + "description": "User not found" + } + } + }, + "put": { + "tags": [ + "user" + ], + "summary": "Update user", + "x-swagger-router-controller": "UserController", + "description": "This can only be done by the logged in user.", + "operationId": "updateUser", + "parameters": [ + { + "name": "username", + "in": "path", + "description": "name that needs to be updated", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "successful operation" + } + }, + "requestBody": { + "description": "Update an existent user in the store", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + } + }, + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "delete": { + "tags": [ + "user" + ], + "summary": "Delete user", + "description": "This can only be done by the logged in user.", + "operationId": "deleteUser", + "parameters": [ + { + "name": "username", + "in": "path", + "description": "The name that needs to be deleted", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "400": { + "description": "Invalid username supplied" + }, + "404": { + "description": "User not found" + } + } + } + } + }, + "externalDocs": { + "description": "Find out more about Swagger", + "url": "http://swagger.io" + }, + "components": { + "schemas": { + "Order": { + "x-swagger-router-model": "io.swagger.petstore.model.Order", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 10 + }, + "petId": { + "type": "integer", + "format": "int64", + "example": 198772 + }, + "quantity": { + "type": "integer", + "format": "int32", + "example": 7 + }, + "shipDate": { + "type": "string", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order Status", + "enum": [ + "placed", + "approved", + "delivered" + ], + "example": "approved" + }, + "complete": { + "type": "boolean" + } + }, + "xml": { + "name": "order" + }, + "type": "object" + }, + "Customer": { + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 100000 + }, + "username": { + "type": "string", + "example": "fehguy" + }, + "address": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Address" + }, + "xml": { + "wrapped": true, + "name": "addresses" + } + } + }, + "xml": { + "name": "customer" + }, + "type": "object" + }, + "Address": { + "properties": { + "street": { + "type": "string", + "example": "437 Lytton" + }, + "city": { + "type": "string", + "example": "Palo Alto" + }, + "state": { + "type": "string", + "example": "CA" + }, + "zip": { + "type": "string", + "example": 94301 + } + }, + "xml": { + "name": "address" + }, + "type": "object" + }, + "Category": { + "x-swagger-router-model": "io.swagger.petstore.model.Category", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 1 + }, + "name": { + "type": "string", + "example": "Dogs" + } + }, + "xml": { + "name": "category" + }, + "type": "object" + }, + "User": { + "x-swagger-router-model": "io.swagger.petstore.model.User", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 10 + }, + "username": { + "type": "string", + "example": "theUser" + }, + "firstName": { + "type": "string", + "example": "John" + }, + "lastName": { + "type": "string", + "example": "James" + }, + "email": { + "type": "string", + "example": "john@email.com" + }, + "password": { + "type": "string", + "example": 12345 + }, + "phone": { + "type": "string", + "example": 12345 + }, + "userStatus": { + "type": "integer", + "format": "int32", + "example": 1, + "description": "User Status" + } + }, + "xml": { + "name": "user" + }, + "type": "object" + }, + "Tag": { + "x-swagger-router-model": "io.swagger.petstore.model.Tag", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "xml": { + "name": "tag" + }, + "type": "object" + }, + "Pet": { + "x-swagger-router-model": "io.swagger.petstore.model.Pet", + "required": [ + "name", + "photoUrls" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 10 + }, + "name": { + "type": "string", + "example": "doggie" + }, + "category": { + "$ref": "#/components/schemas/Category" + }, + "photoUrls": { + "type": "array", + "xml": { + "wrapped": true + }, + "items": { + "type": "string", + "xml": { + "name": "photoUrl" + } + } + }, + "tags": { + "type": "array", + "xml": { + "wrapped": true + }, + "items": { + "$ref": "#/components/schemas/Tag", + "xml": { + "name": "tag" + } + } + }, + "status": { + "type": "string", + "description": "pet status in the store", + "enum": [ + "available", + "pending", + "sold" + ] + } + }, + "xml": { + "name": "pet" + }, + "type": "object" + }, + "ApiResponse": { + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "message": { + "type": "string" + } + }, + "xml": { + "name": "##default" + }, + "type": "object" + } + }, + "requestBodies": { + "Pet": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + }, + "description": "Pet object that needs to be added to the store" + }, + "UserArray": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "description": "List of user object" + } + }, + "securitySchemes": { + "petstore_auth": { + "type": "http", + "scheme": "basic" + }, + "api_key": { + "type": "http", + "scheme": "basic" + } + } + } +} diff --git a/packages/dynamite/dynamite_petstore_example/patch.json b/packages/dynamite/dynamite_petstore_example/patch.json new file mode 100644 index 00000000000..2f831c6362b --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/patch.json @@ -0,0 +1,16 @@ +[ + { + "op": "replace", + "path": "/components/securitySchemes", + "value": { + "petstore_auth": { + "type": "http", + "scheme": "basic" + }, + "api_key": { + "type": "http", + "scheme": "basic" + } + } + } +] diff --git a/packages/dynamite/dynamite_petstore_example/pubspec.yaml b/packages/dynamite/dynamite_petstore_example/pubspec.yaml new file mode 100644 index 00000000000..5a8d5f29c97 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/pubspec.yaml @@ -0,0 +1,23 @@ +name: dynamite_petstore_example +description: An example showing how to use dynamite for the Petstore example API. +version: 1.0.0 +publish_to: none + +environment: + sdk: '>=3.1.3 <4.0.0' + +dependencies: + built_collection: ^5.0.0 + built_value: ^8.0.1 + dynamite_runtime: + git: + url: https://github.com/nextcloud/neon + path: packages/dynamite/dynamite_runtime + +dev_dependencies: + build_runner: ^2.4.6 + built_value_generator: ^8.7.0 + dynamite: + git: + url: https://github.com/nextcloud/neon + path: packages/dynamite/dynamite diff --git a/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml b/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml new file mode 100644 index 00000000000..b0b6cc9f5f9 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: dynamite,dynamite_runtime +dependency_overrides: + dynamite: + path: ../dynamite + dynamite_runtime: + path: ../dynamite_runtime diff --git a/tool/generate-dynamite-petstore-example.sh b/tool/generate-dynamite-petstore-example.sh new file mode 100755 index 00000000000..eef0ba3823e --- /dev/null +++ b/tool/generate-dynamite-petstore-example.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euxo pipefail +cd "$(dirname "$0")/.." + +yq "." external/swagger-petstore/src/main/resources/openapi.yaml | \ + jsonpatch --indent 4 - packages/dynamite/dynamite_petstore_example/patch.json \ + > packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.json + +( + cd packages/dynamite/dynamite_petstore_example + rm -rf .dart_tool/build/generated/dynamite + fvm dart pub run build_runner build --delete-conflicting-outputs + fvm dart fix --apply lib/ + melos run format +)