diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java index e4c05b01189a..8c03ac89c670 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java @@ -105,6 +105,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("ApiException.mustache", toSrcPath(invokerPackage, srcBasePath), "ApiException.php")); supportingFiles.add(new SupportingFile("Configuration.mustache", toSrcPath(invokerPackage, srcBasePath), "Configuration.php")); + supportingFiles.add(new SupportingFile("ApiResponse.mustache", toSrcPath(invokerPackage, srcBasePath), "ApiResponse.php")); supportingFiles.add(new SupportingFile("ObjectSerializer.mustache", toSrcPath(invokerPackage, srcBasePath), "ObjectSerializer.php")); supportingFiles.add(new SupportingFile("ModelInterface.mustache", toSrcPath(modelPackage, srcBasePath), "ModelInterface.php")); supportingFiles.add(new SupportingFile("HeaderSelector.mustache", toSrcPath(invokerPackage, srcBasePath), "HeaderSelector.php")); diff --git a/modules/openapi-generator/src/main/resources/php/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/php/ApiResponse.mustache new file mode 100644 index 000000000000..b8e988469224 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php/ApiResponse.mustache @@ -0,0 +1,133 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +/** + * ApiResponse Class Doc Comment + * PHP version 5 + * + * @category Class + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class ApiResponse +{ + /** + * Message (response) from API call + * + * @var mixed + */ + protected $message; + /** + * Response status code + * + * @var int + */ + protected $statusCode; + /** + * Message headers + * + * @var string[] + */ + protected $headers; + + /** + * Constructor + * + * @param mixed $message Message (response) from API call + * @param int $statusCode Response status code + * @param string[] $headers Message headers + */ + public function __construct($message, $statusCode, $headers) + { + $this->message = $message; + $this->statusCode = $statusCode; + $this->headers = $headers; + } + + /** + * Sets message (response) from API call + * + * @param mixed $message Message (response) from API call + * + * @return $this + */ + public function setMessage($message) + { + $this->message = $message; + return $this; + } + + /** + * Gets message (response) from API call + * + * @return mixed Message (response) from API call + */ + public function getMessage() + { + return $this->message; + } + + /** + * Sets response status code + * + * @param int $statusCode Response status code + * + * @return $this + */ + public function setStatusCode($statusCode) + { + $this->statusCode = $statusCode; + return $this; + } + + /** + * Gets response status code + * + * @return int Response status code + */ + public function getStatusCode() + { + return $this->statusCode; + } + + /** + * Sets message headers + * + * @param string[] $headers Message headers + * + * @return $this + */ + public function setHeaders($headers) + { + $this->headers = $headers; + return $this; + } + + /** + * Gets message headers + * + * @return string[] Message headers + */ + public function getHeaders() + { + return $this->headers; + } +} diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 776ebc14207d..02b56b8d4c5d 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -25,6 +25,7 @@ use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use {{invokerPackage}}\ApiException; +use {{invokerPackage}}\ApiResponse; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\HeaderSelector; use {{invokerPackage}}\ObjectSerializer; @@ -99,12 +100,16 @@ use {{invokerPackage}}\ObjectSerializer; */ public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} - return $response;{{/returnType}} + {{#returnType}}$apiResponse = {{/returnType}}$this->{{operationId}}WithApiResponse({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + return $apiResponse->getMessage();{{/returnType}} } + /** * Operation {{{operationId}}}WithHttpInfo + * + * (method preserved to keep backward compatibility) + * {{#summary}} * * {{{summary}}} @@ -120,9 +125,41 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) + * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (strings[]) */ public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + $apiResponse = $this->{{operationId}}WithApiResponse({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation {{{operationId}}}WithApiResponse +{{#summary}} + * + * {{{summary}}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property {{#returnType}}of type {{{returnType}}}{{/returnType}}{{^returnType}}equals to null{{/returnType}} + */ + public function {{operationId}}WithApiResponse({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { $request = $this->{{operationId}}Request({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); @@ -171,11 +208,11 @@ use {{invokerPackage}}\ObjectSerializer; } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '{{dataType}}', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); {{/dataType}} {{#-last}} } @@ -193,15 +230,15 @@ use {{invokerPackage}}\ObjectSerializer; } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); {{/returnType}} {{^returnType}} - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); {{/returnType}} } catch (ApiException $e) { @@ -241,10 +278,10 @@ use {{invokerPackage}}\ObjectSerializer; */ public function {{operationId}}Async({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - return $this->{{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + return $this->{{operationId}}AsyncWithApiResponse({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -252,6 +289,8 @@ use {{invokerPackage}}\ObjectSerializer; /** * Operation {{{operationId}}}AsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * {{{summary}}} * {{#description}} @@ -267,13 +306,45 @@ use {{invokerPackage}}\ObjectSerializer; */ public function {{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { + return $this->{{operationId}}AsyncWithApiResponse({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation {{{operationId}}}AsyncWithApiResponse + * + * {{{summary}}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function {{operationId}}AsyncWithApiResponse({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + {{#returnType}} $returnType = '{{returnType}}'; + {{/returnType}} $request = $this->{{operationId}}Request({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response){{#returnType}} use ($returnType){{/returnType}} { {{#returnType}} $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { @@ -285,14 +356,14 @@ use {{invokerPackage}}\ObjectSerializer; } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); {{/returnType}} {{^returnType}} - return [null, $response->getStatusCode(), $response->getHeaders()]; + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); {{/returnType}} }, function ($exception) { 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 340735ea2733..38557d534742 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,22 +101,50 @@ public function getConfig() */ public function call123TestSpecialTags($client) { - list($response) = $this->call123TestSpecialTagsWithHttpInfo($client); - return $response; + $apiResponse = $this->call123TestSpecialTagsWithApiResponse($client); + return $apiResponse->getMessage(); } + /** * Operation call123TestSpecialTagsWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test special tags * * @param \OpenAPI\Client\Model\Client $client client model (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (strings[]) */ public function call123TestSpecialTagsWithHttpInfo($client) + { + $apiResponse = $this->call123TestSpecialTagsWithApiResponse($client); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation call123TestSpecialTagsWithApiResponse + * + * To test special tags + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Client + */ + public function call123TestSpecialTagsWithApiResponse($client) { $request = $this->call123TestSpecialTagsRequest($client); @@ -159,11 +188,11 @@ public function call123TestSpecialTagsWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Client'; @@ -177,11 +206,11 @@ public function call123TestSpecialTagsWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -210,10 +239,10 @@ public function call123TestSpecialTagsWithHttpInfo($client) */ public function call123TestSpecialTagsAsync($client) { - return $this->call123TestSpecialTagsAsyncWithHttpInfo($client) + return $this->call123TestSpecialTagsAsyncWithApiResponse($client) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -221,6 +250,8 @@ function ($response) { /** * Operation call123TestSpecialTagsAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test special tags * * @param \OpenAPI\Client\Model\Client $client client model (required) @@ -229,6 +260,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function call123TestSpecialTagsAsyncWithHttpInfo($client) + { + return $this->call123TestSpecialTagsAsyncWithApiResponse($client) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation call123TestSpecialTagsAsyncWithApiResponse + * + * To test special tags + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function call123TestSpecialTagsAsyncWithApiResponse($client) { $returnType = '\OpenAPI\Client\Model\Client'; $request = $this->call123TestSpecialTagsRequest($client); @@ -247,11 +302,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); 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 19a71919f262..5cde0f88371a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -98,20 +99,46 @@ public function getConfig() */ public function fakeOuterBooleanSerialize($body = null) { - list($response) = $this->fakeOuterBooleanSerializeWithHttpInfo($body); - return $response; + $apiResponse = $this->fakeOuterBooleanSerializeWithApiResponse($body); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterBooleanSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param bool $body Input boolean as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of bool, HTTP status code, HTTP response headers (array of strings) + * @return array of bool, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) + { + $apiResponse = $this->fakeOuterBooleanSerializeWithApiResponse($body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterBooleanSerializeWithApiResponse + * + * @param bool $body Input boolean as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type bool + */ + public function fakeOuterBooleanSerializeWithApiResponse($body = null) { $request = $this->fakeOuterBooleanSerializeRequest($body); @@ -155,11 +182,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'bool', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'bool'; @@ -173,11 +200,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -206,10 +233,10 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) */ public function fakeOuterBooleanSerializeAsync($body = null) { - return $this->fakeOuterBooleanSerializeAsyncWithHttpInfo($body) + return $this->fakeOuterBooleanSerializeAsyncWithApiResponse($body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -217,6 +244,8 @@ function ($response) { /** * Operation fakeOuterBooleanSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param bool $body Input boolean as post body (optional) @@ -225,6 +254,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterBooleanSerializeAsyncWithHttpInfo($body = null) + { + return $this->fakeOuterBooleanSerializeAsyncWithApiResponse($body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterBooleanSerializeAsyncWithApiResponse + * + * + * + * @param bool $body Input boolean as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterBooleanSerializeAsyncWithApiResponse($body = null) { $returnType = 'bool'; $request = $this->fakeOuterBooleanSerializeRequest($body); @@ -243,11 +296,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -364,20 +417,46 @@ protected function fakeOuterBooleanSerializeRequest($body = null) */ public function fakeOuterCompositeSerialize($outer_composite = null) { - list($response) = $this->fakeOuterCompositeSerializeWithHttpInfo($outer_composite); - return $response; + $apiResponse = $this->fakeOuterCompositeSerializeWithApiResponse($outer_composite); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterCompositeSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\OuterComposite, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\OuterComposite, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) + { + $apiResponse = $this->fakeOuterCompositeSerializeWithApiResponse($outer_composite); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterCompositeSerializeWithApiResponse + * + * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\OuterComposite + */ + public function fakeOuterCompositeSerializeWithApiResponse($outer_composite = null) { $request = $this->fakeOuterCompositeSerializeRequest($outer_composite); @@ -421,11 +500,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OuterComposite', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\OuterComposite'; @@ -439,11 +518,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -472,10 +551,10 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) */ public function fakeOuterCompositeSerializeAsync($outer_composite = null) { - return $this->fakeOuterCompositeSerializeAsyncWithHttpInfo($outer_composite) + return $this->fakeOuterCompositeSerializeAsyncWithApiResponse($outer_composite) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -483,6 +562,8 @@ function ($response) { /** * Operation fakeOuterCompositeSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) @@ -491,6 +572,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterCompositeSerializeAsyncWithHttpInfo($outer_composite = null) + { + return $this->fakeOuterCompositeSerializeAsyncWithApiResponse($outer_composite) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterCompositeSerializeAsyncWithApiResponse + * + * + * + * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterCompositeSerializeAsyncWithApiResponse($outer_composite = null) { $returnType = '\OpenAPI\Client\Model\OuterComposite'; $request = $this->fakeOuterCompositeSerializeRequest($outer_composite); @@ -509,11 +614,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -630,20 +735,46 @@ protected function fakeOuterCompositeSerializeRequest($outer_composite = null) */ public function fakeOuterNumberSerialize($body = null) { - list($response) = $this->fakeOuterNumberSerializeWithHttpInfo($body); - return $response; + $apiResponse = $this->fakeOuterNumberSerializeWithApiResponse($body); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterNumberSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param float $body Input number as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of float, HTTP status code, HTTP response headers (array of strings) + * @return array of float, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterNumberSerializeWithHttpInfo($body = null) + { + $apiResponse = $this->fakeOuterNumberSerializeWithApiResponse($body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterNumberSerializeWithApiResponse + * + * @param float $body Input number as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type float + */ + public function fakeOuterNumberSerializeWithApiResponse($body = null) { $request = $this->fakeOuterNumberSerializeRequest($body); @@ -687,11 +818,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'float', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'float'; @@ -705,11 +836,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -738,10 +869,10 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) */ public function fakeOuterNumberSerializeAsync($body = null) { - return $this->fakeOuterNumberSerializeAsyncWithHttpInfo($body) + return $this->fakeOuterNumberSerializeAsyncWithApiResponse($body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -749,6 +880,8 @@ function ($response) { /** * Operation fakeOuterNumberSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param float $body Input number as post body (optional) @@ -757,6 +890,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterNumberSerializeAsyncWithHttpInfo($body = null) + { + return $this->fakeOuterNumberSerializeAsyncWithApiResponse($body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterNumberSerializeAsyncWithApiResponse + * + * + * + * @param float $body Input number as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterNumberSerializeAsyncWithApiResponse($body = null) { $returnType = 'float'; $request = $this->fakeOuterNumberSerializeRequest($body); @@ -775,11 +932,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -896,20 +1053,46 @@ protected function fakeOuterNumberSerializeRequest($body = null) */ public function fakeOuterStringSerialize($body = null) { - list($response) = $this->fakeOuterStringSerializeWithHttpInfo($body); - return $response; + $apiResponse = $this->fakeOuterStringSerializeWithApiResponse($body); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterStringSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param string $body Input string as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of string, HTTP status code, HTTP response headers (array of strings) + * @return array of string, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterStringSerializeWithHttpInfo($body = null) + { + $apiResponse = $this->fakeOuterStringSerializeWithApiResponse($body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterStringSerializeWithApiResponse + * + * @param string $body Input string as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type string + */ + public function fakeOuterStringSerializeWithApiResponse($body = null) { $request = $this->fakeOuterStringSerializeRequest($body); @@ -953,11 +1136,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'string', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'string'; @@ -971,11 +1154,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1004,10 +1187,10 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) */ public function fakeOuterStringSerializeAsync($body = null) { - return $this->fakeOuterStringSerializeAsyncWithHttpInfo($body) + return $this->fakeOuterStringSerializeAsyncWithApiResponse($body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1015,6 +1198,8 @@ function ($response) { /** * Operation fakeOuterStringSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param string $body Input string as post body (optional) @@ -1023,6 +1208,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterStringSerializeAsyncWithHttpInfo($body = null) + { + return $this->fakeOuterStringSerializeAsyncWithApiResponse($body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterStringSerializeAsyncWithApiResponse + * + * + * + * @param string $body Input string as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterStringSerializeAsyncWithApiResponse($body = null) { $returnType = 'string'; $request = $this->fakeOuterStringSerializeRequest($body); @@ -1041,11 +1250,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1162,19 +1371,45 @@ protected function fakeOuterStringSerializeRequest($body = null) */ public function testBodyWithFileSchema($file_schema_test_class) { - $this->testBodyWithFileSchemaWithHttpInfo($file_schema_test_class); + $this->testBodyWithFileSchemaWithApiResponse($file_schema_test_class); } + /** * Operation testBodyWithFileSchemaWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class) + { + $apiResponse = $this->testBodyWithFileSchemaWithApiResponse($file_schema_test_class); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testBodyWithFileSchemaWithApiResponse + * + * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testBodyWithFileSchemaWithApiResponse($file_schema_test_class) { $request = $this->testBodyWithFileSchemaRequest($file_schema_test_class); @@ -1206,7 +1441,7 @@ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1227,10 +1462,10 @@ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class) */ public function testBodyWithFileSchemaAsync($file_schema_test_class) { - return $this->testBodyWithFileSchemaAsyncWithHttpInfo($file_schema_test_class) + return $this->testBodyWithFileSchemaAsyncWithApiResponse($file_schema_test_class) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1238,6 +1473,8 @@ function ($response) { /** * Operation testBodyWithFileSchemaAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) @@ -1247,14 +1484,37 @@ function ($response) { */ public function testBodyWithFileSchemaAsyncWithHttpInfo($file_schema_test_class) { - $returnType = ''; + return $this->testBodyWithFileSchemaAsyncWithApiResponse($file_schema_test_class) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testBodyWithFileSchemaAsyncWithApiResponse + * + * + * + * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testBodyWithFileSchemaAsyncWithApiResponse($file_schema_test_class) + { $request = $this->testBodyWithFileSchemaRequest($file_schema_test_class); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1378,20 +1638,47 @@ protected function testBodyWithFileSchemaRequest($file_schema_test_class) */ public function testBodyWithQueryParams($query, $user) { - $this->testBodyWithQueryParamsWithHttpInfo($query, $user); + $this->testBodyWithQueryParamsWithApiResponse($query, $user); } + /** * Operation testBodyWithQueryParamsWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param string $query (required) * @param \OpenAPI\Client\Model\User $user (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testBodyWithQueryParamsWithHttpInfo($query, $user) + { + $apiResponse = $this->testBodyWithQueryParamsWithApiResponse($query, $user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testBodyWithQueryParamsWithApiResponse + * + * @param string $query (required) + * @param \OpenAPI\Client\Model\User $user (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testBodyWithQueryParamsWithApiResponse($query, $user) { $request = $this->testBodyWithQueryParamsRequest($query, $user); @@ -1423,7 +1710,7 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1445,10 +1732,10 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user) */ public function testBodyWithQueryParamsAsync($query, $user) { - return $this->testBodyWithQueryParamsAsyncWithHttpInfo($query, $user) + return $this->testBodyWithQueryParamsAsyncWithApiResponse($query, $user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1456,6 +1743,8 @@ function ($response) { /** * Operation testBodyWithQueryParamsAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param string $query (required) @@ -1466,14 +1755,38 @@ function ($response) { */ public function testBodyWithQueryParamsAsyncWithHttpInfo($query, $user) { - $returnType = ''; + return $this->testBodyWithQueryParamsAsyncWithApiResponse($query, $user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testBodyWithQueryParamsAsyncWithApiResponse + * + * + * + * @param string $query (required) + * @param \OpenAPI\Client\Model\User $user (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testBodyWithQueryParamsAsyncWithApiResponse($query, $user) + { $request = $this->testBodyWithQueryParamsRequest($query, $user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1609,22 +1922,50 @@ protected function testBodyWithQueryParamsRequest($query, $user) */ public function testClientModel($client) { - list($response) = $this->testClientModelWithHttpInfo($client); - return $response; + $apiResponse = $this->testClientModelWithApiResponse($client); + return $apiResponse->getMessage(); } + /** * Operation testClientModelWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test \"client\" model * * @param \OpenAPI\Client\Model\Client $client client model (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (strings[]) */ public function testClientModelWithHttpInfo($client) + { + $apiResponse = $this->testClientModelWithApiResponse($client); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testClientModelWithApiResponse + * + * To test \"client\" model + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Client + */ + public function testClientModelWithApiResponse($client) { $request = $this->testClientModelRequest($client); @@ -1668,11 +2009,11 @@ public function testClientModelWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Client'; @@ -1686,11 +2027,11 @@ public function testClientModelWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1719,10 +2060,10 @@ public function testClientModelWithHttpInfo($client) */ public function testClientModelAsync($client) { - return $this->testClientModelAsyncWithHttpInfo($client) + return $this->testClientModelAsyncWithApiResponse($client) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1730,6 +2071,8 @@ function ($response) { /** * Operation testClientModelAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test \"client\" model * * @param \OpenAPI\Client\Model\Client $client client model (required) @@ -1738,6 +2081,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function testClientModelAsyncWithHttpInfo($client) + { + return $this->testClientModelAsyncWithApiResponse($client) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testClientModelAsyncWithApiResponse + * + * To test \"client\" model + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testClientModelAsyncWithApiResponse($client) { $returnType = '\OpenAPI\Client\Model\Client'; $request = $this->testClientModelRequest($client); @@ -1756,11 +2123,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1898,12 +2265,16 @@ protected function testClientModelRequest($client) */ public function testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - $this->testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); + $this->testEndpointParametersWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); } + /** * Operation testEndpointParametersWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param float $number None (required) @@ -1923,9 +2294,46 @@ public function testEndpointParameters($number, $double, $pattern_without_delimi * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + { + $apiResponse = $this->testEndpointParametersWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testEndpointParametersWithApiResponse + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param float $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $string None (optional) + * @param \SplFileObject $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @param string $callback None (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testEndpointParametersWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); @@ -1957,7 +2365,7 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1991,10 +2399,10 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi */ public function testEndpointParametersAsync($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - return $this->testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) + return $this->testEndpointParametersAsyncWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2002,6 +2410,8 @@ function ($response) { /** * Operation testEndpointParametersAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param float $number None (required) @@ -2024,14 +2434,50 @@ function ($response) { */ public function testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - $returnType = ''; + return $this->testEndpointParametersAsyncWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testEndpointParametersAsyncWithApiResponse + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param float $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $string None (optional) + * @param \SplFileObject $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @param string $callback None (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testEndpointParametersAsyncWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + { $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -2299,12 +2745,16 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with */ public function testEnumParameters($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { - $this->testEnumParametersWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); + $this->testEnumParametersWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); } + /** * Operation testEnumParametersWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test enum parameters * * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) @@ -2318,9 +2768,40 @@ public function testEnumParameters($enum_header_string_array = null, $enum_heade * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') + { + $apiResponse = $this->testEnumParametersWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testEnumParametersWithApiResponse + * + * To test enum parameters + * + * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) + * @param string $enum_header_string Header parameter enum test (string) (optional, default to '-efg') + * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) + * @param string $enum_query_string Query parameter enum test (string) (optional, default to '-efg') + * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional, default to '$') + * @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testEnumParametersWithApiResponse($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); @@ -2352,7 +2833,7 @@ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2380,10 +2861,10 @@ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, */ public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { - return $this->testEnumParametersAsyncWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string) + return $this->testEnumParametersAsyncWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2391,6 +2872,8 @@ function ($response) { /** * Operation testEnumParametersAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test enum parameters * * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) @@ -2407,14 +2890,44 @@ function ($response) { */ public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { - $returnType = ''; + return $this->testEnumParametersAsyncWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testEnumParametersAsyncWithApiResponse + * + * To test enum parameters + * + * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) + * @param string $enum_header_string Header parameter enum test (string) (optional, default to '-efg') + * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) + * @param string $enum_query_string Query parameter enum test (string) (optional, default to '-efg') + * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional, default to '$') + * @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testEnumParametersAsyncWithApiResponse($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') + { $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -2575,21 +3088,49 @@ protected function testEnumParametersRequest($enum_header_string_array = null, $ */ public function testInlineAdditionalProperties($request_body) { - $this->testInlineAdditionalPropertiesWithHttpInfo($request_body); + $this->testInlineAdditionalPropertiesWithApiResponse($request_body); } + /** * Operation testInlineAdditionalPropertiesWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * test inline additionalProperties * * @param map[string,string] $request_body request body (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testInlineAdditionalPropertiesWithHttpInfo($request_body) + { + $apiResponse = $this->testInlineAdditionalPropertiesWithApiResponse($request_body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testInlineAdditionalPropertiesWithApiResponse + * + * test inline additionalProperties + * + * @param map[string,string] $request_body request body (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testInlineAdditionalPropertiesWithApiResponse($request_body) { $request = $this->testInlineAdditionalPropertiesRequest($request_body); @@ -2621,7 +3162,7 @@ public function testInlineAdditionalPropertiesWithHttpInfo($request_body) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2642,10 +3183,10 @@ public function testInlineAdditionalPropertiesWithHttpInfo($request_body) */ public function testInlineAdditionalPropertiesAsync($request_body) { - return $this->testInlineAdditionalPropertiesAsyncWithHttpInfo($request_body) + return $this->testInlineAdditionalPropertiesAsyncWithApiResponse($request_body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2653,6 +3194,8 @@ function ($response) { /** * Operation testInlineAdditionalPropertiesAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * test inline additionalProperties * * @param map[string,string] $request_body request body (required) @@ -2662,14 +3205,37 @@ function ($response) { */ public function testInlineAdditionalPropertiesAsyncWithHttpInfo($request_body) { - $returnType = ''; + return $this->testInlineAdditionalPropertiesAsyncWithApiResponse($request_body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testInlineAdditionalPropertiesAsyncWithApiResponse + * + * test inline additionalProperties + * + * @param map[string,string] $request_body request body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInlineAdditionalPropertiesAsyncWithApiResponse($request_body) + { $request = $this->testInlineAdditionalPropertiesRequest($request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -2795,12 +3361,16 @@ protected function testInlineAdditionalPropertiesRequest($request_body) */ public function testJsonFormData($param, $param2) { - $this->testJsonFormDataWithHttpInfo($param, $param2); + $this->testJsonFormDataWithApiResponse($param, $param2); } + /** * Operation testJsonFormDataWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * test json serialization of form data * * @param string $param field1 (required) @@ -2808,9 +3378,34 @@ public function testJsonFormData($param, $param2) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testJsonFormDataWithHttpInfo($param, $param2) + { + $apiResponse = $this->testJsonFormDataWithApiResponse($param, $param2); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testJsonFormDataWithApiResponse + * + * test json serialization of form data + * + * @param string $param field1 (required) + * @param string $param2 field2 (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testJsonFormDataWithApiResponse($param, $param2) { $request = $this->testJsonFormDataRequest($param, $param2); @@ -2842,7 +3437,7 @@ public function testJsonFormDataWithHttpInfo($param, $param2) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2864,10 +3459,10 @@ public function testJsonFormDataWithHttpInfo($param, $param2) */ public function testJsonFormDataAsync($param, $param2) { - return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2) + return $this->testJsonFormDataAsyncWithApiResponse($param, $param2) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2875,6 +3470,8 @@ function ($response) { /** * Operation testJsonFormDataAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * test json serialization of form data * * @param string $param field1 (required) @@ -2885,14 +3482,38 @@ function ($response) { */ public function testJsonFormDataAsyncWithHttpInfo($param, $param2) { - $returnType = ''; + return $this->testJsonFormDataAsyncWithApiResponse($param, $param2) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testJsonFormDataAsyncWithApiResponse + * + * test json serialization of form data + * + * @param string $param field1 (required) + * @param string $param2 field2 (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testJsonFormDataAsyncWithApiResponse($param, $param2) + { $request = $this->testJsonFormDataRequest($param, $param2); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); 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 9c3d2ac45f5f..a6d4a47f3ad7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,22 +101,50 @@ public function getConfig() */ public function testClassname($client) { - list($response) = $this->testClassnameWithHttpInfo($client); - return $response; + $apiResponse = $this->testClassnameWithApiResponse($client); + return $apiResponse->getMessage(); } + /** * Operation testClassnameWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test class name in snake case * * @param \OpenAPI\Client\Model\Client $client client model (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (strings[]) */ public function testClassnameWithHttpInfo($client) + { + $apiResponse = $this->testClassnameWithApiResponse($client); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testClassnameWithApiResponse + * + * To test class name in snake case + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Client + */ + public function testClassnameWithApiResponse($client) { $request = $this->testClassnameRequest($client); @@ -159,11 +188,11 @@ public function testClassnameWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Client'; @@ -177,11 +206,11 @@ public function testClassnameWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -210,10 +239,10 @@ public function testClassnameWithHttpInfo($client) */ public function testClassnameAsync($client) { - return $this->testClassnameAsyncWithHttpInfo($client) + return $this->testClassnameAsyncWithApiResponse($client) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -221,6 +250,8 @@ function ($response) { /** * Operation testClassnameAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test class name in snake case * * @param \OpenAPI\Client\Model\Client $client client model (required) @@ -229,6 +260,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function testClassnameAsyncWithHttpInfo($client) + { + return $this->testClassnameAsyncWithApiResponse($client) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testClassnameAsyncWithApiResponse + * + * To test class name in snake case + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testClassnameAsyncWithApiResponse($client) { $returnType = '\OpenAPI\Client\Model\Client'; $request = $this->testClassnameRequest($client); @@ -247,11 +302,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); 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 15415530e639..ed1b707d322c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,21 +101,49 @@ public function getConfig() */ public function addPet($pet) { - $this->addPetWithHttpInfo($pet); + $this->addPetWithApiResponse($pet); } + /** * Operation addPetWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Add a new pet to the store * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function addPetWithHttpInfo($pet) + { + $apiResponse = $this->addPetWithApiResponse($pet); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation addPetWithApiResponse + * + * Add a new pet to the store + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function addPetWithApiResponse($pet) { $request = $this->addPetRequest($pet); @@ -146,7 +175,7 @@ public function addPetWithHttpInfo($pet) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -167,10 +196,10 @@ public function addPetWithHttpInfo($pet) */ public function addPetAsync($pet) { - return $this->addPetAsyncWithHttpInfo($pet) + return $this->addPetAsyncWithApiResponse($pet) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -178,6 +207,8 @@ function ($response) { /** * Operation addPetAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Add a new pet to the store * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) @@ -187,14 +218,37 @@ function ($response) { */ public function addPetAsyncWithHttpInfo($pet) { - $returnType = ''; + return $this->addPetAsyncWithApiResponse($pet) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation addPetAsyncWithApiResponse + * + * Add a new pet to the store + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addPetAsyncWithApiResponse($pet) + { $request = $this->addPetRequest($pet); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -324,12 +378,16 @@ protected function addPetRequest($pet) */ public function deletePet($pet_id, $api_key = null) { - $this->deletePetWithHttpInfo($pet_id, $api_key); + $this->deletePetWithApiResponse($pet_id, $api_key); } + /** * Operation deletePetWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Deletes a pet * * @param int $pet_id Pet id to delete (required) @@ -337,9 +395,34 @@ public function deletePet($pet_id, $api_key = null) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function deletePetWithHttpInfo($pet_id, $api_key = null) + { + $apiResponse = $this->deletePetWithApiResponse($pet_id, $api_key); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation deletePetWithApiResponse + * + * Deletes a pet + * + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function deletePetWithApiResponse($pet_id, $api_key = null) { $request = $this->deletePetRequest($pet_id, $api_key); @@ -371,7 +454,7 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -393,10 +476,10 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) */ public function deletePetAsync($pet_id, $api_key = null) { - return $this->deletePetAsyncWithHttpInfo($pet_id, $api_key) + return $this->deletePetAsyncWithApiResponse($pet_id, $api_key) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -404,6 +487,8 @@ function ($response) { /** * Operation deletePetAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Deletes a pet * * @param int $pet_id Pet id to delete (required) @@ -414,14 +499,38 @@ function ($response) { */ public function deletePetAsyncWithHttpInfo($pet_id, $api_key = null) { - $returnType = ''; + return $this->deletePetAsyncWithApiResponse($pet_id, $api_key) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation deletePetAsyncWithApiResponse + * + * Deletes a pet + * + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePetAsyncWithApiResponse($pet_id, $api_key = null) + { $request = $this->deletePetRequest($pet_id, $api_key); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -560,22 +669,50 @@ protected function deletePetRequest($pet_id, $api_key = null) */ public function findPetsByStatus($status) { - list($response) = $this->findPetsByStatusWithHttpInfo($status); - return $response; + $apiResponse = $this->findPetsByStatusWithApiResponse($status); + return $apiResponse->getMessage(); } + /** * Operation findPetsByStatusWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (strings[]) */ public function findPetsByStatusWithHttpInfo($status) + { + $apiResponse = $this->findPetsByStatusWithApiResponse($status); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation findPetsByStatusWithApiResponse + * + * Finds Pets by status + * + * @param string[] $status Status values that need to be considered for filter (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Pet[] + */ + public function findPetsByStatusWithApiResponse($status) { $request = $this->findPetsByStatusRequest($status); @@ -619,11 +756,11 @@ public function findPetsByStatusWithHttpInfo($status) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet[]', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Pet[]'; @@ -637,11 +774,11 @@ public function findPetsByStatusWithHttpInfo($status) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -670,10 +807,10 @@ public function findPetsByStatusWithHttpInfo($status) */ public function findPetsByStatusAsync($status) { - return $this->findPetsByStatusAsyncWithHttpInfo($status) + return $this->findPetsByStatusAsyncWithApiResponse($status) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -681,6 +818,8 @@ function ($response) { /** * Operation findPetsByStatusAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) @@ -689,6 +828,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function findPetsByStatusAsyncWithHttpInfo($status) + { + return $this->findPetsByStatusAsyncWithApiResponse($status) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation findPetsByStatusAsyncWithApiResponse + * + * Finds Pets by status + * + * @param string[] $status Status values that need to be considered for filter (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function findPetsByStatusAsyncWithApiResponse($status) { $returnType = '\OpenAPI\Client\Model\Pet[]'; $request = $this->findPetsByStatusRequest($status); @@ -707,11 +870,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -844,22 +1007,50 @@ protected function findPetsByStatusRequest($status) */ public function findPetsByTags($tags) { - list($response) = $this->findPetsByTagsWithHttpInfo($tags); - return $response; + $apiResponse = $this->findPetsByTagsWithApiResponse($tags); + return $apiResponse->getMessage(); } + /** * Operation findPetsByTagsWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (strings[]) */ public function findPetsByTagsWithHttpInfo($tags) + { + $apiResponse = $this->findPetsByTagsWithApiResponse($tags); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation findPetsByTagsWithApiResponse + * + * Finds Pets by tags + * + * @param string[] $tags Tags to filter by (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Pet[] + */ + public function findPetsByTagsWithApiResponse($tags) { $request = $this->findPetsByTagsRequest($tags); @@ -903,11 +1094,11 @@ public function findPetsByTagsWithHttpInfo($tags) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet[]', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Pet[]'; @@ -921,11 +1112,11 @@ public function findPetsByTagsWithHttpInfo($tags) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -954,10 +1145,10 @@ public function findPetsByTagsWithHttpInfo($tags) */ public function findPetsByTagsAsync($tags) { - return $this->findPetsByTagsAsyncWithHttpInfo($tags) + return $this->findPetsByTagsAsyncWithApiResponse($tags) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -965,6 +1156,8 @@ function ($response) { /** * Operation findPetsByTagsAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) @@ -973,6 +1166,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function findPetsByTagsAsyncWithHttpInfo($tags) + { + return $this->findPetsByTagsAsyncWithApiResponse($tags) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation findPetsByTagsAsyncWithApiResponse + * + * Finds Pets by tags + * + * @param string[] $tags Tags to filter by (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function findPetsByTagsAsyncWithApiResponse($tags) { $returnType = '\OpenAPI\Client\Model\Pet[]'; $request = $this->findPetsByTagsRequest($tags); @@ -991,11 +1208,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1128,22 +1345,50 @@ protected function findPetsByTagsRequest($tags) */ public function getPetById($pet_id) { - list($response) = $this->getPetByIdWithHttpInfo($pet_id); - return $response; + $apiResponse = $this->getPetByIdWithApiResponse($pet_id); + return $apiResponse->getMessage(); } + /** * Operation getPetByIdWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Find pet by ID * * @param int $pet_id ID of pet to return (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (strings[]) */ public function getPetByIdWithHttpInfo($pet_id) + { + $apiResponse = $this->getPetByIdWithApiResponse($pet_id); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getPetByIdWithApiResponse + * + * Find pet by ID + * + * @param int $pet_id ID of pet to return (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Pet + */ + public function getPetByIdWithApiResponse($pet_id) { $request = $this->getPetByIdRequest($pet_id); @@ -1187,11 +1432,11 @@ public function getPetByIdWithHttpInfo($pet_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Pet'; @@ -1205,11 +1450,11 @@ public function getPetByIdWithHttpInfo($pet_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1238,10 +1483,10 @@ public function getPetByIdWithHttpInfo($pet_id) */ public function getPetByIdAsync($pet_id) { - return $this->getPetByIdAsyncWithHttpInfo($pet_id) + return $this->getPetByIdAsyncWithApiResponse($pet_id) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1249,6 +1494,8 @@ function ($response) { /** * Operation getPetByIdAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Find pet by ID * * @param int $pet_id ID of pet to return (required) @@ -1257,6 +1504,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getPetByIdAsyncWithHttpInfo($pet_id) + { + return $this->getPetByIdAsyncWithApiResponse($pet_id) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getPetByIdAsyncWithApiResponse + * + * Find pet by ID + * + * @param int $pet_id ID of pet to return (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPetByIdAsyncWithApiResponse($pet_id) { $returnType = '\OpenAPI\Client\Model\Pet'; $request = $this->getPetByIdRequest($pet_id); @@ -1275,11 +1546,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1414,21 +1685,49 @@ protected function getPetByIdRequest($pet_id) */ public function updatePet($pet) { - $this->updatePetWithHttpInfo($pet); + $this->updatePetWithApiResponse($pet); } + /** * Operation updatePetWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Update an existing pet * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function updatePetWithHttpInfo($pet) + { + $apiResponse = $this->updatePetWithApiResponse($pet); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation updatePetWithApiResponse + * + * Update an existing pet + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function updatePetWithApiResponse($pet) { $request = $this->updatePetRequest($pet); @@ -1460,7 +1759,7 @@ public function updatePetWithHttpInfo($pet) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1481,10 +1780,10 @@ public function updatePetWithHttpInfo($pet) */ public function updatePetAsync($pet) { - return $this->updatePetAsyncWithHttpInfo($pet) + return $this->updatePetAsyncWithApiResponse($pet) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1492,6 +1791,8 @@ function ($response) { /** * Operation updatePetAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Update an existing pet * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) @@ -1501,14 +1802,37 @@ function ($response) { */ public function updatePetAsyncWithHttpInfo($pet) { - $returnType = ''; + return $this->updatePetAsyncWithApiResponse($pet) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation updatePetAsyncWithApiResponse + * + * Update an existing pet + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePetAsyncWithApiResponse($pet) + { $request = $this->updatePetRequest($pet); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1639,12 +1963,16 @@ protected function updatePetRequest($pet) */ public function updatePetWithForm($pet_id, $name = null, $status = null) { - $this->updatePetWithFormWithHttpInfo($pet_id, $name, $status); + $this->updatePetWithFormWithApiResponse($pet_id, $name, $status); } + /** * Operation updatePetWithFormWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) @@ -1653,9 +1981,35 @@ public function updatePetWithForm($pet_id, $name = null, $status = null) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = null) + { + $apiResponse = $this->updatePetWithFormWithApiResponse($pet_id, $name, $status); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation updatePetWithFormWithApiResponse + * + * Updates a pet in the store with form data + * + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function updatePetWithFormWithApiResponse($pet_id, $name = null, $status = null) { $request = $this->updatePetWithFormRequest($pet_id, $name, $status); @@ -1687,7 +2041,7 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1710,10 +2064,10 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n */ public function updatePetWithFormAsync($pet_id, $name = null, $status = null) { - return $this->updatePetWithFormAsyncWithHttpInfo($pet_id, $name, $status) + return $this->updatePetWithFormAsyncWithApiResponse($pet_id, $name, $status) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1721,6 +2075,8 @@ function ($response) { /** * Operation updatePetWithFormAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) @@ -1732,14 +2088,39 @@ function ($response) { */ public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $status = null) { - $returnType = ''; + return $this->updatePetWithFormAsyncWithApiResponse($pet_id, $name, $status) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation updatePetWithFormAsyncWithApiResponse + * + * Updates a pet in the store with form data + * + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePetWithFormAsyncWithApiResponse($pet_id, $name = null, $status = null) + { $request = $this->updatePetWithFormRequest($pet_id, $name, $status); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1885,13 +2266,17 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul */ public function uploadFile($pet_id, $additional_metadata = null, $file = null) { - list($response) = $this->uploadFileWithHttpInfo($pet_id, $additional_metadata, $file); - return $response; + $apiResponse = $this->uploadFileWithApiResponse($pet_id, $additional_metadata, $file); + return $apiResponse->getMessage(); } + /** * Operation uploadFileWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * uploads an image * * @param int $pet_id ID of pet to update (required) @@ -1900,9 +2285,35 @@ public function uploadFile($pet_id, $additional_metadata = null, $file = null) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (strings[]) */ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null) + { + $apiResponse = $this->uploadFileWithApiResponse($pet_id, $additional_metadata, $file); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation uploadFileWithApiResponse + * + * uploads an image + * + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\ApiResponse + */ + public function uploadFileWithApiResponse($pet_id, $additional_metadata = null, $file = null) { $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); @@ -1946,11 +2357,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApiResponse', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\ApiResponse'; @@ -1964,11 +2375,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1999,10 +2410,10 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi */ public function uploadFileAsync($pet_id, $additional_metadata = null, $file = null) { - return $this->uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata, $file) + return $this->uploadFileAsyncWithApiResponse($pet_id, $additional_metadata, $file) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2010,6 +2421,8 @@ function ($response) { /** * Operation uploadFileAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * uploads an image * * @param int $pet_id ID of pet to update (required) @@ -2020,6 +2433,32 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null, $file = null) + { + return $this->uploadFileAsyncWithApiResponse($pet_id, $additional_metadata, $file) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation uploadFileAsyncWithApiResponse + * + * uploads an image + * + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadFileAsyncWithApiResponse($pet_id, $additional_metadata = null, $file = null) { $returnType = '\OpenAPI\Client\Model\ApiResponse'; $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); @@ -2038,11 +2477,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -2189,13 +2628,17 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file */ public function uploadFileWithRequiredFile($pet_id, $required_file, $additional_metadata = null) { - list($response) = $this->uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $additional_metadata); - return $response; + $apiResponse = $this->uploadFileWithRequiredFileWithApiResponse($pet_id, $required_file, $additional_metadata); + return $apiResponse->getMessage(); } + /** * Operation uploadFileWithRequiredFileWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * uploads an image (required) * * @param int $pet_id ID of pet to update (required) @@ -2204,9 +2647,35 @@ public function uploadFileWithRequiredFile($pet_id, $required_file, $additional_ * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (strings[]) */ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $additional_metadata = null) + { + $apiResponse = $this->uploadFileWithRequiredFileWithApiResponse($pet_id, $required_file, $additional_metadata); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation uploadFileWithRequiredFileWithApiResponse + * + * uploads an image (required) + * + * @param int $pet_id ID of pet to update (required) + * @param \SplFileObject $required_file file to upload (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\ApiResponse + */ + public function uploadFileWithRequiredFileWithApiResponse($pet_id, $required_file, $additional_metadata = null) { $request = $this->uploadFileWithRequiredFileRequest($pet_id, $required_file, $additional_metadata); @@ -2250,11 +2719,11 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApiResponse', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\ApiResponse'; @@ -2268,11 +2737,11 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2303,10 +2772,10 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, */ public function uploadFileWithRequiredFileAsync($pet_id, $required_file, $additional_metadata = null) { - return $this->uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $required_file, $additional_metadata) + return $this->uploadFileWithRequiredFileAsyncWithApiResponse($pet_id, $required_file, $additional_metadata) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2314,6 +2783,8 @@ function ($response) { /** * Operation uploadFileWithRequiredFileAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * uploads an image (required) * * @param int $pet_id ID of pet to update (required) @@ -2324,6 +2795,32 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $required_file, $additional_metadata = null) + { + return $this->uploadFileWithRequiredFileAsyncWithApiResponse($pet_id, $required_file, $additional_metadata) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation uploadFileWithRequiredFileAsyncWithApiResponse + * + * uploads an image (required) + * + * @param int $pet_id ID of pet to update (required) + * @param \SplFileObject $required_file file to upload (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadFileWithRequiredFileAsyncWithApiResponse($pet_id, $required_file, $additional_metadata = null) { $returnType = '\OpenAPI\Client\Model\ApiResponse'; $request = $this->uploadFileWithRequiredFileRequest($pet_id, $required_file, $additional_metadata); @@ -2342,11 +2839,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); 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 fe5168429be2..061eabeb859b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,21 +101,49 @@ public function getConfig() */ public function deleteOrder($order_id) { - $this->deleteOrderWithHttpInfo($order_id); + $this->deleteOrderWithApiResponse($order_id); } + /** * Operation deleteOrderWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function deleteOrderWithHttpInfo($order_id) + { + $apiResponse = $this->deleteOrderWithApiResponse($order_id); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation deleteOrderWithApiResponse + * + * Delete purchase order by ID + * + * @param string $order_id ID of the order that needs to be deleted (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function deleteOrderWithApiResponse($order_id) { $request = $this->deleteOrderRequest($order_id); @@ -146,7 +175,7 @@ public function deleteOrderWithHttpInfo($order_id) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -167,10 +196,10 @@ public function deleteOrderWithHttpInfo($order_id) */ public function deleteOrderAsync($order_id) { - return $this->deleteOrderAsyncWithHttpInfo($order_id) + return $this->deleteOrderAsyncWithApiResponse($order_id) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -178,6 +207,8 @@ function ($response) { /** * Operation deleteOrderAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) @@ -187,14 +218,37 @@ function ($response) { */ public function deleteOrderAsyncWithHttpInfo($order_id) { - $returnType = ''; + return $this->deleteOrderAsyncWithApiResponse($order_id) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation deleteOrderAsyncWithApiResponse + * + * Delete purchase order by ID + * + * @param string $order_id ID of the order that needs to be deleted (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteOrderAsyncWithApiResponse($order_id) + { $request = $this->deleteOrderRequest($order_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -323,21 +377,48 @@ protected function deleteOrderRequest($order_id) */ public function getInventory() { - list($response) = $this->getInventoryWithHttpInfo(); - return $response; + $apiResponse = $this->getInventoryWithApiResponse(); + return $apiResponse->getMessage(); } + /** * Operation getInventoryWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Returns pet inventories by status * * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of map[string,int], HTTP status code, HTTP response headers (array of strings) + * @return array of map[string,int], HTTP status code, HTTP response headers (strings[]) */ public function getInventoryWithHttpInfo() + { + $apiResponse = $this->getInventoryWithApiResponse(); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getInventoryWithApiResponse + * + * Returns pet inventories by status + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type map[string,int] + */ + public function getInventoryWithApiResponse() { $request = $this->getInventoryRequest(); @@ -381,11 +462,11 @@ public function getInventoryWithHttpInfo() } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'map[string,int]', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'map[string,int]'; @@ -399,11 +480,11 @@ public function getInventoryWithHttpInfo() } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -431,10 +512,10 @@ public function getInventoryWithHttpInfo() */ public function getInventoryAsync() { - return $this->getInventoryAsyncWithHttpInfo() + return $this->getInventoryAsyncWithApiResponse() ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -442,6 +523,8 @@ function ($response) { /** * Operation getInventoryAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Returns pet inventories by status * * @@ -449,6 +532,29 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getInventoryAsyncWithHttpInfo() + { + return $this->getInventoryAsyncWithApiResponse() + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getInventoryAsyncWithApiResponse + * + * Returns pet inventories by status + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInventoryAsyncWithApiResponse() { $returnType = 'map[string,int]'; $request = $this->getInventoryRequest(); @@ -467,11 +573,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -591,22 +697,50 @@ protected function getInventoryRequest() */ public function getOrderById($order_id) { - list($response) = $this->getOrderByIdWithHttpInfo($order_id); - return $response; + $apiResponse = $this->getOrderByIdWithApiResponse($order_id); + return $apiResponse->getMessage(); } + /** * Operation getOrderByIdWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (strings[]) */ public function getOrderByIdWithHttpInfo($order_id) + { + $apiResponse = $this->getOrderByIdWithApiResponse($order_id); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getOrderByIdWithApiResponse + * + * Find purchase order by ID + * + * @param int $order_id ID of pet that needs to be fetched (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Order + */ + public function getOrderByIdWithApiResponse($order_id) { $request = $this->getOrderByIdRequest($order_id); @@ -650,11 +784,11 @@ public function getOrderByIdWithHttpInfo($order_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Order', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Order'; @@ -668,11 +802,11 @@ public function getOrderByIdWithHttpInfo($order_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -701,10 +835,10 @@ public function getOrderByIdWithHttpInfo($order_id) */ public function getOrderByIdAsync($order_id) { - return $this->getOrderByIdAsyncWithHttpInfo($order_id) + return $this->getOrderByIdAsyncWithApiResponse($order_id) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -712,6 +846,8 @@ function ($response) { /** * Operation getOrderByIdAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) @@ -720,6 +856,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getOrderByIdAsyncWithHttpInfo($order_id) + { + return $this->getOrderByIdAsyncWithApiResponse($order_id) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getOrderByIdAsyncWithApiResponse + * + * Find purchase order by ID + * + * @param int $order_id ID of pet that needs to be fetched (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrderByIdAsyncWithApiResponse($order_id) { $returnType = '\OpenAPI\Client\Model\Order'; $request = $this->getOrderByIdRequest($order_id); @@ -738,11 +898,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -879,22 +1039,50 @@ protected function getOrderByIdRequest($order_id) */ public function placeOrder($order) { - list($response) = $this->placeOrderWithHttpInfo($order); - return $response; + $apiResponse = $this->placeOrderWithApiResponse($order); + return $apiResponse->getMessage(); } + /** * Operation placeOrderWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Place an order for a pet * * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (strings[]) */ public function placeOrderWithHttpInfo($order) + { + $apiResponse = $this->placeOrderWithApiResponse($order); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation placeOrderWithApiResponse + * + * Place an order for a pet + * + * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Order + */ + public function placeOrderWithApiResponse($order) { $request = $this->placeOrderRequest($order); @@ -938,11 +1126,11 @@ public function placeOrderWithHttpInfo($order) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Order', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Order'; @@ -956,11 +1144,11 @@ public function placeOrderWithHttpInfo($order) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -989,10 +1177,10 @@ public function placeOrderWithHttpInfo($order) */ public function placeOrderAsync($order) { - return $this->placeOrderAsyncWithHttpInfo($order) + return $this->placeOrderAsyncWithApiResponse($order) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1000,6 +1188,8 @@ function ($response) { /** * Operation placeOrderAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Place an order for a pet * * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) @@ -1008,6 +1198,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function placeOrderAsyncWithHttpInfo($order) + { + return $this->placeOrderAsyncWithApiResponse($order) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation placeOrderAsyncWithApiResponse + * + * Place an order for a pet + * + * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function placeOrderAsyncWithApiResponse($order) { $returnType = '\OpenAPI\Client\Model\Order'; $request = $this->placeOrderRequest($order); @@ -1026,11 +1240,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); 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 43a301ebafdb..9dc1c0be2005 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,21 +101,49 @@ public function getConfig() */ public function createUser($user) { - $this->createUserWithHttpInfo($user); + $this->createUserWithApiResponse($user); } + /** * Operation createUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Create user * * @param \OpenAPI\Client\Model\User $user Created user object (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function createUserWithHttpInfo($user) + { + $apiResponse = $this->createUserWithApiResponse($user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation createUserWithApiResponse + * + * Create user + * + * @param \OpenAPI\Client\Model\User $user Created user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function createUserWithApiResponse($user) { $request = $this->createUserRequest($user); @@ -146,7 +175,7 @@ public function createUserWithHttpInfo($user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -167,10 +196,10 @@ public function createUserWithHttpInfo($user) */ public function createUserAsync($user) { - return $this->createUserAsyncWithHttpInfo($user) + return $this->createUserAsyncWithApiResponse($user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -178,6 +207,8 @@ function ($response) { /** * Operation createUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Create user * * @param \OpenAPI\Client\Model\User $user Created user object (required) @@ -187,14 +218,37 @@ function ($response) { */ public function createUserAsyncWithHttpInfo($user) { - $returnType = ''; + return $this->createUserAsyncWithApiResponse($user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation createUserAsyncWithApiResponse + * + * Create user + * + * @param \OpenAPI\Client\Model\User $user Created user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createUserAsyncWithApiResponse($user) + { $request = $this->createUserRequest($user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -319,21 +373,49 @@ protected function createUserRequest($user) */ public function createUsersWithArrayInput($user) { - $this->createUsersWithArrayInputWithHttpInfo($user); + $this->createUsersWithArrayInputWithApiResponse($user); } + /** * Operation createUsersWithArrayInputWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function createUsersWithArrayInputWithHttpInfo($user) + { + $apiResponse = $this->createUsersWithArrayInputWithApiResponse($user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation createUsersWithArrayInputWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function createUsersWithArrayInputWithApiResponse($user) { $request = $this->createUsersWithArrayInputRequest($user); @@ -365,7 +447,7 @@ public function createUsersWithArrayInputWithHttpInfo($user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -386,10 +468,10 @@ public function createUsersWithArrayInputWithHttpInfo($user) */ public function createUsersWithArrayInputAsync($user) { - return $this->createUsersWithArrayInputAsyncWithHttpInfo($user) + return $this->createUsersWithArrayInputAsyncWithApiResponse($user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -397,6 +479,8 @@ function ($response) { /** * Operation createUsersWithArrayInputAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) @@ -406,14 +490,37 @@ function ($response) { */ public function createUsersWithArrayInputAsyncWithHttpInfo($user) { - $returnType = ''; + return $this->createUsersWithArrayInputAsyncWithApiResponse($user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation createUsersWithArrayInputAsyncWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createUsersWithArrayInputAsyncWithApiResponse($user) + { $request = $this->createUsersWithArrayInputRequest($user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -538,21 +645,49 @@ protected function createUsersWithArrayInputRequest($user) */ public function createUsersWithListInput($user) { - $this->createUsersWithListInputWithHttpInfo($user); + $this->createUsersWithListInputWithApiResponse($user); } + /** * Operation createUsersWithListInputWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function createUsersWithListInputWithHttpInfo($user) + { + $apiResponse = $this->createUsersWithListInputWithApiResponse($user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation createUsersWithListInputWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function createUsersWithListInputWithApiResponse($user) { $request = $this->createUsersWithListInputRequest($user); @@ -584,7 +719,7 @@ public function createUsersWithListInputWithHttpInfo($user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -605,10 +740,10 @@ public function createUsersWithListInputWithHttpInfo($user) */ public function createUsersWithListInputAsync($user) { - return $this->createUsersWithListInputAsyncWithHttpInfo($user) + return $this->createUsersWithListInputAsyncWithApiResponse($user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -616,6 +751,8 @@ function ($response) { /** * Operation createUsersWithListInputAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) @@ -625,14 +762,37 @@ function ($response) { */ public function createUsersWithListInputAsyncWithHttpInfo($user) { - $returnType = ''; + return $this->createUsersWithListInputAsyncWithApiResponse($user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation createUsersWithListInputAsyncWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createUsersWithListInputAsyncWithApiResponse($user) + { $request = $this->createUsersWithListInputRequest($user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -757,21 +917,49 @@ protected function createUsersWithListInputRequest($user) */ public function deleteUser($username) { - $this->deleteUserWithHttpInfo($username); + $this->deleteUserWithApiResponse($username); } + /** * Operation deleteUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Delete user * * @param string $username The name that needs to be deleted (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function deleteUserWithHttpInfo($username) + { + $apiResponse = $this->deleteUserWithApiResponse($username); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation deleteUserWithApiResponse + * + * Delete user + * + * @param string $username The name that needs to be deleted (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function deleteUserWithApiResponse($username) { $request = $this->deleteUserRequest($username); @@ -803,7 +991,7 @@ public function deleteUserWithHttpInfo($username) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -824,10 +1012,10 @@ public function deleteUserWithHttpInfo($username) */ public function deleteUserAsync($username) { - return $this->deleteUserAsyncWithHttpInfo($username) + return $this->deleteUserAsyncWithApiResponse($username) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -835,6 +1023,8 @@ function ($response) { /** * Operation deleteUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Delete user * * @param string $username The name that needs to be deleted (required) @@ -844,14 +1034,37 @@ function ($response) { */ public function deleteUserAsyncWithHttpInfo($username) { - $returnType = ''; + return $this->deleteUserAsyncWithApiResponse($username) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation deleteUserAsyncWithApiResponse + * + * Delete user + * + * @param string $username The name that needs to be deleted (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteUserAsyncWithApiResponse($username) + { $request = $this->deleteUserRequest($username); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -981,22 +1194,50 @@ protected function deleteUserRequest($username) */ public function getUserByName($username) { - list($response) = $this->getUserByNameWithHttpInfo($username); - return $response; + $apiResponse = $this->getUserByNameWithApiResponse($username); + return $apiResponse->getMessage(); } + /** * Operation getUserByNameWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (strings[]) */ public function getUserByNameWithHttpInfo($username) + { + $apiResponse = $this->getUserByNameWithApiResponse($username); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getUserByNameWithApiResponse + * + * Get user by user name + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\User + */ + public function getUserByNameWithApiResponse($username) { $request = $this->getUserByNameRequest($username); @@ -1040,11 +1281,11 @@ public function getUserByNameWithHttpInfo($username) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\User', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\User'; @@ -1058,11 +1299,11 @@ public function getUserByNameWithHttpInfo($username) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1091,10 +1332,10 @@ public function getUserByNameWithHttpInfo($username) */ public function getUserByNameAsync($username) { - return $this->getUserByNameAsyncWithHttpInfo($username) + return $this->getUserByNameAsyncWithApiResponse($username) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1102,6 +1343,8 @@ function ($response) { /** * Operation getUserByNameAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) @@ -1110,6 +1353,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getUserByNameAsyncWithHttpInfo($username) + { + return $this->getUserByNameAsyncWithApiResponse($username) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getUserByNameAsyncWithApiResponse + * + * Get user by user name + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUserByNameAsyncWithApiResponse($username) { $returnType = '\OpenAPI\Client\Model\User'; $request = $this->getUserByNameRequest($username); @@ -1128,11 +1395,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1263,13 +1530,17 @@ protected function getUserByNameRequest($username) */ public function loginUser($username, $password) { - list($response) = $this->loginUserWithHttpInfo($username, $password); - return $response; + $apiResponse = $this->loginUserWithApiResponse($username, $password); + return $apiResponse->getMessage(); } + /** * Operation loginUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Logs user into the system * * @param string $username The user name for login (required) @@ -1277,9 +1548,34 @@ public function loginUser($username, $password) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of string, HTTP status code, HTTP response headers (array of strings) + * @return array of string, HTTP status code, HTTP response headers (strings[]) */ public function loginUserWithHttpInfo($username, $password) + { + $apiResponse = $this->loginUserWithApiResponse($username, $password); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation loginUserWithApiResponse + * + * Logs user into the system + * + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type string + */ + public function loginUserWithApiResponse($username, $password) { $request = $this->loginUserRequest($username, $password); @@ -1323,11 +1619,11 @@ public function loginUserWithHttpInfo($username, $password) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'string', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'string'; @@ -1341,11 +1637,11 @@ public function loginUserWithHttpInfo($username, $password) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1375,10 +1671,10 @@ public function loginUserWithHttpInfo($username, $password) */ public function loginUserAsync($username, $password) { - return $this->loginUserAsyncWithHttpInfo($username, $password) + return $this->loginUserAsyncWithApiResponse($username, $password) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1386,6 +1682,8 @@ function ($response) { /** * Operation loginUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Logs user into the system * * @param string $username The user name for login (required) @@ -1395,6 +1693,31 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function loginUserAsyncWithHttpInfo($username, $password) + { + return $this->loginUserAsyncWithApiResponse($username, $password) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation loginUserAsyncWithApiResponse + * + * Logs user into the system + * + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function loginUserAsyncWithApiResponse($username, $password) { $returnType = 'string'; $request = $this->loginUserRequest($username, $password); @@ -1413,11 +1736,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1553,20 +1876,47 @@ protected function loginUserRequest($username, $password) */ public function logoutUser() { - $this->logoutUserWithHttpInfo(); + $this->logoutUserWithApiResponse(); } + /** * Operation logoutUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Logs out current logged in user session * * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function logoutUserWithHttpInfo() + { + $apiResponse = $this->logoutUserWithApiResponse(); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation logoutUserWithApiResponse + * + * Logs out current logged in user session + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function logoutUserWithApiResponse() { $request = $this->logoutUserRequest(); @@ -1598,7 +1948,7 @@ public function logoutUserWithHttpInfo() ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1618,10 +1968,10 @@ public function logoutUserWithHttpInfo() */ public function logoutUserAsync() { - return $this->logoutUserAsyncWithHttpInfo() + return $this->logoutUserAsyncWithApiResponse() ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1629,6 +1979,8 @@ function ($response) { /** * Operation logoutUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Logs out current logged in user session * * @@ -1637,14 +1989,36 @@ function ($response) { */ public function logoutUserAsyncWithHttpInfo() { - $returnType = ''; + return $this->logoutUserAsyncWithApiResponse() + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation logoutUserAsyncWithApiResponse + * + * Logs out current logged in user session + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function logoutUserAsyncWithApiResponse() + { $request = $this->logoutUserRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1760,12 +2134,16 @@ protected function logoutUserRequest() */ public function updateUser($username, $user) { - $this->updateUserWithHttpInfo($username, $user); + $this->updateUserWithApiResponse($username, $user); } + /** * Operation updateUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Updated user * * @param string $username name that need to be deleted (required) @@ -1773,9 +2151,34 @@ public function updateUser($username, $user) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function updateUserWithHttpInfo($username, $user) + { + $apiResponse = $this->updateUserWithApiResponse($username, $user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation updateUserWithApiResponse + * + * Updated user + * + * @param string $username name that need to be deleted (required) + * @param \OpenAPI\Client\Model\User $user Updated user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function updateUserWithApiResponse($username, $user) { $request = $this->updateUserRequest($username, $user); @@ -1807,7 +2210,7 @@ public function updateUserWithHttpInfo($username, $user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1829,10 +2232,10 @@ public function updateUserWithHttpInfo($username, $user) */ public function updateUserAsync($username, $user) { - return $this->updateUserAsyncWithHttpInfo($username, $user) + return $this->updateUserAsyncWithApiResponse($username, $user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1840,6 +2243,8 @@ function ($response) { /** * Operation updateUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Updated user * * @param string $username name that need to be deleted (required) @@ -1850,14 +2255,38 @@ function ($response) { */ public function updateUserAsyncWithHttpInfo($username, $user) { - $returnType = ''; + return $this->updateUserAsyncWithApiResponse($username, $user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation updateUserAsyncWithApiResponse + * + * Updated user + * + * @param string $username name that need to be deleted (required) + * @param \OpenAPI\Client\Model\User $user Updated user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateUserAsyncWithApiResponse($username, $user) + { $request = $this->updateUserRequest($username, $user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ApiResponse.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ApiResponse.php new file mode 100644 index 000000000000..52fcccc3f800 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ApiResponse.php @@ -0,0 +1,143 @@ +message = $message; + $this->statusCode = $statusCode; + $this->headers = $headers; + } + + /** + * Sets message (response) from API call + * + * @param mixed $message Message (response) from API call + * + * @return $this + */ + public function setMessage($message) + { + $this->message = $message; + return $this; + } + + /** + * Gets message (response) from API call + * + * @return mixed Message (response) from API call + */ + public function getMessage() + { + return $this->message; + } + + /** + * Sets response status code + * + * @param int $statusCode Response status code + * + * @return $this + */ + public function setStatusCode($statusCode) + { + $this->statusCode = $statusCode; + return $this; + } + + /** + * Gets response status code + * + * @return int Response status code + */ + public function getStatusCode() + { + return $this->statusCode; + } + + /** + * Sets message headers + * + * @param string[] $headers Message headers + * + * @return $this + */ + public function setHeaders($headers) + { + $this->headers = $headers; + return $this; + } + + /** + * Gets message headers + * + * @return string[] Message headers + */ + public function getHeaders() + { + return $this->headers; + } +} diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 340735ea2733..38557d534742 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,22 +101,50 @@ public function getConfig() */ public function call123TestSpecialTags($client) { - list($response) = $this->call123TestSpecialTagsWithHttpInfo($client); - return $response; + $apiResponse = $this->call123TestSpecialTagsWithApiResponse($client); + return $apiResponse->getMessage(); } + /** * Operation call123TestSpecialTagsWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test special tags * * @param \OpenAPI\Client\Model\Client $client client model (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (strings[]) */ public function call123TestSpecialTagsWithHttpInfo($client) + { + $apiResponse = $this->call123TestSpecialTagsWithApiResponse($client); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation call123TestSpecialTagsWithApiResponse + * + * To test special tags + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Client + */ + public function call123TestSpecialTagsWithApiResponse($client) { $request = $this->call123TestSpecialTagsRequest($client); @@ -159,11 +188,11 @@ public function call123TestSpecialTagsWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Client'; @@ -177,11 +206,11 @@ public function call123TestSpecialTagsWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -210,10 +239,10 @@ public function call123TestSpecialTagsWithHttpInfo($client) */ public function call123TestSpecialTagsAsync($client) { - return $this->call123TestSpecialTagsAsyncWithHttpInfo($client) + return $this->call123TestSpecialTagsAsyncWithApiResponse($client) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -221,6 +250,8 @@ function ($response) { /** * Operation call123TestSpecialTagsAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test special tags * * @param \OpenAPI\Client\Model\Client $client client model (required) @@ -229,6 +260,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function call123TestSpecialTagsAsyncWithHttpInfo($client) + { + return $this->call123TestSpecialTagsAsyncWithApiResponse($client) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation call123TestSpecialTagsAsyncWithApiResponse + * + * To test special tags + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function call123TestSpecialTagsAsyncWithApiResponse($client) { $returnType = '\OpenAPI\Client\Model\Client'; $request = $this->call123TestSpecialTagsRequest($client); @@ -247,11 +302,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 336312fdeb53..fcfacb89bbb3 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -98,20 +99,46 @@ public function getConfig() */ public function fakeOuterBooleanSerialize($body = null) { - list($response) = $this->fakeOuterBooleanSerializeWithHttpInfo($body); - return $response; + $apiResponse = $this->fakeOuterBooleanSerializeWithApiResponse($body); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterBooleanSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param bool $body Input boolean as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of bool, HTTP status code, HTTP response headers (array of strings) + * @return array of bool, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) + { + $apiResponse = $this->fakeOuterBooleanSerializeWithApiResponse($body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterBooleanSerializeWithApiResponse + * + * @param bool $body Input boolean as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type bool + */ + public function fakeOuterBooleanSerializeWithApiResponse($body = null) { $request = $this->fakeOuterBooleanSerializeRequest($body); @@ -155,11 +182,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'bool', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'bool'; @@ -173,11 +200,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -206,10 +233,10 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) */ public function fakeOuterBooleanSerializeAsync($body = null) { - return $this->fakeOuterBooleanSerializeAsyncWithHttpInfo($body) + return $this->fakeOuterBooleanSerializeAsyncWithApiResponse($body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -217,6 +244,8 @@ function ($response) { /** * Operation fakeOuterBooleanSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param bool $body Input boolean as post body (optional) @@ -225,6 +254,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterBooleanSerializeAsyncWithHttpInfo($body = null) + { + return $this->fakeOuterBooleanSerializeAsyncWithApiResponse($body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterBooleanSerializeAsyncWithApiResponse + * + * + * + * @param bool $body Input boolean as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterBooleanSerializeAsyncWithApiResponse($body = null) { $returnType = 'bool'; $request = $this->fakeOuterBooleanSerializeRequest($body); @@ -243,11 +296,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -364,20 +417,46 @@ protected function fakeOuterBooleanSerializeRequest($body = null) */ public function fakeOuterCompositeSerialize($outer_composite = null) { - list($response) = $this->fakeOuterCompositeSerializeWithHttpInfo($outer_composite); - return $response; + $apiResponse = $this->fakeOuterCompositeSerializeWithApiResponse($outer_composite); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterCompositeSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\OuterComposite, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\OuterComposite, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) + { + $apiResponse = $this->fakeOuterCompositeSerializeWithApiResponse($outer_composite); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterCompositeSerializeWithApiResponse + * + * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\OuterComposite + */ + public function fakeOuterCompositeSerializeWithApiResponse($outer_composite = null) { $request = $this->fakeOuterCompositeSerializeRequest($outer_composite); @@ -421,11 +500,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OuterComposite', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\OuterComposite'; @@ -439,11 +518,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -472,10 +551,10 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) */ public function fakeOuterCompositeSerializeAsync($outer_composite = null) { - return $this->fakeOuterCompositeSerializeAsyncWithHttpInfo($outer_composite) + return $this->fakeOuterCompositeSerializeAsyncWithApiResponse($outer_composite) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -483,6 +562,8 @@ function ($response) { /** * Operation fakeOuterCompositeSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) @@ -491,6 +572,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterCompositeSerializeAsyncWithHttpInfo($outer_composite = null) + { + return $this->fakeOuterCompositeSerializeAsyncWithApiResponse($outer_composite) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterCompositeSerializeAsyncWithApiResponse + * + * + * + * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterCompositeSerializeAsyncWithApiResponse($outer_composite = null) { $returnType = '\OpenAPI\Client\Model\OuterComposite'; $request = $this->fakeOuterCompositeSerializeRequest($outer_composite); @@ -509,11 +614,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -630,20 +735,46 @@ protected function fakeOuterCompositeSerializeRequest($outer_composite = null) */ public function fakeOuterNumberSerialize($body = null) { - list($response) = $this->fakeOuterNumberSerializeWithHttpInfo($body); - return $response; + $apiResponse = $this->fakeOuterNumberSerializeWithApiResponse($body); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterNumberSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param float $body Input number as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of float, HTTP status code, HTTP response headers (array of strings) + * @return array of float, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterNumberSerializeWithHttpInfo($body = null) + { + $apiResponse = $this->fakeOuterNumberSerializeWithApiResponse($body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterNumberSerializeWithApiResponse + * + * @param float $body Input number as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type float + */ + public function fakeOuterNumberSerializeWithApiResponse($body = null) { $request = $this->fakeOuterNumberSerializeRequest($body); @@ -687,11 +818,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'float', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'float'; @@ -705,11 +836,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -738,10 +869,10 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) */ public function fakeOuterNumberSerializeAsync($body = null) { - return $this->fakeOuterNumberSerializeAsyncWithHttpInfo($body) + return $this->fakeOuterNumberSerializeAsyncWithApiResponse($body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -749,6 +880,8 @@ function ($response) { /** * Operation fakeOuterNumberSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param float $body Input number as post body (optional) @@ -757,6 +890,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterNumberSerializeAsyncWithHttpInfo($body = null) + { + return $this->fakeOuterNumberSerializeAsyncWithApiResponse($body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterNumberSerializeAsyncWithApiResponse + * + * + * + * @param float $body Input number as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterNumberSerializeAsyncWithApiResponse($body = null) { $returnType = 'float'; $request = $this->fakeOuterNumberSerializeRequest($body); @@ -775,11 +932,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -896,20 +1053,46 @@ protected function fakeOuterNumberSerializeRequest($body = null) */ public function fakeOuterStringSerialize($body = null) { - list($response) = $this->fakeOuterStringSerializeWithHttpInfo($body); - return $response; + $apiResponse = $this->fakeOuterStringSerializeWithApiResponse($body); + return $apiResponse->getMessage(); } + /** * Operation fakeOuterStringSerializeWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param string $body Input string as post body (optional) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of string, HTTP status code, HTTP response headers (array of strings) + * @return array of string, HTTP status code, HTTP response headers (strings[]) */ public function fakeOuterStringSerializeWithHttpInfo($body = null) + { + $apiResponse = $this->fakeOuterStringSerializeWithApiResponse($body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation fakeOuterStringSerializeWithApiResponse + * + * @param string $body Input string as post body (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type string + */ + public function fakeOuterStringSerializeWithApiResponse($body = null) { $request = $this->fakeOuterStringSerializeRequest($body); @@ -953,11 +1136,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'string', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'string'; @@ -971,11 +1154,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1004,10 +1187,10 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) */ public function fakeOuterStringSerializeAsync($body = null) { - return $this->fakeOuterStringSerializeAsyncWithHttpInfo($body) + return $this->fakeOuterStringSerializeAsyncWithApiResponse($body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1015,6 +1198,8 @@ function ($response) { /** * Operation fakeOuterStringSerializeAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param string $body Input string as post body (optional) @@ -1023,6 +1208,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function fakeOuterStringSerializeAsyncWithHttpInfo($body = null) + { + return $this->fakeOuterStringSerializeAsyncWithApiResponse($body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation fakeOuterStringSerializeAsyncWithApiResponse + * + * + * + * @param string $body Input string as post body (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeOuterStringSerializeAsyncWithApiResponse($body = null) { $returnType = 'string'; $request = $this->fakeOuterStringSerializeRequest($body); @@ -1041,11 +1250,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1162,19 +1371,45 @@ protected function fakeOuterStringSerializeRequest($body = null) */ public function testBodyWithFileSchema($file_schema_test_class) { - $this->testBodyWithFileSchemaWithHttpInfo($file_schema_test_class); + $this->testBodyWithFileSchemaWithApiResponse($file_schema_test_class); } + /** * Operation testBodyWithFileSchemaWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class) + { + $apiResponse = $this->testBodyWithFileSchemaWithApiResponse($file_schema_test_class); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testBodyWithFileSchemaWithApiResponse + * + * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testBodyWithFileSchemaWithApiResponse($file_schema_test_class) { $request = $this->testBodyWithFileSchemaRequest($file_schema_test_class); @@ -1206,7 +1441,7 @@ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1227,10 +1462,10 @@ public function testBodyWithFileSchemaWithHttpInfo($file_schema_test_class) */ public function testBodyWithFileSchemaAsync($file_schema_test_class) { - return $this->testBodyWithFileSchemaAsyncWithHttpInfo($file_schema_test_class) + return $this->testBodyWithFileSchemaAsyncWithApiResponse($file_schema_test_class) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1238,6 +1473,8 @@ function ($response) { /** * Operation testBodyWithFileSchemaAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) @@ -1247,14 +1484,37 @@ function ($response) { */ public function testBodyWithFileSchemaAsyncWithHttpInfo($file_schema_test_class) { - $returnType = ''; + return $this->testBodyWithFileSchemaAsyncWithApiResponse($file_schema_test_class) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testBodyWithFileSchemaAsyncWithApiResponse + * + * + * + * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testBodyWithFileSchemaAsyncWithApiResponse($file_schema_test_class) + { $request = $this->testBodyWithFileSchemaRequest($file_schema_test_class); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1378,20 +1638,47 @@ protected function testBodyWithFileSchemaRequest($file_schema_test_class) */ public function testBodyWithQueryParams($query, $user) { - $this->testBodyWithQueryParamsWithHttpInfo($query, $user); + $this->testBodyWithQueryParamsWithApiResponse($query, $user); } + /** * Operation testBodyWithQueryParamsWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * @param string $query (required) * @param \OpenAPI\Client\Model\User $user (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testBodyWithQueryParamsWithHttpInfo($query, $user) + { + $apiResponse = $this->testBodyWithQueryParamsWithApiResponse($query, $user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testBodyWithQueryParamsWithApiResponse + * + * @param string $query (required) + * @param \OpenAPI\Client\Model\User $user (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testBodyWithQueryParamsWithApiResponse($query, $user) { $request = $this->testBodyWithQueryParamsRequest($query, $user); @@ -1423,7 +1710,7 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1445,10 +1732,10 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user) */ public function testBodyWithQueryParamsAsync($query, $user) { - return $this->testBodyWithQueryParamsAsyncWithHttpInfo($query, $user) + return $this->testBodyWithQueryParamsAsyncWithApiResponse($query, $user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1456,6 +1743,8 @@ function ($response) { /** * Operation testBodyWithQueryParamsAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * * * @param string $query (required) @@ -1466,14 +1755,38 @@ function ($response) { */ public function testBodyWithQueryParamsAsyncWithHttpInfo($query, $user) { - $returnType = ''; + return $this->testBodyWithQueryParamsAsyncWithApiResponse($query, $user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testBodyWithQueryParamsAsyncWithApiResponse + * + * + * + * @param string $query (required) + * @param \OpenAPI\Client\Model\User $user (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testBodyWithQueryParamsAsyncWithApiResponse($query, $user) + { $request = $this->testBodyWithQueryParamsRequest($query, $user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1609,22 +1922,50 @@ protected function testBodyWithQueryParamsRequest($query, $user) */ public function testClientModel($client) { - list($response) = $this->testClientModelWithHttpInfo($client); - return $response; + $apiResponse = $this->testClientModelWithApiResponse($client); + return $apiResponse->getMessage(); } + /** * Operation testClientModelWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test \"client\" model * * @param \OpenAPI\Client\Model\Client $client client model (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (strings[]) */ public function testClientModelWithHttpInfo($client) + { + $apiResponse = $this->testClientModelWithApiResponse($client); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testClientModelWithApiResponse + * + * To test \"client\" model + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Client + */ + public function testClientModelWithApiResponse($client) { $request = $this->testClientModelRequest($client); @@ -1668,11 +2009,11 @@ public function testClientModelWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Client'; @@ -1686,11 +2027,11 @@ public function testClientModelWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1719,10 +2060,10 @@ public function testClientModelWithHttpInfo($client) */ public function testClientModelAsync($client) { - return $this->testClientModelAsyncWithHttpInfo($client) + return $this->testClientModelAsyncWithApiResponse($client) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1730,6 +2071,8 @@ function ($response) { /** * Operation testClientModelAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test \"client\" model * * @param \OpenAPI\Client\Model\Client $client client model (required) @@ -1738,6 +2081,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function testClientModelAsyncWithHttpInfo($client) + { + return $this->testClientModelAsyncWithApiResponse($client) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testClientModelAsyncWithApiResponse + * + * To test \"client\" model + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testClientModelAsyncWithApiResponse($client) { $returnType = '\OpenAPI\Client\Model\Client'; $request = $this->testClientModelRequest($client); @@ -1756,11 +2123,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1898,12 +2265,16 @@ protected function testClientModelRequest($client) */ public function testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - $this->testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); + $this->testEndpointParametersWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); } + /** * Operation testEndpointParametersWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param float $number None (required) @@ -1923,9 +2294,46 @@ public function testEndpointParameters($number, $double, $pattern_without_delimi * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + { + $apiResponse = $this->testEndpointParametersWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testEndpointParametersWithApiResponse + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param float $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $string None (optional) + * @param \SplFileObject $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @param string $callback None (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testEndpointParametersWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); @@ -1957,7 +2365,7 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1991,10 +2399,10 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi */ public function testEndpointParametersAsync($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - return $this->testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) + return $this->testEndpointParametersAsyncWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2002,6 +2410,8 @@ function ($response) { /** * Operation testEndpointParametersAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param float $number None (required) @@ -2024,14 +2434,50 @@ function ($response) { */ public function testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - $returnType = ''; + return $this->testEndpointParametersAsyncWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testEndpointParametersAsyncWithApiResponse + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param float $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $string None (optional) + * @param \SplFileObject $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @param string $callback None (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testEndpointParametersAsyncWithApiResponse($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + { $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -2299,12 +2745,16 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with */ public function testEnumParameters($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { - $this->testEnumParametersWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); + $this->testEnumParametersWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); } + /** * Operation testEnumParametersWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test enum parameters * * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) @@ -2318,9 +2768,40 @@ public function testEnumParameters($enum_header_string_array = null, $enum_heade * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') + { + $apiResponse = $this->testEnumParametersWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testEnumParametersWithApiResponse + * + * To test enum parameters + * + * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) + * @param string $enum_header_string Header parameter enum test (string) (optional, default to '-efg') + * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) + * @param string $enum_query_string Query parameter enum test (string) (optional, default to '-efg') + * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional, default to '$') + * @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testEnumParametersWithApiResponse($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); @@ -2352,7 +2833,7 @@ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2380,10 +2861,10 @@ public function testEnumParametersWithHttpInfo($enum_header_string_array = null, */ public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { - return $this->testEnumParametersAsyncWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string) + return $this->testEnumParametersAsyncWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2391,6 +2872,8 @@ function ($response) { /** * Operation testEnumParametersAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test enum parameters * * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) @@ -2407,14 +2890,44 @@ function ($response) { */ public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') { - $returnType = ''; + return $this->testEnumParametersAsyncWithApiResponse($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testEnumParametersAsyncWithApiResponse + * + * To test enum parameters + * + * @param string[] $enum_header_string_array Header parameter enum test (string array) (optional) + * @param string $enum_header_string Header parameter enum test (string) (optional, default to '-efg') + * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) + * @param string $enum_query_string Query parameter enum test (string) (optional, default to '-efg') + * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional, default to '$') + * @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testEnumParametersAsyncWithApiResponse($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = '$', $enum_form_string = '-efg') + { $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -2575,21 +3088,49 @@ protected function testEnumParametersRequest($enum_header_string_array = null, $ */ public function testInlineAdditionalProperties($request_body) { - $this->testInlineAdditionalPropertiesWithHttpInfo($request_body); + $this->testInlineAdditionalPropertiesWithApiResponse($request_body); } + /** * Operation testInlineAdditionalPropertiesWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * test inline additionalProperties * * @param map[string,string] $request_body request body (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testInlineAdditionalPropertiesWithHttpInfo($request_body) + { + $apiResponse = $this->testInlineAdditionalPropertiesWithApiResponse($request_body); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testInlineAdditionalPropertiesWithApiResponse + * + * test inline additionalProperties + * + * @param map[string,string] $request_body request body (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testInlineAdditionalPropertiesWithApiResponse($request_body) { $request = $this->testInlineAdditionalPropertiesRequest($request_body); @@ -2621,7 +3162,7 @@ public function testInlineAdditionalPropertiesWithHttpInfo($request_body) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2642,10 +3183,10 @@ public function testInlineAdditionalPropertiesWithHttpInfo($request_body) */ public function testInlineAdditionalPropertiesAsync($request_body) { - return $this->testInlineAdditionalPropertiesAsyncWithHttpInfo($request_body) + return $this->testInlineAdditionalPropertiesAsyncWithApiResponse($request_body) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2653,6 +3194,8 @@ function ($response) { /** * Operation testInlineAdditionalPropertiesAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * test inline additionalProperties * * @param map[string,string] $request_body request body (required) @@ -2662,14 +3205,37 @@ function ($response) { */ public function testInlineAdditionalPropertiesAsyncWithHttpInfo($request_body) { - $returnType = ''; + return $this->testInlineAdditionalPropertiesAsyncWithApiResponse($request_body) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testInlineAdditionalPropertiesAsyncWithApiResponse + * + * test inline additionalProperties + * + * @param map[string,string] $request_body request body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testInlineAdditionalPropertiesAsyncWithApiResponse($request_body) + { $request = $this->testInlineAdditionalPropertiesRequest($request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -2795,12 +3361,16 @@ protected function testInlineAdditionalPropertiesRequest($request_body) */ public function testJsonFormData($param, $param2) { - $this->testJsonFormDataWithHttpInfo($param, $param2); + $this->testJsonFormDataWithApiResponse($param, $param2); } + /** * Operation testJsonFormDataWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * test json serialization of form data * * @param string $param field1 (required) @@ -2808,9 +3378,34 @@ public function testJsonFormData($param, $param2) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function testJsonFormDataWithHttpInfo($param, $param2) + { + $apiResponse = $this->testJsonFormDataWithApiResponse($param, $param2); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testJsonFormDataWithApiResponse + * + * test json serialization of form data + * + * @param string $param field1 (required) + * @param string $param2 field2 (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function testJsonFormDataWithApiResponse($param, $param2) { $request = $this->testJsonFormDataRequest($param, $param2); @@ -2842,7 +3437,7 @@ public function testJsonFormDataWithHttpInfo($param, $param2) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2864,10 +3459,10 @@ public function testJsonFormDataWithHttpInfo($param, $param2) */ public function testJsonFormDataAsync($param, $param2) { - return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2) + return $this->testJsonFormDataAsyncWithApiResponse($param, $param2) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2875,6 +3470,8 @@ function ($response) { /** * Operation testJsonFormDataAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * test json serialization of form data * * @param string $param field1 (required) @@ -2885,14 +3482,38 @@ function ($response) { */ public function testJsonFormDataAsyncWithHttpInfo($param, $param2) { - $returnType = ''; + return $this->testJsonFormDataAsyncWithApiResponse($param, $param2) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testJsonFormDataAsyncWithApiResponse + * + * test json serialization of form data + * + * @param string $param field1 (required) + * @param string $param2 field2 (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testJsonFormDataAsyncWithApiResponse($param, $param2) + { $request = $this->testJsonFormDataRequest($param, $param2); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 9c3d2ac45f5f..a6d4a47f3ad7 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,22 +101,50 @@ public function getConfig() */ public function testClassname($client) { - list($response) = $this->testClassnameWithHttpInfo($client); - return $response; + $apiResponse = $this->testClassnameWithApiResponse($client); + return $apiResponse->getMessage(); } + /** * Operation testClassnameWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * To test class name in snake case * * @param \OpenAPI\Client\Model\Client $client client model (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (strings[]) */ public function testClassnameWithHttpInfo($client) + { + $apiResponse = $this->testClassnameWithApiResponse($client); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation testClassnameWithApiResponse + * + * To test class name in snake case + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Client + */ + public function testClassnameWithApiResponse($client) { $request = $this->testClassnameRequest($client); @@ -159,11 +188,11 @@ public function testClassnameWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Client'; @@ -177,11 +206,11 @@ public function testClassnameWithHttpInfo($client) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -210,10 +239,10 @@ public function testClassnameWithHttpInfo($client) */ public function testClassnameAsync($client) { - return $this->testClassnameAsyncWithHttpInfo($client) + return $this->testClassnameAsyncWithApiResponse($client) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -221,6 +250,8 @@ function ($response) { /** * Operation testClassnameAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * To test class name in snake case * * @param \OpenAPI\Client\Model\Client $client client model (required) @@ -229,6 +260,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function testClassnameAsyncWithHttpInfo($client) + { + return $this->testClassnameAsyncWithApiResponse($client) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation testClassnameAsyncWithApiResponse + * + * To test class name in snake case + * + * @param \OpenAPI\Client\Model\Client $client client model (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testClassnameAsyncWithApiResponse($client) { $returnType = '\OpenAPI\Client\Model\Client'; $request = $this->testClassnameRequest($client); @@ -247,11 +302,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 15415530e639..ed1b707d322c 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,21 +101,49 @@ public function getConfig() */ public function addPet($pet) { - $this->addPetWithHttpInfo($pet); + $this->addPetWithApiResponse($pet); } + /** * Operation addPetWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Add a new pet to the store * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function addPetWithHttpInfo($pet) + { + $apiResponse = $this->addPetWithApiResponse($pet); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation addPetWithApiResponse + * + * Add a new pet to the store + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function addPetWithApiResponse($pet) { $request = $this->addPetRequest($pet); @@ -146,7 +175,7 @@ public function addPetWithHttpInfo($pet) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -167,10 +196,10 @@ public function addPetWithHttpInfo($pet) */ public function addPetAsync($pet) { - return $this->addPetAsyncWithHttpInfo($pet) + return $this->addPetAsyncWithApiResponse($pet) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -178,6 +207,8 @@ function ($response) { /** * Operation addPetAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Add a new pet to the store * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) @@ -187,14 +218,37 @@ function ($response) { */ public function addPetAsyncWithHttpInfo($pet) { - $returnType = ''; + return $this->addPetAsyncWithApiResponse($pet) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation addPetAsyncWithApiResponse + * + * Add a new pet to the store + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addPetAsyncWithApiResponse($pet) + { $request = $this->addPetRequest($pet); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -324,12 +378,16 @@ protected function addPetRequest($pet) */ public function deletePet($pet_id, $api_key = null) { - $this->deletePetWithHttpInfo($pet_id, $api_key); + $this->deletePetWithApiResponse($pet_id, $api_key); } + /** * Operation deletePetWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Deletes a pet * * @param int $pet_id Pet id to delete (required) @@ -337,9 +395,34 @@ public function deletePet($pet_id, $api_key = null) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function deletePetWithHttpInfo($pet_id, $api_key = null) + { + $apiResponse = $this->deletePetWithApiResponse($pet_id, $api_key); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation deletePetWithApiResponse + * + * Deletes a pet + * + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function deletePetWithApiResponse($pet_id, $api_key = null) { $request = $this->deletePetRequest($pet_id, $api_key); @@ -371,7 +454,7 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -393,10 +476,10 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) */ public function deletePetAsync($pet_id, $api_key = null) { - return $this->deletePetAsyncWithHttpInfo($pet_id, $api_key) + return $this->deletePetAsyncWithApiResponse($pet_id, $api_key) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -404,6 +487,8 @@ function ($response) { /** * Operation deletePetAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Deletes a pet * * @param int $pet_id Pet id to delete (required) @@ -414,14 +499,38 @@ function ($response) { */ public function deletePetAsyncWithHttpInfo($pet_id, $api_key = null) { - $returnType = ''; + return $this->deletePetAsyncWithApiResponse($pet_id, $api_key) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation deletePetAsyncWithApiResponse + * + * Deletes a pet + * + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePetAsyncWithApiResponse($pet_id, $api_key = null) + { $request = $this->deletePetRequest($pet_id, $api_key); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -560,22 +669,50 @@ protected function deletePetRequest($pet_id, $api_key = null) */ public function findPetsByStatus($status) { - list($response) = $this->findPetsByStatusWithHttpInfo($status); - return $response; + $apiResponse = $this->findPetsByStatusWithApiResponse($status); + return $apiResponse->getMessage(); } + /** * Operation findPetsByStatusWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (strings[]) */ public function findPetsByStatusWithHttpInfo($status) + { + $apiResponse = $this->findPetsByStatusWithApiResponse($status); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation findPetsByStatusWithApiResponse + * + * Finds Pets by status + * + * @param string[] $status Status values that need to be considered for filter (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Pet[] + */ + public function findPetsByStatusWithApiResponse($status) { $request = $this->findPetsByStatusRequest($status); @@ -619,11 +756,11 @@ public function findPetsByStatusWithHttpInfo($status) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet[]', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Pet[]'; @@ -637,11 +774,11 @@ public function findPetsByStatusWithHttpInfo($status) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -670,10 +807,10 @@ public function findPetsByStatusWithHttpInfo($status) */ public function findPetsByStatusAsync($status) { - return $this->findPetsByStatusAsyncWithHttpInfo($status) + return $this->findPetsByStatusAsyncWithApiResponse($status) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -681,6 +818,8 @@ function ($response) { /** * Operation findPetsByStatusAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) @@ -689,6 +828,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function findPetsByStatusAsyncWithHttpInfo($status) + { + return $this->findPetsByStatusAsyncWithApiResponse($status) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation findPetsByStatusAsyncWithApiResponse + * + * Finds Pets by status + * + * @param string[] $status Status values that need to be considered for filter (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function findPetsByStatusAsyncWithApiResponse($status) { $returnType = '\OpenAPI\Client\Model\Pet[]'; $request = $this->findPetsByStatusRequest($status); @@ -707,11 +870,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -844,22 +1007,50 @@ protected function findPetsByStatusRequest($status) */ public function findPetsByTags($tags) { - list($response) = $this->findPetsByTagsWithHttpInfo($tags); - return $response; + $apiResponse = $this->findPetsByTagsWithApiResponse($tags); + return $apiResponse->getMessage(); } + /** * Operation findPetsByTagsWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (strings[]) */ public function findPetsByTagsWithHttpInfo($tags) + { + $apiResponse = $this->findPetsByTagsWithApiResponse($tags); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation findPetsByTagsWithApiResponse + * + * Finds Pets by tags + * + * @param string[] $tags Tags to filter by (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Pet[] + */ + public function findPetsByTagsWithApiResponse($tags) { $request = $this->findPetsByTagsRequest($tags); @@ -903,11 +1094,11 @@ public function findPetsByTagsWithHttpInfo($tags) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet[]', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Pet[]'; @@ -921,11 +1112,11 @@ public function findPetsByTagsWithHttpInfo($tags) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -954,10 +1145,10 @@ public function findPetsByTagsWithHttpInfo($tags) */ public function findPetsByTagsAsync($tags) { - return $this->findPetsByTagsAsyncWithHttpInfo($tags) + return $this->findPetsByTagsAsyncWithApiResponse($tags) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -965,6 +1156,8 @@ function ($response) { /** * Operation findPetsByTagsAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) @@ -973,6 +1166,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function findPetsByTagsAsyncWithHttpInfo($tags) + { + return $this->findPetsByTagsAsyncWithApiResponse($tags) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation findPetsByTagsAsyncWithApiResponse + * + * Finds Pets by tags + * + * @param string[] $tags Tags to filter by (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function findPetsByTagsAsyncWithApiResponse($tags) { $returnType = '\OpenAPI\Client\Model\Pet[]'; $request = $this->findPetsByTagsRequest($tags); @@ -991,11 +1208,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1128,22 +1345,50 @@ protected function findPetsByTagsRequest($tags) */ public function getPetById($pet_id) { - list($response) = $this->getPetByIdWithHttpInfo($pet_id); - return $response; + $apiResponse = $this->getPetByIdWithApiResponse($pet_id); + return $apiResponse->getMessage(); } + /** * Operation getPetByIdWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Find pet by ID * * @param int $pet_id ID of pet to return (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (strings[]) */ public function getPetByIdWithHttpInfo($pet_id) + { + $apiResponse = $this->getPetByIdWithApiResponse($pet_id); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getPetByIdWithApiResponse + * + * Find pet by ID + * + * @param int $pet_id ID of pet to return (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Pet + */ + public function getPetByIdWithApiResponse($pet_id) { $request = $this->getPetByIdRequest($pet_id); @@ -1187,11 +1432,11 @@ public function getPetByIdWithHttpInfo($pet_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Pet'; @@ -1205,11 +1450,11 @@ public function getPetByIdWithHttpInfo($pet_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1238,10 +1483,10 @@ public function getPetByIdWithHttpInfo($pet_id) */ public function getPetByIdAsync($pet_id) { - return $this->getPetByIdAsyncWithHttpInfo($pet_id) + return $this->getPetByIdAsyncWithApiResponse($pet_id) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1249,6 +1494,8 @@ function ($response) { /** * Operation getPetByIdAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Find pet by ID * * @param int $pet_id ID of pet to return (required) @@ -1257,6 +1504,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getPetByIdAsyncWithHttpInfo($pet_id) + { + return $this->getPetByIdAsyncWithApiResponse($pet_id) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getPetByIdAsyncWithApiResponse + * + * Find pet by ID + * + * @param int $pet_id ID of pet to return (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPetByIdAsyncWithApiResponse($pet_id) { $returnType = '\OpenAPI\Client\Model\Pet'; $request = $this->getPetByIdRequest($pet_id); @@ -1275,11 +1546,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1414,21 +1685,49 @@ protected function getPetByIdRequest($pet_id) */ public function updatePet($pet) { - $this->updatePetWithHttpInfo($pet); + $this->updatePetWithApiResponse($pet); } + /** * Operation updatePetWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Update an existing pet * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function updatePetWithHttpInfo($pet) + { + $apiResponse = $this->updatePetWithApiResponse($pet); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation updatePetWithApiResponse + * + * Update an existing pet + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function updatePetWithApiResponse($pet) { $request = $this->updatePetRequest($pet); @@ -1460,7 +1759,7 @@ public function updatePetWithHttpInfo($pet) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1481,10 +1780,10 @@ public function updatePetWithHttpInfo($pet) */ public function updatePetAsync($pet) { - return $this->updatePetAsyncWithHttpInfo($pet) + return $this->updatePetAsyncWithApiResponse($pet) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1492,6 +1791,8 @@ function ($response) { /** * Operation updatePetAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Update an existing pet * * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) @@ -1501,14 +1802,37 @@ function ($response) { */ public function updatePetAsyncWithHttpInfo($pet) { - $returnType = ''; + return $this->updatePetAsyncWithApiResponse($pet) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation updatePetAsyncWithApiResponse + * + * Update an existing pet + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePetAsyncWithApiResponse($pet) + { $request = $this->updatePetRequest($pet); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1639,12 +1963,16 @@ protected function updatePetRequest($pet) */ public function updatePetWithForm($pet_id, $name = null, $status = null) { - $this->updatePetWithFormWithHttpInfo($pet_id, $name, $status); + $this->updatePetWithFormWithApiResponse($pet_id, $name, $status); } + /** * Operation updatePetWithFormWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) @@ -1653,9 +1981,35 @@ public function updatePetWithForm($pet_id, $name = null, $status = null) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = null) + { + $apiResponse = $this->updatePetWithFormWithApiResponse($pet_id, $name, $status); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation updatePetWithFormWithApiResponse + * + * Updates a pet in the store with form data + * + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function updatePetWithFormWithApiResponse($pet_id, $name = null, $status = null) { $request = $this->updatePetWithFormRequest($pet_id, $name, $status); @@ -1687,7 +2041,7 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1710,10 +2064,10 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n */ public function updatePetWithFormAsync($pet_id, $name = null, $status = null) { - return $this->updatePetWithFormAsyncWithHttpInfo($pet_id, $name, $status) + return $this->updatePetWithFormAsyncWithApiResponse($pet_id, $name, $status) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1721,6 +2075,8 @@ function ($response) { /** * Operation updatePetWithFormAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) @@ -1732,14 +2088,39 @@ function ($response) { */ public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $status = null) { - $returnType = ''; + return $this->updatePetWithFormAsyncWithApiResponse($pet_id, $name, $status) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation updatePetWithFormAsyncWithApiResponse + * + * Updates a pet in the store with form data + * + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePetWithFormAsyncWithApiResponse($pet_id, $name = null, $status = null) + { $request = $this->updatePetWithFormRequest($pet_id, $name, $status); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1885,13 +2266,17 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul */ public function uploadFile($pet_id, $additional_metadata = null, $file = null) { - list($response) = $this->uploadFileWithHttpInfo($pet_id, $additional_metadata, $file); - return $response; + $apiResponse = $this->uploadFileWithApiResponse($pet_id, $additional_metadata, $file); + return $apiResponse->getMessage(); } + /** * Operation uploadFileWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * uploads an image * * @param int $pet_id ID of pet to update (required) @@ -1900,9 +2285,35 @@ public function uploadFile($pet_id, $additional_metadata = null, $file = null) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (strings[]) */ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null) + { + $apiResponse = $this->uploadFileWithApiResponse($pet_id, $additional_metadata, $file); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation uploadFileWithApiResponse + * + * uploads an image + * + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\ApiResponse + */ + public function uploadFileWithApiResponse($pet_id, $additional_metadata = null, $file = null) { $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); @@ -1946,11 +2357,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApiResponse', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\ApiResponse'; @@ -1964,11 +2375,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1999,10 +2410,10 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi */ public function uploadFileAsync($pet_id, $additional_metadata = null, $file = null) { - return $this->uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata, $file) + return $this->uploadFileAsyncWithApiResponse($pet_id, $additional_metadata, $file) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2010,6 +2421,8 @@ function ($response) { /** * Operation uploadFileAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * uploads an image * * @param int $pet_id ID of pet to update (required) @@ -2020,6 +2433,32 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null, $file = null) + { + return $this->uploadFileAsyncWithApiResponse($pet_id, $additional_metadata, $file) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation uploadFileAsyncWithApiResponse + * + * uploads an image + * + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadFileAsyncWithApiResponse($pet_id, $additional_metadata = null, $file = null) { $returnType = '\OpenAPI\Client\Model\ApiResponse'; $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); @@ -2038,11 +2477,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -2189,13 +2628,17 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file */ public function uploadFileWithRequiredFile($pet_id, $required_file, $additional_metadata = null) { - list($response) = $this->uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $additional_metadata); - return $response; + $apiResponse = $this->uploadFileWithRequiredFileWithApiResponse($pet_id, $required_file, $additional_metadata); + return $apiResponse->getMessage(); } + /** * Operation uploadFileWithRequiredFileWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * uploads an image (required) * * @param int $pet_id ID of pet to update (required) @@ -2204,9 +2647,35 @@ public function uploadFileWithRequiredFile($pet_id, $required_file, $additional_ * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (strings[]) */ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $additional_metadata = null) + { + $apiResponse = $this->uploadFileWithRequiredFileWithApiResponse($pet_id, $required_file, $additional_metadata); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation uploadFileWithRequiredFileWithApiResponse + * + * uploads an image (required) + * + * @param int $pet_id ID of pet to update (required) + * @param \SplFileObject $required_file file to upload (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\ApiResponse + */ + public function uploadFileWithRequiredFileWithApiResponse($pet_id, $required_file, $additional_metadata = null) { $request = $this->uploadFileWithRequiredFileRequest($pet_id, $required_file, $additional_metadata); @@ -2250,11 +2719,11 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApiResponse', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\ApiResponse'; @@ -2268,11 +2737,11 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -2303,10 +2772,10 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, */ public function uploadFileWithRequiredFileAsync($pet_id, $required_file, $additional_metadata = null) { - return $this->uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $required_file, $additional_metadata) + return $this->uploadFileWithRequiredFileAsyncWithApiResponse($pet_id, $required_file, $additional_metadata) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -2314,6 +2783,8 @@ function ($response) { /** * Operation uploadFileWithRequiredFileAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * uploads an image (required) * * @param int $pet_id ID of pet to update (required) @@ -2324,6 +2795,32 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $required_file, $additional_metadata = null) + { + return $this->uploadFileWithRequiredFileAsyncWithApiResponse($pet_id, $required_file, $additional_metadata) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation uploadFileWithRequiredFileAsyncWithApiResponse + * + * uploads an image (required) + * + * @param int $pet_id ID of pet to update (required) + * @param \SplFileObject $required_file file to upload (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadFileWithRequiredFileAsyncWithApiResponse($pet_id, $required_file, $additional_metadata = null) { $returnType = '\OpenAPI\Client\Model\ApiResponse'; $request = $this->uploadFileWithRequiredFileRequest($pet_id, $required_file, $additional_metadata); @@ -2342,11 +2839,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index f673735429e0..93ba77108158 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,21 +101,49 @@ public function getConfig() */ public function deleteOrder($order_id) { - $this->deleteOrderWithHttpInfo($order_id); + $this->deleteOrderWithApiResponse($order_id); } + /** * Operation deleteOrderWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function deleteOrderWithHttpInfo($order_id) + { + $apiResponse = $this->deleteOrderWithApiResponse($order_id); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation deleteOrderWithApiResponse + * + * Delete purchase order by ID + * + * @param string $order_id ID of the order that needs to be deleted (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function deleteOrderWithApiResponse($order_id) { $request = $this->deleteOrderRequest($order_id); @@ -146,7 +175,7 @@ public function deleteOrderWithHttpInfo($order_id) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -167,10 +196,10 @@ public function deleteOrderWithHttpInfo($order_id) */ public function deleteOrderAsync($order_id) { - return $this->deleteOrderAsyncWithHttpInfo($order_id) + return $this->deleteOrderAsyncWithApiResponse($order_id) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -178,6 +207,8 @@ function ($response) { /** * Operation deleteOrderAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) @@ -187,14 +218,37 @@ function ($response) { */ public function deleteOrderAsyncWithHttpInfo($order_id) { - $returnType = ''; + return $this->deleteOrderAsyncWithApiResponse($order_id) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation deleteOrderAsyncWithApiResponse + * + * Delete purchase order by ID + * + * @param string $order_id ID of the order that needs to be deleted (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteOrderAsyncWithApiResponse($order_id) + { $request = $this->deleteOrderRequest($order_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -323,21 +377,48 @@ protected function deleteOrderRequest($order_id) */ public function getInventory() { - list($response) = $this->getInventoryWithHttpInfo(); - return $response; + $apiResponse = $this->getInventoryWithApiResponse(); + return $apiResponse->getMessage(); } + /** * Operation getInventoryWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Returns pet inventories by status * * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of map[string,int], HTTP status code, HTTP response headers (array of strings) + * @return array of map[string,int], HTTP status code, HTTP response headers (strings[]) */ public function getInventoryWithHttpInfo() + { + $apiResponse = $this->getInventoryWithApiResponse(); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getInventoryWithApiResponse + * + * Returns pet inventories by status + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type map[string,int] + */ + public function getInventoryWithApiResponse() { $request = $this->getInventoryRequest(); @@ -381,11 +462,11 @@ public function getInventoryWithHttpInfo() } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'map[string,int]', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'map[string,int]'; @@ -399,11 +480,11 @@ public function getInventoryWithHttpInfo() } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -431,10 +512,10 @@ public function getInventoryWithHttpInfo() */ public function getInventoryAsync() { - return $this->getInventoryAsyncWithHttpInfo() + return $this->getInventoryAsyncWithApiResponse() ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -442,6 +523,8 @@ function ($response) { /** * Operation getInventoryAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Returns pet inventories by status * * @@ -449,6 +532,29 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getInventoryAsyncWithHttpInfo() + { + return $this->getInventoryAsyncWithApiResponse() + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getInventoryAsyncWithApiResponse + * + * Returns pet inventories by status + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInventoryAsyncWithApiResponse() { $returnType = 'map[string,int]'; $request = $this->getInventoryRequest(); @@ -467,11 +573,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -591,22 +697,50 @@ protected function getInventoryRequest() */ public function getOrderById($order_id) { - list($response) = $this->getOrderByIdWithHttpInfo($order_id); - return $response; + $apiResponse = $this->getOrderByIdWithApiResponse($order_id); + return $apiResponse->getMessage(); } + /** * Operation getOrderByIdWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (strings[]) */ public function getOrderByIdWithHttpInfo($order_id) + { + $apiResponse = $this->getOrderByIdWithApiResponse($order_id); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getOrderByIdWithApiResponse + * + * Find purchase order by ID + * + * @param int $order_id ID of pet that needs to be fetched (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Order + */ + public function getOrderByIdWithApiResponse($order_id) { $request = $this->getOrderByIdRequest($order_id); @@ -650,11 +784,11 @@ public function getOrderByIdWithHttpInfo($order_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Order', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Order'; @@ -668,11 +802,11 @@ public function getOrderByIdWithHttpInfo($order_id) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -701,10 +835,10 @@ public function getOrderByIdWithHttpInfo($order_id) */ public function getOrderByIdAsync($order_id) { - return $this->getOrderByIdAsyncWithHttpInfo($order_id) + return $this->getOrderByIdAsyncWithApiResponse($order_id) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -712,6 +846,8 @@ function ($response) { /** * Operation getOrderByIdAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) @@ -720,6 +856,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getOrderByIdAsyncWithHttpInfo($order_id) + { + return $this->getOrderByIdAsyncWithApiResponse($order_id) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getOrderByIdAsyncWithApiResponse + * + * Find purchase order by ID + * + * @param int $order_id ID of pet that needs to be fetched (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrderByIdAsyncWithApiResponse($order_id) { $returnType = '\OpenAPI\Client\Model\Order'; $request = $this->getOrderByIdRequest($order_id); @@ -738,11 +898,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -879,22 +1039,50 @@ protected function getOrderByIdRequest($order_id) */ public function placeOrder($order) { - list($response) = $this->placeOrderWithHttpInfo($order); - return $response; + $apiResponse = $this->placeOrderWithApiResponse($order); + return $apiResponse->getMessage(); } + /** * Operation placeOrderWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Place an order for a pet * * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (strings[]) */ public function placeOrderWithHttpInfo($order) + { + $apiResponse = $this->placeOrderWithApiResponse($order); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation placeOrderWithApiResponse + * + * Place an order for a pet + * + * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\Order + */ + public function placeOrderWithApiResponse($order) { $request = $this->placeOrderRequest($order); @@ -938,11 +1126,11 @@ public function placeOrderWithHttpInfo($order) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Order', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\Order'; @@ -956,11 +1144,11 @@ public function placeOrderWithHttpInfo($order) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -989,10 +1177,10 @@ public function placeOrderWithHttpInfo($order) */ public function placeOrderAsync($order) { - return $this->placeOrderAsyncWithHttpInfo($order) + return $this->placeOrderAsyncWithApiResponse($order) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1000,6 +1188,8 @@ function ($response) { /** * Operation placeOrderAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Place an order for a pet * * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) @@ -1008,6 +1198,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function placeOrderAsyncWithHttpInfo($order) + { + return $this->placeOrderAsyncWithApiResponse($order) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation placeOrderAsyncWithApiResponse + * + * Place an order for a pet + * + * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function placeOrderAsyncWithApiResponse($order) { $returnType = '\OpenAPI\Client\Model\Order'; $request = $this->placeOrderRequest($order); @@ -1026,11 +1240,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 824fc74c8257..354121f2b8d0 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -35,6 +35,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; +use OpenAPI\Client\ApiResponse; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -100,21 +101,49 @@ public function getConfig() */ public function createUser($user) { - $this->createUserWithHttpInfo($user); + $this->createUserWithApiResponse($user); } + /** * Operation createUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Create user * * @param \OpenAPI\Client\Model\User $user Created user object (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function createUserWithHttpInfo($user) + { + $apiResponse = $this->createUserWithApiResponse($user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation createUserWithApiResponse + * + * Create user + * + * @param \OpenAPI\Client\Model\User $user Created user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function createUserWithApiResponse($user) { $request = $this->createUserRequest($user); @@ -146,7 +175,7 @@ public function createUserWithHttpInfo($user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -167,10 +196,10 @@ public function createUserWithHttpInfo($user) */ public function createUserAsync($user) { - return $this->createUserAsyncWithHttpInfo($user) + return $this->createUserAsyncWithApiResponse($user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -178,6 +207,8 @@ function ($response) { /** * Operation createUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Create user * * @param \OpenAPI\Client\Model\User $user Created user object (required) @@ -187,14 +218,37 @@ function ($response) { */ public function createUserAsyncWithHttpInfo($user) { - $returnType = ''; + return $this->createUserAsyncWithApiResponse($user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation createUserAsyncWithApiResponse + * + * Create user + * + * @param \OpenAPI\Client\Model\User $user Created user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createUserAsyncWithApiResponse($user) + { $request = $this->createUserRequest($user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -319,21 +373,49 @@ protected function createUserRequest($user) */ public function createUsersWithArrayInput($user) { - $this->createUsersWithArrayInputWithHttpInfo($user); + $this->createUsersWithArrayInputWithApiResponse($user); } + /** * Operation createUsersWithArrayInputWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function createUsersWithArrayInputWithHttpInfo($user) + { + $apiResponse = $this->createUsersWithArrayInputWithApiResponse($user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation createUsersWithArrayInputWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function createUsersWithArrayInputWithApiResponse($user) { $request = $this->createUsersWithArrayInputRequest($user); @@ -365,7 +447,7 @@ public function createUsersWithArrayInputWithHttpInfo($user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -386,10 +468,10 @@ public function createUsersWithArrayInputWithHttpInfo($user) */ public function createUsersWithArrayInputAsync($user) { - return $this->createUsersWithArrayInputAsyncWithHttpInfo($user) + return $this->createUsersWithArrayInputAsyncWithApiResponse($user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -397,6 +479,8 @@ function ($response) { /** * Operation createUsersWithArrayInputAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) @@ -406,14 +490,37 @@ function ($response) { */ public function createUsersWithArrayInputAsyncWithHttpInfo($user) { - $returnType = ''; + return $this->createUsersWithArrayInputAsyncWithApiResponse($user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation createUsersWithArrayInputAsyncWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createUsersWithArrayInputAsyncWithApiResponse($user) + { $request = $this->createUsersWithArrayInputRequest($user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -538,21 +645,49 @@ protected function createUsersWithArrayInputRequest($user) */ public function createUsersWithListInput($user) { - $this->createUsersWithListInputWithHttpInfo($user); + $this->createUsersWithListInputWithApiResponse($user); } + /** * Operation createUsersWithListInputWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function createUsersWithListInputWithHttpInfo($user) + { + $apiResponse = $this->createUsersWithListInputWithApiResponse($user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation createUsersWithListInputWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function createUsersWithListInputWithApiResponse($user) { $request = $this->createUsersWithListInputRequest($user); @@ -584,7 +719,7 @@ public function createUsersWithListInputWithHttpInfo($user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -605,10 +740,10 @@ public function createUsersWithListInputWithHttpInfo($user) */ public function createUsersWithListInputAsync($user) { - return $this->createUsersWithListInputAsyncWithHttpInfo($user) + return $this->createUsersWithListInputAsyncWithApiResponse($user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -616,6 +751,8 @@ function ($response) { /** * Operation createUsersWithListInputAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Creates list of users with given input array * * @param \OpenAPI\Client\Model\User[] $user List of user object (required) @@ -625,14 +762,37 @@ function ($response) { */ public function createUsersWithListInputAsyncWithHttpInfo($user) { - $returnType = ''; + return $this->createUsersWithListInputAsyncWithApiResponse($user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation createUsersWithListInputAsyncWithApiResponse + * + * Creates list of users with given input array + * + * @param \OpenAPI\Client\Model\User[] $user List of user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createUsersWithListInputAsyncWithApiResponse($user) + { $request = $this->createUsersWithListInputRequest($user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -757,21 +917,49 @@ protected function createUsersWithListInputRequest($user) */ public function deleteUser($username) { - $this->deleteUserWithHttpInfo($username); + $this->deleteUserWithApiResponse($username); } + /** * Operation deleteUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Delete user * * @param string $username The name that needs to be deleted (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function deleteUserWithHttpInfo($username) + { + $apiResponse = $this->deleteUserWithApiResponse($username); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation deleteUserWithApiResponse + * + * Delete user + * + * @param string $username The name that needs to be deleted (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function deleteUserWithApiResponse($username) { $request = $this->deleteUserRequest($username); @@ -803,7 +991,7 @@ public function deleteUserWithHttpInfo($username) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -824,10 +1012,10 @@ public function deleteUserWithHttpInfo($username) */ public function deleteUserAsync($username) { - return $this->deleteUserAsyncWithHttpInfo($username) + return $this->deleteUserAsyncWithApiResponse($username) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -835,6 +1023,8 @@ function ($response) { /** * Operation deleteUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Delete user * * @param string $username The name that needs to be deleted (required) @@ -844,14 +1034,37 @@ function ($response) { */ public function deleteUserAsyncWithHttpInfo($username) { - $returnType = ''; + return $this->deleteUserAsyncWithApiResponse($username) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation deleteUserAsyncWithApiResponse + * + * Delete user + * + * @param string $username The name that needs to be deleted (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteUserAsyncWithApiResponse($username) + { $request = $this->deleteUserRequest($username); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -981,22 +1194,50 @@ protected function deleteUserRequest($username) */ public function getUserByName($username) { - list($response) = $this->getUserByNameWithHttpInfo($username); - return $response; + $apiResponse = $this->getUserByNameWithApiResponse($username); + return $apiResponse->getMessage(); } + /** * Operation getUserByNameWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (strings[]) */ public function getUserByNameWithHttpInfo($username) + { + $apiResponse = $this->getUserByNameWithApiResponse($username); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation getUserByNameWithApiResponse + * + * Get user by user name + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type \OpenAPI\Client\Model\User + */ + public function getUserByNameWithApiResponse($username) { $request = $this->getUserByNameRequest($username); @@ -1040,11 +1281,11 @@ public function getUserByNameWithHttpInfo($username) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\User', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = '\OpenAPI\Client\Model\User'; @@ -1058,11 +1299,11 @@ public function getUserByNameWithHttpInfo($username) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1091,10 +1332,10 @@ public function getUserByNameWithHttpInfo($username) */ public function getUserByNameAsync($username) { - return $this->getUserByNameAsyncWithHttpInfo($username) + return $this->getUserByNameAsyncWithApiResponse($username) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1102,6 +1343,8 @@ function ($response) { /** * Operation getUserByNameAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) @@ -1110,6 +1353,30 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function getUserByNameAsyncWithHttpInfo($username) + { + return $this->getUserByNameAsyncWithApiResponse($username) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation getUserByNameAsyncWithApiResponse + * + * Get user by user name + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUserByNameAsyncWithApiResponse($username) { $returnType = '\OpenAPI\Client\Model\User'; $request = $this->getUserByNameRequest($username); @@ -1128,11 +1395,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1263,13 +1530,17 @@ protected function getUserByNameRequest($username) */ public function loginUser($username, $password) { - list($response) = $this->loginUserWithHttpInfo($username, $password); - return $response; + $apiResponse = $this->loginUserWithApiResponse($username, $password); + return $apiResponse->getMessage(); } + /** * Operation loginUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Logs user into the system * * @param string $username The user name for login (required) @@ -1277,9 +1548,34 @@ public function loginUser($username, $password) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of string, HTTP status code, HTTP response headers (array of strings) + * @return array of string, HTTP status code, HTTP response headers (strings[]) */ public function loginUserWithHttpInfo($username, $password) + { + $apiResponse = $this->loginUserWithApiResponse($username, $password); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation loginUserWithApiResponse + * + * Logs user into the system + * + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property of type string + */ + public function loginUserWithApiResponse($username, $password) { $request = $this->loginUserRequest($username, $password); @@ -1323,11 +1619,11 @@ public function loginUserWithHttpInfo($username, $password) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, 'string', []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } $returnType = 'string'; @@ -1341,11 +1637,11 @@ public function loginUserWithHttpInfo($username, $password) } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1375,10 +1671,10 @@ public function loginUserWithHttpInfo($username, $password) */ public function loginUserAsync($username, $password) { - return $this->loginUserAsyncWithHttpInfo($username, $password) + return $this->loginUserAsyncWithApiResponse($username, $password) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1386,6 +1682,8 @@ function ($response) { /** * Operation loginUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Logs user into the system * * @param string $username The user name for login (required) @@ -1395,6 +1693,31 @@ function ($response) { * @return \GuzzleHttp\Promise\PromiseInterface */ public function loginUserAsyncWithHttpInfo($username, $password) + { + return $this->loginUserAsyncWithApiResponse($username, $password) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation loginUserAsyncWithApiResponse + * + * Logs user into the system + * + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function loginUserAsyncWithApiResponse($username, $password) { $returnType = 'string'; $request = $this->loginUserRequest($username, $password); @@ -1413,11 +1736,11 @@ function ($response) use ($returnType) { } } - return [ + return new ApiResponse( ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() - ]; + ); }, function ($exception) { $response = $exception->getResponse(); @@ -1553,20 +1876,47 @@ protected function loginUserRequest($username, $password) */ public function logoutUser() { - $this->logoutUserWithHttpInfo(); + $this->logoutUserWithApiResponse(); } + /** * Operation logoutUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Logs out current logged in user session * * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function logoutUserWithHttpInfo() + { + $apiResponse = $this->logoutUserWithApiResponse(); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation logoutUserWithApiResponse + * + * Logs out current logged in user session + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function logoutUserWithApiResponse() { $request = $this->logoutUserRequest(); @@ -1598,7 +1948,7 @@ public function logoutUserWithHttpInfo() ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1618,10 +1968,10 @@ public function logoutUserWithHttpInfo() */ public function logoutUserAsync() { - return $this->logoutUserAsyncWithHttpInfo() + return $this->logoutUserAsyncWithApiResponse() ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1629,6 +1979,8 @@ function ($response) { /** * Operation logoutUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Logs out current logged in user session * * @@ -1637,14 +1989,36 @@ function ($response) { */ public function logoutUserAsyncWithHttpInfo() { - $returnType = ''; + return $this->logoutUserAsyncWithApiResponse() + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation logoutUserAsyncWithApiResponse + * + * Logs out current logged in user session + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function logoutUserAsyncWithApiResponse() + { $request = $this->logoutUserRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); @@ -1760,12 +2134,16 @@ protected function logoutUserRequest() */ public function updateUser($username, $user) { - $this->updateUserWithHttpInfo($username, $user); + $this->updateUserWithApiResponse($username, $user); } + /** * Operation updateUserWithHttpInfo * + * (method preserved to keep backward compatibility) + * + * * Updated user * * @param string $username name that need to be deleted (required) @@ -1773,9 +2151,34 @@ public function updateUser($username, $user) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (strings[]) */ public function updateUserWithHttpInfo($username, $user) + { + $apiResponse = $this->updateUserWithApiResponse($username, $user); + + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + + + + /** + * Operation updateUserWithApiResponse + * + * Updated user + * + * @param string $username name that need to be deleted (required) + * @param \OpenAPI\Client\Model\User $user Updated user object (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return APIResponse with "message" property equals to null + */ + public function updateUserWithApiResponse($username, $user) { $request = $this->updateUserRequest($username, $user); @@ -1807,7 +2210,7 @@ public function updateUserWithHttpInfo($username, $user) ); } - return [null, $statusCode, $response->getHeaders()]; + return new ApiResponse(null, $statusCode, $response->getHeaders()); } catch (ApiException $e) { switch ($e->getCode()) { @@ -1829,10 +2232,10 @@ public function updateUserWithHttpInfo($username, $user) */ public function updateUserAsync($username, $user) { - return $this->updateUserAsyncWithHttpInfo($username, $user) + return $this->updateUserAsyncWithApiResponse($username, $user) ->then( - function ($response) { - return $response[0]; + function ($apiResponse) { + return $apiResponse->getMessage(); } ); } @@ -1840,6 +2243,8 @@ function ($response) { /** * Operation updateUserAsyncWithHttpInfo * + * (method preserved to keep backward compatibility) + * * Updated user * * @param string $username name that need to be deleted (required) @@ -1850,14 +2255,38 @@ function ($response) { */ public function updateUserAsyncWithHttpInfo($username, $user) { - $returnType = ''; + return $this->updateUserAsyncWithApiResponse($username, $user) + ->then( + function ($apiResponse) { + return [ + $apiResponse->getMessage(), + $apiResponse->getStatusCode(), + $apiResponse->getHeaders() + ]; + } + ); + } + + /** + * Operation updateUserAsyncWithApiResponse + * + * Updated user + * + * @param string $username name that need to be deleted (required) + * @param \OpenAPI\Client\Model\User $user Updated user object (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateUserAsyncWithApiResponse($username, $user) + { $request = $this->updateUserRequest($username, $user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + function ($response) { + return new ApiResponse(null, $response->getStatusCode(), $response->getHeaders()); }, function ($exception) { $response = $exception->getResponse(); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ApiResponse.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ApiResponse.php new file mode 100644 index 000000000000..52fcccc3f800 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ApiResponse.php @@ -0,0 +1,143 @@ +message = $message; + $this->statusCode = $statusCode; + $this->headers = $headers; + } + + /** + * Sets message (response) from API call + * + * @param mixed $message Message (response) from API call + * + * @return $this + */ + public function setMessage($message) + { + $this->message = $message; + return $this; + } + + /** + * Gets message (response) from API call + * + * @return mixed Message (response) from API call + */ + public function getMessage() + { + return $this->message; + } + + /** + * Sets response status code + * + * @param int $statusCode Response status code + * + * @return $this + */ + public function setStatusCode($statusCode) + { + $this->statusCode = $statusCode; + return $this; + } + + /** + * Gets response status code + * + * @return int Response status code + */ + public function getStatusCode() + { + return $this->statusCode; + } + + /** + * Sets message headers + * + * @param string[] $headers Message headers + * + * @return $this + */ + public function setHeaders($headers) + { + $this->headers = $headers; + return $this; + } + + /** + * Gets message headers + * + * @return string[] Message headers + */ + public function getHeaders() + { + return $this->headers; + } +}