From 63f6950afb8c8f8a57769acce5317ef435645a37 Mon Sep 17 00:00:00 2001 From: Jahn Nietzke Date: Thu, 29 Aug 2024 10:13:34 +0200 Subject: [PATCH 1/2] in case of defined status codes > 299 switch will have no effect. As described in issue 7788 so we get only an error if statusCode is not defined AND not between 200 and 299 https://github.com/OpenAPITools/openapi-generator/issues/7788 --- .../main/resources/php-nextgen/api.mustache | 25 ++++++++++--------- .../src/main/resources/php/api.mustache | 25 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache index d05252c5b956..4ece0f88c4fb 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache @@ -286,18 +286,6 @@ use {{invokerPackage}}\ObjectSerializer; $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } {{#returnType}} {{#responses}} {{#-first}} @@ -338,6 +326,19 @@ use {{invokerPackage}}\ObjectSerializer; {{/-last}} {{/responses}} + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '{{{returnType}}}'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 30ec1cfc80ab..966a0025691c 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -254,18 +254,6 @@ use {{invokerPackage}}\ObjectSerializer; $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } {{#returnType}} {{#responses}} {{#-first}} @@ -306,6 +294,19 @@ use {{invokerPackage}}\ObjectSerializer; {{/-last}} {{/responses}} + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '{{{returnType}}}'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer From 25eeba8b3306088e6b49925aef78d2052205679d Mon Sep 17 00:00:00 2001 From: Jahn Nietzke Date: Mon, 16 Sep 2024 18:46:13 +0200 Subject: [PATCH 2/2] in case of defined status codes > 299 switch will have no effect. As described in issue 7788 so we get only an error if statusCode is not defined AND not between 200 and 299 https://github.com/OpenAPITools/openapi-generator/issues/7788 --- .../php-nextgen-streaming/src/Api/AuthApi.php | 50 +-- .../php-nextgen-streaming/src/Api/BodyApi.php | 250 ++++++------ .../php-nextgen-streaming/src/Api/FormApi.php | 75 ++-- .../src/Api/HeaderApi.php | 25 +- .../php-nextgen-streaming/src/Api/PathApi.php | 25 +- .../src/Api/QueryApi.php | 250 ++++++------ .../echo_api/php-nextgen/src/Api/AuthApi.php | 50 +-- .../echo_api/php-nextgen/src/Api/BodyApi.php | 250 ++++++------ .../echo_api/php-nextgen/src/Api/FormApi.php | 75 ++-- .../php-nextgen/src/Api/HeaderApi.php | 25 +- .../echo_api/php-nextgen/src/Api/PathApi.php | 25 +- .../echo_api/php-nextgen/src/Api/QueryApi.php | 250 ++++++------ .../src/Api/AnotherFakeApi.php | 25 +- .../OpenAPIClient-php/src/Api/DefaultApi.php | 25 +- .../OpenAPIClient-php/src/Api/FakeApi.php | 368 +++++------------- .../src/Api/FakeClassnameTags123Api.php | 25 +- .../OpenAPIClient-php/src/Api/PetApi.php | 173 ++++---- .../OpenAPIClient-php/src/Api/StoreApi.php | 87 ++--- .../OpenAPIClient-php/src/Api/UserApi.php | 122 ++---- .../lib/Api/AnotherFakeApi.php | 25 +- .../OpenAPIClient-php/lib/Api/DefaultApi.php | 25 +- .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 368 +++++------------- .../lib/Api/FakeClassnameTags123Api.php | 25 +- .../php/OpenAPIClient-php/lib/Api/PetApi.php | 173 ++++---- .../OpenAPIClient-php/lib/Api/StoreApi.php | 87 ++--- .../php/OpenAPIClient-php/lib/Api/UserApi.php | 122 ++---- 26 files changed, 1248 insertions(+), 1752 deletions(-) diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php index 7c3dc10acf3f..9049d3cf487c 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php @@ -184,18 +184,6 @@ public function testAuthHttpBasicWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -227,6 +215,19 @@ public function testAuthHttpBasicWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -485,18 +486,6 @@ public function testAuthHttpBearerWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -528,6 +517,19 @@ public function testAuthHttpBearerWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php index bc47cee3d1ca..ac482d820bc0 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php @@ -208,18 +208,6 @@ public function testBinaryGifWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -251,6 +239,19 @@ public function testBinaryGifWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\Psr\Http\Message\StreamInterface'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -509,18 +510,6 @@ public function testBodyApplicationOctetstreamBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -552,6 +541,19 @@ public function testBodyApplicationOctetstreamBinaryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -824,18 +826,6 @@ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -867,6 +857,19 @@ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1152,18 +1155,6 @@ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1195,6 +1186,19 @@ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1474,18 +1478,6 @@ public function testEchoBodyAllOfPetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1517,6 +1509,19 @@ public function testEchoBodyAllOfPetWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1789,18 +1794,6 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1832,6 +1825,19 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2104,18 +2110,6 @@ public function testEchoBodyPetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2147,6 +2141,19 @@ public function testEchoBodyPetWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2419,18 +2426,6 @@ public function testEchoBodyPetResponseStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2462,6 +2457,19 @@ public function testEchoBodyPetResponseStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2734,18 +2742,6 @@ public function testEchoBodyStringEnumWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2777,6 +2773,19 @@ public function testEchoBodyStringEnumWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\StringEnumRef'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -3049,18 +3058,6 @@ public function testEchoBodyTagResponseStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -3092,6 +3089,19 @@ public function testEchoBodyTagResponseStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php index 8a67a6113445..e9e04aaa7cd1 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php @@ -199,18 +199,6 @@ public function testFormIntegerBooleanStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -242,6 +230,19 @@ public function testFormIntegerBooleanStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -533,18 +534,6 @@ public function testFormObjectMultipartWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -576,6 +565,19 @@ public function testFormObjectMultipartWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -871,18 +873,6 @@ public function testFormOneofWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -914,6 +904,19 @@ public function testFormOneofWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php index 6465a1b3ba45..8468dbc077b8 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php @@ -201,18 +201,6 @@ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php index dbeb47e3dde3..bde32e5b3b9d 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php @@ -197,18 +197,6 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -240,6 +228,19 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php index ca420cea4f22..d4c06d83d09a 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php @@ -216,18 +216,6 @@ public function testEnumRefStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -259,6 +247,19 @@ public function testEnumRefStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -557,18 +558,6 @@ public function testQueryDatetimeDateStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -600,6 +589,19 @@ public function testQueryDatetimeDateStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -914,18 +916,6 @@ public function testQueryIntegerBooleanStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -957,6 +947,19 @@ public function testQueryIntegerBooleanStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1263,18 +1266,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1306,6 +1297,19 @@ public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1580,18 +1584,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1623,6 +1615,19 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1897,18 +1902,6 @@ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1940,6 +1933,19 @@ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2214,18 +2220,6 @@ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2257,6 +2251,19 @@ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2531,18 +2538,6 @@ public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2574,6 +2569,19 @@ public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2848,18 +2856,6 @@ public function testQueryStyleFormExplodeTrueObjectWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2891,6 +2887,19 @@ public function testQueryStyleFormExplodeTrueObjectWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -3165,18 +3174,6 @@ public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -3208,6 +3205,19 @@ public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php index 7c3dc10acf3f..9049d3cf487c 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php @@ -184,18 +184,6 @@ public function testAuthHttpBasicWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -227,6 +215,19 @@ public function testAuthHttpBasicWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -485,18 +486,6 @@ public function testAuthHttpBearerWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -528,6 +517,19 @@ public function testAuthHttpBearerWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php index 20521664c4aa..da15f96a10a7 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php @@ -208,18 +208,6 @@ public function testBinaryGifWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -251,6 +239,19 @@ public function testBinaryGifWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\SplFileObject'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -509,18 +510,6 @@ public function testBodyApplicationOctetstreamBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -552,6 +541,19 @@ public function testBodyApplicationOctetstreamBinaryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -824,18 +826,6 @@ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -867,6 +857,19 @@ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1152,18 +1155,6 @@ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1195,6 +1186,19 @@ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1474,18 +1478,6 @@ public function testEchoBodyAllOfPetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1517,6 +1509,19 @@ public function testEchoBodyAllOfPetWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1789,18 +1794,6 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1832,6 +1825,19 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2104,18 +2110,6 @@ public function testEchoBodyPetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2147,6 +2141,19 @@ public function testEchoBodyPetWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2419,18 +2426,6 @@ public function testEchoBodyPetResponseStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2462,6 +2457,19 @@ public function testEchoBodyPetResponseStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2734,18 +2742,6 @@ public function testEchoBodyStringEnumWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2777,6 +2773,19 @@ public function testEchoBodyStringEnumWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\StringEnumRef'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -3049,18 +3058,6 @@ public function testEchoBodyTagResponseStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -3092,6 +3089,19 @@ public function testEchoBodyTagResponseStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php index 8a67a6113445..e9e04aaa7cd1 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php @@ -199,18 +199,6 @@ public function testFormIntegerBooleanStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -242,6 +230,19 @@ public function testFormIntegerBooleanStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -533,18 +534,6 @@ public function testFormObjectMultipartWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -576,6 +565,19 @@ public function testFormObjectMultipartWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -871,18 +873,6 @@ public function testFormOneofWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -914,6 +904,19 @@ public function testFormOneofWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php index 6465a1b3ba45..8468dbc077b8 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php @@ -201,18 +201,6 @@ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php index dbeb47e3dde3..bde32e5b3b9d 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php @@ -197,18 +197,6 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -240,6 +228,19 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php index ca420cea4f22..d4c06d83d09a 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php @@ -216,18 +216,6 @@ public function testEnumRefStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -259,6 +247,19 @@ public function testEnumRefStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -557,18 +558,6 @@ public function testQueryDatetimeDateStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -600,6 +589,19 @@ public function testQueryDatetimeDateStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -914,18 +916,6 @@ public function testQueryIntegerBooleanStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -957,6 +947,19 @@ public function testQueryIntegerBooleanStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1263,18 +1266,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1306,6 +1297,19 @@ public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1580,18 +1584,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1623,6 +1615,19 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1897,18 +1902,6 @@ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1940,6 +1933,19 @@ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2214,18 +2220,6 @@ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2257,6 +2251,19 @@ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2531,18 +2538,6 @@ public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2574,6 +2569,19 @@ public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2848,18 +2856,6 @@ public function testQueryStyleFormExplodeTrueObjectWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2891,6 +2887,19 @@ public function testQueryStyleFormExplodeTrueObjectWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -3165,18 +3174,6 @@ public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -3208,6 +3205,19 @@ public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php index dcc4d80422fb..dbbf779792c0 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php @@ -184,18 +184,6 @@ public function call123TestSpecialTagsWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -227,6 +215,19 @@ public function call123TestSpecialTagsWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Client'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php index cdb4771a7839..7e8304008912 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php @@ -176,18 +176,6 @@ public function fooGetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { default: @@ -219,6 +207,19 @@ public function fooGetWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php index c44d49f9d4c5..809e46c0129f 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php @@ -240,18 +240,6 @@ public function fakeBigDecimalMapWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -283,6 +271,19 @@ public function fakeBigDecimalMapWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\FakeBigDecimalMap200Response'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -533,18 +534,6 @@ public function fakeHealthGetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -576,6 +565,19 @@ public function fakeHealthGetWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\HealthCheckResult'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -841,18 +843,6 @@ public function fakeHttpSignatureTestWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -1108,18 +1098,6 @@ public function fakeOuterBooleanSerializeWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1151,6 +1129,19 @@ public function fakeOuterBooleanSerializeWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'bool'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1415,18 +1406,6 @@ public function fakeOuterCompositeSerializeWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1458,6 +1437,19 @@ public function fakeOuterCompositeSerializeWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\OuterComposite'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1722,18 +1714,6 @@ public function fakeOuterNumberSerializeWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1765,6 +1745,19 @@ public function fakeOuterNumberSerializeWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'float'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2029,18 +2022,6 @@ public function fakeOuterStringSerializeWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2072,6 +2053,19 @@ public function fakeOuterStringSerializeWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2336,18 +2330,6 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2379,6 +2361,19 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\OuterObjectWithEnumProperty'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2652,18 +2647,6 @@ public function testAdditionalPropertiesReferenceWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2891,18 +2874,6 @@ public function testBodyWithBinaryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3126,18 +3097,6 @@ public function testBodyWithFileSchemaWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3365,18 +3324,6 @@ public function testBodyWithQueryParamsWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3627,18 +3574,6 @@ public function testClientModelWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -3670,6 +3605,19 @@ public function testClientModelWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Client'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -3999,18 +3947,6 @@ public function testEndpointParametersWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -4485,18 +4421,6 @@ public function testEnumParametersWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -4847,18 +4771,6 @@ public function testGroupParametersWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5174,18 +5086,6 @@ public function testInlineAdditionalPropertiesWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5417,18 +5317,6 @@ public function testInlineFreeformAdditionalPropertiesWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5664,18 +5552,6 @@ public function testJsonFormDataWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5921,18 +5797,6 @@ public function testNullableWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -6184,18 +6048,6 @@ public function testQueryParameterCollectionFormatWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -6551,18 +6403,6 @@ public function testStringMapReferenceWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php index 09ac32f947d4..4d2b47c5221d 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php @@ -184,18 +184,6 @@ public function testClassnameWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -227,6 +215,19 @@ public function testClassnameWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Client'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php index db7a07e6915f..87ada0a8e9c2 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php @@ -249,18 +249,6 @@ public function addPetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -612,18 +600,6 @@ public function deletePetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -872,18 +848,6 @@ public function findPetsByStatusWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -915,6 +879,19 @@ public function findPetsByStatusWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet[]'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1201,18 +1178,6 @@ public function findPetsByTagsWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1244,6 +1209,19 @@ public function findPetsByTagsWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet[]'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1531,18 +1509,6 @@ public function getPetByIdWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1574,6 +1540,19 @@ public function getPetByIdWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1897,18 +1876,6 @@ public function updatePetWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2264,18 +2231,6 @@ public function updatePetWithFormWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2543,18 +2498,6 @@ public function uploadFileWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2586,6 +2529,19 @@ public function uploadFileWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\ApiResponse'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -2909,18 +2865,6 @@ public function uploadFileWithRequiredFileWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2952,6 +2896,19 @@ public function uploadFileWithRequiredFileWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\ApiResponse'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php index 43f26158e1a2..6d1bfda250ad 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php @@ -192,18 +192,6 @@ public function deleteOrderWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -433,18 +421,6 @@ public function getInventoryWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -476,6 +452,19 @@ public function getInventoryWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'array'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -739,18 +728,6 @@ public function getOrderByIdWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -782,6 +759,19 @@ public function getOrderByIdWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Order'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1067,18 +1057,6 @@ public function placeOrderWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1110,6 +1088,19 @@ public function placeOrderWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Order'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php index eb519f2feafc..82cfd01b6ed1 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php @@ -204,18 +204,6 @@ public function createUserWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -447,18 +435,6 @@ public function createUsersWithArrayInputWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -690,18 +666,6 @@ public function createUsersWithListInputWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -933,18 +897,6 @@ public function deleteUserWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -1178,18 +1130,6 @@ public function getUserByNameWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1221,6 +1161,19 @@ public function getUserByNameWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\User'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1504,18 +1457,6 @@ public function loginUserWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1547,6 +1488,19 @@ public function loginUserWithHttpInfo( ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { $content = $response->getBody(); //stream goes to serializer @@ -1844,18 +1798,6 @@ public function logoutUserWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2071,18 +2013,6 @@ public function updateUserWithHttpInfo( $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index f671e665594f..4866aac869c1 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -178,18 +178,6 @@ public function call123TestSpecialTagsWithHttpInfo($client, string $contentType $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -221,6 +209,19 @@ public function call123TestSpecialTagsWithHttpInfo($client, string $contentType ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Client'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index beb8ddb3f7d9..447fd757399a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -172,18 +172,6 @@ public function fooGetWithHttpInfo(string $contentType = self::contentTypes['foo $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { default: @@ -215,6 +203,19 @@ public function fooGetWithHttpInfo(string $contentType = self::contentTypes['foo ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index c39f19e0fc70..27f1cb010d76 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -236,18 +236,6 @@ public function fakeBigDecimalMapWithHttpInfo(string $contentType = self::conten $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -279,6 +267,19 @@ public function fakeBigDecimalMapWithHttpInfo(string $contentType = self::conten ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\FakeBigDecimalMap200Response'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -519,18 +520,6 @@ public function fakeHealthGetWithHttpInfo(string $contentType = self::contentTyp $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -562,6 +551,19 @@ public function fakeHealthGetWithHttpInfo(string $contentType = self::contentTyp ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\HealthCheckResult'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -811,18 +813,6 @@ public function fakeHttpSignatureTestWithHttpInfo($pet, $query_1 = null, $header $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -1057,18 +1047,6 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null, string $cont $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1100,6 +1078,19 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null, string $cont ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'bool'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1349,18 +1340,6 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null, $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1392,6 +1371,19 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null, ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\OuterComposite'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1641,18 +1633,6 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null, string $conte $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1684,6 +1664,19 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null, string $conte ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'float'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1933,18 +1926,6 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null, string $conte $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1976,6 +1957,19 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null, string $conte ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2225,18 +2219,6 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_ $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2268,6 +2250,19 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_ ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\OuterObjectWithEnumProperty'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2534,18 +2529,6 @@ public function getParameterNameMappingWithHttpInfo($underscore_type, $type, $ty $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2825,18 +2808,6 @@ public function testAdditionalPropertiesReferenceWithHttpInfo($request_body, str $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3049,18 +3020,6 @@ public function testBodyWithBinaryWithHttpInfo($body, string $contentType = self $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3269,18 +3228,6 @@ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class, stri $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3491,18 +3438,6 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user, string $conte $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -3735,18 +3670,6 @@ public function testClientModelWithHttpInfo($client, string $contentType = self: $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -3778,6 +3701,19 @@ public function testClientModelWithHttpInfo($client, string $contentType = self: ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Client'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4066,18 +4002,6 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -4480,18 +4404,6 @@ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -4805,18 +4717,6 @@ public function testGroupParametersWithHttpInfo($associative_array) $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5120,18 +5020,6 @@ public function testInlineAdditionalPropertiesWithHttpInfo($request_body, string $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5348,18 +5236,6 @@ public function testInlineFreeformAdditionalPropertiesWithHttpInfo($test_inline_ $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5578,18 +5454,6 @@ public function testJsonFormDataWithHttpInfo($param, $param2, string $contentTyp $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -5825,18 +5689,6 @@ public function testQueryParameterCollectionFormatWithHttpInfo($pipe, $ioutil, $ $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -6159,18 +6011,6 @@ public function testStringMapReferenceWithHttpInfo($request_body, string $conten $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 9179715876b3..3537e09c3f40 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -178,18 +178,6 @@ public function testClassnameWithHttpInfo($client, string $contentType = self::c $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -221,6 +209,19 @@ public function testClassnameWithHttpInfo($client, string $contentType = self::c ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Client'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 4e98ad23551b..d14beadefb1c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -239,18 +239,6 @@ public function addPetWithHttpInfo($pet, ?int $hostIndex = null, array $variable $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -579,18 +567,6 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null, string $contentT $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -821,18 +797,6 @@ public function findPetsByStatusWithHttpInfo($status, string $contentType = self $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -864,6 +828,19 @@ public function findPetsByStatusWithHttpInfo($status, string $contentType = self ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet[]'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1135,18 +1112,6 @@ public function findPetsByTagsWithHttpInfo($tags, string $contentType = self::co $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1178,6 +1143,19 @@ public function findPetsByTagsWithHttpInfo($tags, string $contentType = self::co ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet[]'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1450,18 +1428,6 @@ public function getPetByIdWithHttpInfo($pet_id, string $contentType = self::cont $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1493,6 +1459,19 @@ public function getPetByIdWithHttpInfo($pet_id, string $contentType = self::cont ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Pet'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1797,18 +1776,6 @@ public function updatePetWithHttpInfo($pet, ?int $hostIndex = null, array $varia $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2139,18 +2106,6 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -2393,18 +2348,6 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2436,6 +2379,19 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\ApiResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2732,18 +2688,6 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -2775,6 +2719,19 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\ApiResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 96376e959d9c..fa7e99292821 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -186,18 +186,6 @@ public function deleteOrderWithHttpInfo($order_id, string $contentType = self::c $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -414,18 +402,6 @@ public function getInventoryWithHttpInfo(string $contentType = self::contentType $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -457,6 +433,19 @@ public function getInventoryWithHttpInfo(string $contentType = self::contentType ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'array'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -708,18 +697,6 @@ public function getOrderByIdWithHttpInfo($order_id, string $contentType = self:: $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -751,6 +728,19 @@ public function getOrderByIdWithHttpInfo($order_id, string $contentType = self:: ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Order'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1021,18 +1011,6 @@ public function placeOrderWithHttpInfo($order, string $contentType = self::conte $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1064,6 +1042,19 @@ public function placeOrderWithHttpInfo($order, string $contentType = self::conte ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\Order'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 845025655d73..33136e741f4f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -198,18 +198,6 @@ public function createUserWithHttpInfo($user, string $contentType = self::conten $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -426,18 +414,6 @@ public function createUsersWithArrayInputWithHttpInfo($user, string $contentType $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -654,18 +630,6 @@ public function createUsersWithListInputWithHttpInfo($user, string $contentType $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -882,18 +846,6 @@ public function deleteUserWithHttpInfo($username, string $contentType = self::co $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -1112,18 +1064,6 @@ public function getUserByNameWithHttpInfo($username, string $contentType = self: $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1155,6 +1095,19 @@ public function getUserByNameWithHttpInfo($username, string $contentType = self: ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\OpenAPI\Client\Model\User'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1421,18 +1374,6 @@ public function loginUserWithHttpInfo($username, $password, string $contentType $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1464,6 +1405,19 @@ public function loginUserWithHttpInfo($username, $password, string $contentType ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = 'string'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,18 +1699,6 @@ public function logoutUserWithHttpInfo(string $contentType = self::contentTypes[ $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -1958,18 +1900,6 @@ public function updateUserWithHttpInfo($username, $user, string $contentType = s $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()];