From 8d916d2138ab8112cec3f90d2ca28c5e66823320 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 4 Jun 2025 11:54:09 -0600 Subject: [PATCH 01/10] fixed inconsistencies with the dart-dio json_serializable string binary response types --- .../languages/DartDioClientCodegen.java | 3 +++ .../dart/dio/DartDioClientCodegenTest.java | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 81414c5e03bf..c9caa785a81b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -274,6 +274,9 @@ private void configureSerializationLibraryJsonSerializable(String srcFolder) { supportingFiles.add(new SupportingFile("serialization/json_serializable/deserialize.mustache", srcFolder, "deserialize.dart")); + typeMapping.put("file", "Uint8List"); + typeMapping.put("binary", "Uint8List"); + // most of these are defined in AbstractDartCodegen, we are overriding // just the binary / file handling languageSpecificPrimitives.add("Object"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java index 90017530fb85..955923cdde64 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java @@ -16,6 +16,10 @@ package org.openapitools.codegen.dart.dio; +import io.swagger.v3.oas.models.media.Content; +import io.swagger.v3.oas.models.media.MediaType; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.responses.ApiResponse; import org.openapitools.codegen.*; import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.DartDioClientCodegen; @@ -115,4 +119,25 @@ public void verifyDartDioGeneratorRuns() throws IOException { TestUtils.ensureContainsFile(files, output, "README.md"); TestUtils.ensureContainsFile(files, output, "lib/src/api.dart"); } + + @Test(description = "json_serializable with binary response type (#20682)") + public void jsonSerializableBinaryResponseType() throws IOException { + final DefaultCodegen codegen = new DartDioClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, "json_serializable"); + codegen.processOpts(); + + final MediaType binaryMediaType = new MediaType().schema(new Schema().type("string").format("binary")); + + CodegenResponse zipResponse = codegen.fromResponse( + "200", + new ApiResponse().content(new Content().addMediaType("application/zip", binaryMediaType)) + ); + Assert.assertEquals(zipResponse.dataType, "Uint8List"); + + CodegenResponse streamResponse = codegen.fromResponse( + "200", + new ApiResponse().content(new Content().addMediaType("application/octet-stream", binaryMediaType)) + ); + Assert.assertEquals(streamResponse.dataType, "Uint8List"); + } } From 52f45f9a1194f1669cb4c10ef466cc5533768b5b Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 4 Jun 2025 12:05:51 -0600 Subject: [PATCH 02/10] update deserialize template to handle responseFile --- .../json_serializable/api/deserialize.mustache | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/deserialize.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/deserialize.mustache index f8666920780e..d2762e131a87 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/deserialize.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/deserialize.mustache @@ -1,2 +1,7 @@ final rawData = _response.data; -_responseData = rawData == null ? null : deserialize<{{{returnType}}}, {{{returnBaseType}}}>(rawData, '{{{returnType}}}', growable: true); \ No newline at end of file +{{#isResponseFile}} +_responseData = rawData == null ? null : rawData as {{{returnType}}}; +{{/isResponseFile}} +{{^isResponseFile}} +_responseData = rawData == null ? null : deserialize<{{{returnType}}}, {{{returnBaseType}}}>(rawData, '{{{returnType}}}', growable: true); +{{/isResponseFile}} \ No newline at end of file From daf929506277c4b40968cc77656cebc3cb2a8061 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 4 Jun 2025 12:16:17 -0600 Subject: [PATCH 03/10] regenerate samples --- .../doc/FakeApi.md | 4 ++-- .../doc/FormatTest.md | 2 +- .../lib/src/api/another_fake_api.dart | 1 + .../lib/src/api/default_api.dart | 1 + .../lib/src/api/fake_api.dart | 11 ++++++++++- .../lib/src/api/fake_classname_tags123_api.dart | 1 + .../lib/src/api/pet_api.dart | 5 +++++ .../lib/src/api/store_api.dart | 3 +++ .../lib/src/api/user_api.dart | 2 ++ .../lib/src/model/format_test.dart | 4 ++-- 10 files changed, 28 insertions(+), 6 deletions(-) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md index 1b5e1ca297c8..23bbcf65b329 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md @@ -603,7 +603,7 @@ final int int32 = 56; // int | None final int int64 = 789; // int | None final double float = 3.4; // double | None final String string = string_example; // String | None -final MultipartFile binary = BINARY_DATA_HERE; // MultipartFile | None +final Uint8List binary = BINARY_DATA_HERE; // Uint8List | None final DateTime date = 2013-10-20; // DateTime | None final DateTime dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None final String password = password_example; // String | None @@ -629,7 +629,7 @@ Name | Type | Description | Notes **int64** | **int**| None | [optional] **float** | **double**| None | [optional] **string** | **String**| None | [optional] - **binary** | **MultipartFile**| None | [optional] + **binary** | **Uint8List**| None | [optional] **date** | **DateTime**| None | [optional] **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md index 83b60545eb61..7cac4e3b6be1 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md @@ -17,7 +17,7 @@ Name | Type | Description | Notes **decimal** | **double** | | [optional] **string** | **String** | | [optional] **byte** | **String** | | -**binary** | [**MultipartFile**](MultipartFile.md) | | [optional] +**binary** | [**Uint8List**](Uint8List.md) | | [optional] **date** | [**DateTime**](DateTime.md) | | **dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart index d98f3c23f4f7..20e0f8da9464 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart @@ -84,6 +84,7 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart index e9efb7b5b194..7db9981e2a88 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart @@ -64,6 +64,7 @@ class DefaultApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'FooGetDefaultResponse', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index 06486358eda5..6b366d6f980a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -9,6 +9,7 @@ import 'dart:convert'; import 'package:openapi/src/deserialize.dart'; import 'package:dio/dio.dart'; +import 'dart:typed_data'; import 'package:openapi/src/model/child_with_nullable.dart'; import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; @@ -74,6 +75,7 @@ class FakeApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'FakeBigDecimalMap200Response', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -143,6 +145,7 @@ _responseData = rawData == null ? null : deserialize(rawData, 'HealthCheckResult', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -314,6 +317,7 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'bool', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -403,6 +407,7 @@ _bodyData=jsonEncode(outerComposite); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'OuterComposite', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -492,6 +497,7 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'num', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -581,6 +587,7 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -670,6 +677,7 @@ _bodyData=jsonEncode(outerObjectWithEnumProperty); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'OuterObjectWithEnumProperty', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1027,6 +1035,7 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1086,7 +1095,7 @@ _responseData = rawData == null ? null : deserialize(r int? int64, double? float, String? string, - MultipartFile? binary, + Uint8List? binary, DateTime? date, DateTime? dateTime, String? password, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart index 56ec33f1cace..85fbbac9287b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart @@ -91,6 +91,7 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart index ec20128ee1e3..aab8df518913 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart @@ -202,6 +202,7 @@ _bodyData=jsonEncode(pet); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'List', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -284,6 +285,7 @@ _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'L try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Set', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -362,6 +364,7 @@ _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Se try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Pet', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -604,6 +607,7 @@ _bodyData=jsonEncode(pet); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -702,6 +706,7 @@ _responseData = rawData == null ? null : deserialize(r try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart index 23e8deceaea8..f81b521ed418 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart @@ -118,6 +118,7 @@ class StoreApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, int>(rawData, 'Map', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -189,6 +190,7 @@ _responseData = rawData == null ? null : deserialize, int>(rawD try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -278,6 +280,7 @@ _bodyData=jsonEncode(order); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart index 24bbeb48f746..85583331abe7 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart @@ -308,6 +308,7 @@ _bodyData=jsonEncode(user); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'User', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -387,6 +388,7 @@ _responseData = rawData == null ? null : deserialize(rawData, 'User' try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart index a20ba417fa54..392faa8bf00c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart @@ -3,7 +3,7 @@ // // ignore_for_file: unused_element -import 'package:dio/dio.dart'; +import 'dart:typed_data'; import 'package:json_annotation/json_annotation.dart'; part 'format_test.g.dart'; @@ -173,7 +173,7 @@ class FormatTest { @JsonKey(ignore: true) - final MultipartFile? binary; + final Uint8List? binary; From 266073a2b5bc0d75fafd236a080d8e08702928b0 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 4 Jun 2025 13:48:10 -0600 Subject: [PATCH 04/10] only convert return_type to Uint8List --- .../languages/DartDioClientCodegen.java | 13 +- .../dart/dio/DartDioClientCodegenTest.java | 21 --- ...ith-fake-endpoints-models-for-testing.yaml | 27 ++++ .../java-helidon-client/v3/mp/docs/PetApi.md | 36 +++++ .../org/openapitools/client/api/PetApi.java | 9 ++ .../java-helidon-client/v3/se/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 8 + .../openapitools/client/api/PetApiImpl.java | 40 +++++ .../java-helidon-client/v4/mp/docs/PetApi.md | 36 +++++ .../org/openapitools/client/api/PetApi.java | 9 ++ .../java-helidon-client/v4/se/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 8 + .../openapitools/client/api/PetApiImpl.java | 40 +++++ .../petstore/java/apache-httpclient/README.md | 1 + .../java/apache-httpclient/api/openapi.yaml | 31 ++++ .../java/apache-httpclient/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 75 +++++++++ .../petstore/java/feign-hc5/api/openapi.yaml | 31 ++++ .../org/openapitools/client/api/PetApi.java | 27 ++++ .../petstore/java/feign/api/openapi.yaml | 31 ++++ .../org/openapitools/client/api/PetApi.java | 27 ++++ .../docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 11 ++ .../docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 11 ++ .../microprofile-rest-client/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 11 ++ .../java/restclient-swagger2/README.md | 1 + .../java/restclient-swagger2/api/openapi.yaml | 31 ++++ .../java/restclient-swagger2/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 74 +++++++++ .../README.md | 1 + .../api/openapi.yaml | 31 ++++ .../docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 74 +++++++++ .../README.md | 1 + .../api/openapi.yaml | 31 ++++ .../docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 74 +++++++++ .../client/petstore/java/restclient/README.md | 1 + .../petstore/java/restclient/api/openapi.yaml | 31 ++++ .../petstore/java/restclient/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 74 +++++++++ .../client/petstore/java/resteasy/README.md | 1 + .../petstore/java/resteasy/api/openapi.yaml | 31 ++++ .../petstore/java/resteasy/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 44 ++++++ .../java/resttemplate-withXml/README.md | 1 + .../resttemplate-withXml/api/openapi.yaml | 31 ++++ .../java/resttemplate-withXml/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 49 ++++++ .../petstore/java/resttemplate/README.md | 1 + .../java/resttemplate/api/openapi.yaml | 31 ++++ .../petstore/java/resttemplate/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 49 ++++++ .../java/vertx-supportVertxFuture/README.md | 1 + .../vertx-supportVertxFuture/api/openapi.yaml | 31 ++++ .../vertx-supportVertxFuture/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 16 ++ .../openapitools/client/api/PetApiImpl.java | 48 ++++++ .../client/api/rxjava/PetApi.java | 45 ++++++ samples/client/petstore/java/vertx/README.md | 1 + .../petstore/java/vertx/api/openapi.yaml | 31 ++++ .../client/petstore/java/vertx/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 4 + .../openapitools/client/api/PetApiImpl.java | 48 ++++++ .../client/api/rxjava/PetApi.java | 45 ++++++ .../petstore/java/webclient-jakarta/README.md | 1 + .../java/webclient-jakarta/api/openapi.yaml | 31 ++++ .../java/webclient-jakarta/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 75 +++++++++ .../java/webclient-swagger2/README.md | 1 + .../java/webclient-swagger2/api/openapi.yaml | 31 ++++ .../java/webclient-swagger2/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 75 +++++++++ .../README.md | 1 + .../api/openapi.yaml | 31 ++++ .../docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 75 +++++++++ .../client/petstore/java/webclient/README.md | 1 + .../petstore/java/webclient/api/openapi.yaml | 31 ++++ .../petstore/java/webclient/docs/PetApi.md | 72 +++++++++ .../org/openapitools/client/api/PetApi.java | 75 +++++++++ .../src/App/DTO/DownloadFileParameterData.php | 21 +++ .../src/App/DTO/DownloadFileParameterData.php | 21 +++ .../client/petstore/ruby-autoload/README.md | 1 + .../petstore/ruby-autoload/docs/PetApi.md | 70 +++++++++ .../ruby-autoload/lib/petstore/api/pet_api.rb | 63 ++++++++ .../client/petstore/ruby-faraday/README.md | 1 + .../petstore/ruby-faraday/docs/PetApi.md | 70 +++++++++ .../ruby-faraday/lib/petstore/api/pet_api.rb | 63 ++++++++ .../builds/default-v3.0/apis/PetApi.ts | 44 ++++++ .../README.md | 1 + .../doc/FakeApi.md | 4 +- .../doc/FormatTest.md | 2 +- .../doc/PetApi.md | 46 ++++++ .../lib/src/api/fake_api.dart | 3 +- .../lib/src/api/pet_api.dart | 78 ++++++++++ .../lib/src/model/format_test.dart | 4 +- .../petstore_client_lib_fake/README.md | 1 + .../petstore_client_lib_fake/doc/PetApi.md | 46 ++++++ .../lib/src/api/pet_api.dart | 79 ++++++++++ .../dart2/petstore_client_lib_fake/README.md | 1 + .../petstore_client_lib_fake/doc/PetApi.md | 46 ++++++ .../lib/api/pet_api.dart | 59 +++++++ .../cpp-restbed/generated/3_0/api/PetApi.cpp | 132 ++++++++++++++++ .../cpp-restbed/generated/3_0/api/PetApi.h | 68 ++++++++ .../java-helidon-server/v3/mp/README.md | 1 + .../openapitools/server/api/PetService.java | 5 + .../server/api/PetServiceImpl.java | 8 + .../src/main/resources/META-INF/openapi.yml | 31 ++++ .../java-helidon-server/v3/se/README.md | 1 + .../openapitools/server/api/PetService.java | 8 + .../server/api/PetServiceImpl.java | 4 + .../src/main/resources/META-INF/openapi.yml | 31 ++++ .../java-helidon-server/v4/mp/README.md | 1 + .../openapitools/server/api/PetService.java | 5 + .../server/api/PetServiceImpl.java | 8 + .../src/main/resources/META-INF/openapi.yml | 31 ++++ .../v4/se-uac-group-by-file-path/README.md | 1 + .../openapitools/server/api/PetService.java | 145 ++++++++++++++++++ .../server/api/PetServiceImpl.java | 7 + .../src/main/resources/META-INF/openapi.yml | 31 ++++ .../java-helidon-server/v4/se-uac/README.md | 1 + .../openapitools/server/api/PetService.java | 145 ++++++++++++++++++ .../server/api/PetServiceImpl.java | 7 + .../src/main/resources/META-INF/openapi.yml | 31 ++++ .../java-helidon-server/v4/se/README.md | 1 + .../openapitools/server/api/PetService.java | 8 + .../server/api/PetServiceImpl.java | 7 + .../src/main/resources/META-INF/openapi.yml | 31 ++++ .../mockserver/api/PetApiMockServer.java | 31 ++++ .../gen/java/org/openapitools/api/PetApi.java | 17 ++ .../org/openapitools/api/PetApiService.java | 1 + .../api/impl/PetApiServiceImpl.java | 5 + .../gen/java/org/openapitools/api/PetApi.java | 17 ++ .../src/main/resources/META-INF/openapi.yaml | 33 ++++ .../gen/java/org/openapitools/api/PetApi.java | 14 ++ .../org/openapitools/api/PetApiService.java | 1 + .../api/impl/PetApiServiceImpl.java | 5 + .../php-laravel/Api/PetApiInterface.php | 14 ++ .../Http/Controllers/PetController.php | 44 ++++++ .../server/petstore/php-laravel/routes.php | 7 + .../lib/app/Http/Controllers/PetApi.php | 20 +++ .../petstore/php-lumen/lib/routes/web.php | 7 + .../src/App/Handler/PetPetIdDownloadImage.php | 27 ++++ .../src/App/Handler/PetPetIdDownloadImage.php | 34 ++++ 147 files changed, 4950 insertions(+), 31 deletions(-) create mode 100644 samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php create mode 100644 samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php create mode 100644 samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php create mode 100644 samples/server/petstore/php-mezzio-ph/src/App/Handler/PetPetIdDownloadImage.php diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index c9caa785a81b..9a759a48369a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -274,9 +274,6 @@ private void configureSerializationLibraryJsonSerializable(String srcFolder) { supportingFiles.add(new SupportingFile("serialization/json_serializable/deserialize.mustache", srcFolder, "deserialize.dart")); - typeMapping.put("file", "Uint8List"); - typeMapping.put("binary", "Uint8List"); - // most of these are defined in AbstractDartCodegen, we are overriding // just the binary / file handling languageSpecificPrimitives.add("Object"); @@ -661,6 +658,16 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List File downloadFile(petId) + +downloads an image + + + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java index e70db50695c1..e72b446fbe35 100644 --- a/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java @@ -57,6 +57,15 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + /** + * downloads an image + * + */ + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java index a333b1942689..90c9dd388a35 100644 --- a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java @@ -44,6 +44,14 @@ public interface PetApi { */ ApiResponse deletePet(Long petId, String apiKey); + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return {@code ApiResponse} + */ + ApiResponse downloadFile(Long petId); + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java index 00cefb142b80..7e32e35eebee 100644 --- a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -51,6 +51,7 @@ public class PetApiImpl implements PetApi { protected static final GenericType RESPONSE_TYPE_addPet = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_deletePet = ResponseType.create(Void.class); + protected static final GenericType RESPONSE_TYPE_downloadFile = ResponseType.create(File.class); protected static final GenericType> RESPONSE_TYPE_findPetsByStatus = ResponseType.create(List.class, Pet.class); protected static final GenericType> RESPONSE_TYPE_findPetsByTags = ResponseType.create(List.class, Pet.class); protected static final GenericType RESPONSE_TYPE_getPetById = ResponseType.create(Pet.class); @@ -155,6 +156,45 @@ protected ApiResponse deletePetSubmit(WebClientRequestBuilder webClientReq return ApiResponse.create(RESPONSE_TYPE_deletePet, webClientResponse); } + @Override + public ApiResponse downloadFile(Long petId) { + Objects.requireNonNull(petId, "Required parameter 'petId' not specified"); + WebClientRequestBuilder webClientRequestBuilder = downloadFileRequestBuilder(petId); + return downloadFileSubmit(webClientRequestBuilder, petId); + } + + /** + * Creates a {@code WebClientRequestBuilder} for the downloadFile operation. + * Optional customization point for subclasses. + * + * @param petId ID of pet to update (required) + * @return WebClientRequestBuilder for downloadFile + */ + protected WebClientRequestBuilder downloadFileRequestBuilder(Long petId) { + WebClientRequestBuilder webClientRequestBuilder = apiClient.webClient() + .method("POST"); + + String path = "/pet/{petId}/downloadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + webClientRequestBuilder.path(path); + webClientRequestBuilder.accept(MediaType.APPLICATION_JSON); + + return webClientRequestBuilder; + } + + /** + * Initiates the request for the downloadFile operation. + * Optional customization point for subclasses. + * + * @param webClientRequestBuilder the request builder to use for submitting the request + * @param petId ID of pet to update (required) + * @return {@code ApiResponse} for the submitted request + */ + protected ApiResponse downloadFileSubmit(WebClientRequestBuilder webClientRequestBuilder, Long petId) { + Single webClientResponse = webClientRequestBuilder.submit(); + return ApiResponse.create(RESPONSE_TYPE_downloadFile, webClientResponse); + } + @Override public ApiResponse> findPetsByStatus(List status) { Objects.requireNonNull(status, "Required parameter 'status' not specified"); diff --git a/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md index 2f1e3c02a2e5..44be01066fbe 100644 --- a/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -89,6 +90,41 @@ Deletes a pet | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java index 04d31a358118..290291dbb0ae 100644 --- a/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java @@ -58,6 +58,15 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + /** + * downloads an image + * + */ + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java index 7731763f5934..8cc13f1104d4 100644 --- a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java @@ -45,6 +45,14 @@ public interface PetApi { */ ApiResponse deletePet(Long petId, String apiKey); + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return {@code ApiResponse} + */ + ApiResponse downloadFile(Long petId); + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java index d8e33fe1fd3c..de3577193035 100644 --- a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -53,6 +53,7 @@ public class PetApiImpl implements PetApi { protected static final GenericType RESPONSE_TYPE_addPet = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_deletePet = ResponseType.create(Void.class); + protected static final GenericType RESPONSE_TYPE_downloadFile = ResponseType.create(File.class); protected static final GenericType> RESPONSE_TYPE_findPetsByStatus = ResponseType.create(List.class, Pet.class); protected static final GenericType> RESPONSE_TYPE_findPetsByTags = ResponseType.create(List.class, Pet.class); protected static final GenericType RESPONSE_TYPE_getPetById = ResponseType.create(Pet.class); @@ -157,6 +158,45 @@ protected ApiResponse deletePetSubmit(HttpClientRequest webClientRequestBu return ApiResponse.create(RESPONSE_TYPE_deletePet, webClientResponse); } + @Override + public ApiResponse downloadFile(Long petId) { + Objects.requireNonNull(petId, "Required parameter 'petId' not specified"); + HttpClientRequest webClientRequestBuilder = downloadFileRequestBuilder(petId); + return downloadFileSubmit(webClientRequestBuilder, petId); + } + + /** + * Creates a {@code WebClientRequestBuilder} for the downloadFile operation. + * Optional customization point for subclasses. + * + * @param petId ID of pet to update (required) + * @return HttpClientRequest for downloadFile + */ + protected HttpClientRequest downloadFileRequestBuilder(Long petId) { + HttpClientRequest webClientRequestBuilder = apiClient.webClient() + .method(Method.POST); + + String path = "/pet/{petId}/downloadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + webClientRequestBuilder.path(path); + webClientRequestBuilder.accept(MediaTypes.APPLICATION_JSON); + + return webClientRequestBuilder; + } + + /** + * Initiates the request for the downloadFile operation. + * Optional customization point for subclasses. + * + * @param webClientRequestBuilder the request builder to use for submitting the request + * @param petId ID of pet to update (required) + * @return {@code ApiResponse} for the submitted request + */ + protected ApiResponse downloadFileSubmit(HttpClientRequest webClientRequestBuilder, Long petId) { + HttpClientResponse webClientResponse = webClientRequestBuilder.request(); + return ApiResponse.create(RESPONSE_TYPE_downloadFile, webClientResponse); + } + @Override public ApiResponse> findPetsByStatus(List status) { Objects.requireNonNull(status, "Required parameter 'status' not specified"); diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index 4b72c4b65de3..cce7feacc5e3 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -135,6 +135,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/apache-httpclient/docs/PetApi.md b/samples/client/petstore/java/apache-httpclient/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/apache-httpclient/docs/PetApi.md +++ b/samples/client/petstore/java/apache-httpclient/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java index b56be51a7bb0..584ace6fb444 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -191,6 +191,81 @@ public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nu ); } + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File downloadFile(@javax.annotation.Nonnull Long petId) throws ApiException { + return this.downloadFile(petId, Collections.emptyMap()); + } + + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param additionalHeaders additionalHeaders for this call + * @return File + * @throws ApiException if fails to make API call + */ + public File downloadFile(@javax.annotation.Nonnull Long petId, Map additionalHeaders) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling downloadFile"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}/downloadImage" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(apiClient.parameterToString(petId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + localVarHeaderParams.putAll(additionalHeaders); + + + + final String[] localVarAccepts = { + "application/zip" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/feign-hc5/api/openapi.yaml b/samples/client/petstore/java/feign-hc5/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/feign-hc5/api/openapi.yaml +++ b/samples/client/petstore/java/feign-hc5/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java index 42840ad0754c..a870ddb241e9 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java @@ -75,6 +75,33 @@ public interface PetApi extends ApiClient.Api { + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return File + */ + @RequestLine("POST /pet/{petId}/downloadImage") + @Headers({ + "Accept: application/zip", + }) + File downloadFile(@Param("petId") @javax.annotation.Nonnull Long petId); + + /** + * downloads an image + * Similar to downloadFile but it also returns the http response headers . + * + * @param petId ID of pet to update (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /pet/{petId}/downloadImage") + @Headers({ + "Accept: application/zip", + }) + ApiResponse downloadFileWithHttpInfo(@Param("petId") @javax.annotation.Nonnull Long petId); + + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java index 42840ad0754c..a870ddb241e9 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java @@ -75,6 +75,33 @@ public interface PetApi extends ApiClient.Api { + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return File + */ + @RequestLine("POST /pet/{petId}/downloadImage") + @Headers({ + "Accept: application/zip", + }) + File downloadFile(@Param("petId") @javax.annotation.Nonnull Long petId); + + /** + * downloads an image + * Similar to downloadFile but it also returns the http response headers . + * + * @param petId ID of pet to update (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /pet/{petId}/downloadImage") + @Headers({ + "Accept: application/zip", + }) + ApiResponse downloadFileWithHttpInfo(@Param("petId") @javax.annotation.Nonnull Long petId); + + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md index bf4b4333d964..602ad088d70e 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -162,6 +163,77 @@ public class Example { | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java index 224b962916ed..7a2b3858dbcb 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,6 +64,17 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + /** + * downloads an image + * + * + * + */ + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + /** * Finds Pets by status * diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md index bf4b4333d964..602ad088d70e 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -162,6 +163,77 @@ public class Example { | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java index 224b962916ed..7a2b3858dbcb 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,6 +64,17 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + /** + * downloads an image + * + * + * + */ + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + /** * Finds Pets by status * diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md index bf4b4333d964..602ad088d70e 100644 --- a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -162,6 +163,77 @@ public class Example { | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java index f5ce26c6765a..b4ecbd295458 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,6 +64,17 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; + /** + * downloads an image + * + * + * + */ + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; + /** * Finds Pets by status * diff --git a/samples/client/petstore/java/restclient-swagger2/README.md b/samples/client/petstore/java/restclient-swagger2/README.md index 9499bd28689f..3af5b68b63b7 100644 --- a/samples/client/petstore/java/restclient-swagger2/README.md +++ b/samples/client/petstore/java/restclient-swagger2/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml b/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md b/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md +++ b/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java index 3584fb0c39a9..879396094cee 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java @@ -200,6 +200,80 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).body(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + return downloadFileRequestCreation(petId); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md index e123bb028f94..9f60df9196c6 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java index ae894a2aa281..9836c9db7270 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java @@ -284,6 +284,80 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).body(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + return downloadFileRequestCreation(petId); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md b/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md index 9f6fbc164f72..e2635a15460f 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml b/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md b/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java index 392068a7c24e..1ce618b210d7 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -240,6 +240,80 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).body(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + return downloadFileRequestCreation(petId); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/restclient/README.md b/samples/client/petstore/java/restclient/README.md index 9499bd28689f..3af5b68b63b7 100644 --- a/samples/client/petstore/java/restclient/README.md +++ b/samples/client/petstore/java/restclient/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient/api/openapi.yaml b/samples/client/petstore/java/restclient/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/restclient/api/openapi.yaml +++ b/samples/client/petstore/java/restclient/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient/docs/PetApi.md b/samples/client/petstore/java/restclient/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/restclient/docs/PetApi.md +++ b/samples/client/petstore/java/restclient/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java index 3584fb0c39a9..879396094cee 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -200,6 +200,80 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).body(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { + return downloadFileRequestCreation(petId); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/resteasy/README.md b/samples/client/petstore/java/resteasy/README.md index 079078abd4bb..900922465460 100644 --- a/samples/client/petstore/java/resteasy/README.md +++ b/samples/client/petstore/java/resteasy/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/resteasy/api/openapi.yaml b/samples/client/petstore/java/resteasy/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/resteasy/api/openapi.yaml +++ b/samples/client/petstore/java/resteasy/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/resteasy/docs/PetApi.md b/samples/client/petstore/java/resteasy/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/resteasy/docs/PetApi.md +++ b/samples/client/petstore/java/resteasy/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java index 12f82eabeaa7..19a988d64a69 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java @@ -125,6 +125,50 @@ public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nu apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); } + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return a {@code File} + * @throws ApiException if fails to make API call + */ + public File downloadFile(@javax.annotation.Nonnull Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling downloadFile"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}/downloadImage".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/zip" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/resttemplate-withXml/README.md b/samples/client/petstore/java/resttemplate-withXml/README.md index 0972858dd9d8..316d0769cf14 100644 --- a/samples/client/petstore/java/resttemplate-withXml/README.md +++ b/samples/client/petstore/java/resttemplate-withXml/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java index c9cd2bd6844d..2babd189f616 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java @@ -140,6 +140,55 @@ public ResponseEntity deletePetWithHttpInfo(Long petId, String apiKey) thr ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update (required) + * @return File + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public File downloadFile(Long petId) throws RestClientException { + return downloadFileWithHttpInfo(petId).getBody(); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update (required) + * @return ResponseEntity<File> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadFileWithHttpInfo(Long petId) throws RestClientException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling downloadFile"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("petId", petId); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/resttemplate/README.md b/samples/client/petstore/java/resttemplate/README.md index 37e6b5536663..3aad3e64775e 100644 --- a/samples/client/petstore/java/resttemplate/README.md +++ b/samples/client/petstore/java/resttemplate/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/resttemplate/api/openapi.yaml b/samples/client/petstore/java/resttemplate/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/resttemplate/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/resttemplate/docs/PetApi.md b/samples/client/petstore/java/resttemplate/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/resttemplate/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java index c9cd2bd6844d..2babd189f616 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java @@ -140,6 +140,55 @@ public ResponseEntity deletePetWithHttpInfo(Long petId, String apiKey) thr ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update (required) + * @return File + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public File downloadFile(Long petId) throws RestClientException { + return downloadFileWithHttpInfo(petId).getBody(); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update (required) + * @return ResponseEntity<File> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadFileWithHttpInfo(Long petId) throws RestClientException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling downloadFile"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("petId", petId); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/README.md b/samples/client/petstore/java/vertx-supportVertxFuture/README.md index b098f20df228..ad7cb2739a66 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/README.md +++ b/samples/client/petstore/java/vertx-supportVertxFuture/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml b/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml +++ b/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md index 115d5ff89d81..59ab6f47d007 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> AsyncFile downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + AsyncFile result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**AsyncFile**](AsyncFile.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java index 9b3a7f9df4cb..a764b4044066 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java @@ -47,6 +47,22 @@ default Future deletePet(@javax.annotation.Nonnull Long petId, @javax.anno return promise.future(); } + void downloadFile(@javax.annotation.Nonnull Long petId, Handler> handler); + + default Future downloadFile(@javax.annotation.Nonnull Long petId){ + Promise promise = Promise.promise(); + downloadFile(petId, promise); + return promise.future(); + } + + void downloadFile(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future downloadFile(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + downloadFile(petId, authInfo, promise); + return promise.future(); + } + void findPetsByStatus(@javax.annotation.Nonnull List status, Handler>> handler); default Future> findPetsByStatus(@javax.annotation.Nonnull List status){ diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java index 2717a717786a..f4c940c788f2 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -144,6 +144,54 @@ public void deletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo, Ha apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); } /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, Handler> resultHandler) { + downloadFile(petId, null, resultHandler); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling downloadFile")); + return; + } + + // create path and map variables + String localVarPath = "/pet/{petId}/downloadImage".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/zip" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java index 4e7fe09eabbc..df76c0fd6bb5 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java @@ -120,6 +120,51 @@ public Single rxDeletePet(Long petId, String apiKey, ApiClient.AuthInfo au )); } /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, Handler> resultHandler) { + delegate.downloadFile(petId, resultHandler); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.downloadFile(petId, authInfo, resultHandler); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDownloadFile(Long petId) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.downloadFile(petId, fut) + )); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDownloadFile(Long petId, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.downloadFile(petId, authInfo, fut) + )); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/vertx/README.md b/samples/client/petstore/java/vertx/README.md index 3473b0e4d755..a10c976682bb 100644 --- a/samples/client/petstore/java/vertx/README.md +++ b/samples/client/petstore/java/vertx/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/vertx/api/openapi.yaml b/samples/client/petstore/java/vertx/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/vertx/api/openapi.yaml +++ b/samples/client/petstore/java/vertx/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/vertx/docs/PetApi.md b/samples/client/petstore/java/vertx/docs/PetApi.md index 115d5ff89d81..59ab6f47d007 100644 --- a/samples/client/petstore/java/vertx/docs/PetApi.md +++ b/samples/client/petstore/java/vertx/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> AsyncFile downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + AsyncFile result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**AsyncFile**](AsyncFile.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java index 535191f77b1e..2f09a7cb645e 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java @@ -21,6 +21,10 @@ public interface PetApi { void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, ApiClient.AuthInfo authInfo, Handler> handler); + void downloadFile(@javax.annotation.Nonnull Long petId, Handler> handler); + + void downloadFile(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo, Handler> handler); + void findPetsByStatus(@javax.annotation.Nonnull List status, Handler>> handler); void findPetsByStatus(@javax.annotation.Nonnull List status, ApiClient.AuthInfo authInfo, Handler>> handler); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java index 2717a717786a..f4c940c788f2 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -144,6 +144,54 @@ public void deletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo, Ha apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); } /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, Handler> resultHandler) { + downloadFile(petId, null, resultHandler); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling downloadFile")); + return; + } + + // create path and map variables + String localVarPath = "/pet/{petId}/downloadImage".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/zip" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java index 4e7fe09eabbc..df76c0fd6bb5 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java @@ -120,6 +120,51 @@ public Single rxDeletePet(Long petId, String apiKey, ApiClient.AuthInfo au )); } /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, Handler> resultHandler) { + delegate.downloadFile(petId, resultHandler); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.downloadFile(petId, authInfo, resultHandler); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDownloadFile(Long petId) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.downloadFile(petId, fut) + )); + } + + /** + * downloads an image + * + * @param petId ID of pet to update (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDownloadFile(Long petId, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.downloadFile(petId, authInfo, fut) + )); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/webclient-jakarta/README.md b/samples/client/petstore/java/webclient-jakarta/README.md index b42fa07d17d9..de51b7cffc63 100644 --- a/samples/client/petstore/java/webclient-jakarta/README.md +++ b/samples/client/petstore/java/webclient-jakarta/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md b/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md +++ b/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index 1003b9794bfc..446224de5436 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -205,6 +205,81 @@ public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long p return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono downloadFile(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { + return downloadFileRequestCreation(petId); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/webclient-swagger2/README.md b/samples/client/petstore/java/webclient-swagger2/README.md index b42fa07d17d9..de51b7cffc63 100644 --- a/samples/client/petstore/java/webclient-swagger2/README.md +++ b/samples/client/petstore/java/webclient-swagger2/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md b/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md +++ b/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java index d133bebd78e8..5677b3bee155 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java @@ -205,6 +205,81 @@ public ResponseSpec deletePetWithResponseSpec(@javax.annotation.Nonnull Long pet return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono downloadFile(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> downloadFileWithHttpInfo(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + return downloadFileRequestCreation(petId); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md b/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md index bd162b612977..51db06ae86c4 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml b/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md b/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java index f0988c50a60c..6554caa3e7d5 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -289,6 +289,81 @@ public ResponseSpec deletePetWithResponseSpec(@javax.annotation.Nonnull Long pet return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono downloadFile(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> downloadFileWithHttpInfo(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + return downloadFileRequestCreation(petId); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index b42fa07d17d9..de51b7cffc63 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -142,6 +142,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 7d3a48a0496b..751121da1d20 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient/docs/PetApi.md b/samples/client/petstore/java/webclient/docs/PetApi.md index e2515d9bb9bb..8032b9317e8b 100644 --- a/samples/client/petstore/java/webclient/docs/PetApi.md +++ b/samples/client/petstore/java/webclient/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -160,6 +161,77 @@ null (empty response body) | **400** | Invalid pet value | - | +## downloadFile + +> File downloadFile(petId) + +downloads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + try { + File result = apiInstance.downloadFile(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#downloadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | + +### Return type + +[**File**](File.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java index d133bebd78e8..5677b3bee155 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -205,6 +205,81 @@ public ResponseSpec deletePetWithResponseSpec(@javax.annotation.Nonnull Long pet return deletePetRequestCreation(petId, apiKey); } + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadFileRequestCreation(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + Object postBody = null; + // verify the required parameter 'petId' is set + if (petId == null) { + throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + pathParams.put("petId", petId); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/zip" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono downloadFile(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseEntity<File> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> downloadFileWithHttpInfo(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadFileRequestCreation(petId).toEntity(localVarReturnType); + } + + /** + * downloads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec downloadFileWithResponseSpec(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { + return downloadFileRequestCreation(petId); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php b/samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php new file mode 100644 index 000000000000..fa9ec67796f8 --- /dev/null +++ b/samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php @@ -0,0 +1,21 @@ + "int"], "path")] + #[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")] + public int|null $pet_id = null; + +} diff --git a/samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php b/samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php new file mode 100644 index 000000000000..418599c8b417 --- /dev/null +++ b/samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php @@ -0,0 +1,21 @@ + File download_file(pet_id) + +downloads an image + + + +### Examples + +```ruby +require 'time' +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = Petstore::PetApi.new +pet_id = 789 # Integer | ID of pet to update + +begin + # downloads an image + result = api_instance.download_file(pet_id) + p result +rescue Petstore::ApiError => e + puts "Error when calling PetApi->download_file: #{e}" +end +``` + +#### Using the download_file_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> download_file_with_http_info(pet_id) + +```ruby +begin + # downloads an image + data, status_code, headers = api_instance.download_file_with_http_info(pet_id) + p status_code # => 2xx + p headers # => { ... } + p data # => File +rescue Petstore::ApiError => e + puts "Error when calling PetApi->download_file_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pet_id** | **Integer** | ID of pet to update | | + +### Return type + +**File** + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + ## find_pets_by_status > > find_pets_by_status(status) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb index b183c0a33570..80ec4773d10f 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb @@ -149,6 +149,69 @@ def delete_pet_with_http_info(pet_id, opts = {}) return data, status_code, headers end + # downloads an image + # + # @param pet_id [Integer] ID of pet to update + # @param [Hash] opts the optional parameters + # @return [File] + def download_file(pet_id, opts = {}) + data, _status_code, _headers = download_file_with_http_info(pet_id, opts) + data + end + + # downloads an image + # + # @param pet_id [Integer] ID of pet to update + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_file_with_http_info(pet_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PetApi.download_file ...' + end + # verify the required parameter 'pet_id' is set + if @api_client.config.client_side_validation && pet_id.nil? + fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.download_file" + end + # resource path + local_var_path = '/pet/{petId}/downloadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/zip']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['petstore_auth'] + + new_options = opts.merge( + :operation => :"PetApi.download_file", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PetApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Finds Pets by status # Multiple status values can be provided with comma separated strings # @param status [Array] Status values that need to be considered for filter diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index fbae077b6e7d..cfb7209c6623 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -103,6 +103,7 @@ Class | Method | HTTP request | Description *Petstore::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +*Petstore::PetApi* | [**download_file**](docs/PetApi.md#download_file) | **POST** /pet/{petId}/downloadImage | downloads an image *Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *Petstore::PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *Petstore::PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/ruby-faraday/docs/PetApi.md b/samples/client/petstore/ruby-faraday/docs/PetApi.md index b28334ae2c58..4f956182c76f 100644 --- a/samples/client/petstore/ruby-faraday/docs/PetApi.md +++ b/samples/client/petstore/ruby-faraday/docs/PetApi.md @@ -6,6 +6,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | ------ | ------------ | ----------- | | [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store | | [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**download_file**](PetApi.md#download_file) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status | | [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags | | [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID | @@ -155,6 +156,75 @@ nil (empty response body) - **Accept**: Not defined +## download_file + +> File download_file(pet_id) + +downloads an image + + + +### Examples + +```ruby +require 'time' +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = Petstore::PetApi.new +pet_id = 789 # Integer | ID of pet to update + +begin + # downloads an image + result = api_instance.download_file(pet_id) + p result +rescue Petstore::ApiError => e + puts "Error when calling PetApi->download_file: #{e}" +end +``` + +#### Using the download_file_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> download_file_with_http_info(pet_id) + +```ruby +begin + # downloads an image + data, status_code, headers = api_instance.download_file_with_http_info(pet_id) + p status_code # => 2xx + p headers # => { ... } + p data # => File +rescue Petstore::ApiError => e + puts "Error when calling PetApi->download_file_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pet_id** | **Integer** | ID of pet to update | | + +### Return type + +**File** + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/zip + + ## find_pets_by_status > > find_pets_by_status(status) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb index 0a0589a9676d..398385dc59e6 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb @@ -149,6 +149,69 @@ def delete_pet_with_http_info(pet_id, opts = {}) return data, status_code, headers end + # downloads an image + # + # @param pet_id [Integer] ID of pet to update + # @param [Hash] opts the optional parameters + # @return [File] + def download_file(pet_id, opts = {}) + data, _status_code, _headers = download_file_with_http_info(pet_id, opts) + data + end + + # downloads an image + # + # @param pet_id [Integer] ID of pet to update + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_file_with_http_info(pet_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PetApi.download_file ...' + end + # verify the required parameter 'pet_id' is set + if @api_client.config.client_side_validation && pet_id.nil? + fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.download_file" + end + # resource path + local_var_path = '/pet/{petId}/downloadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/zip']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['petstore_auth'] + + new_options = opts.merge( + :operation => :"PetApi.download_file", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PetApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Finds Pets by status # Multiple status values can be provided with comma separated strings # @param status [Array] Status values that need to be considered for filter diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index 5b77f2de4486..ece8c36647b7 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -34,6 +34,10 @@ export interface DeletePetRequest { apiKey?: string; } +export interface DownloadFileRequest { + petId: number; +} + export interface FindPetsByStatusRequest { status: Array; } @@ -158,6 +162,46 @@ export class PetApi extends runtime.BaseAPI { await this.deletePetRaw(requestParameters, initOverrides); } + /** + * + * downloads an image + */ + async downloadFileRaw(requestParameters: DownloadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['petId'] == null) { + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling downloadFile().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); + } + + const response = await this.request({ + path: `/pet/{petId}/downloadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.BlobApiResponse(response); + } + + /** + * + * downloads an image + */ + async downloadFile(requestParameters: DownloadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.downloadFileRaw(requestParameters, initOverrides); + return await response.value(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index 5a5211d271a0..03d84a72c698 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -93,6 +93,7 @@ Class | Method | HTTP request | Description [*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case [*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[*PetApi*](doc/PetApi.md) | [**downloadFile**](doc/PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md index 23bbcf65b329..1b5e1ca297c8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md @@ -603,7 +603,7 @@ final int int32 = 56; // int | None final int int64 = 789; // int | None final double float = 3.4; // double | None final String string = string_example; // String | None -final Uint8List binary = BINARY_DATA_HERE; // Uint8List | None +final MultipartFile binary = BINARY_DATA_HERE; // MultipartFile | None final DateTime date = 2013-10-20; // DateTime | None final DateTime dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None final String password = password_example; // String | None @@ -629,7 +629,7 @@ Name | Type | Description | Notes **int64** | **int**| None | [optional] **float** | **double**| None | [optional] **string** | **String**| None | [optional] - **binary** | **Uint8List**| None | [optional] + **binary** | **MultipartFile**| None | [optional] **date** | **DateTime**| None | [optional] **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md index 7cac4e3b6be1..83b60545eb61 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FormatTest.md @@ -17,7 +17,7 @@ Name | Type | Description | Notes **decimal** | **double** | | [optional] **string** | **String** | | [optional] **byte** | **String** | | -**binary** | [**Uint8List**](Uint8List.md) | | [optional] +**binary** | [**MultipartFile**](MultipartFile.md) | | [optional] **date** | [**DateTime**](DateTime.md) | | **dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md index 5fc7fbd2657f..c1e194c6b9d2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**downloadFile**](PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID @@ -110,6 +111,51 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **downloadFile** +> Uint8List downloadFile(petId) + +downloads an image + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update + +try { + final response = api.downloadFile(petId); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->downloadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + +### Return type + +[**Uint8List**](Uint8List.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/zip + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **findPetsByStatus** > List findPetsByStatus(status) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index 6b366d6f980a..e91f47cebe91 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -9,7 +9,6 @@ import 'dart:convert'; import 'package:openapi/src/deserialize.dart'; import 'package:dio/dio.dart'; -import 'dart:typed_data'; import 'package:openapi/src/model/child_with_nullable.dart'; import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; @@ -1095,7 +1094,7 @@ _responseData = rawData == null ? null : deserialize(r int? int64, double? float, String? string, - Uint8List? binary, + MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart index aab8df518913..20ccc76c76e6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart @@ -143,6 +143,84 @@ _bodyData=jsonEncode(pet); return _response; } + /// downloads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Uint8List] as data + /// Throws [DioException] if API call or serialization fails + Future> downloadFile({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}/downloadImage'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + responseType: ResponseType.bytes, + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Uint8List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : rawData as Uint8List; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + /// Finds Pets by status /// Multiple status values can be provided with comma separated strings /// diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart index 392faa8bf00c..a20ba417fa54 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/format_test.dart @@ -3,7 +3,7 @@ // // ignore_for_file: unused_element -import 'dart:typed_data'; +import 'package:dio/dio.dart'; import 'package:json_annotation/json_annotation.dart'; part 'format_test.g.dart'; @@ -173,7 +173,7 @@ class FormatTest { @JsonKey(ignore: true) - final Uint8List? binary; + final MultipartFile? binary; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index ecde40a0ade4..b67243c5ee95 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -92,6 +92,7 @@ Class | Method | HTTP request | Description [*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case [*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[*PetApi*](doc/PetApi.md) | [**downloadFile**](doc/PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md index 2b7766eb60d4..4f88b6051d34 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**downloadFile**](PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID @@ -110,6 +111,51 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **downloadFile** +> Uint8List downloadFile(petId) + +downloads an image + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update + +try { + final response = api.downloadFile(petId); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->downloadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + +### Return type + +[**Uint8List**](Uint8List.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/zip + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **findPetsByStatus** > BuiltList findPetsByStatus(status) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart index a4da1c5ff6db..f52c634ec5ad 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -8,6 +8,7 @@ import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; +import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:openapi/src/api_util.dart'; import 'package:openapi/src/model/api_response.dart'; @@ -148,6 +149,84 @@ class PetApi { return _response; } + /// downloads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Uint8List] as data + /// Throws [DioException] if API call or serialization fails + Future> downloadFile({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}/downloadImage'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); + final _options = Options( + method: r'POST', + responseType: ResponseType.bytes, + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Uint8List? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : rawResponse as Uint8List; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + /// Finds Pets by status /// Multiple status values can be provided with comma separated strings /// diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index 5a8c345c8de3..1d4519ad82f2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -86,6 +86,7 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**downloadFile**](doc//PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md index 3883a9e96a00..69739c094ea6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**downloadFile**](PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID @@ -110,6 +111,51 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **downloadFile** +> MultipartFile downloadFile(petId) + +downloads an image + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update + +try { + final result = api_instance.downloadFile(petId); + print(result); +} catch (e) { + print('Exception when calling PetApi->downloadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + +### Return type + +[**MultipartFile**](MultipartFile.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/zip + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **findPetsByStatus** > List findPetsByStatus(status) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index 61fd1666af49..4136b3f050f7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -125,6 +125,65 @@ class PetApi { } } + /// downloads an image + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + Future downloadFileWithHttpInfo(int petId,) async { + // ignore: prefer_const_declarations + final path = r'/pet/{petId}/downloadImage' + .replaceAll('{petId}', petId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// downloads an image + /// + /// + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + Future downloadFile(int petId,) async { + final response = await downloadFileWithHttpInfo(petId,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile; + + } + return null; + } + /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp index 3b7c82d9ce8e..f5123db910c7 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp @@ -560,6 +560,121 @@ std::string PetPetIdResource::extractFormParamsFromBody(const std::string& param } return ""; } +PetPetIdDownloadImageResource::PetPetIdDownloadImageResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/pet/{petId: .*}/downloadImage"); + this->set_method_handler("POST", + std::bind(&PetPetIdDownloadImageResource::handler_POST_internal, this, + std::placeholders::_1)); +} + +std::pair PetPetIdDownloadImageResource::handlePetApiException(const PetApiException& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair PetPetIdDownloadImageResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair PetPetIdDownloadImageResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void PetPetIdDownloadImageResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void PetPetIdDownloadImageResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, std::multimap& responseHeaders) +{ + responseHeaders.insert(std::make_pair("Connection", "close")); + session->close(status, result, responseHeaders); +} + +void PetPetIdDownloadImageResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void PetPetIdDownloadImageResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + // Getting the path params + int64_t petId = request->get_path_parameter("petId", 0L); + + int status_code = 500; + std::string resultObject = ""; + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_POST(petId); + } + catch(const PetApiException& e) { + std::tie(status_code, result) = handlePetApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + std::multimap< std::string, std::string > responseHeaders {}; + static const std::vector contentTypes{ + "application/zip", + }; + static const std::string acceptTypes{ + }; + + if (status_code == 200) { + responseHeaders.insert(std::make_pair("Content-Type", selectPreferredContentType(contentTypes))); + if (!acceptTypes.empty()) { + responseHeaders.insert(std::make_pair("Accept", acceptTypes)); + } + + result = resultObject.toJsonString(); + returnResponse(session, 200, result.empty() ? "{}" : result, responseHeaders); + return; + } + defaultSessionClose(session, status_code, result); + + +} + + +std::pair PetPetIdDownloadImageResource::handler_POST( + int64_t & petId) +{ + return handler_POST_func(petId); +} + + +std::string PetPetIdDownloadImageResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} + +std::string PetPetIdDownloadImageResource::extractFormParamsFromBody(const std::string& paramName, const std::string& body) { + const auto uri = restbed::Uri("urlencoded?" + body, true); + const auto params = uri.get_query_parameters(); + const auto result = params.find(paramName); + if (result != params.cend()) { + return result->second; + } + return ""; +} PetFindByStatusResource::PetFindByStatusResource(const std::string& context /* = "/v2" */) { this->set_path(context + "/pet/findByStatus"); @@ -1068,6 +1183,12 @@ std::shared_ptr PetApi::getPetPetIdResource() } return m_spPetPetIdResource; } +std::shared_ptr PetApi::getPetPetIdDownloadImageResource() { + if (!m_spPetPetIdDownloadImageResource) { + setResource(std::make_shared()); + } + return m_spPetPetIdDownloadImageResource; +} std::shared_ptr PetApi::getPetFindByStatusResource() { if (!m_spPetFindByStatusResource) { setResource(std::make_shared()); @@ -1100,6 +1221,10 @@ void PetApi::setResource(std::shared_ptr reso m_spPetPetIdResource = resource; m_service->publish(m_spPetPetIdResource); } +void PetApi::setResource(std::shared_ptr resource) { + m_spPetPetIdDownloadImageResource = resource; + m_service->publish(m_spPetPetIdDownloadImageResource); +} void PetApi::setResource(std::shared_ptr resource) { m_spPetFindByStatusResource = resource; m_service->publish(m_spPetFindByStatusResource); @@ -1124,6 +1249,10 @@ void PetApi::setPetApiPetPetIdResource(std::shared_ptrpublish(m_spPetPetIdResource); } +void PetApi::setPetApiPetPetIdDownloadImageResource(std::shared_ptr spPetPetIdDownloadImageResource) { + m_spPetPetIdDownloadImageResource = spPetPetIdDownloadImageResource; + m_service->publish(m_spPetPetIdDownloadImageResource); +} void PetApi::setPetApiPetFindByStatusResource(std::shared_ptr spPetFindByStatusResource) { m_spPetFindByStatusResource = spPetFindByStatusResource; m_service->publish(m_spPetFindByStatusResource); @@ -1149,6 +1278,9 @@ void PetApi::publishDefaultResources() { if (!m_spPetPetIdResource) { setResource(std::make_shared()); } + if (!m_spPetPetIdDownloadImageResource) { + setResource(std::make_shared()); + } if (!m_spPetFindByStatusResource) { setResource(std::make_shared()); } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h index bc7497437471..a241947b2398 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h @@ -209,6 +209,68 @@ class PetPetIdResource: public restbed::Resource void handler_POST_internal(const std::shared_ptr session); }; +/// +/// downloads an image +/// +/// +/// +/// +class PetPetIdDownloadImageResource: public restbed::Resource +{ +public: + PetPetIdDownloadImageResource(const std::string& context = "/v2"); + virtual ~PetPetIdDownloadImageResource() = default; + + PetPetIdDownloadImageResource( + const PetPetIdDownloadImageResource& other) = default; // copy constructor + PetPetIdDownloadImageResource(PetPetIdDownloadImageResource&& other) noexcept = default; // move constructor + + PetPetIdDownloadImageResource& operator=(const PetPetIdDownloadImageResource& other) = default; // copy assignment + PetPetIdDownloadImageResource& operator=(PetPetIdDownloadImageResource&& other) noexcept = default; // move assignment + + ///////////////////////////////////////////////////// + // Set these to implement the server functionality // + ///////////////////////////////////////////////////// + std::function( + int64_t & petId)> handler_POST_func = + [](int64_t &) -> std::pair + { throw PetApiException(501, "Not implemented"); }; + + +protected: + ////////////////////////////////////////////////////////// + // As an alternative to setting the `std::function`s // + // override these to implement the server functionality // + ////////////////////////////////////////////////////////// + + virtual std::pair handler_POST( + int64_t & petId); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + virtual std::string extractFormParamsFromBody(const std::string& paramName, const std::string& body); + + virtual std::pair handlePetApiException(const PetApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, std::multimap& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); + +private: + void handler_POST_internal(const std::shared_ptr session); +}; + /// /// Finds Pets by status /// @@ -461,6 +523,7 @@ class FakePetIdUploadImageWithRequiredFileResource: public restbed::Resource using PetApiPetResource [[deprecated]] = PetApiResources::PetResource; using PetApiPetPetIdResource [[deprecated]] = PetApiResources::PetPetIdResource; +using PetApiPetPetIdDownloadImageResource [[deprecated]] = PetApiResources::PetPetIdDownloadImageResource; using PetApiPetFindByStatusResource [[deprecated]] = PetApiResources::PetFindByStatusResource; using PetApiPetFindByTagsResource [[deprecated]] = PetApiResources::PetFindByTagsResource; using PetApiPetPetIdUploadImageResource [[deprecated]] = PetApiResources::PetPetIdUploadImageResource; @@ -477,6 +540,7 @@ class PetApi std::shared_ptr getPetResource(); std::shared_ptr getPetPetIdResource(); + std::shared_ptr getPetPetIdDownloadImageResource(); std::shared_ptr getPetFindByStatusResource(); std::shared_ptr getPetFindByTagsResource(); std::shared_ptr getPetPetIdUploadImageResource(); @@ -484,6 +548,7 @@ class PetApi void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); + void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); @@ -493,6 +558,8 @@ class PetApi [[deprecated("use setResource()")]] virtual void setPetApiPetPetIdResource(std::shared_ptr spPetApiPetPetIdResource); [[deprecated("use setResource()")]] + virtual void setPetApiPetPetIdDownloadImageResource(std::shared_ptr spPetApiPetPetIdDownloadImageResource); + [[deprecated("use setResource()")]] virtual void setPetApiPetFindByStatusResource(std::shared_ptr spPetApiPetFindByStatusResource); [[deprecated("use setResource()")]] virtual void setPetApiPetFindByTagsResource(std::shared_ptr spPetApiPetFindByTagsResource); @@ -508,6 +575,7 @@ class PetApi protected: std::shared_ptr m_spPetResource; std::shared_ptr m_spPetPetIdResource; + std::shared_ptr m_spPetPetIdDownloadImageResource; std::shared_ptr m_spPetFindByStatusResource; std::shared_ptr m_spPetFindByTagsResource; std::shared_ptr m_spPetPetIdUploadImageResource; diff --git a/samples/server/petstore/java-helidon-server/v3/mp/README.md b/samples/server/petstore/java-helidon-server/v3/mp/README.md index 323a58c291c1..d6653bde86fe 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/README.md +++ b/samples/server/petstore/java-helidon-server/v3/mp/README.md @@ -38,6 +38,7 @@ curl -X POST http://petstore.swagger.io:80/v2/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2 curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} +curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java index 741f9db3a0ec..9b71ea5864cf 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java @@ -39,6 +39,11 @@ public interface PetService { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId); + @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java index f434a7706553..3107c2c8d850 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -42,6 +42,14 @@ public void addPet(@Valid @NotNull Pet pet) { public void deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey) { } + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + public File downloadFile(@PathParam("petId") Long petId) { + File result = null; // Replace with correct business logic. + return result; + } + @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml index 71ba74eeb055..c6682ecb5b2c 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v3/se/README.md b/samples/server/petstore/java-helidon-server/v3/se/README.md index 3442efc621ab..a898facd0b87 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/README.md +++ b/samples/server/petstore/java-helidon-server/v3/se/README.md @@ -38,6 +38,7 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} +curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java index be72664fc47f..900a8449ccb4 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java @@ -23,6 +23,7 @@ public interface PetService extends Service { default void update(Routing.Rules rules) { rules.post("/pet", Handler.create(Pet.class, this::addPet)); rules.delete("/pet/{petId}", this::deletePet); + rules.post("/pet/{petId}/downloadImage", this::downloadFile); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); @@ -48,6 +49,13 @@ default void update(Routing.Rules rules) { */ void deletePet(ServerRequest request, ServerResponse response); + /** + * POST /pet/{petId}/downloadImage : downloads an image. + * @param request the server request + * @param response the server response + */ + void downloadFile(ServerRequest request, ServerResponse response); + /** * GET /pet/findByStatus : Finds Pets by status. * @param request the server request diff --git a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 0a016564542b..b066575d8984 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -27,6 +27,10 @@ public void deletePet(ServerRequest request, ServerResponse response) { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } + public void downloadFile(ServerRequest request, ServerResponse response) { + response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); + } + public void findPetsByStatus(ServerRequest request, ServerResponse response) { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } diff --git a/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml index 71ba74eeb055..c6682ecb5b2c 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/mp/README.md b/samples/server/petstore/java-helidon-server/v4/mp/README.md index 323a58c291c1..d6653bde86fe 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/README.md +++ b/samples/server/petstore/java-helidon-server/v4/mp/README.md @@ -38,6 +38,7 @@ curl -X POST http://petstore.swagger.io:80/v2/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2 curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} +curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java index d8ed5842cb18..198f017dea8c 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java @@ -40,6 +40,11 @@ public interface PetService { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + File downloadFile(@PathParam("petId") Long petId); + @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 708ebf48f849..9d9e492af940 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -43,6 +43,14 @@ public void addPet(@Valid @NotNull Pet pet) { public void deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey) { } + @POST + @Path("/pet/{petId}/downloadImage") + @Produces({ "application/zip" }) + public File downloadFile(@PathParam("petId") Long petId) { + File result = null; // Replace with correct business logic. + return result; + } + @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml index 71ba74eeb055..c6682ecb5b2c 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md index 696bd42249ed..9bb83822431a 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md @@ -39,6 +39,7 @@ curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X GET http://petstore.swagger.io:80/v2/foo curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} +curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java index 6cdd1203dd96..19b5af435fab 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java @@ -40,6 +40,7 @@ public abstract class PetService implements HttpService { protected AddPetOp addPetOp = createAddPetOp(); protected DeletePetOp deletePetOp = createDeletePetOp(); + protected DownloadFileOp downloadFileOp = createDownloadFileOp(); protected FindPetsByStatusOp findPetsByStatusOp = createFindPetsByStatusOp(); protected FindPetsByTagsOp findPetsByTagsOp = createFindPetsByTagsOp(); protected GetPetByIdOp getPetByIdOp = createGetPetByIdOp(); @@ -56,6 +57,7 @@ public abstract class PetService implements HttpService { public void routing(HttpRules rules) { rules.post("/", this::addPet); rules.delete("/{petId}", this::deletePet); + rules.post("/{petId}/downloadImage", this::downloadFile); rules.get("/findByStatus", this::findPetsByStatus); rules.get("/findByTags", this::findPetsByTags); rules.get("/{petId}", this::getPetById); @@ -132,6 +134,36 @@ protected abstract void handleDeletePet(ServerRequest request, ServerResponse re Long petId, Optional apiKey); + /** + * POST /pet/{petId}/downloadImage : downloads an image. + * + * @param request the server request + * @param response the server response + */ + protected void downloadFile(ServerRequest request, ServerResponse response) { + + ValidatorUtils.Validator validator = ValidatorUtils.validator(); + + // Parameter: petId + Long petId = downloadFileOp.petId(request, validator); + + validator.require("petId", petId); + validator.execute(); + + handleDownloadFile(request, response, + petId); + } + + /** + * Handle POST /pet/{petId}/downloadImage : downloads an image. + * + * @param request the server request + * @param response the server response + * @param petId ID of pet to update + */ + protected abstract void handleDownloadFile(ServerRequest request, ServerResponse response, + Long petId); + /** * GET /pet/findByStatus : Finds Pets by status. * @@ -657,6 +689,119 @@ void send(ServerResponse _serverResponse) { } } + /** + * Returns a new instance of the class which handles parameters to and responses from the downloadFile operation. + *

+ * Developers can override this method if they extend the PetService class. + *

+ * + * @return new DownloadFile + */ + protected DownloadFileOp createDownloadFileOp() { + return new DownloadFileOp(); + } + + /** + * Helper elements for the {@code downloadFile} operation. + *

+ * Also below are records for each response declared in the OpenAPI document, organized by response status. + *

+ * Once your code determines which (if any) declared response to send it can use the static {@code builder} method for + * that specific result, passing the required elements of the response as parameters, and then assign any optional + * response elements using the other builder methods. + *

+ * Finally, your code should invoke the {@code apply} method, passing the original {@link ServerResponse}. The + * generated method sets any headers you have assigned, sets the correct status in the response, and sends + * the response including any appropriate entity. + *

+ */ + public static class DownloadFileOp { + + /** + * Prepares the petId parameter. + * + * @param request {@link io.helidon.webserver.http.ServerRequest} containing the parameter + * @param validator {@link org.openapitools.server.api.ValidatorUtils.Validator} for validating all parameters to the operation + * @return petId parameter value + */ + protected Long petId(ServerRequest request, ValidatorUtils.Validator validator) { + return request.path() + .pathParameters() + .first("petId") + .asOptional() + .map(Long::valueOf) + .orElse(null); + } + + /** + * Response for HTTP status code {@code 200}. + * + * @param response + */ + record Response200(InputStream response) { + + /** + * Creates a response builder for the status {@code 200} response + * for the downloadFile operation; there are no required result values for this response. + * + * @return new builder for status 200 + */ + static Builder builder() { + return new Builder(); + } + + /** + * Builder for the Response200 result. + */ + static class Builder implements io.helidon.common.Builder { + + private InputStream response; + @Override + public Response200 build() { + return new Response200(response); + } + + /** + * Sends the response data in this builder to the specified {@link io.helidon.webserver.http.ServerResponse}, + * assigning the HTTP status, any response headers, and any response entity. + *

+ * Equivalent to {@snippet : + * build().send(_serverResponse); + * } + *

+ * + * @param _serverResponse the {@code ServerResponse} to which to apply the status, headers, and entity + */ + void send(ServerResponse _serverResponse) { + build().send(_serverResponse); + } + + /** + * Sets the value for the optional return property {@code response}. + * @param response + * @return updated result builder + */ + Builder response(InputStream response) { + this.response = response; + return this; + } + } + + /** + * Applies this response data to the specified {@link io.helidon.webserver.http.ServerResponse}, assigning the + * HTTP status, any response headers, and any response entity. + * + * @param _serverResponse the server response to which to apply these result values + */ + void send(ServerResponse _serverResponse) { + _serverResponse.status(Status.OK_200); + if (response != null) { + _serverResponse.contentLength(response.transferTo(_serverResponse.outputStream())); + } _serverResponse.send(); + } + } + } + /** * Returns a new instance of the class which handles parameters to and responses from the findPetsByStatus operation. *

diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 299009d0b712..ec44ab9662ef 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -42,6 +42,13 @@ protected void handleDeletePet(ServerRequest request, ServerResponse response, response.status(Status.NOT_IMPLEMENTED_501).send(); } + @Override + protected void handleDownloadFile(ServerRequest request, ServerResponse response, + Long petId) { + + response.status(Status.NOT_IMPLEMENTED_501).send(); + } + @Override protected void handleFindPetsByStatus(ServerRequest request, ServerResponse response, List status) { diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml index 71ba74eeb055..c6682ecb5b2c 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/README.md b/samples/server/petstore/java-helidon-server/v4/se-uac/README.md index 3442efc621ab..a898facd0b87 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/README.md +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/README.md @@ -38,6 +38,7 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} +curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java index a2f02a0657b8..ad402d15d10c 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java @@ -40,6 +40,7 @@ public abstract class PetService implements HttpService { protected AddPetOp addPetOp = createAddPetOp(); protected DeletePetOp deletePetOp = createDeletePetOp(); + protected DownloadFileOp downloadFileOp = createDownloadFileOp(); protected FindPetsByStatusOp findPetsByStatusOp = createFindPetsByStatusOp(); protected FindPetsByTagsOp findPetsByTagsOp = createFindPetsByTagsOp(); protected GetPetByIdOp getPetByIdOp = createGetPetByIdOp(); @@ -57,6 +58,7 @@ public abstract class PetService implements HttpService { public void routing(HttpRules rules) { rules.post("/pet", this::addPet); rules.delete("/pet/{petId}", this::deletePet); + rules.post("/pet/{petId}/downloadImage", this::downloadFile); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); @@ -134,6 +136,36 @@ protected abstract void handleDeletePet(ServerRequest request, ServerResponse re Long petId, Optional apiKey); + /** + * POST /pet/{petId}/downloadImage : downloads an image. + * + * @param request the server request + * @param response the server response + */ + protected void downloadFile(ServerRequest request, ServerResponse response) { + + ValidatorUtils.Validator validator = ValidatorUtils.validator(); + + // Parameter: petId + Long petId = downloadFileOp.petId(request, validator); + + validator.require("petId", petId); + validator.execute(); + + handleDownloadFile(request, response, + petId); + } + + /** + * Handle POST /pet/{petId}/downloadImage : downloads an image. + * + * @param request the server request + * @param response the server response + * @param petId ID of pet to update + */ + protected abstract void handleDownloadFile(ServerRequest request, ServerResponse response, + Long petId); + /** * GET /pet/findByStatus : Finds Pets by status. * @@ -707,6 +739,119 @@ void send(ServerResponse _serverResponse) { } } + /** + * Returns a new instance of the class which handles parameters to and responses from the downloadFile operation. + *

+ * Developers can override this method if they extend the PetService class. + *

+ * + * @return new DownloadFile + */ + protected DownloadFileOp createDownloadFileOp() { + return new DownloadFileOp(); + } + + /** + * Helper elements for the {@code downloadFile} operation. + *

+ * Also below are records for each response declared in the OpenAPI document, organized by response status. + *

+ * Once your code determines which (if any) declared response to send it can use the static {@code builder} method for + * that specific result, passing the required elements of the response as parameters, and then assign any optional + * response elements using the other builder methods. + *

+ * Finally, your code should invoke the {@code apply} method, passing the original {@link ServerResponse}. The + * generated method sets any headers you have assigned, sets the correct status in the response, and sends + * the response including any appropriate entity. + *

+ */ + public static class DownloadFileOp { + + /** + * Prepares the petId parameter. + * + * @param request {@link io.helidon.webserver.http.ServerRequest} containing the parameter + * @param validator {@link org.openapitools.server.api.ValidatorUtils.Validator} for validating all parameters to the operation + * @return petId parameter value + */ + protected Long petId(ServerRequest request, ValidatorUtils.Validator validator) { + return request.path() + .pathParameters() + .first("petId") + .asOptional() + .map(Long::valueOf) + .orElse(null); + } + + /** + * Response for HTTP status code {@code 200}. + * + * @param response + */ + record Response200(InputStream response) { + + /** + * Creates a response builder for the status {@code 200} response + * for the downloadFile operation; there are no required result values for this response. + * + * @return new builder for status 200 + */ + static Builder builder() { + return new Builder(); + } + + /** + * Builder for the Response200 result. + */ + static class Builder implements io.helidon.common.Builder { + + private InputStream response; + @Override + public Response200 build() { + return new Response200(response); + } + + /** + * Sends the response data in this builder to the specified {@link io.helidon.webserver.http.ServerResponse}, + * assigning the HTTP status, any response headers, and any response entity. + *

+ * Equivalent to {@snippet : + * build().send(_serverResponse); + * } + *

+ * + * @param _serverResponse the {@code ServerResponse} to which to apply the status, headers, and entity + */ + void send(ServerResponse _serverResponse) { + build().send(_serverResponse); + } + + /** + * Sets the value for the optional return property {@code response}. + * @param response + * @return updated result builder + */ + Builder response(InputStream response) { + this.response = response; + return this; + } + } + + /** + * Applies this response data to the specified {@link io.helidon.webserver.http.ServerResponse}, assigning the + * HTTP status, any response headers, and any response entity. + * + * @param _serverResponse the server response to which to apply these result values + */ + void send(ServerResponse _serverResponse) { + _serverResponse.status(Status.OK_200); + if (response != null) { + _serverResponse.contentLength(response.transferTo(_serverResponse.outputStream())); + } _serverResponse.send(); + } + } + } + /** * Returns a new instance of the class which handles parameters to and responses from the findPetsByStatus operation. *

diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java index ba312ca6ef1a..a94b4f05793b 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -42,6 +42,13 @@ protected void handleDeletePet(ServerRequest request, ServerResponse response, response.status(Status.NOT_IMPLEMENTED_501).send(); } + @Override + protected void handleDownloadFile(ServerRequest request, ServerResponse response, + Long petId) { + + response.status(Status.NOT_IMPLEMENTED_501).send(); + } + @Override protected void handleFindPetsByStatus(ServerRequest request, ServerResponse response, List status) { diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml index 71ba74eeb055..c6682ecb5b2c 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/se/README.md b/samples/server/petstore/java-helidon-server/v4/se/README.md index 3442efc621ab..a898facd0b87 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/README.md +++ b/samples/server/petstore/java-helidon-server/v4/se/README.md @@ -38,6 +38,7 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} +curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java index 1ccfc5ad4d46..42b2e2232514 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java @@ -36,6 +36,7 @@ public interface PetService extends HttpService { default void routing(HttpRules rules) { rules.post("/pet", this::addPet); rules.delete("/pet/{petId}", this::deletePet); + rules.post("/pet/{petId}/downloadImage", this::downloadFile); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); @@ -60,6 +61,13 @@ default void routing(HttpRules rules) { * @param response the server response */ void deletePet(ServerRequest request, ServerResponse response); + /** + * POST /pet/{petId}/downloadImage : downloads an image. + * + * @param request the server request + * @param response the server response + */ + void downloadFile(ServerRequest request, ServerResponse response); /** * GET /pet/findByStatus : Finds Pets by status. * diff --git a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 9159d959b246..55bbcd9e8ab2 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -38,6 +38,13 @@ public void deletePet(ServerRequest request, ServerResponse response) { response.status(Status.NOT_IMPLEMENTED_501).send(); } + @Override + public void downloadFile(ServerRequest request, ServerResponse response) { + ValidatorUtils.Validator validator = ValidatorUtils.validator(); + + response.status(Status.NOT_IMPLEMENTED_501).send(); + } + @Override public void findPetsByStatus(ServerRequest request, ServerResponse response) { ValidatorUtils.Validator validator = ValidatorUtils.validator(); diff --git a/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml index 71ba74eeb055..c6682ecb5b2c 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml @@ -351,6 +351,37 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java index 6aea7e0bfccb..c4fc662cba26 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java @@ -107,6 +107,37 @@ public static MappingBuilder stubDeletePetFault(@javax.annotation.Nonnull String + public static MappingBuilder stubDownloadFile200(@javax.annotation.Nonnull String petId, String response) { + MappingBuilder stub = post(urlPathTemplate("/pet/{petId}/downloadImage")) + .withHeader("Accept", havingExactly("application/zip")) + .withHeader("Authorization", matching(".*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/zip") + .withBody(response) + ); + + stub = stub.withPathParam("petId", equalTo(petId)); + + return stub; + } + + public static MappingBuilder stubDownloadFileFault(@javax.annotation.Nonnull String petId, Fault fault) { + MappingBuilder stub = post(urlPathTemplate("/pet/{petId}/downloadImage")) + .withHeader("Accept", havingExactly("application/zip")) + .withHeader("Authorization", matching(".*")) + .willReturn(aResponse() + .withFault(fault) + ); + + stub = stub.withPathParam("petId", equalTo(petId)); + + return stub; + } + + + + public static MappingBuilder stubFindPetsByStatus200(@javax.annotation.Nonnull String status, String response) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByStatus")) .withHeader("Accept", havingExactly("application/xml", "application/json")) diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java index b842a2718943..38a69c4f0cb3 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java @@ -93,6 +93,23 @@ public Response deletePet(@ApiParam(value = "Pet id to delete", required = true) throws NotFoundException { return delegate.deletePet(petId, apiKey, securityContext); } + @javax.ws.rs.POST + @Path("/{petId}/downloadImage") + + @Produces({ "application/zip" }) + @io.swagger.annotations.ApiOperation(value = "downloads an image", notes = "", response = File.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = File.class) + }) + public Response downloadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.downloadFile(petId, securityContext); + } @javax.ws.rs.GET @Path("/findByStatus") diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java index fa0fde034235..97cb10180778 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java @@ -22,6 +22,7 @@ public abstract class PetApiService { public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; + public abstract Response downloadFile(Long petId,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByStatus( @NotNull List status,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByTags( @NotNull Set tags,SecurityContext securityContext) throws NotFoundException; public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index db46c8ba90d4..5c6262aacc87 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -30,6 +30,11 @@ public Response deletePet(Long petId, String apiKey, SecurityContext securityCon return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override + public Response downloadFile(Long petId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override public Response findPetsByStatus( @NotNull List status, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java index b6e1712fa52d..f9123761f887 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java @@ -104,6 +104,23 @@ public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi. return Response.ok().entity("magic!").build(); } + @POST + @Path("/{petId}/downloadImage") + @Produces({ "application/zip" }) + @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ + @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) + }) + @org.eclipse.microprofile.openapi.annotations.Operation(operationId = "downloadFile", summary = "downloads an image", description = "") + @org.eclipse.microprofile.openapi.annotations.tags.Tag(name="pet") + @org.eclipse.microprofile.openapi.annotations.responses.APIResponses(value = { + @org.eclipse.microprofile.openapi.annotations.responses.APIResponse(responseCode = "200", description = "successful operation", content = { + @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/zip", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = File.class)) + }) + }) + public Response downloadFile(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId) { + return Response.ok().entity("magic!").build(); + } + @GET @Path("/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml index 81900f211c15..5d97cea065b0 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml @@ -367,6 +367,39 @@ paths: - application/json x-tags: - tag: pet + /pet/{petId}/downloadImage: + post: + description: "" + operationId: downloadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: downloads an image + tags: + - pet + x-accepts: + - application/zip + x-tags: + - tag: pet /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java index 1e7fa6a84560..ca3b8791fdab 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java @@ -93,6 +93,20 @@ public Response deletePet(@Schema(description= "Pet id to delete", required = tr return delegate.deletePet(petId, apiKey, securityContext); } + @jakarta.ws.rs.POST + @Path("/{petId}/downloadImage") + @Produces({ "application/zip" }) + @Operation(summary = "downloads an image", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = File.class))), + },security = { + @SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" }) + }, tags={ "pet", }) + public Response downloadFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.downloadFile(petId, securityContext); + } + @jakarta.ws.rs.GET @Path("/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java index 58e497e96375..b0e880435881 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java @@ -22,6 +22,7 @@ public abstract class PetApiService { public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; + public abstract Response downloadFile(Long petId,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByStatus( @NotNull List status,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByTags( @NotNull Set tags,SecurityContext securityContext) throws NotFoundException; public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index ebf441d748c6..e25a246c7649 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -30,6 +30,11 @@ public Response deletePet(Long petId, String apiKey, SecurityContext securityCon return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override + public Response downloadFile(Long petId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override public Response findPetsByStatus( @NotNull List status, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/php-laravel/Api/PetApiInterface.php b/samples/server/petstore/php-laravel/Api/PetApiInterface.php index 24dbb1f2b046..e84c41aa444b 100644 --- a/samples/server/petstore/php-laravel/Api/PetApiInterface.php +++ b/samples/server/petstore/php-laravel/Api/PetApiInterface.php @@ -56,6 +56,20 @@ public function deletePet( ; + /** + * Operation downloadFile + * + * downloads an image + * @param int $petId + * @return \Illuminate\Http\UploadedFile + */ + public function downloadFile( + int $petId, + ): + \Illuminate\Http\UploadedFile + ; + + /** * Operation findPetsByStatus * diff --git a/samples/server/petstore/php-laravel/Http/Controllers/PetController.php b/samples/server/petstore/php-laravel/Http/Controllers/PetController.php index 098346fd1e71..690e63e76ff4 100644 --- a/samples/server/petstore/php-laravel/Http/Controllers/PetController.php +++ b/samples/server/petstore/php-laravel/Http/Controllers/PetController.php @@ -136,6 +136,50 @@ public function deletePet(Request $request, int $petId): JsonResponse } + // This shouldn't happen + return response()->abort(500); + } + /** + * Operation downloadFile + * + * downloads an image. + * + */ + public function downloadFile(Request $request, int $petId): JsonResponse + { + $validator = Validator::make( + array_merge( + [ + 'petId' => $petId, + ], + $request->all(), + ), + [ + 'petId' => [ + 'required', + 'integer', + ], + ], + ); + + if ($validator->fails()) { + return response()->json(['error' => 'Invalid input'], 400); + } + + + try { + $apiResult = $this->api->downloadFile($petId); + } catch (\Exception $exception) { + // This shouldn't happen + report($exception); + return response()->json(['error' => $exception->getMessage()], 500); + } + + if ($apiResult instanceof \Illuminate\Http\UploadedFile) { + return response()->json($this->serde->serialize($apiResult, format: 'array'), 200); + } + + // This shouldn't happen return response()->abort(500); } diff --git a/samples/server/petstore/php-laravel/routes.php b/samples/server/petstore/php-laravel/routes.php index a92d702b6043..9b91f2733bec 100644 --- a/samples/server/petstore/php-laravel/routes.php +++ b/samples/server/petstore/php-laravel/routes.php @@ -209,6 +209,13 @@ */ Route::DELETE('/v2/pet/{petId}', [\OpenAPI\Server\Http\Controllers\PetController::class, 'deletePet'])->name('pet.delete.pet'); +/** + * POST downloadFile + * Summary: downloads an image + * Notes: + */ +Route::POST('/v2/pet/{petId}/downloadImage', [\OpenAPI\Server\Http\Controllers\PetController::class, 'downloadFile'])->name('pet.download.file'); + /** * GET findPetsByStatus * Summary: Finds Pets by status diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php index 3b7944400c77..8d990427ac6f 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php @@ -204,6 +204,26 @@ public function updatePetWithForm($pet_id) return response('How about implementing updatePetWithForm as a post method ?'); } + /** + * Operation downloadFile + * + * downloads an image. + * + * @param int $pet_id ID of pet to update (required) + * + * @return Http response + */ + public function downloadFile($pet_id) + { + $input = Request::all(); + + //path params validation + + + //not path params validation + + return response('How about implementing downloadFile as a post method ?'); + } /** * Operation uploadFile * diff --git a/samples/server/petstore/php-lumen/lib/routes/web.php b/samples/server/petstore/php-lumen/lib/routes/web.php index dfd864d4d144..208688be8a18 100644 --- a/samples/server/petstore/php-lumen/lib/routes/web.php +++ b/samples/server/petstore/php-lumen/lib/routes/web.php @@ -268,6 +268,13 @@ */ $router->post('/v2/pet/{petId}', 'PetApi@updatePetWithForm'); +/** + * post downloadFile + * Summary: downloads an image + * Notes: + */ +$router->post('/v2/pet/{petId}/downloadImage', 'PetApi@downloadFile'); + /** * post uploadFile * Summary: uploads an image diff --git a/samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php b/samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php new file mode 100644 index 000000000000..d02ec2c522c5 --- /dev/null +++ b/samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php @@ -0,0 +1,27 @@ + Date: Wed, 4 Jun 2025 13:49:09 -0600 Subject: [PATCH 05/10] remove unused imports from previous changes --- .../codegen/dart/dio/DartDioClientCodegenTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java index c81dd269cb50..90017530fb85 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java @@ -16,10 +16,6 @@ package org.openapitools.codegen.dart.dio; -import io.swagger.v3.oas.models.media.Content; -import io.swagger.v3.oas.models.media.MediaType; -import io.swagger.v3.oas.models.media.Schema; -import io.swagger.v3.oas.models.responses.ApiResponse; import org.openapitools.codegen.*; import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.DartDioClientCodegen; From a65d0b898e7e57932d83c400eba4a154eb2a0809 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Wed, 4 Jun 2025 15:11:57 -0600 Subject: [PATCH 06/10] fixed issues where import wouldn't get included --- .../languages/DartDioClientCodegen.java | 21 ++++++++++--------- .../lib/src/api/pet_api.dart | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 9a759a48369a..cf8338e47e3d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -658,16 +658,6 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List Date: Tue, 10 Jun 2025 12:52:14 -0600 Subject: [PATCH 07/10] specific unit test for binary response --- bin/configs/dart-dio-binary-response.yaml | 8 + .../src/test/resources/3_0/issue_20682.yaml | 16 ++ ...ith-fake-endpoints-models-for-testing.yaml | 27 ---- .../java-helidon-client/v3/mp/docs/PetApi.md | 36 ----- .../org/openapitools/client/api/PetApi.java | 9 -- .../java-helidon-client/v3/se/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 8 - .../openapitools/client/api/PetApiImpl.java | 40 ----- .../java-helidon-client/v4/mp/docs/PetApi.md | 36 ----- .../org/openapitools/client/api/PetApi.java | 9 -- .../java-helidon-client/v4/se/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 8 - .../openapitools/client/api/PetApiImpl.java | 40 ----- .../petstore/java/apache-httpclient/README.md | 1 - .../java/apache-httpclient/api/openapi.yaml | 31 ---- .../java/apache-httpclient/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 75 --------- .../petstore/java/feign-hc5/api/openapi.yaml | 31 ---- .../org/openapitools/client/api/PetApi.java | 27 ---- .../petstore/java/feign/api/openapi.yaml | 31 ---- .../org/openapitools/client/api/PetApi.java | 27 ---- .../docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 11 -- .../docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 11 -- .../microprofile-rest-client/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 11 -- .../java/restclient-swagger2/README.md | 1 - .../java/restclient-swagger2/api/openapi.yaml | 31 ---- .../java/restclient-swagger2/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 74 --------- .../README.md | 1 - .../api/openapi.yaml | 31 ---- .../docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 74 --------- .../README.md | 1 - .../api/openapi.yaml | 31 ---- .../docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 74 --------- .../client/petstore/java/restclient/README.md | 1 - .../petstore/java/restclient/api/openapi.yaml | 31 ---- .../petstore/java/restclient/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 74 --------- .../client/petstore/java/resteasy/README.md | 1 - .../petstore/java/resteasy/api/openapi.yaml | 31 ---- .../petstore/java/resteasy/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 44 ------ .../java/resttemplate-withXml/README.md | 1 - .../resttemplate-withXml/api/openapi.yaml | 31 ---- .../java/resttemplate-withXml/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 49 ------ .../petstore/java/resttemplate/README.md | 1 - .../java/resttemplate/api/openapi.yaml | 31 ---- .../petstore/java/resttemplate/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 49 ------ .../java/vertx-supportVertxFuture/README.md | 1 - .../vertx-supportVertxFuture/api/openapi.yaml | 31 ---- .../vertx-supportVertxFuture/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 16 -- .../openapitools/client/api/PetApiImpl.java | 48 ------ .../client/api/rxjava/PetApi.java | 45 ------ samples/client/petstore/java/vertx/README.md | 1 - .../petstore/java/vertx/api/openapi.yaml | 31 ---- .../client/petstore/java/vertx/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 4 - .../openapitools/client/api/PetApiImpl.java | 48 ------ .../client/api/rxjava/PetApi.java | 45 ------ .../petstore/java/webclient-jakarta/README.md | 1 - .../java/webclient-jakarta/api/openapi.yaml | 31 ---- .../java/webclient-jakarta/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 75 --------- .../java/webclient-swagger2/README.md | 1 - .../java/webclient-swagger2/api/openapi.yaml | 31 ---- .../java/webclient-swagger2/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 75 --------- .../README.md | 1 - .../api/openapi.yaml | 31 ---- .../docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 75 --------- .../client/petstore/java/webclient/README.md | 1 - .../petstore/java/webclient/api/openapi.yaml | 31 ---- .../petstore/java/webclient/docs/PetApi.md | 72 --------- .../org/openapitools/client/api/PetApi.java | 75 --------- .../client/petstore/ruby-autoload/README.md | 1 - .../petstore/ruby-autoload/docs/PetApi.md | 70 --------- .../ruby-autoload/lib/petstore/api/pet_api.rb | 63 -------- .../client/petstore/ruby-faraday/README.md | 1 - .../petstore/ruby-faraday/docs/PetApi.md | 70 --------- .../ruby-faraday/lib/petstore/api/pet_api.rb | 63 -------- .../builds/default-v3.0/apis/PetApi.ts | 44 ------ .../dart-dio/binary_response/.gitignore | 41 +++++ .../binary_response/.openapi-generator-ignore | 23 +++ .../binary_response/.openapi-generator/FILES | 17 ++ .../.openapi-generator/VERSION | 1 + .../dart-dio/binary_response/README.md | 83 ++++++++++ .../binary_response/analysis_options.yaml | 10 ++ .../dart-dio/binary_response/build.yaml | 18 +++ .../binary_response/doc/DefaultApi.md | 51 ++++++ .../dart-dio/binary_response/lib/openapi.dart | 14 ++ .../dart-dio/binary_response/lib/src/api.dart | 68 ++++++++ .../lib/src/api/default_api.dart | 91 +++++++++++ .../lib/src/auth/api_key_auth.dart | 30 ++++ .../binary_response/lib/src/auth/auth.dart | 18 +++ .../lib/src/auth/basic_auth.dart | 37 +++++ .../lib/src/auth/bearer_auth.dart | 26 ++++ .../binary_response/lib/src/auth/oauth.dart | 26 ++++ .../binary_response/lib/src/deserialize.dart | 45 ++++++ .../dart-dio/binary_response/pubspec.yaml | 17 ++ .../test/default_api_test.dart | 16 ++ .../README.md | 1 - .../doc/PetApi.md | 46 ------ .../lib/src/api/pet_api.dart | 79 ---------- .../petstore_client_lib_fake/README.md | 1 - .../petstore_client_lib_fake/doc/PetApi.md | 46 ------ .../lib/src/api/pet_api.dart | 79 ---------- .../dart2/petstore_client_lib_fake/README.md | 1 - .../petstore_client_lib_fake/doc/PetApi.md | 46 ------ .../lib/api/pet_api.dart | 59 ------- .../cpp-restbed/generated/3_0/api/PetApi.cpp | 132 ---------------- .../cpp-restbed/generated/3_0/api/PetApi.h | 68 -------- .../java-helidon-server/v3/mp/README.md | 1 - .../openapitools/server/api/PetService.java | 5 - .../server/api/PetServiceImpl.java | 8 - .../src/main/resources/META-INF/openapi.yml | 31 ---- .../java-helidon-server/v3/se/README.md | 1 - .../openapitools/server/api/PetService.java | 8 - .../server/api/PetServiceImpl.java | 4 - .../src/main/resources/META-INF/openapi.yml | 31 ---- .../java-helidon-server/v4/mp/README.md | 1 - .../openapitools/server/api/PetService.java | 5 - .../server/api/PetServiceImpl.java | 8 - .../src/main/resources/META-INF/openapi.yml | 31 ---- .../v4/se-uac-group-by-file-path/README.md | 1 - .../openapitools/server/api/PetService.java | 145 ------------------ .../server/api/PetServiceImpl.java | 7 - .../src/main/resources/META-INF/openapi.yml | 31 ---- .../java-helidon-server/v4/se-uac/README.md | 1 - .../openapitools/server/api/PetService.java | 145 ------------------ .../server/api/PetServiceImpl.java | 7 - .../src/main/resources/META-INF/openapi.yml | 31 ---- .../java-helidon-server/v4/se/README.md | 1 - .../openapitools/server/api/PetService.java | 8 - .../server/api/PetServiceImpl.java | 7 - .../src/main/resources/META-INF/openapi.yml | 31 ---- .../mockserver/api/PetApiMockServer.java | 31 ---- .../gen/java/org/openapitools/api/PetApi.java | 17 -- .../org/openapitools/api/PetApiService.java | 1 - .../api/impl/PetApiServiceImpl.java | 5 - .../gen/java/org/openapitools/api/PetApi.java | 17 -- .../src/main/resources/META-INF/openapi.yaml | 33 ---- .../gen/java/org/openapitools/api/PetApi.java | 14 -- .../org/openapitools/api/PetApiService.java | 1 - .../api/impl/PetApiServiceImpl.java | 5 - .../php-laravel/Api/PetApiInterface.php | 14 -- .../Http/Controllers/PetController.php | 44 ------ .../server/petstore/php-laravel/routes.php | 7 - .../lib/app/Http/Controllers/PetApi.php | 20 --- .../petstore/php-lumen/lib/routes/web.php | 7 - 158 files changed, 656 insertions(+), 4832 deletions(-) create mode 100644 bin/configs/dart-dio-binary-response.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/.gitignore create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/README.md create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/analysis_options.yaml create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/build.yaml create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/doc/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/openapi.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api/default_api.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/api_key_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/basic_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/bearer_auth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/oauth.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/deserialize.dart create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/pubspec.yaml create mode 100644 samples/openapi3/client/petstore/dart-dio/binary_response/test/default_api_test.dart diff --git a/bin/configs/dart-dio-binary-response.yaml b/bin/configs/dart-dio-binary-response.yaml new file mode 100644 index 000000000000..30ad33a740c1 --- /dev/null +++ b/bin/configs/dart-dio-binary-response.yaml @@ -0,0 +1,8 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/binary_response +inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "json_serializable" diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml new file mode 100644 index 000000000000..9e7b65142bb1 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Binary response +paths: + /limits: + get: + operationId: binaryResponse + responses: + '200': + description: OK + content: + application/zip: + schema: + type: string + format: binary \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index 74a52a8de45b..e4957b4e19d1 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -311,33 +311,6 @@ paths: description: file to upload type: string format: binary - '/pet/{petId}/downloadImage': - post: - tags: - - pet - summary: downloads an image - description: '' - operationId: downloadFile - parameters: - - name: petId - in: path - description: ID of pet to update - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: successful operation - content: - application/zip: - schema: - type: string - format: binary - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' /store/inventory: get: tags: diff --git a/samples/client/petstore/java-helidon-client/v3/mp/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v3/mp/docs/PetApi.md index 44be01066fbe..2f1e3c02a2e5 100644 --- a/samples/client/petstore/java-helidon-client/v3/mp/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v3/mp/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -90,41 +89,6 @@ Deletes a pet | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java index e72b446fbe35..e70db50695c1 100644 --- a/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java @@ -57,15 +57,6 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; - /** - * downloads an image - * - */ - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java index 90c9dd388a35..a333b1942689 100644 --- a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java @@ -44,14 +44,6 @@ public interface PetApi { */ ApiResponse deletePet(Long petId, String apiKey); - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return {@code ApiResponse} - */ - ApiResponse downloadFile(Long petId); - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java index 7e32e35eebee..00cefb142b80 100644 --- a/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -51,7 +51,6 @@ public class PetApiImpl implements PetApi { protected static final GenericType RESPONSE_TYPE_addPet = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_deletePet = ResponseType.create(Void.class); - protected static final GenericType RESPONSE_TYPE_downloadFile = ResponseType.create(File.class); protected static final GenericType> RESPONSE_TYPE_findPetsByStatus = ResponseType.create(List.class, Pet.class); protected static final GenericType> RESPONSE_TYPE_findPetsByTags = ResponseType.create(List.class, Pet.class); protected static final GenericType RESPONSE_TYPE_getPetById = ResponseType.create(Pet.class); @@ -156,45 +155,6 @@ protected ApiResponse deletePetSubmit(WebClientRequestBuilder webClientReq return ApiResponse.create(RESPONSE_TYPE_deletePet, webClientResponse); } - @Override - public ApiResponse downloadFile(Long petId) { - Objects.requireNonNull(petId, "Required parameter 'petId' not specified"); - WebClientRequestBuilder webClientRequestBuilder = downloadFileRequestBuilder(petId); - return downloadFileSubmit(webClientRequestBuilder, petId); - } - - /** - * Creates a {@code WebClientRequestBuilder} for the downloadFile operation. - * Optional customization point for subclasses. - * - * @param petId ID of pet to update (required) - * @return WebClientRequestBuilder for downloadFile - */ - protected WebClientRequestBuilder downloadFileRequestBuilder(Long petId) { - WebClientRequestBuilder webClientRequestBuilder = apiClient.webClient() - .method("POST"); - - String path = "/pet/{petId}/downloadImage" - .replace("{petId}", ApiClient.urlEncode(petId.toString())); - webClientRequestBuilder.path(path); - webClientRequestBuilder.accept(MediaType.APPLICATION_JSON); - - return webClientRequestBuilder; - } - - /** - * Initiates the request for the downloadFile operation. - * Optional customization point for subclasses. - * - * @param webClientRequestBuilder the request builder to use for submitting the request - * @param petId ID of pet to update (required) - * @return {@code ApiResponse} for the submitted request - */ - protected ApiResponse downloadFileSubmit(WebClientRequestBuilder webClientRequestBuilder, Long petId) { - Single webClientResponse = webClientRequestBuilder.submit(); - return ApiResponse.create(RESPONSE_TYPE_downloadFile, webClientResponse); - } - @Override public ApiResponse> findPetsByStatus(List status) { Objects.requireNonNull(status, "Required parameter 'status' not specified"); diff --git a/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md index 44be01066fbe..2f1e3c02a2e5 100644 --- a/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -90,41 +89,6 @@ Deletes a pet | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java index 290291dbb0ae..04d31a358118 100644 --- a/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java @@ -58,15 +58,6 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; - /** - * downloads an image - * - */ - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md b/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md +++ b/samples/client/petstore/java-helidon-client/v4/se/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java index 8cc13f1104d4..7731763f5934 100644 --- a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApi.java @@ -45,14 +45,6 @@ public interface PetApi { */ ApiResponse deletePet(Long petId, String apiKey); - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return {@code ApiResponse} - */ - ApiResponse downloadFile(Long petId); - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java index de3577193035..d8e33fe1fd3c 100644 --- a/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java-helidon-client/v4/se/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -53,7 +53,6 @@ public class PetApiImpl implements PetApi { protected static final GenericType RESPONSE_TYPE_addPet = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_deletePet = ResponseType.create(Void.class); - protected static final GenericType RESPONSE_TYPE_downloadFile = ResponseType.create(File.class); protected static final GenericType> RESPONSE_TYPE_findPetsByStatus = ResponseType.create(List.class, Pet.class); protected static final GenericType> RESPONSE_TYPE_findPetsByTags = ResponseType.create(List.class, Pet.class); protected static final GenericType RESPONSE_TYPE_getPetById = ResponseType.create(Pet.class); @@ -158,45 +157,6 @@ protected ApiResponse deletePetSubmit(HttpClientRequest webClientRequestBu return ApiResponse.create(RESPONSE_TYPE_deletePet, webClientResponse); } - @Override - public ApiResponse downloadFile(Long petId) { - Objects.requireNonNull(petId, "Required parameter 'petId' not specified"); - HttpClientRequest webClientRequestBuilder = downloadFileRequestBuilder(petId); - return downloadFileSubmit(webClientRequestBuilder, petId); - } - - /** - * Creates a {@code WebClientRequestBuilder} for the downloadFile operation. - * Optional customization point for subclasses. - * - * @param petId ID of pet to update (required) - * @return HttpClientRequest for downloadFile - */ - protected HttpClientRequest downloadFileRequestBuilder(Long petId) { - HttpClientRequest webClientRequestBuilder = apiClient.webClient() - .method(Method.POST); - - String path = "/pet/{petId}/downloadImage" - .replace("{petId}", ApiClient.urlEncode(petId.toString())); - webClientRequestBuilder.path(path); - webClientRequestBuilder.accept(MediaTypes.APPLICATION_JSON); - - return webClientRequestBuilder; - } - - /** - * Initiates the request for the downloadFile operation. - * Optional customization point for subclasses. - * - * @param webClientRequestBuilder the request builder to use for submitting the request - * @param petId ID of pet to update (required) - * @return {@code ApiResponse} for the submitted request - */ - protected ApiResponse downloadFileSubmit(HttpClientRequest webClientRequestBuilder, Long petId) { - HttpClientResponse webClientResponse = webClientRequestBuilder.request(); - return ApiResponse.create(RESPONSE_TYPE_downloadFile, webClientResponse); - } - @Override public ApiResponse> findPetsByStatus(List status) { Objects.requireNonNull(status, "Required parameter 'status' not specified"); diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index cce7feacc5e3..4b72c4b65de3 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -135,7 +135,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/apache-httpclient/docs/PetApi.md b/samples/client/petstore/java/apache-httpclient/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/apache-httpclient/docs/PetApi.md +++ b/samples/client/petstore/java/apache-httpclient/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java index 584ace6fb444..b56be51a7bb0 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -191,81 +191,6 @@ public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nu ); } - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return File - * @throws ApiException if fails to make API call - */ - public File downloadFile(@javax.annotation.Nonnull Long petId) throws ApiException { - return this.downloadFile(petId, Collections.emptyMap()); - } - - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param additionalHeaders additionalHeaders for this call - * @return File - * @throws ApiException if fails to make API call - */ - public File downloadFile(@javax.annotation.Nonnull Long petId, Map additionalHeaders) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling downloadFile"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}/downloadImage" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(apiClient.parameterToString(petId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - localVarHeaderParams.putAll(additionalHeaders); - - - - final String[] localVarAccepts = { - "application/zip" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - TypeReference localVarReturnType = new TypeReference() {}; - return apiClient.invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType - ); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/feign-hc5/api/openapi.yaml b/samples/client/petstore/java/feign-hc5/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/feign-hc5/api/openapi.yaml +++ b/samples/client/petstore/java/feign-hc5/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java index a870ddb241e9..42840ad0754c 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/api/PetApi.java @@ -75,33 +75,6 @@ public interface PetApi extends ApiClient.Api { - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return File - */ - @RequestLine("POST /pet/{petId}/downloadImage") - @Headers({ - "Accept: application/zip", - }) - File downloadFile(@Param("petId") @javax.annotation.Nonnull Long petId); - - /** - * downloads an image - * Similar to downloadFile but it also returns the http response headers . - * - * @param petId ID of pet to update (required) - * @return A ApiResponse that wraps the response boyd and the http headers. - */ - @RequestLine("POST /pet/{petId}/downloadImage") - @Headers({ - "Accept: application/zip", - }) - ApiResponse downloadFileWithHttpInfo(@Param("petId") @javax.annotation.Nonnull Long petId); - - - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java index a870ddb241e9..42840ad0754c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java @@ -75,33 +75,6 @@ public interface PetApi extends ApiClient.Api { - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return File - */ - @RequestLine("POST /pet/{petId}/downloadImage") - @Headers({ - "Accept: application/zip", - }) - File downloadFile(@Param("petId") @javax.annotation.Nonnull Long petId); - - /** - * downloads an image - * Similar to downloadFile but it also returns the http response headers . - * - * @param petId ID of pet to update (required) - * @return A ApiResponse that wraps the response boyd and the http headers. - */ - @RequestLine("POST /pet/{petId}/downloadImage") - @Headers({ - "Accept: application/zip", - }) - ApiResponse downloadFileWithHttpInfo(@Param("petId") @javax.annotation.Nonnull Long petId); - - - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md index 602ad088d70e..bf4b4333d964 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -163,77 +162,6 @@ public class Example { | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java index 7a2b3858dbcb..224b962916ed 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,17 +64,6 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; - /** - * downloads an image - * - * - * - */ - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; - /** * Finds Pets by status * diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md index 602ad088d70e..bf4b4333d964 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -163,77 +162,6 @@ public class Example { | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java index 7a2b3858dbcb..224b962916ed 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,17 +64,6 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; - /** - * downloads an image - * - * - * - */ - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; - /** * Finds Pets by status * diff --git a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md index 602ad088d70e..bf4b4333d964 100644 --- a/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md +++ b/samples/client/petstore/java/microprofile-rest-client/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -163,77 +162,6 @@ public class Example { | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java index b4ecbd295458..f5ce26c6765a 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,17 +64,6 @@ public interface PetApi { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; - /** - * downloads an image - * - * - * - */ - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException; - /** * Finds Pets by status * diff --git a/samples/client/petstore/java/restclient-swagger2/README.md b/samples/client/petstore/java/restclient-swagger2/README.md index 3af5b68b63b7..9499bd28689f 100644 --- a/samples/client/petstore/java/restclient-swagger2/README.md +++ b/samples/client/petstore/java/restclient-swagger2/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml b/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-swagger2/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md b/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md +++ b/samples/client/petstore/java/restclient-swagger2/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java index 879396094cee..3584fb0c39a9 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java @@ -200,80 +200,6 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap<>(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap<>(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); - final MultiValueMap formParams = new LinkedMultiValueMap<>(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).body(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - return downloadFileRequestCreation(petId); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md index 9f60df9196c6..e123bb028f94 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java index 9836c9db7270..ae894a2aa281 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/api/PetApi.java @@ -284,80 +284,6 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap<>(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap<>(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); - final MultiValueMap formParams = new LinkedMultiValueMap<>(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).body(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - return downloadFileRequestCreation(petId); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md b/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md index e2635a15460f..9f6fbc164f72 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml b/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md b/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java index 1ce618b210d7..392068a7c24e 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -240,80 +240,6 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap<>(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap<>(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); - final MultiValueMap formParams = new LinkedMultiValueMap<>(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).body(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - return downloadFileRequestCreation(petId); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/restclient/README.md b/samples/client/petstore/java/restclient/README.md index 3af5b68b63b7..9499bd28689f 100644 --- a/samples/client/petstore/java/restclient/README.md +++ b/samples/client/petstore/java/restclient/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/restclient/api/openapi.yaml b/samples/client/petstore/java/restclient/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/restclient/api/openapi.yaml +++ b/samples/client/petstore/java/restclient/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/restclient/docs/PetApi.md b/samples/client/petstore/java/restclient/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/restclient/docs/PetApi.md +++ b/samples/client/petstore/java/restclient/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java index 879396094cee..3584fb0c39a9 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -200,80 +200,6 @@ public ResponseEntity deletePetWithHttpInfo(@jakarta.annotation.Nonnull Lo public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws RestClientResponseException { return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new RestClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap<>(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap<>(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); - final MultiValueMap formParams = new LinkedMultiValueMap<>(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public File downloadFile(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).body(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseEntity downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws RestClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws RestClientResponseException { - return downloadFileRequestCreation(petId); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/resteasy/README.md b/samples/client/petstore/java/resteasy/README.md index 900922465460..079078abd4bb 100644 --- a/samples/client/petstore/java/resteasy/README.md +++ b/samples/client/petstore/java/resteasy/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/resteasy/api/openapi.yaml b/samples/client/petstore/java/resteasy/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/resteasy/api/openapi.yaml +++ b/samples/client/petstore/java/resteasy/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/resteasy/docs/PetApi.md b/samples/client/petstore/java/resteasy/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/resteasy/docs/PetApi.md +++ b/samples/client/petstore/java/resteasy/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java index 19a988d64a69..12f82eabeaa7 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java @@ -125,50 +125,6 @@ public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nu apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); } - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return a {@code File} - * @throws ApiException if fails to make API call - */ - public File downloadFile(@javax.annotation.Nonnull Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling downloadFile"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}/downloadImage".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/zip" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/resttemplate-withXml/README.md b/samples/client/petstore/java/resttemplate-withXml/README.md index 316d0769cf14..0972858dd9d8 100644 --- a/samples/client/petstore/java/resttemplate-withXml/README.md +++ b/samples/client/petstore/java/resttemplate-withXml/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java index 2babd189f616..c9cd2bd6844d 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/PetApi.java @@ -140,55 +140,6 @@ public ResponseEntity deletePetWithHttpInfo(Long petId, String apiKey) thr ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update (required) - * @return File - * @throws RestClientException if an error occurs while attempting to invoke the API - */ - public File downloadFile(Long petId) throws RestClientException { - return downloadFileWithHttpInfo(petId).getBody(); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update (required) - * @return ResponseEntity<File> - * @throws RestClientException if an error occurs while attempting to invoke the API - */ - public ResponseEntity downloadFileWithHttpInfo(Long petId) throws RestClientException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling downloadFile"); - } - - // create path and map variables - final Map uriVariables = new HashMap(); - uriVariables.put("petId", petId); - - final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); - final HttpHeaders localVarHeaderParams = new HttpHeaders(); - final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); - final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/resttemplate/README.md b/samples/client/petstore/java/resttemplate/README.md index 3aad3e64775e..37e6b5536663 100644 --- a/samples/client/petstore/java/resttemplate/README.md +++ b/samples/client/petstore/java/resttemplate/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/resttemplate/api/openapi.yaml b/samples/client/petstore/java/resttemplate/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/resttemplate/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/resttemplate/docs/PetApi.md b/samples/client/petstore/java/resttemplate/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/resttemplate/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java index 2babd189f616..c9cd2bd6844d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/PetApi.java @@ -140,55 +140,6 @@ public ResponseEntity deletePetWithHttpInfo(Long petId, String apiKey) thr ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update (required) - * @return File - * @throws RestClientException if an error occurs while attempting to invoke the API - */ - public File downloadFile(Long petId) throws RestClientException { - return downloadFileWithHttpInfo(petId).getBody(); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update (required) - * @return ResponseEntity<File> - * @throws RestClientException if an error occurs while attempting to invoke the API - */ - public ResponseEntity downloadFileWithHttpInfo(Long petId) throws RestClientException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling downloadFile"); - } - - // create path and map variables - final Map uriVariables = new HashMap(); - uriVariables.put("petId", petId); - - final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); - final HttpHeaders localVarHeaderParams = new HttpHeaders(); - final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); - final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); - } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/README.md b/samples/client/petstore/java/vertx-supportVertxFuture/README.md index ad7cb2739a66..b098f20df228 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/README.md +++ b/samples/client/petstore/java/vertx-supportVertxFuture/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml b/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml +++ b/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md index 59ab6f47d007..115d5ff89d81 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> AsyncFile downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - AsyncFile result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**AsyncFile**](AsyncFile.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java index a764b4044066..9b3a7f9df4cb 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java @@ -47,22 +47,6 @@ default Future deletePet(@javax.annotation.Nonnull Long petId, @javax.anno return promise.future(); } - void downloadFile(@javax.annotation.Nonnull Long petId, Handler> handler); - - default Future downloadFile(@javax.annotation.Nonnull Long petId){ - Promise promise = Promise.promise(); - downloadFile(petId, promise); - return promise.future(); - } - - void downloadFile(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo, Handler> handler); - - default Future downloadFile(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo){ - Promise promise = Promise.promise(); - downloadFile(petId, authInfo, promise); - return promise.future(); - } - void findPetsByStatus(@javax.annotation.Nonnull List status, Handler>> handler); default Future> findPetsByStatus(@javax.annotation.Nonnull List status){ diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java index f4c940c788f2..2717a717786a 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -144,54 +144,6 @@ public void deletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo, Ha apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); } /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, Handler> resultHandler) { - downloadFile(petId, null, resultHandler); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param authInfo per call authentication override. - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { - Object localVarBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling downloadFile")); - return; - } - - // create path and map variables - String localVarPath = "/pet/{petId}/downloadImage".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList<>(); - - // header params - MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); - - // cookie params - MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); - - // form params - // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) - Map localVarFormParams = new HashMap<>(); - - String[] localVarAccepts = { "application/zip" }; - String[] localVarContentTypes = { }; - String[] localVarAuthNames = new String[] { "petstore_auth" }; - TypeReference localVarReturnType = new TypeReference() {}; - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java index df76c0fd6bb5..4e7fe09eabbc 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java @@ -120,51 +120,6 @@ public Single rxDeletePet(Long petId, String apiKey, ApiClient.AuthInfo au )); } /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, Handler> resultHandler) { - delegate.downloadFile(petId, resultHandler); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param authInfo call specific auth overrides - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { - delegate.downloadFile(petId, authInfo, resultHandler); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return Asynchronous result handler (RxJava Single) - */ - public Single rxDownloadFile(Long petId) { - return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> - delegate.downloadFile(petId, fut) - )); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param authInfo call specific auth overrides - * @return Asynchronous result handler (RxJava Single) - */ - public Single rxDownloadFile(Long petId, ApiClient.AuthInfo authInfo) { - return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> - delegate.downloadFile(petId, authInfo, fut) - )); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/vertx/README.md b/samples/client/petstore/java/vertx/README.md index a10c976682bb..3473b0e4d755 100644 --- a/samples/client/petstore/java/vertx/README.md +++ b/samples/client/petstore/java/vertx/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/vertx/api/openapi.yaml b/samples/client/petstore/java/vertx/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/vertx/api/openapi.yaml +++ b/samples/client/petstore/java/vertx/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/vertx/docs/PetApi.md b/samples/client/petstore/java/vertx/docs/PetApi.md index 59ab6f47d007..115d5ff89d81 100644 --- a/samples/client/petstore/java/vertx/docs/PetApi.md +++ b/samples/client/petstore/java/vertx/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> AsyncFile downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - AsyncFile result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**AsyncFile**](AsyncFile.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java index 2f09a7cb645e..535191f77b1e 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApi.java @@ -21,10 +21,6 @@ public interface PetApi { void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, ApiClient.AuthInfo authInfo, Handler> handler); - void downloadFile(@javax.annotation.Nonnull Long petId, Handler> handler); - - void downloadFile(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo, Handler> handler); - void findPetsByStatus(@javax.annotation.Nonnull List status, Handler>> handler); void findPetsByStatus(@javax.annotation.Nonnull List status, ApiClient.AuthInfo authInfo, Handler>> handler); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java index f4c940c788f2..2717a717786a 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -144,54 +144,6 @@ public void deletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo, Ha apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); } /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, Handler> resultHandler) { - downloadFile(petId, null, resultHandler); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param authInfo per call authentication override. - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { - Object localVarBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling downloadFile")); - return; - } - - // create path and map variables - String localVarPath = "/pet/{petId}/downloadImage".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList<>(); - - // header params - MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); - - // cookie params - MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); - - // form params - // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) - Map localVarFormParams = new HashMap<>(); - - String[] localVarAccepts = { "application/zip" }; - String[] localVarContentTypes = { }; - String[] localVarAuthNames = new String[] { "petstore_auth" }; - TypeReference localVarReturnType = new TypeReference() {}; - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java index df76c0fd6bb5..4e7fe09eabbc 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java @@ -120,51 +120,6 @@ public Single rxDeletePet(Long petId, String apiKey, ApiClient.AuthInfo au )); } /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, Handler> resultHandler) { - delegate.downloadFile(petId, resultHandler); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param authInfo call specific auth overrides - * @param resultHandler Asynchronous result handler - */ - public void downloadFile(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { - delegate.downloadFile(petId, authInfo, resultHandler); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @return Asynchronous result handler (RxJava Single) - */ - public Single rxDownloadFile(Long petId) { - return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> - delegate.downloadFile(petId, fut) - )); - } - - /** - * downloads an image - * - * @param petId ID of pet to update (required) - * @param authInfo call specific auth overrides - * @return Asynchronous result handler (RxJava Single) - */ - public Single rxDownloadFile(Long petId, ApiClient.AuthInfo authInfo) { - return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> - delegate.downloadFile(petId, authInfo, fut) - )); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) diff --git a/samples/client/petstore/java/webclient-jakarta/README.md b/samples/client/petstore/java/webclient-jakarta/README.md index de51b7cffc63..b42fa07d17d9 100644 --- a/samples/client/petstore/java/webclient-jakarta/README.md +++ b/samples/client/petstore/java/webclient-jakarta/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md b/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md +++ b/samples/client/petstore/java/webclient-jakarta/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java index 446224de5436..1003b9794bfc 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java @@ -205,81 +205,6 @@ public ResponseSpec deletePetWithResponseSpec(@jakarta.annotation.Nonnull Long p return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap(); - final MultiValueMap formParams = new LinkedMultiValueMap(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono downloadFile(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono> downloadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@jakarta.annotation.Nonnull Long petId) throws WebClientResponseException { - return downloadFileRequestCreation(petId); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/webclient-swagger2/README.md b/samples/client/petstore/java/webclient-swagger2/README.md index de51b7cffc63..b42fa07d17d9 100644 --- a/samples/client/petstore/java/webclient-swagger2/README.md +++ b/samples/client/petstore/java/webclient-swagger2/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md b/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md +++ b/samples/client/petstore/java/webclient-swagger2/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java index 5677b3bee155..d133bebd78e8 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java @@ -205,81 +205,6 @@ public ResponseSpec deletePetWithResponseSpec(@javax.annotation.Nonnull Long pet return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap(); - final MultiValueMap formParams = new LinkedMultiValueMap(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono downloadFile(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono> downloadFileWithHttpInfo(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - return downloadFileRequestCreation(petId); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md b/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md index 51db06ae86c4..bd162b612977 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml b/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md b/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java index 6554caa3e7d5..f0988c50a60c 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -289,81 +289,6 @@ public ResponseSpec deletePetWithResponseSpec(@javax.annotation.Nonnull Long pet return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap(); - final MultiValueMap formParams = new LinkedMultiValueMap(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono downloadFile(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono> downloadFileWithHttpInfo(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - return downloadFileRequestCreation(petId); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index de51b7cffc63..b42fa07d17d9 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -142,7 +142,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](docs/PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 751121da1d20..7d3a48a0496b 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/client/petstore/java/webclient/docs/PetApi.md b/samples/client/petstore/java/webclient/docs/PetApi.md index 8032b9317e8b..e2515d9bb9bb 100644 --- a/samples/client/petstore/java/webclient/docs/PetApi.md +++ b/samples/client/petstore/java/webclient/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* |------------- | ------------- | -------------| | [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | | [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | | [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | | [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | @@ -161,77 +160,6 @@ null (empty response body) | **400** | Invalid pet value | - | -## downloadFile - -> File downloadFile(petId) - -downloads an image - - - -### Example - -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.PetApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - - PetApi apiInstance = new PetApi(defaultClient); - Long petId = 56L; // Long | ID of pet to update - try { - File result = apiInstance.downloadFile(petId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling PetApi#downloadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **petId** | **Long**| ID of pet to update | | - -### Return type - -[**File**](File.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - ## findPetsByStatus > List<Pet> findPetsByStatus(status) diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java index 5677b3bee155..d133bebd78e8 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -205,81 +205,6 @@ public ResponseSpec deletePetWithResponseSpec(@javax.annotation.Nonnull Long pet return deletePetRequestCreation(petId, apiKey); } - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec downloadFileRequestCreation(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - Object postBody = null; - // verify the required parameter 'petId' is set - if (petId == null) { - throw new WebClientResponseException("Missing the required parameter 'petId' when calling downloadFile", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); - } - // create path and map variables - final Map pathParams = new HashMap(); - - pathParams.put("petId", petId); - - final MultiValueMap queryParams = new LinkedMultiValueMap(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap(); - final MultiValueMap formParams = new LinkedMultiValueMap(); - - final String[] localVarAccepts = { - "application/zip" - }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/pet/{petId}/downloadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return File - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono downloadFile(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).bodyToMono(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseEntity<File> - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono> downloadFileWithHttpInfo(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return downloadFileRequestCreation(petId).toEntity(localVarReturnType); - } - - /** - * downloads an image - * - *

200 - successful operation - * @param petId ID of pet to update - * @return ResponseSpec - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec downloadFileWithResponseSpec(@javax.annotation.Nonnull Long petId) throws WebClientResponseException { - return downloadFileRequestCreation(petId); - } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings diff --git a/samples/client/petstore/ruby-autoload/README.md b/samples/client/petstore/ruby-autoload/README.md index cfb7209c6623..fbae077b6e7d 100644 --- a/samples/client/petstore/ruby-autoload/README.md +++ b/samples/client/petstore/ruby-autoload/README.md @@ -103,7 +103,6 @@ Class | Method | HTTP request | Description *Petstore::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet -*Petstore::PetApi* | [**download_file**](docs/PetApi.md#download_file) | **POST** /pet/{petId}/downloadImage | downloads an image *Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *Petstore::PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *Petstore::PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/ruby-autoload/docs/PetApi.md b/samples/client/petstore/ruby-autoload/docs/PetApi.md index 4f956182c76f..b28334ae2c58 100644 --- a/samples/client/petstore/ruby-autoload/docs/PetApi.md +++ b/samples/client/petstore/ruby-autoload/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | ------ | ------------ | ----------- | | [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store | | [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**download_file**](PetApi.md#download_file) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status | | [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags | | [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID | @@ -156,75 +155,6 @@ nil (empty response body) - **Accept**: Not defined -## download_file - -> File download_file(pet_id) - -downloads an image - - - -### Examples - -```ruby -require 'time' -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = Petstore::PetApi.new -pet_id = 789 # Integer | ID of pet to update - -begin - # downloads an image - result = api_instance.download_file(pet_id) - p result -rescue Petstore::ApiError => e - puts "Error when calling PetApi->download_file: #{e}" -end -``` - -#### Using the download_file_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> download_file_with_http_info(pet_id) - -```ruby -begin - # downloads an image - data, status_code, headers = api_instance.download_file_with_http_info(pet_id) - p status_code # => 2xx - p headers # => { ... } - p data # => File -rescue Petstore::ApiError => e - puts "Error when calling PetApi->download_file_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **pet_id** | **Integer** | ID of pet to update | | - -### Return type - -**File** - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - ## find_pets_by_status > > find_pets_by_status(status) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb index 80ec4773d10f..b183c0a33570 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb @@ -149,69 +149,6 @@ def delete_pet_with_http_info(pet_id, opts = {}) return data, status_code, headers end - # downloads an image - # - # @param pet_id [Integer] ID of pet to update - # @param [Hash] opts the optional parameters - # @return [File] - def download_file(pet_id, opts = {}) - data, _status_code, _headers = download_file_with_http_info(pet_id, opts) - data - end - - # downloads an image - # - # @param pet_id [Integer] ID of pet to update - # @param [Hash] opts the optional parameters - # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers - def download_file_with_http_info(pet_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: PetApi.download_file ...' - end - # verify the required parameter 'pet_id' is set - if @api_client.config.client_side_validation && pet_id.nil? - fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.download_file" - end - # resource path - local_var_path = '/pet/{petId}/downloadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) - - # query parameters - query_params = opts[:query_params] || {} - - # header parameters - header_params = opts[:header_params] || {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/zip']) unless header_params['Accept'] - - # form parameters - form_params = opts[:form_params] || {} - - # http body (model) - post_body = opts[:debug_body] - - # return_type - return_type = opts[:debug_return_type] || 'File' - - # auth_names - auth_names = opts[:debug_auth_names] || ['petstore_auth'] - - new_options = opts.merge( - :operation => :"PetApi.download_file", - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => return_type - ) - - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Finds Pets by status # Multiple status values can be provided with comma separated strings # @param status [Array] Status values that need to be considered for filter diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index cfb7209c6623..fbae077b6e7d 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -103,7 +103,6 @@ Class | Method | HTTP request | Description *Petstore::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet -*Petstore::PetApi* | [**download_file**](docs/PetApi.md#download_file) | **POST** /pet/{petId}/downloadImage | downloads an image *Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *Petstore::PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *Petstore::PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/client/petstore/ruby-faraday/docs/PetApi.md b/samples/client/petstore/ruby-faraday/docs/PetApi.md index 4f956182c76f..b28334ae2c58 100644 --- a/samples/client/petstore/ruby-faraday/docs/PetApi.md +++ b/samples/client/petstore/ruby-faraday/docs/PetApi.md @@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | ------ | ------------ | ----------- | | [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store | | [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet | -| [**download_file**](PetApi.md#download_file) | **POST** /pet/{petId}/downloadImage | downloads an image | | [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status | | [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags | | [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID | @@ -156,75 +155,6 @@ nil (empty response body) - **Accept**: Not defined -## download_file - -> File download_file(pet_id) - -downloads an image - - - -### Examples - -```ruby -require 'time' -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = Petstore::PetApi.new -pet_id = 789 # Integer | ID of pet to update - -begin - # downloads an image - result = api_instance.download_file(pet_id) - p result -rescue Petstore::ApiError => e - puts "Error when calling PetApi->download_file: #{e}" -end -``` - -#### Using the download_file_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> download_file_with_http_info(pet_id) - -```ruby -begin - # downloads an image - data, status_code, headers = api_instance.download_file_with_http_info(pet_id) - p status_code # => 2xx - p headers # => { ... } - p data # => File -rescue Petstore::ApiError => e - puts "Error when calling PetApi->download_file_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **pet_id** | **Integer** | ID of pet to update | | - -### Return type - -**File** - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/zip - - ## find_pets_by_status > > find_pets_by_status(status) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb index 398385dc59e6..0a0589a9676d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb @@ -149,69 +149,6 @@ def delete_pet_with_http_info(pet_id, opts = {}) return data, status_code, headers end - # downloads an image - # - # @param pet_id [Integer] ID of pet to update - # @param [Hash] opts the optional parameters - # @return [File] - def download_file(pet_id, opts = {}) - data, _status_code, _headers = download_file_with_http_info(pet_id, opts) - data - end - - # downloads an image - # - # @param pet_id [Integer] ID of pet to update - # @param [Hash] opts the optional parameters - # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers - def download_file_with_http_info(pet_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: PetApi.download_file ...' - end - # verify the required parameter 'pet_id' is set - if @api_client.config.client_side_validation && pet_id.nil? - fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.download_file" - end - # resource path - local_var_path = '/pet/{petId}/downloadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) - - # query parameters - query_params = opts[:query_params] || {} - - # header parameters - header_params = opts[:header_params] || {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/zip']) unless header_params['Accept'] - - # form parameters - form_params = opts[:form_params] || {} - - # http body (model) - post_body = opts[:debug_body] - - # return_type - return_type = opts[:debug_return_type] || 'File' - - # auth_names - auth_names = opts[:debug_auth_names] || ['petstore_auth'] - - new_options = opts.merge( - :operation => :"PetApi.download_file", - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => return_type - ) - - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Finds Pets by status # Multiple status values can be provided with comma separated strings # @param status [Array] Status values that need to be considered for filter diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index ece8c36647b7..5b77f2de4486 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -34,10 +34,6 @@ export interface DeletePetRequest { apiKey?: string; } -export interface DownloadFileRequest { - petId: number; -} - export interface FindPetsByStatusRequest { status: Array; } @@ -162,46 +158,6 @@ export class PetApi extends runtime.BaseAPI { await this.deletePetRaw(requestParameters, initOverrides); } - /** - * - * downloads an image - */ - async downloadFileRaw(requestParameters: DownloadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters['petId'] == null) { - throw new runtime.RequiredError( - 'petId', - 'Required parameter "petId" was null or undefined when calling downloadFile().' - ); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { - // oauth required - headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } - - const response = await this.request({ - path: `/pet/{petId}/downloadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.BlobApiResponse(response); - } - - /** - * - * downloads an image - */ - async downloadFile(requestParameters: DownloadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.downloadFileRaw(requestParameters, initOverrides); - return await response.value(); - } - /** * Multiple status values can be provided with comma separated strings * Finds Pets by status diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/.gitignore b/samples/openapi3/client/petstore/dart-dio/binary_response/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/.gitignore @@ -0,0 +1,41 @@ +# See https://dart.dev/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES new file mode 100644 index 000000000000..cf3837b05e52 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES @@ -0,0 +1,17 @@ +.gitignore +.openapi-generator-ignore +README.md +analysis_options.yaml +build.yaml +doc/DefaultApi.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/default_api.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/deserialize.dart +pubspec.yaml +test/default_api_test.dart diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/VERSION new file mode 100644 index 000000000000..4c631cf217a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/README.md b/samples/openapi3/client/petstore/dart-dio/binary_response/README.md new file mode 100644 index 000000000000..72b788d40d24 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/README.md @@ -0,0 +1,83 @@ +# openapi (EXPERIMENTAL) +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Generator version: 7.14.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +* JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) + +## Installation & Usage + +### pub.dev +To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml +```yaml +dependencies: + openapi: 1.0.0 +``` + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + git: + url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + #ref: main +``` + +### Local development +To use the package from your local drive, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + path: /path/to/openapi +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/openapi.dart'; + + +final api = Openapi().getDefaultApi(); + +try { + final response = await api.binaryResponse(); + print(response); +} catch on DioException (e) { + print("Exception when calling DefaultApi->binaryResponse: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*DefaultApi*](doc/DefaultApi.md) | [**binaryResponse**](doc/DefaultApi.md#binaryresponse) | **GET** /limits | + + +## Documentation For Models + + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/binary_response/analysis_options.yaml new file mode 100644 index 000000000000..70524126e3fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/analysis_options.yaml @@ -0,0 +1,10 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/build.yaml b/samples/openapi3/client/petstore/dart-dio/binary_response/build.yaml new file mode 100644 index 000000000000..89a4dd6e1c2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/build.yaml @@ -0,0 +1,18 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/binary_response/doc/DefaultApi.md new file mode 100644 index 000000000000..3286dd380c85 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**binaryResponse**](DefaultApi.md#binaryresponse) | **GET** /limits | + + +# **binaryResponse** +> Uint8List binaryResponse() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.binaryResponse(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->binaryResponse: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Uint8List**](Uint8List.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/zip + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/openapi.dart new file mode 100644 index 000000000000..2eeebdc99764 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/openapi.dart @@ -0,0 +1,14 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; + + +export 'package:openapi/src/api/default_api.dart'; + + diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api.dart new file mode 100644 index 000000000000..8943da413f65 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api.dart @@ -0,0 +1,68 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/api_key_auth.dart'; +import 'package:openapi/src/auth/basic_auth.dart'; +import 'package:openapi/src/auth/bearer_auth.dart'; +import 'package:openapi/src/auth/oauth.dart'; +import 'package:openapi/src/api/default_api.dart'; + +class Openapi { + static const String basePath = r'http://localhost'; + + final Dio dio; + Openapi({ + Dio? dio, + String? basePathOverride, + List? interceptors, + }) : + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + ApiKeyAuthInterceptor(), + ]); + } else { + this.dio.interceptors.addAll(interceptors); + } + } + + void setOAuthToken(String name, String token) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token; + } + } + + void setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token; + } + } + + void setBasicAuth(String name, String username, String password) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); + } + } + + void setApiKey(String name, String apiKey) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + } + + /// Get DefaultApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + DefaultApi getDefaultApi() { + return DefaultApi(dio); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api/default_api.dart new file mode 100644 index 000000000000..9935152e2909 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/api/default_api.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'dart:typed_data'; + +class DefaultApi { + + final Dio _dio; + + const DefaultApi(this._dio); + + /// binaryResponse + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Uint8List] as data + /// Throws [DioException] if API call or serialization fails + Future> binaryResponse({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/limits'; + final _options = Options( + method: r'GET', + responseType: ResponseType.bytes, + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Uint8List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : rawData as Uint8List; + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/api_key_auth.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); + for (final info in authInfo) { + final authName = info['name'] as String; + final authKeyName = info['keyName'] as String; + final authWhere = info['where'] as String; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/auth.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /// Get auth information on given route for the given type. + /// Can return an empty list if type is not present on auth data or + /// if route doesn't need authentication. + List> getAuthInfo(RequestOptions route, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/basic_auth.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + final Map authInfo = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'basic') || secure['type'] == 'basic'); + for (final info in metadataAuthInfo) { + final authName = info['name'] as String; + final basicAuthInfo = authInfo[authName]; + if (basicAuthInfo != null) { + final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + options.headers['Authorization'] = basicAuth; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/bearer_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'bearer'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/auth/oauth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/deserialize.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/deserialize.dart new file mode 100644 index 000000000000..c16d0340f384 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/lib/src/deserialize.dart @@ -0,0 +1,45 @@ + +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + + ReturnType deserialize(dynamic value, String targetType, {bool growable= true}) { + switch (targetType) { + case 'String': + return '$value' as ReturnType; + case 'int': + return (value is int ? value : int.parse('$value')) as ReturnType; + case 'bool': + if (value is bool) { + return value as ReturnType; + } + final valueString = '$value'.toLowerCase(); + return (valueString == 'true' || valueString == '1') as ReturnType; + case 'double': + return (value is double ? value : double.parse('$value')) as ReturnType; + default: + RegExpMatch? match; + + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize(v, targetType, growable: growable)) + .toList(growable: growable) as ReturnType; + } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize(v, targetType, growable: growable)) + .toSet() as ReturnType; + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + targetType = match![1]!.trim(); // ignore: parameter_assignments + return Map.fromIterables( + value.keys as Iterable, + value.values.map((dynamic v) => deserialize(v, targetType, growable: growable)), + ) as ReturnType; + } + break; + } + throw Exception('Cannot deserialize'); + } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/binary_response/pubspec.yaml new file mode 100644 index 000000000000..cbfddf172a6c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/pubspec.yaml @@ -0,0 +1,17 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '>=3.5.0 <4.0.0' + +dependencies: + dio: '^5.7.0' + json_annotation: '^4.9.0' + +dev_dependencies: + build_runner: any + json_serializable: '^6.9.3' + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/binary_response/test/default_api_test.dart new file mode 100644 index 000000000000..dd547067d91c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/test/default_api_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future binaryResponse() async + test('test binaryResponse', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index 03d84a72c698..5a5211d271a0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -93,7 +93,6 @@ Class | Method | HTTP request | Description [*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case [*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[*PetApi*](doc/PetApi.md) | [**downloadFile**](doc/PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md index c1e194c6b9d2..5fc7fbd2657f 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/PetApi.md @@ -11,7 +11,6 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**downloadFile**](PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID @@ -111,51 +110,6 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **downloadFile** -> Uint8List downloadFile(petId) - -downloads an image - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api = Openapi().getPetApi(); -final int petId = 789; // int | ID of pet to update - -try { - final response = api.downloadFile(petId); - print(response); -} catch on DioException (e) { - print('Exception when calling PetApi->downloadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - -### Return type - -[**Uint8List**](Uint8List.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/zip - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **findPetsByStatus** > List findPetsByStatus(status) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart index 895349832f5b..aab8df518913 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart @@ -9,7 +9,6 @@ import 'dart:convert'; import 'package:openapi/src/deserialize.dart'; import 'package:dio/dio.dart'; -import 'dart:typed_data'; import 'package:openapi/src/model/api_response.dart'; import 'package:openapi/src/model/pet.dart'; @@ -144,84 +143,6 @@ _bodyData=jsonEncode(pet); return _response; } - /// downloads an image - /// - /// - /// Parameters: - /// * [petId] - ID of pet to update - /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation - /// * [headers] - Can be used to add additional headers to the request - /// * [extras] - Can be used to add flags to the request - /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response - /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress - /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress - /// - /// Returns a [Future] containing a [Response] with a [Uint8List] as data - /// Throws [DioException] if API call or serialization fails - Future> downloadFile({ - required int petId, - CancelToken? cancelToken, - Map? headers, - Map? extra, - ValidateStatus? validateStatus, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - final _path = r'/pet/{petId}/downloadImage'.replaceAll('{' r'petId' '}', petId.toString()); - final _options = Options( - method: r'POST', - responseType: ResponseType.bytes, - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - ); - - final _response = await _dio.request( - _path, - options: _options, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - Uint8List? _responseData; - - try { -final rawData = _response.data; -_responseData = rawData == null ? null : rawData as Uint8List; - - } catch (error, stackTrace) { - throw DioException( - requestOptions: _response.requestOptions, - response: _response, - type: DioExceptionType.unknown, - error: error, - stackTrace: stackTrace, - ); - } - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - requestOptions: _response.requestOptions, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - /// Finds Pets by status /// Multiple status values can be provided with comma separated strings /// diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index b67243c5ee95..ecde40a0ade4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -92,7 +92,6 @@ Class | Method | HTTP request | Description [*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case [*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[*PetApi*](doc/PetApi.md) | [**downloadFile**](doc/PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md index 4f88b6051d34..2b7766eb60d4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md @@ -11,7 +11,6 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**downloadFile**](PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID @@ -111,51 +110,6 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **downloadFile** -> Uint8List downloadFile(petId) - -downloads an image - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api = Openapi().getPetApi(); -final int petId = 789; // int | ID of pet to update - -try { - final response = api.downloadFile(petId); - print(response); -} catch on DioException (e) { - print('Exception when calling PetApi->downloadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - -### Return type - -[**Uint8List**](Uint8List.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/zip - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **findPetsByStatus** > BuiltList findPetsByStatus(status) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart index f52c634ec5ad..a4da1c5ff6db 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -8,7 +8,6 @@ import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; -import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:openapi/src/api_util.dart'; import 'package:openapi/src/model/api_response.dart'; @@ -149,84 +148,6 @@ class PetApi { return _response; } - /// downloads an image - /// - /// - /// Parameters: - /// * [petId] - ID of pet to update - /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation - /// * [headers] - Can be used to add additional headers to the request - /// * [extras] - Can be used to add flags to the request - /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response - /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress - /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress - /// - /// Returns a [Future] containing a [Response] with a [Uint8List] as data - /// Throws [DioException] if API call or serialization fails - Future> downloadFile({ - required int petId, - CancelToken? cancelToken, - Map? headers, - Map? extra, - ValidateStatus? validateStatus, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - final _path = r'/pet/{petId}/downloadImage'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString()); - final _options = Options( - method: r'POST', - responseType: ResponseType.bytes, - headers: { - ...?headers, - }, - extra: { - 'secure': >[ - { - 'type': 'oauth2', - 'name': 'petstore_auth', - }, - ], - ...?extra, - }, - validateStatus: validateStatus, - ); - - final _response = await _dio.request( - _path, - options: _options, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - Uint8List? _responseData; - - try { - final rawResponse = _response.data; - _responseData = rawResponse == null ? null : rawResponse as Uint8List; - - } catch (error, stackTrace) { - throw DioException( - requestOptions: _response.requestOptions, - response: _response, - type: DioExceptionType.unknown, - error: error, - stackTrace: stackTrace, - ); - } - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - requestOptions: _response.requestOptions, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - /// Finds Pets by status /// Multiple status values can be provided with comma separated strings /// diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index 1d4519ad82f2..5a8c345c8de3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -86,7 +86,6 @@ Class | Method | HTTP request | Description *FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**downloadFile**](doc//PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image *PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md index 69739c094ea6..3883a9e96a00 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md @@ -11,7 +11,6 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store [**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**downloadFile**](PetApi.md#downloadfile) | **POST** /pet/{petId}/downloadImage | downloads an image [**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID @@ -111,51 +110,6 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **downloadFile** -> MultipartFile downloadFile(petId) - -downloads an image - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure OAuth2 access token for authorization: petstore_auth -//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; - -final api_instance = PetApi(); -final petId = 789; // int | ID of pet to update - -try { - final result = api_instance.downloadFile(petId); - print(result); -} catch (e) { - print('Exception when calling PetApi->downloadFile: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | - -### Return type - -[**MultipartFile**](MultipartFile.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/zip - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **findPetsByStatus** > List findPetsByStatus(status) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index 4136b3f050f7..61fd1666af49 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -125,65 +125,6 @@ class PetApi { } } - /// downloads an image - /// - /// - /// - /// Note: This method returns the HTTP [Response]. - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - Future downloadFileWithHttpInfo(int petId,) async { - // ignore: prefer_const_declarations - final path = r'/pet/{petId}/downloadImage' - .replaceAll('{petId}', petId.toString()); - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes.first, - ); - } - - /// downloads an image - /// - /// - /// - /// Parameters: - /// - /// * [int] petId (required): - /// ID of pet to update - Future downloadFile(int petId,) async { - final response = await downloadFileWithHttpInfo(petId,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" - // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile; - - } - return null; - } - /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp index f5123db910c7..3b7c82d9ce8e 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.cpp @@ -560,121 +560,6 @@ std::string PetPetIdResource::extractFormParamsFromBody(const std::string& param } return ""; } -PetPetIdDownloadImageResource::PetPetIdDownloadImageResource(const std::string& context /* = "/v2" */) -{ - this->set_path(context + "/pet/{petId: .*}/downloadImage"); - this->set_method_handler("POST", - std::bind(&PetPetIdDownloadImageResource::handler_POST_internal, this, - std::placeholders::_1)); -} - -std::pair PetPetIdDownloadImageResource::handlePetApiException(const PetApiException& e) -{ - return std::make_pair(e.getStatus(), e.what()); -} - -std::pair PetPetIdDownloadImageResource::handleStdException(const std::exception& e) -{ - return std::make_pair(500, e.what()); -} - -std::pair PetPetIdDownloadImageResource::handleUnspecifiedException() -{ - return std::make_pair(500, "Unknown exception occurred"); -} - -void PetPetIdDownloadImageResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) -{ - session->set_header(header, ""); -} - -void PetPetIdDownloadImageResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, std::multimap& responseHeaders) -{ - responseHeaders.insert(std::make_pair("Connection", "close")); - session->close(status, result, responseHeaders); -} - -void PetPetIdDownloadImageResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) -{ - session->close(status, result, { {"Connection", "close"} }); -} - -void PetPetIdDownloadImageResource::handler_POST_internal(const std::shared_ptr session) -{ - const auto request = session->get_request(); - // Getting the path params - int64_t petId = request->get_path_parameter("petId", 0L); - - int status_code = 500; - std::string resultObject = ""; - std::string result = ""; - - try { - std::tie(status_code, resultObject) = - handler_POST(petId); - } - catch(const PetApiException& e) { - std::tie(status_code, result) = handlePetApiException(e); - } - catch(const std::exception& e) { - std::tie(status_code, result) = handleStdException(e); - } - catch(...) { - std::tie(status_code, result) = handleUnspecifiedException(); - } - - std::multimap< std::string, std::string > responseHeaders {}; - static const std::vector contentTypes{ - "application/zip", - }; - static const std::string acceptTypes{ - }; - - if (status_code == 200) { - responseHeaders.insert(std::make_pair("Content-Type", selectPreferredContentType(contentTypes))); - if (!acceptTypes.empty()) { - responseHeaders.insert(std::make_pair("Accept", acceptTypes)); - } - - result = resultObject.toJsonString(); - returnResponse(session, 200, result.empty() ? "{}" : result, responseHeaders); - return; - } - defaultSessionClose(session, status_code, result); - - -} - - -std::pair PetPetIdDownloadImageResource::handler_POST( - int64_t & petId) -{ - return handler_POST_func(petId); -} - - -std::string PetPetIdDownloadImageResource::extractBodyContent(const std::shared_ptr& session) { - const auto request = session->get_request(); - int content_length = request->get_header("Content-Length", 0); - std::string bodyContent; - session->fetch(content_length, - [&bodyContent](const std::shared_ptr session, - const restbed::Bytes &body) { - bodyContent = restbed::String::format( - "%.*s\n", (int)body.size(), body.data()); - }); - return bodyContent; -} - -std::string PetPetIdDownloadImageResource::extractFormParamsFromBody(const std::string& paramName, const std::string& body) { - const auto uri = restbed::Uri("urlencoded?" + body, true); - const auto params = uri.get_query_parameters(); - const auto result = params.find(paramName); - if (result != params.cend()) { - return result->second; - } - return ""; -} PetFindByStatusResource::PetFindByStatusResource(const std::string& context /* = "/v2" */) { this->set_path(context + "/pet/findByStatus"); @@ -1183,12 +1068,6 @@ std::shared_ptr PetApi::getPetPetIdResource() } return m_spPetPetIdResource; } -std::shared_ptr PetApi::getPetPetIdDownloadImageResource() { - if (!m_spPetPetIdDownloadImageResource) { - setResource(std::make_shared()); - } - return m_spPetPetIdDownloadImageResource; -} std::shared_ptr PetApi::getPetFindByStatusResource() { if (!m_spPetFindByStatusResource) { setResource(std::make_shared()); @@ -1221,10 +1100,6 @@ void PetApi::setResource(std::shared_ptr reso m_spPetPetIdResource = resource; m_service->publish(m_spPetPetIdResource); } -void PetApi::setResource(std::shared_ptr resource) { - m_spPetPetIdDownloadImageResource = resource; - m_service->publish(m_spPetPetIdDownloadImageResource); -} void PetApi::setResource(std::shared_ptr resource) { m_spPetFindByStatusResource = resource; m_service->publish(m_spPetFindByStatusResource); @@ -1249,10 +1124,6 @@ void PetApi::setPetApiPetPetIdResource(std::shared_ptrpublish(m_spPetPetIdResource); } -void PetApi::setPetApiPetPetIdDownloadImageResource(std::shared_ptr spPetPetIdDownloadImageResource) { - m_spPetPetIdDownloadImageResource = spPetPetIdDownloadImageResource; - m_service->publish(m_spPetPetIdDownloadImageResource); -} void PetApi::setPetApiPetFindByStatusResource(std::shared_ptr spPetFindByStatusResource) { m_spPetFindByStatusResource = spPetFindByStatusResource; m_service->publish(m_spPetFindByStatusResource); @@ -1278,9 +1149,6 @@ void PetApi::publishDefaultResources() { if (!m_spPetPetIdResource) { setResource(std::make_shared()); } - if (!m_spPetPetIdDownloadImageResource) { - setResource(std::make_shared()); - } if (!m_spPetFindByStatusResource) { setResource(std::make_shared()); } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h index a241947b2398..bc7497437471 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/PetApi.h @@ -209,68 +209,6 @@ class PetPetIdResource: public restbed::Resource void handler_POST_internal(const std::shared_ptr session); }; -/// -/// downloads an image -/// -/// -/// -/// -class PetPetIdDownloadImageResource: public restbed::Resource -{ -public: - PetPetIdDownloadImageResource(const std::string& context = "/v2"); - virtual ~PetPetIdDownloadImageResource() = default; - - PetPetIdDownloadImageResource( - const PetPetIdDownloadImageResource& other) = default; // copy constructor - PetPetIdDownloadImageResource(PetPetIdDownloadImageResource&& other) noexcept = default; // move constructor - - PetPetIdDownloadImageResource& operator=(const PetPetIdDownloadImageResource& other) = default; // copy assignment - PetPetIdDownloadImageResource& operator=(PetPetIdDownloadImageResource&& other) noexcept = default; // move assignment - - ///////////////////////////////////////////////////// - // Set these to implement the server functionality // - ///////////////////////////////////////////////////// - std::function( - int64_t & petId)> handler_POST_func = - [](int64_t &) -> std::pair - { throw PetApiException(501, "Not implemented"); }; - - -protected: - ////////////////////////////////////////////////////////// - // As an alternative to setting the `std::function`s // - // override these to implement the server functionality // - ////////////////////////////////////////////////////////// - - virtual std::pair handler_POST( - int64_t & petId); - - -protected: - ////////////////////////////////////// - // Override these for customization // - ////////////////////////////////////// - - virtual std::string extractBodyContent(const std::shared_ptr& session); - virtual std::string extractFormParamsFromBody(const std::string& paramName, const std::string& body); - - virtual std::pair handlePetApiException(const PetApiException& e); - virtual std::pair handleStdException(const std::exception& e); - virtual std::pair handleUnspecifiedException(); - - virtual void setResponseHeader(const std::shared_ptr& session, - const std::string& header); - - virtual void returnResponse(const std::shared_ptr& session, - const int status, const std::string& result, std::multimap& contentType); - virtual void defaultSessionClose(const std::shared_ptr& session, - const int status, const std::string& result); - -private: - void handler_POST_internal(const std::shared_ptr session); -}; - /// /// Finds Pets by status /// @@ -523,7 +461,6 @@ class FakePetIdUploadImageWithRequiredFileResource: public restbed::Resource using PetApiPetResource [[deprecated]] = PetApiResources::PetResource; using PetApiPetPetIdResource [[deprecated]] = PetApiResources::PetPetIdResource; -using PetApiPetPetIdDownloadImageResource [[deprecated]] = PetApiResources::PetPetIdDownloadImageResource; using PetApiPetFindByStatusResource [[deprecated]] = PetApiResources::PetFindByStatusResource; using PetApiPetFindByTagsResource [[deprecated]] = PetApiResources::PetFindByTagsResource; using PetApiPetPetIdUploadImageResource [[deprecated]] = PetApiResources::PetPetIdUploadImageResource; @@ -540,7 +477,6 @@ class PetApi std::shared_ptr getPetResource(); std::shared_ptr getPetPetIdResource(); - std::shared_ptr getPetPetIdDownloadImageResource(); std::shared_ptr getPetFindByStatusResource(); std::shared_ptr getPetFindByTagsResource(); std::shared_ptr getPetPetIdUploadImageResource(); @@ -548,7 +484,6 @@ class PetApi void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); - void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); @@ -558,8 +493,6 @@ class PetApi [[deprecated("use setResource()")]] virtual void setPetApiPetPetIdResource(std::shared_ptr spPetApiPetPetIdResource); [[deprecated("use setResource()")]] - virtual void setPetApiPetPetIdDownloadImageResource(std::shared_ptr spPetApiPetPetIdDownloadImageResource); - [[deprecated("use setResource()")]] virtual void setPetApiPetFindByStatusResource(std::shared_ptr spPetApiPetFindByStatusResource); [[deprecated("use setResource()")]] virtual void setPetApiPetFindByTagsResource(std::shared_ptr spPetApiPetFindByTagsResource); @@ -575,7 +508,6 @@ class PetApi protected: std::shared_ptr m_spPetResource; std::shared_ptr m_spPetPetIdResource; - std::shared_ptr m_spPetPetIdDownloadImageResource; std::shared_ptr m_spPetFindByStatusResource; std::shared_ptr m_spPetFindByTagsResource; std::shared_ptr m_spPetPetIdUploadImageResource; diff --git a/samples/server/petstore/java-helidon-server/v3/mp/README.md b/samples/server/petstore/java-helidon-server/v3/mp/README.md index d6653bde86fe..323a58c291c1 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/README.md +++ b/samples/server/petstore/java-helidon-server/v3/mp/README.md @@ -38,7 +38,6 @@ curl -X POST http://petstore.swagger.io:80/v2/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2 curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} -curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java index 9b71ea5864cf..741f9db3a0ec 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetService.java @@ -39,11 +39,6 @@ public interface PetService { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId); - @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 3107c2c8d850..f434a7706553 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v3/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -42,14 +42,6 @@ public void addPet(@Valid @NotNull Pet pet) { public void deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey) { } - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - public File downloadFile(@PathParam("petId") Long petId) { - File result = null; // Replace with correct business logic. - return result; - } - @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml index c6682ecb5b2c..71ba74eeb055 100644 --- a/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v3/mp/src/main/resources/META-INF/openapi.yml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v3/se/README.md b/samples/server/petstore/java-helidon-server/v3/se/README.md index a898facd0b87..3442efc621ab 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/README.md +++ b/samples/server/petstore/java-helidon-server/v3/se/README.md @@ -38,7 +38,6 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} -curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java index 900a8449ccb4..be72664fc47f 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetService.java @@ -23,7 +23,6 @@ public interface PetService extends Service { default void update(Routing.Rules rules) { rules.post("/pet", Handler.create(Pet.class, this::addPet)); rules.delete("/pet/{petId}", this::deletePet); - rules.post("/pet/{petId}/downloadImage", this::downloadFile); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); @@ -49,13 +48,6 @@ default void update(Routing.Rules rules) { */ void deletePet(ServerRequest request, ServerResponse response); - /** - * POST /pet/{petId}/downloadImage : downloads an image. - * @param request the server request - * @param response the server response - */ - void downloadFile(ServerRequest request, ServerResponse response); - /** * GET /pet/findByStatus : Finds Pets by status. * @param request the server request diff --git a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java index b066575d8984..0a016564542b 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v3/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -27,10 +27,6 @@ public void deletePet(ServerRequest request, ServerResponse response) { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } - public void downloadFile(ServerRequest request, ServerResponse response) { - response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); - } - public void findPetsByStatus(ServerRequest request, ServerResponse response) { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } diff --git a/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml index c6682ecb5b2c..71ba74eeb055 100644 --- a/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v3/se/src/main/resources/META-INF/openapi.yml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/mp/README.md b/samples/server/petstore/java-helidon-server/v4/mp/README.md index d6653bde86fe..323a58c291c1 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/README.md +++ b/samples/server/petstore/java-helidon-server/v4/mp/README.md @@ -38,7 +38,6 @@ curl -X POST http://petstore.swagger.io:80/v2/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2 curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} -curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java index 198f017dea8c..d8ed5842cb18 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetService.java @@ -40,11 +40,6 @@ public interface PetService { @Path("/pet/{petId}") void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - File downloadFile(@PathParam("petId") Long petId); - @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 9d9e492af940..708ebf48f849 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/mp/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -43,14 +43,6 @@ public void addPet(@Valid @NotNull Pet pet) { public void deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey) { } - @POST - @Path("/pet/{petId}/downloadImage") - @Produces({ "application/zip" }) - public File downloadFile(@PathParam("petId") Long petId) { - File result = null; // Replace with correct business logic. - return result; - } - @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml index c6682ecb5b2c..71ba74eeb055 100644 --- a/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/mp/src/main/resources/META-INF/openapi.yml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md index 9bb83822431a..696bd42249ed 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/README.md @@ -39,7 +39,6 @@ curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X GET http://petstore.swagger.io:80/v2/foo curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} -curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java index 19b5af435fab..6cdd1203dd96 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetService.java @@ -40,7 +40,6 @@ public abstract class PetService implements HttpService { protected AddPetOp addPetOp = createAddPetOp(); protected DeletePetOp deletePetOp = createDeletePetOp(); - protected DownloadFileOp downloadFileOp = createDownloadFileOp(); protected FindPetsByStatusOp findPetsByStatusOp = createFindPetsByStatusOp(); protected FindPetsByTagsOp findPetsByTagsOp = createFindPetsByTagsOp(); protected GetPetByIdOp getPetByIdOp = createGetPetByIdOp(); @@ -57,7 +56,6 @@ public abstract class PetService implements HttpService { public void routing(HttpRules rules) { rules.post("/", this::addPet); rules.delete("/{petId}", this::deletePet); - rules.post("/{petId}/downloadImage", this::downloadFile); rules.get("/findByStatus", this::findPetsByStatus); rules.get("/findByTags", this::findPetsByTags); rules.get("/{petId}", this::getPetById); @@ -134,36 +132,6 @@ protected abstract void handleDeletePet(ServerRequest request, ServerResponse re Long petId, Optional apiKey); - /** - * POST /pet/{petId}/downloadImage : downloads an image. - * - * @param request the server request - * @param response the server response - */ - protected void downloadFile(ServerRequest request, ServerResponse response) { - - ValidatorUtils.Validator validator = ValidatorUtils.validator(); - - // Parameter: petId - Long petId = downloadFileOp.petId(request, validator); - - validator.require("petId", petId); - validator.execute(); - - handleDownloadFile(request, response, - petId); - } - - /** - * Handle POST /pet/{petId}/downloadImage : downloads an image. - * - * @param request the server request - * @param response the server response - * @param petId ID of pet to update - */ - protected abstract void handleDownloadFile(ServerRequest request, ServerResponse response, - Long petId); - /** * GET /pet/findByStatus : Finds Pets by status. * @@ -689,119 +657,6 @@ void send(ServerResponse _serverResponse) { } } - /** - * Returns a new instance of the class which handles parameters to and responses from the downloadFile operation. - *

- * Developers can override this method if they extend the PetService class. - *

- * - * @return new DownloadFile - */ - protected DownloadFileOp createDownloadFileOp() { - return new DownloadFileOp(); - } - - /** - * Helper elements for the {@code downloadFile} operation. - *

- * Also below are records for each response declared in the OpenAPI document, organized by response status. - *

- * Once your code determines which (if any) declared response to send it can use the static {@code builder} method for - * that specific result, passing the required elements of the response as parameters, and then assign any optional - * response elements using the other builder methods. - *

- * Finally, your code should invoke the {@code apply} method, passing the original {@link ServerResponse}. The - * generated method sets any headers you have assigned, sets the correct status in the response, and sends - * the response including any appropriate entity. - *

- */ - public static class DownloadFileOp { - - /** - * Prepares the petId parameter. - * - * @param request {@link io.helidon.webserver.http.ServerRequest} containing the parameter - * @param validator {@link org.openapitools.server.api.ValidatorUtils.Validator} for validating all parameters to the operation - * @return petId parameter value - */ - protected Long petId(ServerRequest request, ValidatorUtils.Validator validator) { - return request.path() - .pathParameters() - .first("petId") - .asOptional() - .map(Long::valueOf) - .orElse(null); - } - - /** - * Response for HTTP status code {@code 200}. - * - * @param response - */ - record Response200(InputStream response) { - - /** - * Creates a response builder for the status {@code 200} response - * for the downloadFile operation; there are no required result values for this response. - * - * @return new builder for status 200 - */ - static Builder builder() { - return new Builder(); - } - - /** - * Builder for the Response200 result. - */ - static class Builder implements io.helidon.common.Builder { - - private InputStream response; - @Override - public Response200 build() { - return new Response200(response); - } - - /** - * Sends the response data in this builder to the specified {@link io.helidon.webserver.http.ServerResponse}, - * assigning the HTTP status, any response headers, and any response entity. - *

- * Equivalent to {@snippet : - * build().send(_serverResponse); - * } - *

- * - * @param _serverResponse the {@code ServerResponse} to which to apply the status, headers, and entity - */ - void send(ServerResponse _serverResponse) { - build().send(_serverResponse); - } - - /** - * Sets the value for the optional return property {@code response}. - * @param response - * @return updated result builder - */ - Builder response(InputStream response) { - this.response = response; - return this; - } - } - - /** - * Applies this response data to the specified {@link io.helidon.webserver.http.ServerResponse}, assigning the - * HTTP status, any response headers, and any response entity. - * - * @param _serverResponse the server response to which to apply these result values - */ - void send(ServerResponse _serverResponse) { - _serverResponse.status(Status.OK_200); - if (response != null) { - _serverResponse.contentLength(response.transferTo(_serverResponse.outputStream())); - } _serverResponse.send(); - } - } - } - /** * Returns a new instance of the class which handles parameters to and responses from the findPetsByStatus operation. *

diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java index ec44ab9662ef..299009d0b712 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -42,13 +42,6 @@ protected void handleDeletePet(ServerRequest request, ServerResponse response, response.status(Status.NOT_IMPLEMENTED_501).send(); } - @Override - protected void handleDownloadFile(ServerRequest request, ServerResponse response, - Long petId) { - - response.status(Status.NOT_IMPLEMENTED_501).send(); - } - @Override protected void handleFindPetsByStatus(ServerRequest request, ServerResponse response, List status) { diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml index c6682ecb5b2c..71ba74eeb055 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/se-uac-group-by-file-path/src/main/resources/META-INF/openapi.yml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/README.md b/samples/server/petstore/java-helidon-server/v4/se-uac/README.md index a898facd0b87..3442efc621ab 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/README.md +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/README.md @@ -38,7 +38,6 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} -curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java index ad402d15d10c..a2f02a0657b8 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetService.java @@ -40,7 +40,6 @@ public abstract class PetService implements HttpService { protected AddPetOp addPetOp = createAddPetOp(); protected DeletePetOp deletePetOp = createDeletePetOp(); - protected DownloadFileOp downloadFileOp = createDownloadFileOp(); protected FindPetsByStatusOp findPetsByStatusOp = createFindPetsByStatusOp(); protected FindPetsByTagsOp findPetsByTagsOp = createFindPetsByTagsOp(); protected GetPetByIdOp getPetByIdOp = createGetPetByIdOp(); @@ -58,7 +57,6 @@ public abstract class PetService implements HttpService { public void routing(HttpRules rules) { rules.post("/pet", this::addPet); rules.delete("/pet/{petId}", this::deletePet); - rules.post("/pet/{petId}/downloadImage", this::downloadFile); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); @@ -136,36 +134,6 @@ protected abstract void handleDeletePet(ServerRequest request, ServerResponse re Long petId, Optional apiKey); - /** - * POST /pet/{petId}/downloadImage : downloads an image. - * - * @param request the server request - * @param response the server response - */ - protected void downloadFile(ServerRequest request, ServerResponse response) { - - ValidatorUtils.Validator validator = ValidatorUtils.validator(); - - // Parameter: petId - Long petId = downloadFileOp.petId(request, validator); - - validator.require("petId", petId); - validator.execute(); - - handleDownloadFile(request, response, - petId); - } - - /** - * Handle POST /pet/{petId}/downloadImage : downloads an image. - * - * @param request the server request - * @param response the server response - * @param petId ID of pet to update - */ - protected abstract void handleDownloadFile(ServerRequest request, ServerResponse response, - Long petId); - /** * GET /pet/findByStatus : Finds Pets by status. * @@ -739,119 +707,6 @@ void send(ServerResponse _serverResponse) { } } - /** - * Returns a new instance of the class which handles parameters to and responses from the downloadFile operation. - *

- * Developers can override this method if they extend the PetService class. - *

- * - * @return new DownloadFile - */ - protected DownloadFileOp createDownloadFileOp() { - return new DownloadFileOp(); - } - - /** - * Helper elements for the {@code downloadFile} operation. - *

- * Also below are records for each response declared in the OpenAPI document, organized by response status. - *

- * Once your code determines which (if any) declared response to send it can use the static {@code builder} method for - * that specific result, passing the required elements of the response as parameters, and then assign any optional - * response elements using the other builder methods. - *

- * Finally, your code should invoke the {@code apply} method, passing the original {@link ServerResponse}. The - * generated method sets any headers you have assigned, sets the correct status in the response, and sends - * the response including any appropriate entity. - *

- */ - public static class DownloadFileOp { - - /** - * Prepares the petId parameter. - * - * @param request {@link io.helidon.webserver.http.ServerRequest} containing the parameter - * @param validator {@link org.openapitools.server.api.ValidatorUtils.Validator} for validating all parameters to the operation - * @return petId parameter value - */ - protected Long petId(ServerRequest request, ValidatorUtils.Validator validator) { - return request.path() - .pathParameters() - .first("petId") - .asOptional() - .map(Long::valueOf) - .orElse(null); - } - - /** - * Response for HTTP status code {@code 200}. - * - * @param response - */ - record Response200(InputStream response) { - - /** - * Creates a response builder for the status {@code 200} response - * for the downloadFile operation; there are no required result values for this response. - * - * @return new builder for status 200 - */ - static Builder builder() { - return new Builder(); - } - - /** - * Builder for the Response200 result. - */ - static class Builder implements io.helidon.common.Builder { - - private InputStream response; - @Override - public Response200 build() { - return new Response200(response); - } - - /** - * Sends the response data in this builder to the specified {@link io.helidon.webserver.http.ServerResponse}, - * assigning the HTTP status, any response headers, and any response entity. - *

- * Equivalent to {@snippet : - * build().send(_serverResponse); - * } - *

- * - * @param _serverResponse the {@code ServerResponse} to which to apply the status, headers, and entity - */ - void send(ServerResponse _serverResponse) { - build().send(_serverResponse); - } - - /** - * Sets the value for the optional return property {@code response}. - * @param response - * @return updated result builder - */ - Builder response(InputStream response) { - this.response = response; - return this; - } - } - - /** - * Applies this response data to the specified {@link io.helidon.webserver.http.ServerResponse}, assigning the - * HTTP status, any response headers, and any response entity. - * - * @param _serverResponse the server response to which to apply these result values - */ - void send(ServerResponse _serverResponse) { - _serverResponse.status(Status.OK_200); - if (response != null) { - _serverResponse.contentLength(response.transferTo(_serverResponse.outputStream())); - } _serverResponse.send(); - } - } - } - /** * Returns a new instance of the class which handles parameters to and responses from the findPetsByStatus operation. *

diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java index a94b4f05793b..ba312ca6ef1a 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -42,13 +42,6 @@ protected void handleDeletePet(ServerRequest request, ServerResponse response, response.status(Status.NOT_IMPLEMENTED_501).send(); } - @Override - protected void handleDownloadFile(ServerRequest request, ServerResponse response, - Long petId) { - - response.status(Status.NOT_IMPLEMENTED_501).send(); - } - @Override protected void handleFindPetsByStatus(ServerRequest request, ServerResponse response, List status) { diff --git a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml index c6682ecb5b2c..71ba74eeb055 100644 --- a/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/se-uac/src/main/resources/META-INF/openapi.yml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-helidon-server/v4/se/README.md b/samples/server/petstore/java-helidon-server/v4/se/README.md index a898facd0b87..3442efc621ab 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/README.md +++ b/samples/server/petstore/java-helidon-server/v4/se/README.md @@ -38,7 +38,6 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/stringMap-reference curl -X PATCH http://petstore.swagger.io:80/v2/fake_classname_test curl -X POST http://petstore.swagger.io:80/v2/pet curl -X DELETE http://petstore.swagger.io:80/v2/pet/{petId} -curl -X POST http://petstore.swagger.io:80/v2/pet/{petId}/downloadImage curl -X GET http://petstore.swagger.io:80/v2/pet/findByStatus curl -X GET http://petstore.swagger.io:80/v2/pet/findByTags curl -X GET http://petstore.swagger.io:80/v2/pet/{petId} diff --git a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java index 42b2e2232514..1ccfc5ad4d46 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java +++ b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetService.java @@ -36,7 +36,6 @@ public interface PetService extends HttpService { default void routing(HttpRules rules) { rules.post("/pet", this::addPet); rules.delete("/pet/{petId}", this::deletePet); - rules.post("/pet/{petId}/downloadImage", this::downloadFile); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); @@ -61,13 +60,6 @@ default void routing(HttpRules rules) { * @param response the server response */ void deletePet(ServerRequest request, ServerResponse response); - /** - * POST /pet/{petId}/downloadImage : downloads an image. - * - * @param request the server request - * @param response the server response - */ - void downloadFile(ServerRequest request, ServerResponse response); /** * GET /pet/findByStatus : Finds Pets by status. * diff --git a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java index 55bbcd9e8ab2..9159d959b246 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/v4/se/src/main/java/org/openapitools/server/api/PetServiceImpl.java @@ -38,13 +38,6 @@ public void deletePet(ServerRequest request, ServerResponse response) { response.status(Status.NOT_IMPLEMENTED_501).send(); } - @Override - public void downloadFile(ServerRequest request, ServerResponse response) { - ValidatorUtils.Validator validator = ValidatorUtils.validator(); - - response.status(Status.NOT_IMPLEMENTED_501).send(); - } - @Override public void findPetsByStatus(ServerRequest request, ServerResponse response) { ValidatorUtils.Validator validator = ValidatorUtils.validator(); diff --git a/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml index c6682ecb5b2c..71ba74eeb055 100644 --- a/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/v4/se/src/main/resources/META-INF/openapi.yml @@ -351,37 +351,6 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java index c4fc662cba26..6aea7e0bfccb 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java @@ -107,37 +107,6 @@ public static MappingBuilder stubDeletePetFault(@javax.annotation.Nonnull String - public static MappingBuilder stubDownloadFile200(@javax.annotation.Nonnull String petId, String response) { - MappingBuilder stub = post(urlPathTemplate("/pet/{petId}/downloadImage")) - .withHeader("Accept", havingExactly("application/zip")) - .withHeader("Authorization", matching(".*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/zip") - .withBody(response) - ); - - stub = stub.withPathParam("petId", equalTo(petId)); - - return stub; - } - - public static MappingBuilder stubDownloadFileFault(@javax.annotation.Nonnull String petId, Fault fault) { - MappingBuilder stub = post(urlPathTemplate("/pet/{petId}/downloadImage")) - .withHeader("Accept", havingExactly("application/zip")) - .withHeader("Authorization", matching(".*")) - .willReturn(aResponse() - .withFault(fault) - ); - - stub = stub.withPathParam("petId", equalTo(petId)); - - return stub; - } - - - - public static MappingBuilder stubFindPetsByStatus200(@javax.annotation.Nonnull String status, String response) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByStatus")) .withHeader("Accept", havingExactly("application/xml", "application/json")) diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java index 38a69c4f0cb3..b842a2718943 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java @@ -93,23 +93,6 @@ public Response deletePet(@ApiParam(value = "Pet id to delete", required = true) throws NotFoundException { return delegate.deletePet(petId, apiKey, securityContext); } - @javax.ws.rs.POST - @Path("/{petId}/downloadImage") - - @Produces({ "application/zip" }) - @io.swagger.annotations.ApiOperation(value = "downloads an image", notes = "", response = File.class, authorizations = { - @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { - @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = File.class) - }) - public Response downloadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.downloadFile(petId, securityContext); - } @javax.ws.rs.GET @Path("/findByStatus") diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java index 97cb10180778..fa0fde034235 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java @@ -22,7 +22,6 @@ public abstract class PetApiService { public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; - public abstract Response downloadFile(Long petId,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByStatus( @NotNull List status,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByTags( @NotNull Set tags,SecurityContext securityContext) throws NotFoundException; public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index 5c6262aacc87..db46c8ba90d4 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -30,11 +30,6 @@ public Response deletePet(Long petId, String apiKey, SecurityContext securityCon return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response downloadFile(Long petId, SecurityContext securityContext) throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - @Override public Response findPetsByStatus( @NotNull List status, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java index f9123761f887..b6e1712fa52d 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java @@ -104,23 +104,6 @@ public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi. return Response.ok().entity("magic!").build(); } - @POST - @Path("/{petId}/downloadImage") - @Produces({ "application/zip" }) - @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ - @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) - }) - @org.eclipse.microprofile.openapi.annotations.Operation(operationId = "downloadFile", summary = "downloads an image", description = "") - @org.eclipse.microprofile.openapi.annotations.tags.Tag(name="pet") - @org.eclipse.microprofile.openapi.annotations.responses.APIResponses(value = { - @org.eclipse.microprofile.openapi.annotations.responses.APIResponse(responseCode = "200", description = "successful operation", content = { - @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/zip", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = File.class)) - }) - }) - public Response downloadFile(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId) { - return Response.ok().entity("magic!").build(); - } - @GET @Path("/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml index 5d97cea065b0..81900f211c15 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/main/resources/META-INF/openapi.yaml @@ -367,39 +367,6 @@ paths: - application/json x-tags: - tag: pet - /pet/{petId}/downloadImage: - post: - description: "" - operationId: downloadFile - parameters: - - description: ID of pet to update - explode: false - in: path - name: petId - required: true - schema: - format: int64 - type: integer - style: simple - responses: - "200": - content: - application/zip: - schema: - format: binary - type: string - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: downloads an image - tags: - - pet - x-accepts: - - application/zip - x-tags: - - tag: pet /store/inventory: get: description: Returns a map of status codes to quantities diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java index ca3b8791fdab..1e7fa6a84560 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java @@ -93,20 +93,6 @@ public Response deletePet(@Schema(description= "Pet id to delete", required = tr return delegate.deletePet(petId, apiKey, securityContext); } - @jakarta.ws.rs.POST - @Path("/{petId}/downloadImage") - @Produces({ "application/zip" }) - @Operation(summary = "downloads an image", description = "", responses = { - @ApiResponse(responseCode = "200", description = "successful operation", content = - @Content(schema = @Schema(implementation = File.class))), - },security = { - @SecurityRequirement(name = "petstore_auth", scopes={ "write:pets", "read:pets" }) - }, tags={ "pet", }) - public Response downloadFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.downloadFile(petId, securityContext); - } - @jakarta.ws.rs.GET @Path("/findByStatus") @Produces({ "application/xml", "application/json" }) diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java index b0e880435881..58e497e96375 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java @@ -22,7 +22,6 @@ public abstract class PetApiService { public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; - public abstract Response downloadFile(Long petId,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByStatus( @NotNull List status,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByTags( @NotNull Set tags,SecurityContext securityContext) throws NotFoundException; public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index e25a246c7649..ebf441d748c6 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -30,11 +30,6 @@ public Response deletePet(Long petId, String apiKey, SecurityContext securityCon return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response downloadFile(Long petId, SecurityContext securityContext) throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - @Override public Response findPetsByStatus( @NotNull List status, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/php-laravel/Api/PetApiInterface.php b/samples/server/petstore/php-laravel/Api/PetApiInterface.php index e84c41aa444b..24dbb1f2b046 100644 --- a/samples/server/petstore/php-laravel/Api/PetApiInterface.php +++ b/samples/server/petstore/php-laravel/Api/PetApiInterface.php @@ -56,20 +56,6 @@ public function deletePet( ; - /** - * Operation downloadFile - * - * downloads an image - * @param int $petId - * @return \Illuminate\Http\UploadedFile - */ - public function downloadFile( - int $petId, - ): - \Illuminate\Http\UploadedFile - ; - - /** * Operation findPetsByStatus * diff --git a/samples/server/petstore/php-laravel/Http/Controllers/PetController.php b/samples/server/petstore/php-laravel/Http/Controllers/PetController.php index 690e63e76ff4..098346fd1e71 100644 --- a/samples/server/petstore/php-laravel/Http/Controllers/PetController.php +++ b/samples/server/petstore/php-laravel/Http/Controllers/PetController.php @@ -136,50 +136,6 @@ public function deletePet(Request $request, int $petId): JsonResponse } - // This shouldn't happen - return response()->abort(500); - } - /** - * Operation downloadFile - * - * downloads an image. - * - */ - public function downloadFile(Request $request, int $petId): JsonResponse - { - $validator = Validator::make( - array_merge( - [ - 'petId' => $petId, - ], - $request->all(), - ), - [ - 'petId' => [ - 'required', - 'integer', - ], - ], - ); - - if ($validator->fails()) { - return response()->json(['error' => 'Invalid input'], 400); - } - - - try { - $apiResult = $this->api->downloadFile($petId); - } catch (\Exception $exception) { - // This shouldn't happen - report($exception); - return response()->json(['error' => $exception->getMessage()], 500); - } - - if ($apiResult instanceof \Illuminate\Http\UploadedFile) { - return response()->json($this->serde->serialize($apiResult, format: 'array'), 200); - } - - // This shouldn't happen return response()->abort(500); } diff --git a/samples/server/petstore/php-laravel/routes.php b/samples/server/petstore/php-laravel/routes.php index 9b91f2733bec..a92d702b6043 100644 --- a/samples/server/petstore/php-laravel/routes.php +++ b/samples/server/petstore/php-laravel/routes.php @@ -209,13 +209,6 @@ */ Route::DELETE('/v2/pet/{petId}', [\OpenAPI\Server\Http\Controllers\PetController::class, 'deletePet'])->name('pet.delete.pet'); -/** - * POST downloadFile - * Summary: downloads an image - * Notes: - */ -Route::POST('/v2/pet/{petId}/downloadImage', [\OpenAPI\Server\Http\Controllers\PetController::class, 'downloadFile'])->name('pet.download.file'); - /** * GET findPetsByStatus * Summary: Finds Pets by status diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php index 8d990427ac6f..3b7944400c77 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php @@ -204,26 +204,6 @@ public function updatePetWithForm($pet_id) return response('How about implementing updatePetWithForm as a post method ?'); } - /** - * Operation downloadFile - * - * downloads an image. - * - * @param int $pet_id ID of pet to update (required) - * - * @return Http response - */ - public function downloadFile($pet_id) - { - $input = Request::all(); - - //path params validation - - - //not path params validation - - return response('How about implementing downloadFile as a post method ?'); - } /** * Operation uploadFile * diff --git a/samples/server/petstore/php-lumen/lib/routes/web.php b/samples/server/petstore/php-lumen/lib/routes/web.php index 208688be8a18..dfd864d4d144 100644 --- a/samples/server/petstore/php-lumen/lib/routes/web.php +++ b/samples/server/petstore/php-lumen/lib/routes/web.php @@ -268,13 +268,6 @@ */ $router->post('/v2/pet/{petId}', 'PetApi@updatePetWithForm'); -/** - * post downloadFile - * Summary: downloads an image - * Notes: - */ -$router->post('/v2/pet/{petId}/downloadImage', 'PetApi@downloadFile'); - /** * post uploadFile * Summary: uploads an image From 3a7a3c3117ae5cf0a35eca99d4ac421ff550512a Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Tue, 10 Jun 2025 13:45:13 -0600 Subject: [PATCH 08/10] reverted changes to nested generators --- .../src/App/DTO/DownloadFileParameterData.php | 21 ------------------- .../src/App/DTO/DownloadFileParameterData.php | 21 ------------------- .../lib/src/api/another_fake_api.dart | 1 - .../lib/src/api/default_api.dart | 1 - .../lib/src/api/fake_api.dart | 8 ------- .../src/api/fake_classname_tags123_api.dart | 1 - .../lib/src/api/pet_api.dart | 5 ----- .../lib/src/api/store_api.dart | 3 --- .../lib/src/api/user_api.dart | 2 -- 9 files changed, 63 deletions(-) delete mode 100644 samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php delete mode 100644 samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php diff --git a/samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php b/samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php deleted file mode 100644 index fa9ec67796f8..000000000000 --- a/samples/client/petstore/php-dt-modern/src/App/DTO/DownloadFileParameterData.php +++ /dev/null @@ -1,21 +0,0 @@ - "int"], "path")] - #[DTA\Validator("QueryStringScalar", ["type" => "int"], subset: "path")] - public int|null $pet_id = null; - -} diff --git a/samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php b/samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php deleted file mode 100644 index 418599c8b417..000000000000 --- a/samples/client/petstore/php-dt/src/App/DTO/DownloadFileParameterData.php +++ /dev/null @@ -1,21 +0,0 @@ -(rawData, 'ModelClient', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart index 7db9981e2a88..e9efb7b5b194 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart @@ -64,7 +64,6 @@ class DefaultApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'FooGetDefaultResponse', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index e91f47cebe91..06486358eda5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -74,7 +74,6 @@ class FakeApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'FakeBigDecimalMap200Response', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -144,7 +143,6 @@ _responseData = rawData == null ? null : deserialize(rawData, 'HealthCheckResult', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -316,7 +314,6 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'bool', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -406,7 +403,6 @@ _bodyData=jsonEncode(outerComposite); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'OuterComposite', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -496,7 +492,6 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'num', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -586,7 +581,6 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -676,7 +670,6 @@ _bodyData=jsonEncode(outerObjectWithEnumProperty); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'OuterObjectWithEnumProperty', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1034,7 +1027,6 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart index 85fbbac9287b..56ec33f1cace 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart @@ -91,7 +91,6 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart index aab8df518913..ec20128ee1e3 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart @@ -202,7 +202,6 @@ _bodyData=jsonEncode(pet); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'List', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -285,7 +284,6 @@ _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'L try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Set', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -364,7 +362,6 @@ _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Se try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Pet', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -607,7 +604,6 @@ _bodyData=jsonEncode(pet); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -706,7 +702,6 @@ _responseData = rawData == null ? null : deserialize(r try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart index f81b521ed418..23e8deceaea8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart @@ -118,7 +118,6 @@ class StoreApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, int>(rawData, 'Map', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -190,7 +189,6 @@ _responseData = rawData == null ? null : deserialize, int>(rawD try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -280,7 +278,6 @@ _bodyData=jsonEncode(order); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart index 85583331abe7..24bbeb48f746 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart @@ -308,7 +308,6 @@ _bodyData=jsonEncode(user); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'User', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -388,7 +387,6 @@ _responseData = rawData == null ? null : deserialize(rawData, 'User' try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); - } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, From 842e0a807edfa0debadb2be7d427913f3e8ea1a1 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Tue, 10 Jun 2025 13:45:59 -0600 Subject: [PATCH 09/10] removed 2 additional php modifications --- .../src/App/Handler/PetPetIdDownloadImage.php | 27 --------------- .../src/App/Handler/PetPetIdDownloadImage.php | 34 ------------------- 2 files changed, 61 deletions(-) delete mode 100644 samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php delete mode 100644 samples/server/petstore/php-mezzio-ph/src/App/Handler/PetPetIdDownloadImage.php diff --git a/samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php b/samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php deleted file mode 100644 index d02ec2c522c5..000000000000 --- a/samples/server/petstore/php-mezzio-ph-modern/src/App/Handler/PetPetIdDownloadImage.php +++ /dev/null @@ -1,27 +0,0 @@ - Date: Tue, 17 Jun 2025 11:55:37 -0600 Subject: [PATCH 10/10] regen samples --- .../dart-dio/binary_response/.openapi-generator/FILES | 2 -- .../lib/src/api/another_fake_api.dart | 1 + .../lib/src/api/default_api.dart | 1 + .../lib/src/api/fake_api.dart | 8 ++++++++ .../lib/src/api/fake_classname_tags123_api.dart | 1 + .../lib/src/api/pet_api.dart | 5 +++++ .../lib/src/api/store_api.dart | 3 +++ .../lib/src/api/user_api.dart | 2 ++ 8 files changed, 21 insertions(+), 2 deletions(-) diff --git a/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES index cf3837b05e52..809d28620973 100644 --- a/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/binary_response/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore README.md analysis_options.yaml build.yaml @@ -14,4 +13,3 @@ lib/src/auth/bearer_auth.dart lib/src/auth/oauth.dart lib/src/deserialize.dart pubspec.yaml -test/default_api_test.dart diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart index d98f3c23f4f7..20e0f8da9464 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/another_fake_api.dart @@ -84,6 +84,7 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart index e9efb7b5b194..7db9981e2a88 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart @@ -64,6 +64,7 @@ class DefaultApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'FooGetDefaultResponse', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index 06486358eda5..e91f47cebe91 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -74,6 +74,7 @@ class FakeApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'FakeBigDecimalMap200Response', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -143,6 +144,7 @@ _responseData = rawData == null ? null : deserialize(rawData, 'HealthCheckResult', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -314,6 +316,7 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'bool', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -403,6 +406,7 @@ _bodyData=jsonEncode(outerComposite); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'OuterComposite', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -492,6 +496,7 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'num', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -581,6 +586,7 @@ _bodyData=jsonEncode(body); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -670,6 +676,7 @@ _bodyData=jsonEncode(outerObjectWithEnumProperty); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'OuterObjectWithEnumProperty', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -1027,6 +1034,7 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart index 56ec33f1cace..85fbbac9287b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_classname_tags123_api.dart @@ -91,6 +91,7 @@ _bodyData=jsonEncode(modelClient); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart index ec20128ee1e3..aab8df518913 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/pet_api.dart @@ -202,6 +202,7 @@ _bodyData=jsonEncode(pet); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'List', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -284,6 +285,7 @@ _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'L try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Set', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -362,6 +364,7 @@ _responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Se try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Pet', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -604,6 +607,7 @@ _bodyData=jsonEncode(pet); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -702,6 +706,7 @@ _responseData = rawData == null ? null : deserialize(r try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart index 23e8deceaea8..f81b521ed418 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/store_api.dart @@ -118,6 +118,7 @@ class StoreApi { try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize, int>(rawData, 'Map', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -189,6 +190,7 @@ _responseData = rawData == null ? null : deserialize, int>(rawD try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -278,6 +280,7 @@ _bodyData=jsonEncode(order); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart index 24bbeb48f746..85583331abe7 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/user_api.dart @@ -308,6 +308,7 @@ _bodyData=jsonEncode(user); try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'User', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, @@ -387,6 +388,7 @@ _responseData = rawData == null ? null : deserialize(rawData, 'User' try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); + } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions,