diff --git a/bin/configs/php-nextgen-echo-api-streaming.yaml b/bin/configs/php-nextgen-echo-api-streaming.yaml
new file mode 100644
index 00000000000..cc311b6a467
--- /dev/null
+++ b/bin/configs/php-nextgen-echo-api-streaming.yaml
@@ -0,0 +1,7 @@
+generatorName: php-nextgen
+outputDir: samples/client/echo_api/php-nextgen-streaming
+inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
+templateDir: modules/openapi-generator/src/main/resources/php-nextgen
+additionalProperties:
+ hideGenerationTimestamp: "true"
+ supportStreaming: true
diff --git a/docs/generators/php-nextgen.md b/docs/generators/php-nextgen.md
index f0f5a44a0fd..434804de208 100644
--- a/docs/generators/php-nextgen.md
+++ b/docs/generators/php-nextgen.md
@@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
+|supportStreaming|Support streaming endpoint| |false|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
## IMPORT MAPPING
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java
index 8136c9d3003..6f79932b56f 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java
@@ -18,6 +18,8 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
@@ -42,6 +44,11 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
@SuppressWarnings("hiding")
private final Logger LOGGER = LoggerFactory.getLogger(PhpNextgenClientCodegen.class);
+ public static final String SUPPORT_STREAMING = "supportStreaming";
+
+ @Getter @Setter
+ protected boolean supportStreaming = false;
+
public PhpNextgenClientCodegen() {
super();
@@ -92,6 +99,7 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.ALLOW_UNICODE_IDENTIFIERS_DESC)
.defaultValue(Boolean.TRUE.toString()));
+ cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint", this.supportStreaming));
}
@Override
@@ -113,6 +121,8 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
public void processOpts() {
super.processOpts();
+ convertPropertyToBooleanAndWriteBack(SUPPORT_STREAMING, this::setSupportStreaming);
+
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("ObjectSerializer.mustache", toSrcPath(invokerPackage, srcBasePath), "ObjectSerializer.php"));
@@ -125,6 +135,10 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
supportingFiles.add(new SupportingFile(".php-cs-fixer.dist.php", "", ".php-cs-fixer.dist.php"));
supportingFiles.add(new SupportingFile(".phplint.mustache", "", ".phplint.yml"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
+
+ if(this.supportStreaming) {
+ typeMapping.put("file", "\\Psr\\\\Http\\\\Message\\\\StreamInterface");
+ }
}
@Override
diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache
index 5970d93dc95..624f7c0c79f 100644
--- a/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache
+++ b/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache
@@ -442,6 +442,10 @@ class ObjectSerializer
}
}
+ if ($class === '\Psr\Http\Message\StreamInterface') {
+ return Utils::streamFor($data);
+ }
+
if ($class === '\SplFileObject') {
$data = Utils::streamFor($data);
diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache
index 25fe7070344..d05252c5b95 100644
--- a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache
+++ b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache
@@ -306,7 +306,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/-first}}
{{#dataType}}
{{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
- if ('{{{dataType}}}' === '\SplFileObject') {
+ if (in_array('{{{dataType}}}', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -339,7 +339,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/responses}}
$returnType = '{{{returnType}}}';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -546,7 +546,7 @@ use {{invokerPackage}}\ObjectSerializer;
->then(
function ($response) use ($returnType) {
{{#returnType}}
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -755,10 +755,12 @@ use {{invokerPackage}}\ObjectSerializer;
$formParams['{{baseName}}'] = [];
$paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}];
foreach ($paramFiles as $paramFile) {
- $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
- ObjectSerializer::toFormValue($paramFile),
- 'rb'
- );
+ $formParams['{{baseName}}'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
}
{{/isFile}}
{{^isFile}}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java
new file mode 100644
index 00000000000..e8c7c3c88f6
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.php;
+
+import org.openapitools.codegen.languages.PhpNextgenClientCodegen;
+import org.openapitools.codegen.testutils.ConfigAssert;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class PhpNextgenClientCodegenTest {
+
+ @Test
+ public void testInitialConfigValues() throws Exception {
+ final PhpNextgenClientCodegen codegen = new PhpNextgenClientCodegen();
+
+ codegen.processOpts();
+
+ Assert.assertEquals(codegen.isSupportStreaming(), false);
+ }
+
+ @Test
+ public void testSettersForConfigValues() throws Exception {
+ final PhpNextgenClientCodegen codegen = new PhpNextgenClientCodegen();
+
+ codegen.setSupportStreaming(true);
+
+ codegen.processOpts();
+
+ Assert.assertEquals(codegen.isSupportStreaming(), true);
+ }
+
+ @Test
+ public void testAdditionalPropertiesPutForConfigValuesWithFalseValue() throws Exception {
+ final PhpNextgenClientCodegen codegen = new PhpNextgenClientCodegen();
+
+ codegen.additionalProperties().put(PhpNextgenClientCodegen.SUPPORT_STREAMING, false);
+
+ codegen.processOpts();
+ ConfigAssert configAssert = new ConfigAssert(codegen.additionalProperties());
+
+ configAssert.assertValue(PhpNextgenClientCodegen.SUPPORT_STREAMING, codegen::isSupportStreaming, Boolean.FALSE);
+ Assert.assertEquals(codegen.isSupportStreaming(), false);
+ }
+
+ @Test
+ public void testAdditionalPropertiesPutForConfigValuesWithTrueValue() throws Exception {
+ final PhpNextgenClientCodegen codegen = new PhpNextgenClientCodegen();
+
+ codegen.additionalProperties().put(PhpNextgenClientCodegen.SUPPORT_STREAMING, true);
+
+ codegen.processOpts();
+ ConfigAssert configAssert = new ConfigAssert(codegen.additionalProperties());
+
+ configAssert.assertValue(PhpNextgenClientCodegen.SUPPORT_STREAMING, codegen::isSupportStreaming, Boolean.TRUE);
+ Assert.assertEquals(codegen.isSupportStreaming(), true);
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/.gitignore b/samples/client/echo_api/php-nextgen-streaming/.gitignore
new file mode 100644
index 00000000000..cc2a4bdc54f
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.gitignore
@@ -0,0 +1,19 @@
+# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
+
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+# makes sense since it's a library(client SDK) and not a project
+composer.lock
+
+# php-cs-fixer cache
+.php_cs.cache
+.php-cs-fixer.cache
+
+# PHPUnit cache
+.phpunit.result.cache
+
+# PHPLint cache
+build/phplint.cache
diff --git a/samples/client/echo_api/php-nextgen-streaming/.openapi-generator-ignore b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator-ignore
new file mode 100644
index 00000000000..7484ee590a3
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES
new file mode 100644
index 00000000000..c51141c743e
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES
@@ -0,0 +1,49 @@
+.gitignore
+.php-cs-fixer.dist.php
+.phplint.yml
+.travis.yml
+README.md
+composer.json
+docs/Api/AuthApi.md
+docs/Api/BodyApi.md
+docs/Api/FormApi.md
+docs/Api/HeaderApi.md
+docs/Api/PathApi.md
+docs/Api/QueryApi.md
+docs/Model/Bird.md
+docs/Model/Category.md
+docs/Model/DataQuery.md
+docs/Model/DefaultValue.md
+docs/Model/NumberPropertiesOnly.md
+docs/Model/Pet.md
+docs/Model/Query.md
+docs/Model/StringEnumRef.md
+docs/Model/Tag.md
+docs/Model/TestFormObjectMultipartRequestMarker.md
+docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
+docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
+git_push.sh
+phpunit.xml.dist
+src/Api/AuthApi.php
+src/Api/BodyApi.php
+src/Api/FormApi.php
+src/Api/HeaderApi.php
+src/Api/PathApi.php
+src/Api/QueryApi.php
+src/ApiException.php
+src/Configuration.php
+src/HeaderSelector.php
+src/Model/Bird.php
+src/Model/Category.php
+src/Model/DataQuery.php
+src/Model/DefaultValue.php
+src/Model/ModelInterface.php
+src/Model/NumberPropertiesOnly.php
+src/Model/Pet.php
+src/Model/Query.php
+src/Model/StringEnumRef.php
+src/Model/Tag.php
+src/Model/TestFormObjectMultipartRequestMarker.php
+src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php
+src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php
+src/ObjectSerializer.php
diff --git a/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/VERSION b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/VERSION
new file mode 100644
index 00000000000..6116b14d2c5
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/VERSION
@@ -0,0 +1 @@
+7.8.0-SNAPSHOT
diff --git a/samples/client/echo_api/php-nextgen-streaming/.php-cs-fixer.dist.php b/samples/client/echo_api/php-nextgen-streaming/.php-cs-fixer.dist.php
new file mode 100644
index 00000000000..af9cf39fddb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.php-cs-fixer.dist.php
@@ -0,0 +1,29 @@
+in(__DIR__)
+ ->exclude('vendor')
+ ->exclude('test')
+ ->exclude('tests')
+;
+
+$config = new PhpCsFixer\Config();
+return $config->setRules([
+ '@PSR12' => true,
+ 'phpdoc_order' => true,
+ 'array_syntax' => [ 'syntax' => 'short' ],
+ 'strict_comparison' => true,
+ 'strict_param' => true,
+ 'no_trailing_whitespace' => false,
+ 'no_trailing_whitespace_in_comment' => false,
+ 'braces' => false,
+ 'single_blank_line_at_eof' => false,
+ 'blank_line_after_namespace' => false,
+ 'no_leading_import_slash' => false,
+ ])
+ ->setFinder($finder)
+;
diff --git a/samples/client/echo_api/php-nextgen-streaming/.phplint.yml b/samples/client/echo_api/php-nextgen-streaming/.phplint.yml
new file mode 100644
index 00000000000..ef4be48fa2d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.phplint.yml
@@ -0,0 +1,11 @@
+path:
+ - ./src
+ - ./tests
+jobs: 10
+extensions:
+ - php
+exclude:
+ - vendor
+warning: true
+memory-limit: -1
+no-cache: true
diff --git a/samples/client/echo_api/php-nextgen-streaming/.travis.yml b/samples/client/echo_api/php-nextgen-streaming/.travis.yml
new file mode 100644
index 00000000000..707be2a11d5
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/.travis.yml
@@ -0,0 +1,12 @@
+language: php
+# Jammy Jellyfish environment has preinstalled PHP 8.1
+# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only
+# https://docs.travis-ci.com/user/reference/jammy/#php-support
+dist: jammy
+os:
+ - linux
+php:
+ - 8.1
+ - 8.2
+before_install: "composer install"
+script: "vendor/bin/phpunit"
diff --git a/samples/client/echo_api/php-nextgen-streaming/README.md b/samples/client/echo_api/php-nextgen-streaming/README.md
new file mode 100644
index 00000000000..ec17c042f5e
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/README.md
@@ -0,0 +1,152 @@
+# OpenAPIClient-php
+
+Echo Server API
+
+
+## Installation & Usage
+
+### Requirements
+
+PHP 8.1 and later.
+
+### Composer
+
+To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
+
+```json
+{
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
+ }
+ ],
+ "require": {
+ "GIT_USER_ID/GIT_REPO_ID": "*@dev"
+ }
+}
+```
+
+Then run `composer install`
+
+### Manual Installation
+
+Download the files and include `autoload.php`:
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+
+$apiInstance = new OpenAPI\Client\Api\AuthApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+
+try {
+ $result = $apiInstance->testAuthHttpBasic();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling AuthApi->testAuthHttpBasic: ', $e->getMessage(), PHP_EOL;
+}
+
+```
+
+## API Endpoints
+
+All URIs are relative to *http://localhost:3000*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*AuthApi* | [**testAuthHttpBasic**](docs/Api/AuthApi.md#testauthhttpbasic) | **POST** /auth/http/basic | To test HTTP basic authentication
+*AuthApi* | [**testAuthHttpBearer**](docs/Api/AuthApi.md#testauthhttpbearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
+*BodyApi* | [**testBinaryGif**](docs/Api/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body
+*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/Api/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
+*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/Api/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
+*BodyApi* | [**testBodyMultipartFormdataSingleBinary**](docs/Api/BodyApi.md#testbodymultipartformdatasinglebinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
+*BodyApi* | [**testEchoBodyAllOfPet**](docs/Api/BodyApi.md#testechobodyallofpet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
+*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/Api/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
+*BodyApi* | [**testEchoBodyPet**](docs/Api/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s)
+*BodyApi* | [**testEchoBodyPetResponseString**](docs/Api/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body
+*BodyApi* | [**testEchoBodyStringEnum**](docs/Api/BodyApi.md#testechobodystringenum) | **POST** /echo/body/string_enum | Test string enum response body
+*BodyApi* | [**testEchoBodyTagResponseString**](docs/Api/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
+*FormApi* | [**testFormIntegerBooleanString**](docs/Api/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s)
+*FormApi* | [**testFormObjectMultipart**](docs/Api/FormApi.md#testformobjectmultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema
+*FormApi* | [**testFormOneof**](docs/Api/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
+*HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/Api/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
+*PathApi* | [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/Api/PathApi.md#testspathstringpathstringintegerpathintegerenumnonrefstringpathenumrefstringpath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
+*QueryApi* | [**testEnumRefString**](docs/Api/QueryApi.md#testenumrefstring) | **GET** /query/enum_ref_string | Test query parameter(s)
+*QueryApi* | [**testQueryDatetimeDateString**](docs/Api/QueryApi.md#testquerydatetimedatestring) | **GET** /query/datetime/date/string | Test query parameter(s)
+*QueryApi* | [**testQueryIntegerBooleanString**](docs/Api/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s)
+*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObject**](docs/Api/QueryApi.md#testquerystyledeepobjectexplodetrueobject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
+*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/Api/QueryApi.md#testquerystyledeepobjectexplodetrueobjectallof) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeFalseArrayInteger**](docs/Api/QueryApi.md#testquerystyleformexplodefalsearrayinteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeFalseArrayString**](docs/Api/QueryApi.md#testquerystyleformexplodefalsearraystring) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/Api/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/Api/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeTrueObjectAllOf**](docs/Api/QueryApi.md#testquerystyleformexplodetrueobjectallof) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
+
+## Models
+
+- [Bird](docs/Model/Bird.md)
+- [Category](docs/Model/Category.md)
+- [DataQuery](docs/Model/DataQuery.md)
+- [DefaultValue](docs/Model/DefaultValue.md)
+- [NumberPropertiesOnly](docs/Model/NumberPropertiesOnly.md)
+- [Pet](docs/Model/Pet.md)
+- [Query](docs/Model/Query.md)
+- [StringEnumRef](docs/Model/StringEnumRef.md)
+- [Tag](docs/Model/Tag.md)
+- [TestFormObjectMultipartRequestMarker](docs/Model/TestFormObjectMultipartRequestMarker.md)
+- [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
+- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
+
+## Authorization
+
+### http_auth
+
+- **Type**: HTTP basic authentication
+
+
+### http_bearer_auth
+
+- **Type**: Bearer authentication
+
+## Tests
+
+To run the tests, use:
+
+```bash
+composer install
+vendor/bin/phpunit
+```
+
+## Author
+
+team@openapitools.org
+
+## About this package
+
+This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+- API version: `0.1.0`
+ - Generator version: `7.8.0-SNAPSHOT`
+- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen`
diff --git a/samples/client/echo_api/php-nextgen-streaming/composer.json b/samples/client/echo_api/php-nextgen-streaming/composer.json
new file mode 100644
index 00000000000..1d2015c490e
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/composer.json
@@ -0,0 +1,45 @@
+{
+ "description": "Echo Server API",
+ "keywords": [
+ "openapitools",
+ "openapi-generator",
+ "openapi",
+ "php",
+ "sdk",
+ "rest",
+ "api"
+ ],
+ "homepage": "https://openapi-generator.tech",
+ "license": "unlicense",
+ "authors": [
+ {
+ "name": "OpenAPI-Generator contributors",
+ "homepage": "https://openapi-generator.tech"
+ }
+ ],
+ "require": {
+ "php": "^8.1",
+ "ext-curl": "*",
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "guzzlehttp/guzzle": "^7.4.5",
+ "guzzlehttp/psr7": "^2.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.5",
+ "overtrue/phplint": "^9.0",
+ "phpunit/phpunit": "^9.0"
+ },
+ "autoload": {
+ "psr-4": { "OpenAPI\\Client\\" : "src/" }
+ },
+ "autoload-dev": {
+ "psr-4": { "OpenAPI\\Client\\Test\\" : "tests/" }
+ },
+ "scripts": {
+ "test": [
+ "@phplint"
+ ],
+ "phplint": "phplint"
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/AuthApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/AuthApi.md
new file mode 100644
index 00000000000..874f3c61c69
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/AuthApi.md
@@ -0,0 +1,125 @@
+# OpenAPI\Client\AuthApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testAuthHttpBasic()**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication |
+| [**testAuthHttpBearer()**](AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication |
+
+
+## `testAuthHttpBasic()`
+
+```php
+testAuthHttpBasic(): string
+```
+
+To test HTTP basic authentication
+
+To test HTTP basic authentication
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+
+$apiInstance = new OpenAPI\Client\Api\AuthApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+
+try {
+ $result = $apiInstance->testAuthHttpBasic();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling AuthApi->testAuthHttpBasic: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**string**
+
+### Authorization
+
+[http_auth](../../README.md#http_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testAuthHttpBearer()`
+
+```php
+testAuthHttpBearer(): string
+```
+
+To test HTTP bearer authentication
+
+To test HTTP bearer authentication
+
+### Example
+
+```php
+setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new OpenAPI\Client\Api\AuthApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+
+try {
+ $result = $apiInstance->testAuthHttpBearer();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling AuthApi->testAuthHttpBearer: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**string**
+
+### Authorization
+
+[http_bearer_auth](../../README.md#http_bearer_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md
new file mode 100644
index 00000000000..6c26bb843ff
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md
@@ -0,0 +1,574 @@
+# OpenAPI\Client\BodyApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testBinaryGif()**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
+| [**testBodyApplicationOctetstreamBinary()**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
+| [**testBodyMultipartFormdataArrayOfBinary()**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
+| [**testBodyMultipartFormdataSingleBinary()**](BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime |
+| [**testEchoBodyAllOfPet()**](BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) |
+| [**testEchoBodyFreeFormObjectResponseString()**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
+| [**testEchoBodyPet()**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
+| [**testEchoBodyPetResponseString()**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
+| [**testEchoBodyStringEnum()**](BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body |
+| [**testEchoBodyTagResponseString()**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) |
+
+
+## `testBinaryGif()`
+
+```php
+testBinaryGif(): \Psr\Http\Message\StreamInterface
+```
+
+Test binary (gif) response body
+
+Test binary (gif) response body
+
+### Example
+
+```php
+testBinaryGif();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBinaryGif: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+[**\Psr\Http\Message\StreamInterface**](../Model/\Psr\Http\Message\StreamInterface.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `image/gif`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testBodyApplicationOctetstreamBinary()`
+
+```php
+testBodyApplicationOctetstreamBinary($body): string
+```
+
+Test body parameter(s)
+
+Test body parameter(s)
+
+### Example
+
+```php
+testBodyApplicationOctetstreamBinary($body);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBodyApplicationOctetstreamBinary: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **body** | **\Psr\Http\Message\StreamInterface****\Psr\Http\Message\StreamInterface**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/octet-stream`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testBodyMultipartFormdataArrayOfBinary()`
+
+```php
+testBodyMultipartFormdataArrayOfBinary($files): string
+```
+
+Test array of binary in multipart mime
+
+Test array of binary in multipart mime
+
+### Example
+
+```php
+testBodyMultipartFormdataArrayOfBinary($files);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBodyMultipartFormdataArrayOfBinary: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **files** | **\Psr\Http\Message\StreamInterface[]**| | |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `multipart/form-data`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testBodyMultipartFormdataSingleBinary()`
+
+```php
+testBodyMultipartFormdataSingleBinary($my_file): string
+```
+
+Test single binary in multipart mime
+
+Test single binary in multipart mime
+
+### Example
+
+```php
+testBodyMultipartFormdataSingleBinary($my_file);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBodyMultipartFormdataSingleBinary: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **my_file** | **\Psr\Http\Message\StreamInterface****\Psr\Http\Message\StreamInterface**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `multipart/form-data`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyAllOfPet()`
+
+```php
+testEchoBodyAllOfPet($pet): \OpenAPI\Client\Model\Pet
+```
+
+Test body parameter(s)
+
+Test body parameter(s)
+
+### Example
+
+```php
+testEchoBodyAllOfPet($pet);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyAllOfPet: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | [optional] |
+
+### Return type
+
+[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyFreeFormObjectResponseString()`
+
+```php
+testEchoBodyFreeFormObjectResponseString($body): string
+```
+
+Test free form object
+
+Test free form object
+
+### Example
+
+```php
+ new \stdClass); // object | Free form object
+
+try {
+ $result = $apiInstance->testEchoBodyFreeFormObjectResponseString($body);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyFreeFormObjectResponseString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **body** | **object**| Free form object | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyPet()`
+
+```php
+testEchoBodyPet($pet): \OpenAPI\Client\Model\Pet
+```
+
+Test body parameter(s)
+
+Test body parameter(s)
+
+### Example
+
+```php
+testEchoBodyPet($pet);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyPet: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | [optional] |
+
+### Return type
+
+[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyPetResponseString()`
+
+```php
+testEchoBodyPetResponseString($pet): string
+```
+
+Test empty response body
+
+Test empty response body
+
+### Example
+
+```php
+testEchoBodyPetResponseString($pet);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyPetResponseString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyStringEnum()`
+
+```php
+testEchoBodyStringEnum($body): \OpenAPI\Client\Model\StringEnumRef
+```
+
+Test string enum response body
+
+Test string enum response body
+
+### Example
+
+```php
+testEchoBodyStringEnum($body);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyStringEnum: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **body** | **string**| String enum | [optional] |
+
+### Return type
+
+[**\OpenAPI\Client\Model\StringEnumRef**](../Model/StringEnumRef.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyTagResponseString()`
+
+```php
+testEchoBodyTagResponseString($tag): string
+```
+
+Test empty json (request body)
+
+Test empty json (request body)
+
+### Example
+
+```php
+testEchoBodyTagResponseString($tag);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyTagResponseString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **tag** | [**\OpenAPI\Client\Model\Tag**](../Model/Tag.md)| Tag object | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/FormApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/FormApi.md
new file mode 100644
index 00000000000..f9236a17214
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/FormApi.md
@@ -0,0 +1,192 @@
+# OpenAPI\Client\FormApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testFormIntegerBooleanString()**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) |
+| [**testFormObjectMultipart()**](FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema |
+| [**testFormOneof()**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
+
+
+## `testFormIntegerBooleanString()`
+
+```php
+testFormIntegerBooleanString($integer_form, $boolean_form, $string_form): string
+```
+
+Test form parameter(s)
+
+Test form parameter(s)
+
+### Example
+
+```php
+testFormIntegerBooleanString($integer_form, $boolean_form, $string_form);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling FormApi->testFormIntegerBooleanString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **integer_form** | **int**| | [optional] |
+| **boolean_form** | **bool**| | [optional] |
+| **string_form** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/x-www-form-urlencoded`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testFormObjectMultipart()`
+
+```php
+testFormObjectMultipart($marker): string
+```
+
+Test form parameter(s) for multipart schema
+
+Test form parameter(s) for multipart schema
+
+### Example
+
+```php
+testFormObjectMultipart($marker);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling FormApi->testFormObjectMultipart: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **marker** | [**\OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker**](../Model/TestFormObjectMultipartRequestMarker.md)| | |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `multipart/form-data`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testFormOneof()`
+
+```php
+testFormOneof($form1, $form2, $form3, $form4, $id, $name): string
+```
+
+Test form parameter(s) for oneOf schema
+
+Test form parameter(s) for oneOf schema
+
+### Example
+
+```php
+testFormOneof($form1, $form2, $form3, $form4, $id, $name);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling FormApi->testFormOneof: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **form1** | **string**| | [optional] |
+| **form2** | **int**| | [optional] |
+| **form3** | **string**| | [optional] |
+| **form4** | **bool**| | [optional] |
+| **id** | **int**| | [optional] |
+| **name** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/x-www-form-urlencoded`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/HeaderApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/HeaderApi.md
new file mode 100644
index 00000000000..62de1378949
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/HeaderApi.md
@@ -0,0 +1,72 @@
+# OpenAPI\Client\HeaderApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testHeaderIntegerBooleanStringEnums()**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) |
+
+
+## `testHeaderIntegerBooleanStringEnums()`
+
+```php
+testHeaderIntegerBooleanStringEnums($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header): string
+```
+
+Test header parameter(s)
+
+Test header parameter(s)
+
+### Example
+
+```php
+testHeaderIntegerBooleanStringEnums($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling HeaderApi->testHeaderIntegerBooleanStringEnums: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **integer_header** | **int**| | [optional] |
+| **boolean_header** | **bool**| | [optional] |
+| **string_header** | **string**| | [optional] |
+| **enum_nonref_string_header** | **string**| | [optional] |
+| **enum_ref_string_header** | [**StringEnumRef**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/PathApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/PathApi.md
new file mode 100644
index 00000000000..9d3001f0139
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/PathApi.md
@@ -0,0 +1,70 @@
+# OpenAPI\Client\PathApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath()**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
+
+
+## `testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath()`
+
+```php
+testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path): string
+```
+
+Test path parameter(s)
+
+Test path parameter(s)
+
+### Example
+
+```php
+testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling PathApi->testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **path_string** | **string**| | |
+| **path_integer** | **int**| | |
+| **enum_nonref_string_path** | **string**| | |
+| **enum_ref_string_path** | [**StringEnumRef**](../Model/.md)| | |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md
new file mode 100644
index 00000000000..10208136e80
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md
@@ -0,0 +1,587 @@
+# OpenAPI\Client\QueryApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testEnumRefString()**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) |
+| [**testQueryDatetimeDateString()**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) |
+| [**testQueryIntegerBooleanString()**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) |
+| [**testQueryStyleDeepObjectExplodeTrueObject()**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) |
+| [**testQueryStyleDeepObjectExplodeTrueObjectAllOf()**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) |
+| [**testQueryStyleFormExplodeFalseArrayInteger()**](QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s) |
+| [**testQueryStyleFormExplodeFalseArrayString()**](QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s) |
+| [**testQueryStyleFormExplodeTrueArrayString()**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
+| [**testQueryStyleFormExplodeTrueObject()**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
+| [**testQueryStyleFormExplodeTrueObjectAllOf()**](QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) |
+
+
+## `testEnumRefString()`
+
+```php
+testEnumRefString($enum_nonref_string_query, $enum_ref_string_query): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testEnumRefString($enum_nonref_string_query, $enum_ref_string_query);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testEnumRefString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **enum_nonref_string_query** | **string**| | [optional] |
+| **enum_ref_string_query** | [**StringEnumRef**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryDatetimeDateString()`
+
+```php
+testQueryDatetimeDateString($datetime_query, $date_query, $string_query): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryDatetimeDateString($datetime_query, $date_query, $string_query);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryDatetimeDateString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **datetime_query** | **\DateTime**| | [optional] |
+| **date_query** | **\DateTime**| | [optional] |
+| **string_query** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryIntegerBooleanString()`
+
+```php
+testQueryIntegerBooleanString($integer_query, $boolean_query, $string_query): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryIntegerBooleanString($integer_query, $boolean_query, $string_query);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryIntegerBooleanString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **integer_query** | **int**| | [optional] |
+| **boolean_query** | **bool**| | [optional] |
+| **string_query** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleDeepObjectExplodeTrueObject()`
+
+```php
+testQueryStyleDeepObjectExplodeTrueObject($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleDeepObjectExplodeTrueObject($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleDeepObjectExplodeTrueObject: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**Pet**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleDeepObjectExplodeTrueObjectAllOf()`
+
+```php
+testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleDeepObjectExplodeTrueObjectAllOf: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeFalseArrayInteger()`
+
+```php
+testQueryStyleFormExplodeFalseArrayInteger($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeFalseArrayInteger($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeFalseArrayInteger: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**int[]**](../Model/int.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeFalseArrayString()`
+
+```php
+testQueryStyleFormExplodeFalseArrayString($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeFalseArrayString($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeFalseArrayString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**string[]**](../Model/string.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeTrueArrayString()`
+
+```php
+testQueryStyleFormExplodeTrueArrayString($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeTrueArrayString($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeTrueArrayString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeTrueObject()`
+
+```php
+testQueryStyleFormExplodeTrueObject($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeTrueObject($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeTrueObject: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**Pet**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeTrueObjectAllOf()`
+
+```php
+testQueryStyleFormExplodeTrueObjectAllOf($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeTrueObjectAllOf($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeTrueObjectAllOf: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**DataQuery**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Bird.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Bird.md
new file mode 100644
index 00000000000..e6aa9ec6b21
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Bird.md
@@ -0,0 +1,10 @@
+# # Bird
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**size** | **string** | | [optional]
+**color** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Category.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Category.md
new file mode 100644
index 00000000000..7302be9d97d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Category.md
@@ -0,0 +1,10 @@
+# # Category
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/DataQuery.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/DataQuery.md
new file mode 100644
index 00000000000..c618206597d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/DataQuery.md
@@ -0,0 +1,11 @@
+# # DataQuery
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**suffix** | **string** | test suffix | [optional]
+**text** | **string** | Some text containing white spaces | [optional]
+**date** | **\DateTime** | A date | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md
new file mode 100644
index 00000000000..ad271999e3a
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md
@@ -0,0 +1,16 @@
+# # DefaultValue
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to [["success","failure"]]]
+**array_string_enum_default** | **string[]** | | [optional] [default to [["success","failure"]]]
+**array_string_default** | **string[]** | | [optional] [default to [["failure","skipped"]]]
+**array_integer_default** | **int[]** | | [optional] [default to [[1,3]]]
+**array_string** | **string[]** | | [optional]
+**array_string_nullable** | **string[]** | | [optional]
+**array_string_extension_nullable** | **string[]** | | [optional]
+**string_nullable** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/NumberPropertiesOnly.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/NumberPropertiesOnly.md
new file mode 100644
index 00000000000..e6ea27f9be3
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/NumberPropertiesOnly.md
@@ -0,0 +1,11 @@
+# # NumberPropertiesOnly
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**number** | **float** | | [optional]
+**float** | **float** | | [optional]
+**double** | **float** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Pet.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Pet.md
new file mode 100644
index 00000000000..833b1a761af
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Pet.md
@@ -0,0 +1,14 @@
+# # Pet
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **string** | |
+**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional]
+**photo_urls** | **string[]** | |
+**tags** | [**\OpenAPI\Client\Model\Tag[]**](Tag.md) | | [optional]
+**status** | **string** | pet status in the store | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md
new file mode 100644
index 00000000000..91d1e7e7feb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md
@@ -0,0 +1,10 @@
+# # Query
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | Query | [optional]
+**outcomes** | **string[]** | | [optional] [default to [["SUCCESS","FAILURE"]]]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/StringEnumRef.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/StringEnumRef.md
new file mode 100644
index 00000000000..71ea837b8ed
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/StringEnumRef.md
@@ -0,0 +1,8 @@
+# # StringEnumRef
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Tag.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Tag.md
new file mode 100644
index 00000000000..4cf7084738b
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Tag.md
@@ -0,0 +1,10 @@
+# # Tag
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestFormObjectMultipartRequestMarker.md
new file mode 100644
index 00000000000..212a07554ae
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestFormObjectMultipartRequestMarker.md
@@ -0,0 +1,9 @@
+# # TestFormObjectMultipartRequestMarker
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
new file mode 100644
index 00000000000..c68f7a620bc
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
@@ -0,0 +1,12 @@
+# # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**size** | **string** | | [optional]
+**color** | **string** | | [optional]
+**id** | **int** | | [optional]
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
new file mode 100644
index 00000000000..f91817fe776
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
@@ -0,0 +1,9 @@
+# # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**values** | **string[]** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen-streaming/git_push.sh b/samples/client/echo_api/php-nextgen-streaming/git_push.sh
new file mode 100644
index 00000000000..f53a75d4fab
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/git_push.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+ git_host="github.com"
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=$(git remote)
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
diff --git a/samples/client/echo_api/php-nextgen-streaming/phpunit.xml.dist b/samples/client/echo_api/php-nextgen-streaming/phpunit.xml.dist
new file mode 100644
index 00000000000..1135449a8d9
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/phpunit.xml.dist
@@ -0,0 +1,18 @@
+
+
+
+
+ ./src/Api
+ ./src/Model
+
+
+
+
+ ./tests/Api
+ ./tests/Model
+
+
+
+
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php
new file mode 100644
index 00000000000..ca433d86ac9
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php
@@ -0,0 +1,749 @@
+ [
+ 'application/json',
+ ],
+ 'testAuthHttpBearer' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testAuthHttpBasic
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testAuthHttpBasic(
+ string $contentType = self::contentTypes['testAuthHttpBasic'][0]
+ ): string
+ {
+ list($response) = $this->testAuthHttpBasicWithHttpInfo($contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testAuthHttpBasicWithHttpInfo
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testAuthHttpBasicWithHttpInfo(
+ string $contentType = self::contentTypes['testAuthHttpBasic'][0]
+ ): array
+ {
+ $request = $this->testAuthHttpBasicRequest($contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testAuthHttpBasicAsync
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testAuthHttpBasicAsync(
+ string $contentType = self::contentTypes['testAuthHttpBasic'][0]
+ ): PromiseInterface
+ {
+ return $this->testAuthHttpBasicAsyncWithHttpInfo($contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testAuthHttpBasicAsyncWithHttpInfo
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testAuthHttpBasicAsyncWithHttpInfo(
+ string $contentType = self::contentTypes['testAuthHttpBasic'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testAuthHttpBasicRequest($contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testAuthHttpBasic'
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testAuthHttpBasicRequest(
+ string $contentType = self::contentTypes['testAuthHttpBasic'][0]
+ ): Request
+ {
+
+
+ $resourcePath = '/auth/http/basic';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testAuthHttpBearer
+ *
+ * To test HTTP bearer authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBearer'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testAuthHttpBearer(
+ string $contentType = self::contentTypes['testAuthHttpBearer'][0]
+ ): string
+ {
+ list($response) = $this->testAuthHttpBearerWithHttpInfo($contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testAuthHttpBearerWithHttpInfo
+ *
+ * To test HTTP bearer authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBearer'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testAuthHttpBearerWithHttpInfo(
+ string $contentType = self::contentTypes['testAuthHttpBearer'][0]
+ ): array
+ {
+ $request = $this->testAuthHttpBearerRequest($contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testAuthHttpBearerAsync
+ *
+ * To test HTTP bearer authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBearer'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testAuthHttpBearerAsync(
+ string $contentType = self::contentTypes['testAuthHttpBearer'][0]
+ ): PromiseInterface
+ {
+ return $this->testAuthHttpBearerAsyncWithHttpInfo($contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testAuthHttpBearerAsyncWithHttpInfo
+ *
+ * To test HTTP bearer authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBearer'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testAuthHttpBearerAsyncWithHttpInfo(
+ string $contentType = self::contentTypes['testAuthHttpBearer'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testAuthHttpBearerRequest($contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testAuthHttpBearer'
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBearer'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testAuthHttpBearerRequest(
+ string $contentType = self::contentTypes['testAuthHttpBearer'][0]
+ ): Request
+ {
+
+
+ $resourcePath = '/auth/http/bearer';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires Bearer authentication (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php
new file mode 100644
index 00000000000..53b924002d8
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php
@@ -0,0 +1,3323 @@
+ [
+ 'application/json',
+ ],
+ 'testBodyApplicationOctetstreamBinary' => [
+ 'application/octet-stream',
+ ],
+ 'testBodyMultipartFormdataArrayOfBinary' => [
+ 'multipart/form-data',
+ ],
+ 'testBodyMultipartFormdataSingleBinary' => [
+ 'multipart/form-data',
+ ],
+ 'testEchoBodyAllOfPet' => [
+ 'application/json',
+ ],
+ 'testEchoBodyFreeFormObjectResponseString' => [
+ 'application/json',
+ ],
+ 'testEchoBodyPet' => [
+ 'application/json',
+ ],
+ 'testEchoBodyPetResponseString' => [
+ 'application/json',
+ ],
+ 'testEchoBodyStringEnum' => [
+ 'application/json',
+ ],
+ 'testEchoBodyTagResponseString' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testBinaryGif
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Psr\Http\Message\StreamInterface
+ */
+ public function testBinaryGif(
+ string $contentType = self::contentTypes['testBinaryGif'][0]
+ ): \Psr\Http\Message\StreamInterface
+ {
+ list($response) = $this->testBinaryGifWithHttpInfo($contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBinaryGifWithHttpInfo
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of \Psr\Http\Message\StreamInterface, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBinaryGifWithHttpInfo(
+ string $contentType = self::contentTypes['testBinaryGif'][0]
+ ): array
+ {
+ $request = $this->testBinaryGifRequest($contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('\Psr\Http\Message\StreamInterface', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\Psr\Http\Message\StreamInterface' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\Psr\Http\Message\StreamInterface', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\Psr\Http\Message\StreamInterface';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Psr\Http\Message\StreamInterface',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBinaryGifAsync
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBinaryGifAsync(
+ string $contentType = self::contentTypes['testBinaryGif'][0]
+ ): PromiseInterface
+ {
+ return $this->testBinaryGifAsyncWithHttpInfo($contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBinaryGifAsyncWithHttpInfo
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBinaryGifAsyncWithHttpInfo(
+ string $contentType = self::contentTypes['testBinaryGif'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Psr\Http\Message\StreamInterface';
+ $request = $this->testBinaryGifRequest($contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBinaryGif'
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBinaryGifRequest(
+ string $contentType = self::contentTypes['testBinaryGif'][0]
+ ): Request
+ {
+
+
+ $resourcePath = '/binary/gif';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['image/gif', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinary
+ *
+ * Test body parameter(s)
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $body body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testBodyApplicationOctetstreamBinary(
+ ?\Psr\Http\Message\StreamInterface $body = null,
+ string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
+ ): string
+ {
+ list($response) = $this->testBodyApplicationOctetstreamBinaryWithHttpInfo($body, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinaryWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBodyApplicationOctetstreamBinaryWithHttpInfo(
+ ?\Psr\Http\Message\StreamInterface $body = null,
+ string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
+ ): array
+ {
+ $request = $this->testBodyApplicationOctetstreamBinaryRequest($body, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinaryAsync
+ *
+ * Test body parameter(s)
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBodyApplicationOctetstreamBinaryAsync(
+ ?\Psr\Http\Message\StreamInterface $body = null,
+ string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
+ ): PromiseInterface
+ {
+ return $this->testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo($body, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo(
+ $body = null,
+ string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testBodyApplicationOctetstreamBinaryRequest($body, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBodyApplicationOctetstreamBinary'
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBodyApplicationOctetstreamBinaryRequest(
+ $body = null,
+ string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/body/application/octetstream/binary';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinary
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface[] $files files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testBodyMultipartFormdataArrayOfBinary(
+ array $files,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
+ ): string
+ {
+ list($response) = $this->testBodyMultipartFormdataArrayOfBinaryWithHttpInfo($files, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinaryWithHttpInfo
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(
+ array $files,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
+ ): array
+ {
+ $request = $this->testBodyMultipartFormdataArrayOfBinaryRequest($files, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinaryAsync
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryAsync(
+ array $files,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
+ ): PromiseInterface
+ {
+ return $this->testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo($files, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo(
+ $files,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testBodyMultipartFormdataArrayOfBinaryRequest($files, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBodyMultipartFormdataArrayOfBinary'
+ *
+ * @param \Psr\Http\Message\StreamInterface[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryRequest(
+ $files,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
+ ): Request
+ {
+
+ // verify the required parameter 'files' is set
+ if ($files === null || (is_array($files) && count($files) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $files when calling testBodyMultipartFormdataArrayOfBinary'
+ );
+ }
+
+
+ $resourcePath = '/body/application/octetstream/array_of_binary';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($files !== null) {
+ $multipart = true;
+ $formParams['files'] = [];
+ $paramFiles = is_array($files) ? $files : [$files];
+ foreach ($paramFiles as $paramFile) {
+ $formParams['files'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
+ }
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataSingleBinary
+ *
+ * Test single binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $my_file my_file (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataSingleBinary'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testBodyMultipartFormdataSingleBinary(
+ ?\Psr\Http\Message\StreamInterface $my_file = null,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
+ ): string
+ {
+ list($response) = $this->testBodyMultipartFormdataSingleBinaryWithHttpInfo($my_file, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataSingleBinaryWithHttpInfo
+ *
+ * Test single binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $my_file (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataSingleBinary'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo(
+ ?\Psr\Http\Message\StreamInterface $my_file = null,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
+ ): array
+ {
+ $request = $this->testBodyMultipartFormdataSingleBinaryRequest($my_file, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataSingleBinaryAsync
+ *
+ * Test single binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $my_file (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataSingleBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBodyMultipartFormdataSingleBinaryAsync(
+ ?\Psr\Http\Message\StreamInterface $my_file = null,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
+ ): PromiseInterface
+ {
+ return $this->testBodyMultipartFormdataSingleBinaryAsyncWithHttpInfo($my_file, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataSingleBinaryAsyncWithHttpInfo
+ *
+ * Test single binary in multipart mime
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $my_file (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataSingleBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testBodyMultipartFormdataSingleBinaryAsyncWithHttpInfo(
+ $my_file = null,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testBodyMultipartFormdataSingleBinaryRequest($my_file, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBodyMultipartFormdataSingleBinary'
+ *
+ * @param \Psr\Http\Message\StreamInterface|null $my_file (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataSingleBinary'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBodyMultipartFormdataSingleBinaryRequest(
+ $my_file = null,
+ string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/body/application/octetstream/single_binary';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($my_file !== null) {
+ $multipart = true;
+ $formParams['my-file'] = [];
+ $paramFiles = is_array($my_file) ? $my_file : [$my_file];
+ foreach ($paramFiles as $paramFile) {
+ $formParams['my-file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
+ }
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyAllOfPet
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \OpenAPI\Client\Model\Pet
+ */
+ public function testEchoBodyAllOfPet(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
+ ): \OpenAPI\Client\Model\Pet
+ {
+ list($response) = $this->testEchoBodyAllOfPetWithHttpInfo($pet, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyAllOfPetWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyAllOfPetWithHttpInfo(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
+ ): array
+ {
+ $request = $this->testEchoBodyAllOfPetRequest($pet, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\OpenAPI\Client\Model\Pet' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\OpenAPI\Client\Model\Pet';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\OpenAPI\Client\Model\Pet',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyAllOfPetAsync
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyAllOfPetAsync(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
+ ): PromiseInterface
+ {
+ return $this->testEchoBodyAllOfPetAsyncWithHttpInfo($pet, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyAllOfPetAsyncWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyAllOfPetAsyncWithHttpInfo(
+ $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\OpenAPI\Client\Model\Pet';
+ $request = $this->testEchoBodyAllOfPetRequest($pet, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyAllOfPet'
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyAllOfPetRequest(
+ $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/echo/body/allOf/Pet';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($pet)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pet));
+ } else {
+ $httpBody = $pet;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseString
+ *
+ * Test free form object
+ *
+ * @param object|null $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testEchoBodyFreeFormObjectResponseString(
+ ?array $body = null,
+ string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
+ ): string
+ {
+ list($response) = $this->testEchoBodyFreeFormObjectResponseStringWithHttpInfo($body, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseStringWithHttpInfo
+ *
+ * Test free form object
+ *
+ * @param object|null $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo(
+ ?array $body = null,
+ string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
+ ): array
+ {
+ $request = $this->testEchoBodyFreeFormObjectResponseStringRequest($body, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseStringAsync
+ *
+ * Test free form object
+ *
+ * @param object|null $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyFreeFormObjectResponseStringAsync(
+ ?array $body = null,
+ string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
+ ): PromiseInterface
+ {
+ return $this->testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo($body, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo
+ *
+ * Test free form object
+ *
+ * @param object|null $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo(
+ $body = null,
+ string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testEchoBodyFreeFormObjectResponseStringRequest($body, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyFreeFormObjectResponseString'
+ *
+ * @param object|null $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyFreeFormObjectResponseStringRequest(
+ $body = null,
+ string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/echo/body/FreeFormObject/response_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPet
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \OpenAPI\Client\Model\Pet
+ */
+ public function testEchoBodyPet(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPet'][0]
+ ): \OpenAPI\Client\Model\Pet
+ {
+ list($response) = $this->testEchoBodyPetWithHttpInfo($pet, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyPetWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyPetWithHttpInfo(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPet'][0]
+ ): array
+ {
+ $request = $this->testEchoBodyPetRequest($pet, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\OpenAPI\Client\Model\Pet' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\OpenAPI\Client\Model\Pet';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\OpenAPI\Client\Model\Pet',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyPetAsync
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyPetAsync(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPet'][0]
+ ): PromiseInterface
+ {
+ return $this->testEchoBodyPetAsyncWithHttpInfo($pet, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPetAsyncWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyPetAsyncWithHttpInfo(
+ $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPet'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\OpenAPI\Client\Model\Pet';
+ $request = $this->testEchoBodyPetRequest($pet, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyPet'
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyPetRequest(
+ $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPet'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/echo/body/Pet';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($pet)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pet));
+ } else {
+ $httpBody = $pet;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseString
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testEchoBodyPetResponseString(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
+ ): string
+ {
+ list($response) = $this->testEchoBodyPetResponseStringWithHttpInfo($pet, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseStringWithHttpInfo
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyPetResponseStringWithHttpInfo(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
+ ): array
+ {
+ $request = $this->testEchoBodyPetResponseStringRequest($pet, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseStringAsync
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyPetResponseStringAsync(
+ ?\OpenAPI\Client\Model\Pet $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
+ ): PromiseInterface
+ {
+ return $this->testEchoBodyPetResponseStringAsyncWithHttpInfo($pet, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseStringAsyncWithHttpInfo
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyPetResponseStringAsyncWithHttpInfo(
+ $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testEchoBodyPetResponseStringRequest($pet, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyPetResponseString'
+ *
+ * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyPetResponseStringRequest(
+ $pet = null,
+ string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/echo/body/Pet/response_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($pet)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pet));
+ } else {
+ $httpBody = $pet;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyStringEnum
+ *
+ * Test string enum response body
+ *
+ * @param string|null $body String enum (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyStringEnum'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \OpenAPI\Client\Model\StringEnumRef
+ */
+ public function testEchoBodyStringEnum(
+ ?string $body = null,
+ string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
+ ): \OpenAPI\Client\Model\StringEnumRef
+ {
+ list($response) = $this->testEchoBodyStringEnumWithHttpInfo($body, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyStringEnumWithHttpInfo
+ *
+ * Test string enum response body
+ *
+ * @param string|null $body String enum (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyStringEnum'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of \OpenAPI\Client\Model\StringEnumRef, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyStringEnumWithHttpInfo(
+ ?string $body = null,
+ string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
+ ): array
+ {
+ $request = $this->testEchoBodyStringEnumRequest($body, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('\OpenAPI\Client\Model\StringEnumRef', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\OpenAPI\Client\Model\StringEnumRef' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\StringEnumRef', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\OpenAPI\Client\Model\StringEnumRef';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\OpenAPI\Client\Model\StringEnumRef',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyStringEnumAsync
+ *
+ * Test string enum response body
+ *
+ * @param string|null $body String enum (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyStringEnum'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyStringEnumAsync(
+ ?string $body = null,
+ string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
+ ): PromiseInterface
+ {
+ return $this->testEchoBodyStringEnumAsyncWithHttpInfo($body, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyStringEnumAsyncWithHttpInfo
+ *
+ * Test string enum response body
+ *
+ * @param string|null $body String enum (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyStringEnum'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyStringEnumAsyncWithHttpInfo(
+ $body = null,
+ string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\OpenAPI\Client\Model\StringEnumRef';
+ $request = $this->testEchoBodyStringEnumRequest($body, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyStringEnum'
+ *
+ * @param string|null $body String enum (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyStringEnum'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyStringEnumRequest(
+ $body = null,
+ string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/echo/body/string_enum';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseString
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testEchoBodyTagResponseString(
+ ?\OpenAPI\Client\Model\Tag $tag = null,
+ string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
+ ): string
+ {
+ list($response) = $this->testEchoBodyTagResponseStringWithHttpInfo($tag, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseStringWithHttpInfo
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyTagResponseStringWithHttpInfo(
+ ?\OpenAPI\Client\Model\Tag $tag = null,
+ string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
+ ): array
+ {
+ $request = $this->testEchoBodyTagResponseStringRequest($tag, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseStringAsync
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyTagResponseStringAsync(
+ ?\OpenAPI\Client\Model\Tag $tag = null,
+ string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
+ ): PromiseInterface
+ {
+ return $this->testEchoBodyTagResponseStringAsyncWithHttpInfo($tag, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseStringAsyncWithHttpInfo
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEchoBodyTagResponseStringAsyncWithHttpInfo(
+ $tag = null,
+ string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testEchoBodyTagResponseStringRequest($tag, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyTagResponseString'
+ *
+ * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyTagResponseStringRequest(
+ $tag = null,
+ string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/echo/body/Tag/response_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($tag)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tag));
+ } else {
+ $httpBody = $tag;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php
new file mode 100644
index 00000000000..254e7fe7f9d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php
@@ -0,0 +1,1197 @@
+ [
+ 'application/x-www-form-urlencoded',
+ ],
+ 'testFormObjectMultipart' => [
+ 'multipart/form-data',
+ ],
+ 'testFormOneof' => [
+ 'application/x-www-form-urlencoded',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testFormIntegerBooleanString
+ *
+ * Test form parameter(s)
+ *
+ * @param int|null $integer_form integer_form (optional)
+ * @param bool|null $boolean_form boolean_form (optional)
+ * @param string|null $string_form string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testFormIntegerBooleanString(
+ ?int $integer_form = null,
+ ?bool $boolean_form = null,
+ ?string $string_form = null,
+ string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
+ ): string
+ {
+ list($response) = $this->testFormIntegerBooleanStringWithHttpInfo($integer_form, $boolean_form, $string_form, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testFormIntegerBooleanStringWithHttpInfo
+ *
+ * Test form parameter(s)
+ *
+ * @param int|null $integer_form (optional)
+ * @param bool|null $boolean_form (optional)
+ * @param string|null $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testFormIntegerBooleanStringWithHttpInfo(
+ ?int $integer_form = null,
+ ?bool $boolean_form = null,
+ ?string $string_form = null,
+ string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
+ ): array
+ {
+ $request = $this->testFormIntegerBooleanStringRequest($integer_form, $boolean_form, $string_form, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testFormIntegerBooleanStringAsync
+ *
+ * Test form parameter(s)
+ *
+ * @param int|null $integer_form (optional)
+ * @param bool|null $boolean_form (optional)
+ * @param string|null $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testFormIntegerBooleanStringAsync(
+ ?int $integer_form = null,
+ ?bool $boolean_form = null,
+ ?string $string_form = null,
+ string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
+ ): PromiseInterface
+ {
+ return $this->testFormIntegerBooleanStringAsyncWithHttpInfo($integer_form, $boolean_form, $string_form, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testFormIntegerBooleanStringAsyncWithHttpInfo
+ *
+ * Test form parameter(s)
+ *
+ * @param int|null $integer_form (optional)
+ * @param bool|null $boolean_form (optional)
+ * @param string|null $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testFormIntegerBooleanStringAsyncWithHttpInfo(
+ $integer_form = null,
+ $boolean_form = null,
+ $string_form = null,
+ string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testFormIntegerBooleanStringRequest($integer_form, $boolean_form, $string_form, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testFormIntegerBooleanString'
+ *
+ * @param int|null $integer_form (optional)
+ * @param bool|null $boolean_form (optional)
+ * @param string|null $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testFormIntegerBooleanStringRequest(
+ $integer_form = null,
+ $boolean_form = null,
+ $string_form = null,
+ string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
+ ): Request
+ {
+
+
+
+
+
+ $resourcePath = '/form/integer/boolean/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($integer_form !== null) {
+ $formParams['integer_form'] = ObjectSerializer::toFormValue($integer_form);
+ }
+ // form params
+ if ($boolean_form !== null) {
+ $formParams['boolean_form'] = ObjectSerializer::toFormValue($boolean_form);
+ }
+ // form params
+ if ($string_form !== null) {
+ $formParams['string_form'] = ObjectSerializer::toFormValue($string_form);
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testFormObjectMultipart
+ *
+ * Test form parameter(s) for multipart schema
+ *
+ * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker marker (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testFormObjectMultipart(
+ \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker,
+ string $contentType = self::contentTypes['testFormObjectMultipart'][0]
+ ): string
+ {
+ list($response) = $this->testFormObjectMultipartWithHttpInfo($marker, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testFormObjectMultipartWithHttpInfo
+ *
+ * Test form parameter(s) for multipart schema
+ *
+ * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testFormObjectMultipartWithHttpInfo(
+ \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker,
+ string $contentType = self::contentTypes['testFormObjectMultipart'][0]
+ ): array
+ {
+ $request = $this->testFormObjectMultipartRequest($marker, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testFormObjectMultipartAsync
+ *
+ * Test form parameter(s) for multipart schema
+ *
+ * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testFormObjectMultipartAsync(
+ \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker,
+ string $contentType = self::contentTypes['testFormObjectMultipart'][0]
+ ): PromiseInterface
+ {
+ return $this->testFormObjectMultipartAsyncWithHttpInfo($marker, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testFormObjectMultipartAsyncWithHttpInfo
+ *
+ * Test form parameter(s) for multipart schema
+ *
+ * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testFormObjectMultipartAsyncWithHttpInfo(
+ $marker,
+ string $contentType = self::contentTypes['testFormObjectMultipart'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testFormObjectMultipartRequest($marker, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testFormObjectMultipart'
+ *
+ * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testFormObjectMultipartRequest(
+ $marker,
+ string $contentType = self::contentTypes['testFormObjectMultipart'][0]
+ ): Request
+ {
+
+ // verify the required parameter 'marker' is set
+ if ($marker === null || (is_array($marker) && count($marker) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $marker when calling testFormObjectMultipart'
+ );
+ }
+
+
+ $resourcePath = '/form/object/multipart';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($marker !== null) {
+ $formParams['marker'] = ObjectSerializer::toFormValue($marker);
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testFormOneof
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string|null $form1 form1 (optional)
+ * @param int|null $form2 form2 (optional)
+ * @param string|null $form3 form3 (optional)
+ * @param bool|null $form4 form4 (optional)
+ * @param int|null $id id (optional)
+ * @param string|null $name name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testFormOneof(
+ ?string $form1 = null,
+ ?int $form2 = null,
+ ?string $form3 = null,
+ ?bool $form4 = null,
+ ?int $id = null,
+ ?string $name = null,
+ string $contentType = self::contentTypes['testFormOneof'][0]
+ ): string
+ {
+ list($response) = $this->testFormOneofWithHttpInfo($form1, $form2, $form3, $form4, $id, $name, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testFormOneofWithHttpInfo
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string|null $form1 (optional)
+ * @param int|null $form2 (optional)
+ * @param string|null $form3 (optional)
+ * @param bool|null $form4 (optional)
+ * @param int|null $id (optional)
+ * @param string|null $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testFormOneofWithHttpInfo(
+ ?string $form1 = null,
+ ?int $form2 = null,
+ ?string $form3 = null,
+ ?bool $form4 = null,
+ ?int $id = null,
+ ?string $name = null,
+ string $contentType = self::contentTypes['testFormOneof'][0]
+ ): array
+ {
+ $request = $this->testFormOneofRequest($form1, $form2, $form3, $form4, $id, $name, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testFormOneofAsync
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string|null $form1 (optional)
+ * @param int|null $form2 (optional)
+ * @param string|null $form3 (optional)
+ * @param bool|null $form4 (optional)
+ * @param int|null $id (optional)
+ * @param string|null $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testFormOneofAsync(
+ ?string $form1 = null,
+ ?int $form2 = null,
+ ?string $form3 = null,
+ ?bool $form4 = null,
+ ?int $id = null,
+ ?string $name = null,
+ string $contentType = self::contentTypes['testFormOneof'][0]
+ ): PromiseInterface
+ {
+ return $this->testFormOneofAsyncWithHttpInfo($form1, $form2, $form3, $form4, $id, $name, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testFormOneofAsyncWithHttpInfo
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string|null $form1 (optional)
+ * @param int|null $form2 (optional)
+ * @param string|null $form3 (optional)
+ * @param bool|null $form4 (optional)
+ * @param int|null $id (optional)
+ * @param string|null $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testFormOneofAsyncWithHttpInfo(
+ $form1 = null,
+ $form2 = null,
+ $form3 = null,
+ $form4 = null,
+ $id = null,
+ $name = null,
+ string $contentType = self::contentTypes['testFormOneof'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testFormOneofRequest($form1, $form2, $form3, $form4, $id, $name, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testFormOneof'
+ *
+ * @param string|null $form1 (optional)
+ * @param int|null $form2 (optional)
+ * @param string|null $form3 (optional)
+ * @param bool|null $form4 (optional)
+ * @param int|null $id (optional)
+ * @param string|null $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testFormOneofRequest(
+ $form1 = null,
+ $form2 = null,
+ $form3 = null,
+ $form4 = null,
+ $id = null,
+ $name = null,
+ string $contentType = self::contentTypes['testFormOneof'][0]
+ ): Request
+ {
+
+
+
+
+
+
+
+
+ $resourcePath = '/form/oneof';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($form1 !== null) {
+ $formParams['form1'] = ObjectSerializer::toFormValue($form1);
+ }
+ // form params
+ if ($form2 !== null) {
+ $formParams['form2'] = ObjectSerializer::toFormValue($form2);
+ }
+ // form params
+ if ($form3 !== null) {
+ $formParams['form3'] = ObjectSerializer::toFormValue($form3);
+ }
+ // form params
+ if ($form4 !== null) {
+ $formParams['form4'] = ObjectSerializer::toFormValue($form4);
+ }
+ // form params
+ if ($id !== null) {
+ $formParams['id'] = ObjectSerializer::toFormValue($id);
+ }
+ // form params
+ if ($name !== null) {
+ $formParams['name'] = ObjectSerializer::toFormValue($name);
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php
new file mode 100644
index 00000000000..c9430f11fdc
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php
@@ -0,0 +1,516 @@
+ [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringEnums
+ *
+ * Test header parameter(s)
+ *
+ * @param int|null $integer_header integer_header (optional)
+ * @param bool|null $boolean_header boolean_header (optional)
+ * @param string|null $string_header string_header (optional)
+ * @param string|null $enum_nonref_string_header enum_nonref_string_header (optional)
+ * @param StringEnumRef|null $enum_ref_string_header enum_ref_string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testHeaderIntegerBooleanStringEnums(
+ ?int $integer_header = null,
+ ?bool $boolean_header = null,
+ ?string $string_header = null,
+ ?string $enum_nonref_string_header = null,
+ ?StringEnumRef $enum_ref_string_header = null,
+ string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
+ ): string
+ {
+ list($response) = $this->testHeaderIntegerBooleanStringEnumsWithHttpInfo($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringEnumsWithHttpInfo
+ *
+ * Test header parameter(s)
+ *
+ * @param int|null $integer_header (optional)
+ * @param bool|null $boolean_header (optional)
+ * @param string|null $string_header (optional)
+ * @param string|null $enum_nonref_string_header (optional)
+ * @param StringEnumRef|null $enum_ref_string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo(
+ ?int $integer_header = null,
+ ?bool $boolean_header = null,
+ ?string $string_header = null,
+ ?string $enum_nonref_string_header = null,
+ ?StringEnumRef $enum_ref_string_header = null,
+ string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
+ ): array
+ {
+ $request = $this->testHeaderIntegerBooleanStringEnumsRequest($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringEnumsAsync
+ *
+ * Test header parameter(s)
+ *
+ * @param int|null $integer_header (optional)
+ * @param bool|null $boolean_header (optional)
+ * @param string|null $string_header (optional)
+ * @param string|null $enum_nonref_string_header (optional)
+ * @param StringEnumRef|null $enum_ref_string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testHeaderIntegerBooleanStringEnumsAsync(
+ ?int $integer_header = null,
+ ?bool $boolean_header = null,
+ ?string $string_header = null,
+ ?string $enum_nonref_string_header = null,
+ ?StringEnumRef $enum_ref_string_header = null,
+ string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
+ ): PromiseInterface
+ {
+ return $this->testHeaderIntegerBooleanStringEnumsAsyncWithHttpInfo($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringEnumsAsyncWithHttpInfo
+ *
+ * Test header parameter(s)
+ *
+ * @param int|null $integer_header (optional)
+ * @param bool|null $boolean_header (optional)
+ * @param string|null $string_header (optional)
+ * @param string|null $enum_nonref_string_header (optional)
+ * @param StringEnumRef|null $enum_ref_string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testHeaderIntegerBooleanStringEnumsAsyncWithHttpInfo(
+ $integer_header = null,
+ $boolean_header = null,
+ $string_header = null,
+ $enum_nonref_string_header = null,
+ $enum_ref_string_header = null,
+ string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testHeaderIntegerBooleanStringEnumsRequest($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testHeaderIntegerBooleanStringEnums'
+ *
+ * @param int|null $integer_header (optional)
+ * @param bool|null $boolean_header (optional)
+ * @param string|null $string_header (optional)
+ * @param string|null $enum_nonref_string_header (optional)
+ * @param StringEnumRef|null $enum_ref_string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testHeaderIntegerBooleanStringEnumsRequest(
+ $integer_header = null,
+ $boolean_header = null,
+ $string_header = null,
+ $enum_nonref_string_header = null,
+ $enum_ref_string_header = null,
+ string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
+ ): Request
+ {
+
+
+
+
+
+
+
+ $resourcePath = '/header/integer/boolean/string/enums';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+ // header params
+ if ($integer_header !== null) {
+ $headerParams['integer_header'] = ObjectSerializer::toHeaderValue($integer_header);
+ }
+ // header params
+ if ($boolean_header !== null) {
+ $headerParams['boolean_header'] = ObjectSerializer::toHeaderValue($boolean_header);
+ }
+ // header params
+ if ($string_header !== null) {
+ $headerParams['string_header'] = ObjectSerializer::toHeaderValue($string_header);
+ }
+ // header params
+ if ($enum_nonref_string_header !== null) {
+ $headerParams['enum_nonref_string_header'] = ObjectSerializer::toHeaderValue($enum_nonref_string_header);
+ }
+ // header params
+ if ($enum_ref_string_header !== null) {
+ $headerParams['enum_ref_string_header'] = ObjectSerializer::toHeaderValue($enum_ref_string_header);
+ }
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php
new file mode 100644
index 00000000000..123f7b09d3c
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php
@@ -0,0 +1,541 @@
+ [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string path_string (required)
+ * @param int $path_integer path_integer (required)
+ * @param string $enum_nonref_string_path enum_nonref_string_path (required)
+ * @param StringEnumRef $enum_ref_string_path enum_ref_string_path (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(
+ string $path_string,
+ int $path_integer,
+ string $enum_nonref_string_path,
+ StringEnumRef $enum_ref_string_path,
+ string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
+ ): string
+ {
+ list($response) = $this->testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $enum_nonref_string_path (required)
+ * @param StringEnumRef $enum_ref_string_path (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(
+ string $path_string,
+ int $path_integer,
+ string $enum_nonref_string_path,
+ StringEnumRef $enum_ref_string_path,
+ string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
+ ): array
+ {
+ $request = $this->testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsync
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $enum_nonref_string_path (required)
+ * @param StringEnumRef $enum_ref_string_path (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsync(
+ string $path_string,
+ int $path_integer,
+ string $enum_nonref_string_path,
+ StringEnumRef $enum_ref_string_path,
+ string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
+ ): PromiseInterface
+ {
+ return $this->testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsyncWithHttpInfo($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsyncWithHttpInfo
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $enum_nonref_string_path (required)
+ * @param StringEnumRef $enum_ref_string_path (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsyncWithHttpInfo(
+ $path_string,
+ $path_integer,
+ $enum_nonref_string_path,
+ $enum_ref_string_path,
+ string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $enum_nonref_string_path (required)
+ * @param StringEnumRef $enum_ref_string_path (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest(
+ $path_string,
+ $path_integer,
+ $enum_nonref_string_path,
+ $enum_ref_string_path,
+ string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
+ ): Request
+ {
+
+ // verify the required parameter 'path_string' is set
+ if ($path_string === null || (is_array($path_string) && count($path_string) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $path_string when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'
+ );
+ }
+
+ // verify the required parameter 'path_integer' is set
+ if ($path_integer === null || (is_array($path_integer) && count($path_integer) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $path_integer when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'
+ );
+ }
+
+ // verify the required parameter 'enum_nonref_string_path' is set
+ if ($enum_nonref_string_path === null || (is_array($enum_nonref_string_path) && count($enum_nonref_string_path) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $enum_nonref_string_path when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'
+ );
+ }
+
+ // verify the required parameter 'enum_ref_string_path' is set
+ if ($enum_ref_string_path === null || (is_array($enum_ref_string_path) && count($enum_ref_string_path) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $enum_ref_string_path when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'
+ );
+ }
+
+
+ $resourcePath = '/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($path_string !== null) {
+ $resourcePath = str_replace(
+ '{' . 'path_string' . '}',
+ ObjectSerializer::toPathValue($path_string),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($path_integer !== null) {
+ $resourcePath = str_replace(
+ '{' . 'path_integer' . '}',
+ ObjectSerializer::toPathValue($path_integer),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($enum_nonref_string_path !== null) {
+ $resourcePath = str_replace(
+ '{' . 'enum_nonref_string_path' . '}',
+ ObjectSerializer::toPathValue($enum_nonref_string_path),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($enum_ref_string_path !== null) {
+ $resourcePath = str_replace(
+ '{' . 'enum_ref_string_path' . '}',
+ ObjectSerializer::toPathValue($enum_ref_string_path),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php
new file mode 100644
index 00000000000..2a8a9becf93
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php
@@ -0,0 +1,3441 @@
+ [
+ 'application/json',
+ ],
+ 'testQueryDatetimeDateString' => [
+ 'application/json',
+ ],
+ 'testQueryIntegerBooleanString' => [
+ 'application/json',
+ ],
+ 'testQueryStyleDeepObjectExplodeTrueObject' => [
+ 'application/json',
+ ],
+ 'testQueryStyleDeepObjectExplodeTrueObjectAllOf' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeFalseArrayInteger' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeFalseArrayString' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeTrueArrayString' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeTrueObject' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeTrueObjectAllOf' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testEnumRefString
+ *
+ * Test query parameter(s)
+ *
+ * @param string|null $enum_nonref_string_query enum_nonref_string_query (optional)
+ * @param StringEnumRef|null $enum_ref_string_query enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testEnumRefString(
+ ?string $enum_nonref_string_query = null,
+ ?StringEnumRef $enum_ref_string_query = null,
+ string $contentType = self::contentTypes['testEnumRefString'][0]
+ ): string
+ {
+ list($response) = $this->testEnumRefStringWithHttpInfo($enum_nonref_string_query, $enum_ref_string_query, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEnumRefStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param string|null $enum_nonref_string_query (optional)
+ * @param StringEnumRef|null $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEnumRefStringWithHttpInfo(
+ ?string $enum_nonref_string_query = null,
+ ?StringEnumRef $enum_ref_string_query = null,
+ string $contentType = self::contentTypes['testEnumRefString'][0]
+ ): array
+ {
+ $request = $this->testEnumRefStringRequest($enum_nonref_string_query, $enum_ref_string_query, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEnumRefStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param string|null $enum_nonref_string_query (optional)
+ * @param StringEnumRef|null $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEnumRefStringAsync(
+ ?string $enum_nonref_string_query = null,
+ ?StringEnumRef $enum_ref_string_query = null,
+ string $contentType = self::contentTypes['testEnumRefString'][0]
+ ): PromiseInterface
+ {
+ return $this->testEnumRefStringAsyncWithHttpInfo($enum_nonref_string_query, $enum_ref_string_query, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEnumRefStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param string|null $enum_nonref_string_query (optional)
+ * @param StringEnumRef|null $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testEnumRefStringAsyncWithHttpInfo(
+ $enum_nonref_string_query = null,
+ $enum_ref_string_query = null,
+ string $contentType = self::contentTypes['testEnumRefString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testEnumRefStringRequest($enum_nonref_string_query, $enum_ref_string_query, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEnumRefString'
+ *
+ * @param string|null $enum_nonref_string_query (optional)
+ * @param StringEnumRef|null $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEnumRefStringRequest(
+ $enum_nonref_string_query = null,
+ $enum_ref_string_query = null,
+ string $contentType = self::contentTypes['testEnumRefString'][0]
+ ): Request
+ {
+
+
+
+
+ $resourcePath = '/query/enum_ref_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $enum_nonref_string_query,
+ 'enum_nonref_string_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $enum_ref_string_query,
+ 'enum_ref_string_query', // param base name
+ 'StringEnumRef', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryDatetimeDateString
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime|null $datetime_query datetime_query (optional)
+ * @param \DateTime|null $date_query date_query (optional)
+ * @param string|null $string_query string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryDatetimeDateString(
+ ?\DateTime $datetime_query = null,
+ ?\DateTime $date_query = null,
+ ?string $string_query = null,
+ string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]
+ ): string
+ {
+ list($response) = $this->testQueryDatetimeDateStringWithHttpInfo($datetime_query, $date_query, $string_query, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryDatetimeDateStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime|null $datetime_query (optional)
+ * @param \DateTime|null $date_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryDatetimeDateStringWithHttpInfo(
+ ?\DateTime $datetime_query = null,
+ ?\DateTime $date_query = null,
+ ?string $string_query = null,
+ string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]
+ ): array
+ {
+ $request = $this->testQueryDatetimeDateStringRequest($datetime_query, $date_query, $string_query, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryDatetimeDateStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime|null $datetime_query (optional)
+ * @param \DateTime|null $date_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryDatetimeDateStringAsync(
+ ?\DateTime $datetime_query = null,
+ ?\DateTime $date_query = null,
+ ?string $string_query = null,
+ string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryDatetimeDateStringAsyncWithHttpInfo($datetime_query, $date_query, $string_query, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryDatetimeDateStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime|null $datetime_query (optional)
+ * @param \DateTime|null $date_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryDatetimeDateStringAsyncWithHttpInfo(
+ $datetime_query = null,
+ $date_query = null,
+ $string_query = null,
+ string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryDatetimeDateStringRequest($datetime_query, $date_query, $string_query, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryDatetimeDateString'
+ *
+ * @param \DateTime|null $datetime_query (optional)
+ * @param \DateTime|null $date_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryDatetimeDateStringRequest(
+ $datetime_query = null,
+ $date_query = null,
+ $string_query = null,
+ string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]
+ ): Request
+ {
+
+
+
+
+
+ $resourcePath = '/query/datetime/date/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $datetime_query,
+ 'datetime_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $date_query,
+ 'date_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $string_query,
+ 'string_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanString
+ *
+ * Test query parameter(s)
+ *
+ * @param int|null $integer_query integer_query (optional)
+ * @param bool|null $boolean_query boolean_query (optional)
+ * @param string|null $string_query string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryIntegerBooleanString(
+ ?int $integer_query = null,
+ ?bool $boolean_query = null,
+ ?string $string_query = null,
+ string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]
+ ): string
+ {
+ list($response) = $this->testQueryIntegerBooleanStringWithHttpInfo($integer_query, $boolean_query, $string_query, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param int|null $integer_query (optional)
+ * @param bool|null $boolean_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryIntegerBooleanStringWithHttpInfo(
+ ?int $integer_query = null,
+ ?bool $boolean_query = null,
+ ?string $string_query = null,
+ string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]
+ ): array
+ {
+ $request = $this->testQueryIntegerBooleanStringRequest($integer_query, $boolean_query, $string_query, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param int|null $integer_query (optional)
+ * @param bool|null $boolean_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryIntegerBooleanStringAsync(
+ ?int $integer_query = null,
+ ?bool $boolean_query = null,
+ ?string $string_query = null,
+ string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryIntegerBooleanStringAsyncWithHttpInfo($integer_query, $boolean_query, $string_query, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param int|null $integer_query (optional)
+ * @param bool|null $boolean_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryIntegerBooleanStringAsyncWithHttpInfo(
+ $integer_query = null,
+ $boolean_query = null,
+ $string_query = null,
+ string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryIntegerBooleanStringRequest($integer_query, $boolean_query, $string_query, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryIntegerBooleanString'
+ *
+ * @param int|null $integer_query (optional)
+ * @param bool|null $boolean_query (optional)
+ * @param string|null $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryIntegerBooleanStringRequest(
+ $integer_query = null,
+ $boolean_query = null,
+ $string_query = null,
+ string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]
+ ): Request
+ {
+
+
+
+
+
+ $resourcePath = '/query/integer/boolean/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $integer_query,
+ 'integer_query', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $boolean_query,
+ 'boolean_query', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $string_query,
+ 'string_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObject
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObject(
+ ?Pet $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(
+ ?Pet $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAsync(
+ ?Pet $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleDeepObjectExplodeTrueObject'
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_deepObject/explode_true/object';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'deepObject', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOf
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOf(
+ ?TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(
+ ?TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync(
+ ?TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleDeepObjectExplodeTrueObjectAllOf'
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_deepObject/explode_true/object/allOf';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'Bird', // openApiType
+ 'deepObject', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayInteger
+ *
+ * Test query parameter(s)
+ *
+ * @param int[]|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeFalseArrayInteger(
+ ?array $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param int[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(
+ ?array $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleFormExplodeFalseArrayIntegerRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayIntegerAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param int[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeFalseArrayIntegerAsync(
+ ?array $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleFormExplodeFalseArrayIntegerAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayIntegerAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param int[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeFalseArrayIntegerAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeFalseArrayIntegerRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeFalseArrayInteger'
+ *
+ * @param int[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeFalseArrayIntegerRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_false/array_integer';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'array', // openApiType
+ 'form', // style
+ false, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayString
+ *
+ * Test query parameter(s)
+ *
+ * @param string[]|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeFalseArrayString(
+ ?array $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleFormExplodeFalseArrayStringWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param string[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(
+ ?array $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleFormExplodeFalseArrayStringRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param string[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeFalseArrayStringAsync(
+ ?array $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleFormExplodeFalseArrayStringAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeFalseArrayStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param string[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeFalseArrayStringAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeFalseArrayStringRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeFalseArrayString'
+ *
+ * @param string[]|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeFalseArrayString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeFalseArrayStringRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_false/array_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'array', // openApiType
+ 'form', // style
+ false, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayString
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeTrueArrayString(
+ ?TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleFormExplodeTrueArrayStringWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(
+ ?TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleFormExplodeTrueArrayStringRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringAsync(
+ ?TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeTrueArrayStringRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeTrueArrayString'
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_true/array_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObject
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeTrueObject(
+ ?Pet $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleFormExplodeTrueObjectWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeTrueObjectWithHttpInfo(
+ ?Pet $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleFormExplodeTrueObjectRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAsync(
+ ?Pet $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeTrueObjectRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeTrueObject'
+ *
+ * @param Pet|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeTrueObjectRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_true/object';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOf
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery|null $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOf(
+ ?DataQuery $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]
+ ): string
+ {
+ list($response) = $this->testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(
+ ?DataQuery $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]
+ ): array
+ {
+ $request = $this->testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOfAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfAsync(
+ ?DataQuery $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]
+ ): PromiseInterface
+ {
+ return $this->testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeTrueObjectAllOf'
+ *
+ * @param DataQuery|null $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfRequest(
+ $query_object = null,
+ string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]
+ ): Request
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_true/object/allOf';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/ApiException.php b/samples/client/echo_api/php-nextgen-streaming/src/ApiException.php
new file mode 100644
index 00000000000..fa1d216dbd9
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/ApiException.php
@@ -0,0 +1,119 @@
+responseHeaders = $responseHeaders;
+ $this->responseBody = $responseBody;
+ }
+
+ /**
+ * Gets the HTTP response header
+ *
+ * @return string[][]|null HTTP response header
+ */
+ public function getResponseHeaders(): ?array
+ {
+ return $this->responseHeaders;
+ }
+
+ /**
+ * Gets the HTTP body of the server response either as Json or string
+ *
+ * @return stdClass|string|null HTTP body of the server response either as \stdClass or string
+ */
+ public function getResponseBody(): stdClass|string|null
+ {
+ return $this->responseBody;
+ }
+
+ /**
+ * Sets the deserialized response object (during deserialization)
+ *
+ * @param mixed $obj Deserialized response object
+ *
+ * @return void
+ */
+ public function setResponseObject(mixed $obj): void
+ {
+ $this->responseObject = $obj;
+ }
+
+ /**
+ * Gets the deserialized response object (during deserialization)
+ *
+ * @return mixed the deserialized response object
+ */
+ public function getResponseObject(): mixed
+ {
+ return $this->responseObject;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Configuration.php b/samples/client/echo_api/php-nextgen-streaming/src/Configuration.php
new file mode 100644
index 00000000000..a4b1d14b4fe
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Configuration.php
@@ -0,0 +1,527 @@
+tempFolderPath = sys_get_temp_dir();
+ }
+
+ /**
+ * Sets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $key API key or token
+ *
+ * @return $this
+ */
+ public function setApiKey(string $apiKeyIdentifier, string $key): static
+ {
+ $this->apiKeys[$apiKeyIdentifier] = $key;
+ return $this;
+ }
+
+ /**
+ * Gets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string API key or token
+ */
+ public function getApiKey(string $apiKeyIdentifier): ?string
+ {
+ return $this->apiKeys[$apiKeyIdentifier] ?? null;
+ }
+
+ /**
+ * Sets the prefix for API key (e.g. Bearer)
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $prefix API key prefix, e.g. Bearer
+ *
+ * @return $this
+ */
+ public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static
+ {
+ $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
+ return $this;
+ }
+
+ /**
+ * Gets API key prefix
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string
+ */
+ public function getApiKeyPrefix(string $apiKeyIdentifier): ?string
+ {
+ return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null;
+ }
+
+ /**
+ * Sets the access token for OAuth
+ *
+ * @param string $accessToken Token for OAuth
+ *
+ * @return $this
+ */
+ public function setAccessToken(string $accessToken): static
+ {
+ $this->accessToken = $accessToken;
+ return $this;
+ }
+
+ /**
+ * Gets the access token for OAuth
+ *
+ * @return string Access token for OAuth
+ */
+ public function getAccessToken(): string
+ {
+ return $this->accessToken;
+ }
+
+ /**
+ * Sets boolean format for query string.
+ *
+ * @param string $booleanFormat Boolean format for query string
+ *
+ * @return $this
+ */
+ public function setBooleanFormatForQueryString(string $booleanFormat): static
+ {
+ $this->booleanFormatForQueryString = $booleanFormat;
+
+ return $this;
+ }
+
+ /**
+ * Gets boolean format for query string.
+ *
+ * @return string Boolean format for query string
+ */
+ public function getBooleanFormatForQueryString(): string
+ {
+ return $this->booleanFormatForQueryString;
+ }
+
+ /**
+ * Sets the username for HTTP basic authentication
+ *
+ * @param string $username Username for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setUsername(string $username): static
+ {
+ $this->username = $username;
+ return $this;
+ }
+
+ /**
+ * Gets the username for HTTP basic authentication
+ *
+ * @return string Username for HTTP basic authentication
+ */
+ public function getUsername(): string
+ {
+ return $this->username;
+ }
+
+ /**
+ * Sets the password for HTTP basic authentication
+ *
+ * @param string $password Password for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setPassword(string $password): static
+ {
+ $this->password = $password;
+ return $this;
+ }
+
+ /**
+ * Gets the password for HTTP basic authentication
+ *
+ * @return string Password for HTTP basic authentication
+ */
+ public function getPassword(): string
+ {
+ return $this->password;
+ }
+
+ /**
+ * Sets the host
+ *
+ * @param string $host Host
+ *
+ * @return $this
+ */
+ public function setHost(string $host): static
+ {
+ $this->host = $host;
+ return $this;
+ }
+
+ /**
+ * Gets the host
+ *
+ * @return string Host
+ */
+ public function getHost(): string
+ {
+ return $this->host;
+ }
+
+ /**
+ * Sets the user agent of the api client
+ *
+ * @param string $userAgent the user agent of the api client
+ *
+ * @throws InvalidArgumentException
+ * @return $this
+ */
+ public function setUserAgent(string $userAgent): static
+ {
+ $this->userAgent = $userAgent;
+ return $this;
+ }
+
+ /**
+ * Gets the user agent of the api client
+ *
+ * @return string user agent
+ */
+ public function getUserAgent(): string
+ {
+ return $this->userAgent;
+ }
+
+ /**
+ * Sets debug flag
+ *
+ * @param bool $debug Debug flag
+ *
+ * @return $this
+ */
+ public function setDebug(bool $debug): static
+ {
+ $this->debug = $debug;
+ return $this;
+ }
+
+ /**
+ * Gets the debug flag
+ *
+ * @return bool
+ */
+ public function getDebug(): bool
+ {
+ return $this->debug;
+ }
+
+ /**
+ * Sets the debug file
+ *
+ * @param string $debugFile Debug file
+ *
+ * @return $this
+ */
+ public function setDebugFile(string $debugFile): static
+ {
+ $this->debugFile = $debugFile;
+ return $this;
+ }
+
+ /**
+ * Gets the debug file
+ *
+ * @return string
+ */
+ public function getDebugFile(): string
+ {
+ return $this->debugFile;
+ }
+
+ /**
+ * Sets the temp folder path
+ *
+ * @param string $tempFolderPath Temp folder path
+ *
+ * @return $this
+ */
+ public function setTempFolderPath(string $tempFolderPath): static
+ {
+ $this->tempFolderPath = $tempFolderPath;
+ return $this;
+ }
+
+ /**
+ * Gets the temp folder path
+ *
+ * @return string Temp folder path
+ */
+ public function getTempFolderPath(): string
+ {
+ return $this->tempFolderPath;
+ }
+
+ /**
+ * Gets the default configuration instance
+ *
+ * @return Configuration
+ */
+ public static function getDefaultConfiguration(): Configuration
+ {
+ if (self::$defaultConfiguration === null) {
+ self::$defaultConfiguration = new Configuration();
+ }
+
+ return self::$defaultConfiguration;
+ }
+
+ /**
+ * Sets the default configuration instance
+ *
+ * @param Configuration $config An instance of the Configuration Object
+ *
+ * @return void
+ */
+ public static function setDefaultConfiguration(Configuration $config): void
+ {
+ self::$defaultConfiguration = $config;
+ }
+
+ /**
+ * Gets the essential information for debugging
+ *
+ * @return string The report for debugging
+ */
+ public static function toDebugReport(): string
+ {
+ $report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL;
+ $report .= ' OS: ' . php_uname() . PHP_EOL;
+ $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
+ $report .= ' The version of the OpenAPI document: 0.1.0' . PHP_EOL;
+ $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
+
+ return $report;
+ }
+
+ /**
+ * Get API key (with prefix if set)
+ *
+ * @param string $apiKeyIdentifier name of apikey
+ *
+ * @return null|string API key with the prefix
+ */
+ public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string
+ {
+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
+ $apiKey = $this->getApiKey($apiKeyIdentifier);
+
+ if ($apiKey === null) {
+ return null;
+ }
+
+ if ($prefix === null) {
+ $keyWithPrefix = $apiKey;
+ } else {
+ $keyWithPrefix = $prefix . ' ' . $apiKey;
+ }
+
+ return $keyWithPrefix;
+ }
+
+ /**
+ * Returns an array of host settings
+ *
+ * @return array an array of host settings
+ */
+ public function getHostSettings(): array
+ {
+ return [
+ [
+ "url" => "http://localhost:3000",
+ "description" => "No description provided",
+ ]
+ ];
+ }
+
+ /**
+ * Returns URL based on host settings, index and variables
+ *
+ * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
+ * @param int $hostIndex index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string
+ {
+ if (null === $variables) {
+ $variables = [];
+ }
+
+ // check array index out of bound
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings));
+ }
+
+ $host = $hostSettings[$hostIndex];
+ $url = $host["url"];
+
+ // go through variable and assign a value
+ foreach ($host["variables"] ?? [] as $name => $variable) {
+ if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
+ if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
+ $url = str_replace("{".$name."}", $variables[$name], $url);
+ } else {
+ throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
+ }
+ } else {
+ // use default value
+ $url = str_replace("{".$name."}", $variable["default_value"], $url);
+ }
+ }
+
+ return $url;
+ }
+
+ /**
+ * Returns URL based on the index and variables
+ *
+ * @param int $index index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public function getHostFromSettings(int $index, ?array $variables = null): string
+ {
+ return self::getHostString($this->getHostSettings(), $index, $variables);
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/HeaderSelector.php b/samples/client/echo_api/php-nextgen-streaming/src/HeaderSelector.php
new file mode 100644
index 00000000000..eba87bcb7ec
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/HeaderSelector.php
@@ -0,0 +1,244 @@
+selectAcceptHeader($accept);
+ if ($accept !== null) {
+ $headers['Accept'] = $accept;
+ }
+
+ if (!$isMultipart) {
+ if($contentType === '') {
+ $contentType = 'application/json';
+ }
+
+ $headers['Content-Type'] = $contentType;
+ }
+
+ return $headers;
+ }
+
+ /**
+ * Return the header 'Accept' based on an array of Accept provided.
+ *
+ * @param string[] $accept Array of header
+ *
+ * @return null|string Accept (e.g. application/json)
+ */
+ private function selectAcceptHeader(array $accept): ?string
+ {
+ # filter out empty entries
+ $accept = array_filter($accept);
+
+ if (count($accept) === 0) {
+ return null;
+ }
+
+ # If there's only one Accept header, just use it
+ if (count($accept) === 1) {
+ return reset($accept);
+ }
+
+ # If none of the available Accept headers is of type "json", then just use all them
+ $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept);
+ if (count($headersWithJson) === 0) {
+ return implode(',', $accept);
+ }
+
+ # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1,
+ # to give the highest priority to json-like headers - recalculating the existing ones, if needed
+ return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson);
+ }
+
+ /**
+ * Create an Accept header string from the given "Accept" headers array, recalculating all weights
+ *
+ * @param string[] $accept Array of Accept Headers
+ * @param string[] $headersWithJson Array of Accept Headers of type "json"
+ *
+ * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
+ */
+ private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
+ {
+ $processedHeaders = [
+ 'withApplicationJson' => [],
+ 'withJson' => [],
+ 'withoutJson' => [],
+ ];
+
+ foreach ($accept as $header) {
+
+ $headerData = $this->getHeaderAndWeight($header);
+
+ if (stripos($headerData['header'], 'application/json') === 0) {
+ $processedHeaders['withApplicationJson'][] = $headerData;
+ } elseif (in_array($header, $headersWithJson, true)) {
+ $processedHeaders['withJson'][] = $headerData;
+ } else {
+ $processedHeaders['withoutJson'][] = $headerData;
+ }
+ }
+
+ $acceptHeaders = [];
+ $currentWeight = 1000;
+
+ $hasMoreThan28Headers = count($accept) > 28;
+
+ foreach($processedHeaders as $headers) {
+ if (count($headers) > 0) {
+ $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers);
+ }
+ }
+
+ $acceptHeaders = array_merge(...$acceptHeaders);
+
+ return implode(',', $acceptHeaders);
+ }
+
+ /**
+ * Given an Accept header, returns an associative array splitting the header and its weight
+ *
+ * @param string $header "Accept" Header
+ *
+ * @return array with the header and its weight
+ */
+ private function getHeaderAndWeight(string $header): array
+ {
+ # matches headers with weight, splitting the header and the weight in $outputArray
+ if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) {
+ $headerData = [
+ 'header' => $outputArray[1],
+ 'weight' => (int)($outputArray[2] * 1000),
+ ];
+ } else {
+ $headerData = [
+ 'header' => trim($header),
+ 'weight' => 1000,
+ ];
+ }
+
+ return $headerData;
+ }
+
+ /**
+ * @param array[] $headers
+ * @param float $currentWeight
+ * @param bool $hasMoreThan28Headers
+ * @return string[] array of adjusted "Accept" headers
+ */
+ private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array
+ {
+ usort($headers, function (array $a, array $b) {
+ return $b['weight'] - $a['weight'];
+ });
+
+ $acceptHeaders = [];
+ foreach ($headers as $index => $header) {
+ if($index > 0 && $headers[$index - 1]['weight'] > $header['weight'])
+ {
+ $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
+ }
+
+ $weight = $currentWeight;
+
+ $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight);
+ }
+
+ $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
+
+ return $acceptHeaders;
+ }
+
+ /**
+ * @param string $header
+ * @param int $weight
+ * @return string
+ */
+ private function buildAcceptHeader(string $header, int $weight): string
+ {
+ if($weight === 1000) {
+ return $header;
+ }
+
+ return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0');
+ }
+
+ /**
+ * Calculate the next weight, based on the current one.
+ *
+ * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the
+ * following formula:
+ *
+ * next weight = current weight - 10 ^ (floor(log(current weight - 1)))
+ *
+ * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) )
+ *
+ * Starting from 1000, this generates the following series:
+ *
+ * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ *
+ * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works
+ * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1
+ * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
+ *
+ * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
+ * @param bool $hasMoreThan28Headers
+ * @return int
+ */
+ public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
+ {
+ if ($currentWeight <= 1) {
+ return 1;
+ }
+
+ if ($hasMoreThan28Headers) {
+ return $currentWeight - 1;
+ }
+
+ return $currentWeight - 10 ** floor( log10($currentWeight - 1) );
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/Bird.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/Bird.php
new file mode 100644
index 00000000000..5f9def00a1c
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/Bird.php
@@ -0,0 +1,442 @@
+
+ */
+class Bird implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'Bird';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'size' => 'string',
+ 'color' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'size' => null,
+ 'color' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'size' => false,
+ 'color' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'size' => 'size',
+ 'color' => 'color'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'size' => 'setSize',
+ 'color' => 'setColor'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'size' => 'getSize',
+ 'color' => 'getColor'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('size', $data ?? [], null);
+ $this->setIfExists('color', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets size
+ *
+ * @return string|null
+ */
+ public function getSize(): ?string
+ {
+ return $this->container['size'];
+ }
+
+ /**
+ * Sets size
+ *
+ * @param string|null $size size
+ *
+ * @return $this
+ */
+ public function setSize(?string $size): static
+ {
+ if (is_null($size)) {
+ throw new InvalidArgumentException('non-nullable size cannot be null');
+ }
+ $this->container['size'] = $size;
+
+ return $this;
+ }
+
+ /**
+ * Gets color
+ *
+ * @return string|null
+ */
+ public function getColor(): ?string
+ {
+ return $this->container['color'];
+ }
+
+ /**
+ * Sets color
+ *
+ * @param string|null $color color
+ *
+ * @return $this
+ */
+ public function setColor(?string $color): static
+ {
+ if (is_null($color)) {
+ throw new InvalidArgumentException('non-nullable color cannot be null');
+ }
+ $this->container['color'] = $color;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/Category.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/Category.php
new file mode 100644
index 00000000000..9c677da2e82
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/Category.php
@@ -0,0 +1,442 @@
+
+ */
+class Category implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'Category';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'id' => 'int',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'id' => 'int64',
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'id' => 'id',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'id' => 'setId',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'id' => 'getId',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId(): ?int
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return $this
+ */
+ public function setId(?int $id): static
+ {
+ if (is_null($id)) {
+ throw new InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName(): ?string
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return $this
+ */
+ public function setName(?string $name): static
+ {
+ if (is_null($name)) {
+ throw new InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/DataQuery.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/DataQuery.php
new file mode 100644
index 00000000000..52d19494dd4
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/DataQuery.php
@@ -0,0 +1,466 @@
+
+ */
+class DataQuery extends Query
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'DataQuery';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'suffix' => 'string',
+ 'text' => 'string',
+ 'date' => '\DateTime'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'suffix' => null,
+ 'text' => null,
+ 'date' => 'date-time'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'suffix' => false,
+ 'text' => false,
+ 'date' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes + parent::openAPITypes();
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats + parent::openAPIFormats();
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables + parent::openAPINullables();
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'suffix' => 'suffix',
+ 'text' => 'text',
+ 'date' => 'date'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'suffix' => 'setSuffix',
+ 'text' => 'setText',
+ 'date' => 'setDate'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'suffix' => 'getSuffix',
+ 'text' => 'getText',
+ 'date' => 'getDate'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return parent::attributeMap() + self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return parent::setters() + self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return parent::getters() + self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ parent::__construct($data);
+
+ $this->setIfExists('suffix', $data ?? [], null);
+ $this->setIfExists('text', $data ?? [], null);
+ $this->setIfExists('date', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = parent::listInvalidProperties();
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets suffix
+ *
+ * @return string|null
+ */
+ public function getSuffix(): ?string
+ {
+ return $this->container['suffix'];
+ }
+
+ /**
+ * Sets suffix
+ *
+ * @param string|null $suffix test suffix
+ *
+ * @return $this
+ */
+ public function setSuffix(?string $suffix): static
+ {
+ if (is_null($suffix)) {
+ throw new InvalidArgumentException('non-nullable suffix cannot be null');
+ }
+ $this->container['suffix'] = $suffix;
+
+ return $this;
+ }
+
+ /**
+ * Gets text
+ *
+ * @return string|null
+ */
+ public function getText(): ?string
+ {
+ return $this->container['text'];
+ }
+
+ /**
+ * Sets text
+ *
+ * @param string|null $text Some text containing white spaces
+ *
+ * @return $this
+ */
+ public function setText(?string $text): static
+ {
+ if (is_null($text)) {
+ throw new InvalidArgumentException('non-nullable text cannot be null');
+ }
+ $this->container['text'] = $text;
+
+ return $this;
+ }
+
+ /**
+ * Gets date
+ *
+ * @return \DateTime|null
+ */
+ public function getDate(): ?\DateTime
+ {
+ return $this->container['date'];
+ }
+
+ /**
+ * Sets date
+ *
+ * @param \DateTime|null $date A date
+ *
+ * @return $this
+ */
+ public function setDate(?\DateTime $date): static
+ {
+ if (is_null($date)) {
+ throw new InvalidArgumentException('non-nullable date cannot be null');
+ }
+ $this->container['date'] = $date;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php
new file mode 100644
index 00000000000..5abd155efa9
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php
@@ -0,0 +1,694 @@
+
+ */
+class DefaultValue implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'DefaultValue';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'array_string_enum_ref_default' => '\OpenAPI\Client\Model\StringEnumRef[]',
+ 'array_string_enum_default' => 'string[]',
+ 'array_string_default' => 'string[]',
+ 'array_integer_default' => 'int[]',
+ 'array_string' => 'string[]',
+ 'array_string_nullable' => 'string[]',
+ 'array_string_extension_nullable' => 'string[]',
+ 'string_nullable' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'array_string_enum_ref_default' => null,
+ 'array_string_enum_default' => null,
+ 'array_string_default' => null,
+ 'array_integer_default' => null,
+ 'array_string' => null,
+ 'array_string_nullable' => null,
+ 'array_string_extension_nullable' => null,
+ 'string_nullable' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'array_string_enum_ref_default' => false,
+ 'array_string_enum_default' => false,
+ 'array_string_default' => false,
+ 'array_integer_default' => false,
+ 'array_string' => false,
+ 'array_string_nullable' => true,
+ 'array_string_extension_nullable' => true,
+ 'string_nullable' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'array_string_enum_ref_default' => 'array_string_enum_ref_default',
+ 'array_string_enum_default' => 'array_string_enum_default',
+ 'array_string_default' => 'array_string_default',
+ 'array_integer_default' => 'array_integer_default',
+ 'array_string' => 'array_string',
+ 'array_string_nullable' => 'array_string_nullable',
+ 'array_string_extension_nullable' => 'array_string_extension_nullable',
+ 'string_nullable' => 'string_nullable'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'array_string_enum_ref_default' => 'setArrayStringEnumRefDefault',
+ 'array_string_enum_default' => 'setArrayStringEnumDefault',
+ 'array_string_default' => 'setArrayStringDefault',
+ 'array_integer_default' => 'setArrayIntegerDefault',
+ 'array_string' => 'setArrayString',
+ 'array_string_nullable' => 'setArrayStringNullable',
+ 'array_string_extension_nullable' => 'setArrayStringExtensionNullable',
+ 'string_nullable' => 'setStringNullable'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'array_string_enum_ref_default' => 'getArrayStringEnumRefDefault',
+ 'array_string_enum_default' => 'getArrayStringEnumDefault',
+ 'array_string_default' => 'getArrayStringDefault',
+ 'array_integer_default' => 'getArrayIntegerDefault',
+ 'array_string' => 'getArrayString',
+ 'array_string_nullable' => 'getArrayStringNullable',
+ 'array_string_extension_nullable' => 'getArrayStringExtensionNullable',
+ 'string_nullable' => 'getStringNullable'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const ARRAY_STRING_ENUM_DEFAULT_SUCCESS = 'success';
+ public const ARRAY_STRING_ENUM_DEFAULT_FAILURE = 'failure';
+ public const ARRAY_STRING_ENUM_DEFAULT_UNCLASSIFIED = 'unclassified';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getArrayStringEnumDefaultAllowableValues()
+ {
+ return [
+ self::ARRAY_STRING_ENUM_DEFAULT_SUCCESS,
+ self::ARRAY_STRING_ENUM_DEFAULT_FAILURE,
+ self::ARRAY_STRING_ENUM_DEFAULT_UNCLASSIFIED,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]);
+ $this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]);
+ $this->setIfExists('array_string_default', $data ?? [], [["failure","skipped"]]);
+ $this->setIfExists('array_integer_default', $data ?? [], [[1,3]]);
+ $this->setIfExists('array_string', $data ?? [], null);
+ $this->setIfExists('array_string_nullable', $data ?? [], null);
+ $this->setIfExists('array_string_extension_nullable', $data ?? [], null);
+ $this->setIfExists('string_nullable', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets array_string_enum_ref_default
+ *
+ * @return \OpenAPI\Client\Model\StringEnumRef[]|null
+ */
+ public function getArrayStringEnumRefDefault(): ?array
+ {
+ return $this->container['array_string_enum_ref_default'];
+ }
+
+ /**
+ * Sets array_string_enum_ref_default
+ *
+ * @param \OpenAPI\Client\Model\StringEnumRef[]|null $array_string_enum_ref_default array_string_enum_ref_default
+ *
+ * @return $this
+ */
+ public function setArrayStringEnumRefDefault(?array $array_string_enum_ref_default): static
+ {
+ if (is_null($array_string_enum_ref_default)) {
+ throw new InvalidArgumentException('non-nullable array_string_enum_ref_default cannot be null');
+ }
+ $this->container['array_string_enum_ref_default'] = $array_string_enum_ref_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_enum_default
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringEnumDefault(): ?array
+ {
+ return $this->container['array_string_enum_default'];
+ }
+
+ /**
+ * Sets array_string_enum_default
+ *
+ * @param string[]|null $array_string_enum_default array_string_enum_default
+ *
+ * @return $this
+ */
+ public function setArrayStringEnumDefault(?array $array_string_enum_default): static
+ {
+ if (is_null($array_string_enum_default)) {
+ throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
+ }
+ $allowedValues = $this->getArrayStringEnumDefaultAllowableValues();
+ if (array_diff($array_string_enum_default, $allowedValues)) {
+ throw new InvalidArgumentException(
+ sprintf(
+ "Invalid value for 'array_string_enum_default', must be one of '%s'",
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+ $this->container['array_string_enum_default'] = $array_string_enum_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_default
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringDefault(): ?array
+ {
+ return $this->container['array_string_default'];
+ }
+
+ /**
+ * Sets array_string_default
+ *
+ * @param string[]|null $array_string_default array_string_default
+ *
+ * @return $this
+ */
+ public function setArrayStringDefault(?array $array_string_default): static
+ {
+ if (is_null($array_string_default)) {
+ throw new InvalidArgumentException('non-nullable array_string_default cannot be null');
+ }
+ $this->container['array_string_default'] = $array_string_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_integer_default
+ *
+ * @return int[]|null
+ */
+ public function getArrayIntegerDefault(): ?array
+ {
+ return $this->container['array_integer_default'];
+ }
+
+ /**
+ * Sets array_integer_default
+ *
+ * @param int[]|null $array_integer_default array_integer_default
+ *
+ * @return $this
+ */
+ public function setArrayIntegerDefault(?array $array_integer_default): static
+ {
+ if (is_null($array_integer_default)) {
+ throw new InvalidArgumentException('non-nullable array_integer_default cannot be null');
+ }
+ $this->container['array_integer_default'] = $array_integer_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string
+ *
+ * @return string[]|null
+ */
+ public function getArrayString(): ?array
+ {
+ return $this->container['array_string'];
+ }
+
+ /**
+ * Sets array_string
+ *
+ * @param string[]|null $array_string array_string
+ *
+ * @return $this
+ */
+ public function setArrayString(?array $array_string): static
+ {
+ if (is_null($array_string)) {
+ throw new InvalidArgumentException('non-nullable array_string cannot be null');
+ }
+ $this->container['array_string'] = $array_string;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_nullable
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringNullable(): ?array
+ {
+ return $this->container['array_string_nullable'];
+ }
+
+ /**
+ * Sets array_string_nullable
+ *
+ * @param string[]|null $array_string_nullable array_string_nullable
+ *
+ * @return $this
+ */
+ public function setArrayStringNullable(?array $array_string_nullable): static
+ {
+ if (is_null($array_string_nullable)) {
+ array_push($this->openAPINullablesSetToNull, 'array_string_nullable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('array_string_nullable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['array_string_nullable'] = $array_string_nullable;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_extension_nullable
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringExtensionNullable(): ?array
+ {
+ return $this->container['array_string_extension_nullable'];
+ }
+
+ /**
+ * Sets array_string_extension_nullable
+ *
+ * @param string[]|null $array_string_extension_nullable array_string_extension_nullable
+ *
+ * @return $this
+ */
+ public function setArrayStringExtensionNullable(?array $array_string_extension_nullable): static
+ {
+ if (is_null($array_string_extension_nullable)) {
+ array_push($this->openAPINullablesSetToNull, 'array_string_extension_nullable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('array_string_extension_nullable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['array_string_extension_nullable'] = $array_string_extension_nullable;
+
+ return $this;
+ }
+
+ /**
+ * Gets string_nullable
+ *
+ * @return string|null
+ */
+ public function getStringNullable(): ?string
+ {
+ return $this->container['string_nullable'];
+ }
+
+ /**
+ * Sets string_nullable
+ *
+ * @param string|null $string_nullable string_nullable
+ *
+ * @return $this
+ */
+ public function setStringNullable(?string $string_nullable): static
+ {
+ if (is_null($string_nullable)) {
+ array_push($this->openAPINullablesSetToNull, 'string_nullable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('string_nullable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['string_nullable'] = $string_nullable;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/ModelInterface.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/ModelInterface.php
new file mode 100644
index 00000000000..9a0fc7b3cdb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/ModelInterface.php
@@ -0,0 +1,111 @@
+
+ */
+class NumberPropertiesOnly implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'NumberPropertiesOnly';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'number' => 'float',
+ 'float' => 'float',
+ 'double' => 'float'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'number' => null,
+ 'float' => 'float',
+ 'double' => 'double'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'number' => false,
+ 'float' => false,
+ 'double' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'number' => 'number',
+ 'float' => 'float',
+ 'double' => 'double'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'number' => 'setNumber',
+ 'float' => 'setFloat',
+ 'double' => 'setDouble'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'number' => 'getNumber',
+ 'float' => 'getFloat',
+ 'double' => 'getDouble'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('number', $data ?? [], null);
+ $this->setIfExists('float', $data ?? [], null);
+ $this->setIfExists('double', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ if (!is_null($this->container['double']) && ($this->container['double'] > 50.2)) {
+ $invalidProperties[] = "invalid value for 'double', must be smaller than or equal to 50.2.";
+ }
+
+ if (!is_null($this->container['double']) && ($this->container['double'] < 0.8)) {
+ $invalidProperties[] = "invalid value for 'double', must be bigger than or equal to 0.8.";
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets number
+ *
+ * @return float|null
+ */
+ public function getNumber(): ?float
+ {
+ return $this->container['number'];
+ }
+
+ /**
+ * Sets number
+ *
+ * @param float|null $number number
+ *
+ * @return $this
+ */
+ public function setNumber(?float $number): static
+ {
+ if (is_null($number)) {
+ throw new InvalidArgumentException('non-nullable number cannot be null');
+ }
+ $this->container['number'] = $number;
+
+ return $this;
+ }
+
+ /**
+ * Gets float
+ *
+ * @return float|null
+ */
+ public function getFloat(): ?float
+ {
+ return $this->container['float'];
+ }
+
+ /**
+ * Sets float
+ *
+ * @param float|null $float float
+ *
+ * @return $this
+ */
+ public function setFloat(?float $float): static
+ {
+ if (is_null($float)) {
+ throw new InvalidArgumentException('non-nullable float cannot be null');
+ }
+ $this->container['float'] = $float;
+
+ return $this;
+ }
+
+ /**
+ * Gets double
+ *
+ * @return float|null
+ */
+ public function getDouble(): ?float
+ {
+ return $this->container['double'];
+ }
+
+ /**
+ * Sets double
+ *
+ * @param float|null $double double
+ *
+ * @return $this
+ */
+ public function setDouble(?float $double): static
+ {
+ if (is_null($double)) {
+ throw new InvalidArgumentException('non-nullable double cannot be null');
+ }
+
+ if (($double > 50.2)) {
+ throw new InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be smaller than or equal to 50.2.');
+ }
+ if (($double < 0.8)) {
+ throw new InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be bigger than or equal to 0.8.');
+ }
+
+ $this->container['double'] = $double;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/Pet.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/Pet.php
new file mode 100644
index 00000000000..d13829336ba
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/Pet.php
@@ -0,0 +1,620 @@
+
+ */
+class Pet implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'Pet';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'id' => 'int',
+ 'name' => 'string',
+ 'category' => '\OpenAPI\Client\Model\Category',
+ 'photo_urls' => 'string[]',
+ 'tags' => '\OpenAPI\Client\Model\Tag[]',
+ 'status' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'id' => 'int64',
+ 'name' => null,
+ 'category' => null,
+ 'photo_urls' => null,
+ 'tags' => null,
+ 'status' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'name' => false,
+ 'category' => false,
+ 'photo_urls' => false,
+ 'tags' => false,
+ 'status' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'id' => 'id',
+ 'name' => 'name',
+ 'category' => 'category',
+ 'photo_urls' => 'photoUrls',
+ 'tags' => 'tags',
+ 'status' => 'status'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'id' => 'setId',
+ 'name' => 'setName',
+ 'category' => 'setCategory',
+ 'photo_urls' => 'setPhotoUrls',
+ 'tags' => 'setTags',
+ 'status' => 'setStatus'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'id' => 'getId',
+ 'name' => 'getName',
+ 'category' => 'getCategory',
+ 'photo_urls' => 'getPhotoUrls',
+ 'tags' => 'getTags',
+ 'status' => 'getStatus'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const STATUS_AVAILABLE = 'available';
+ public const STATUS_PENDING = 'pending';
+ public const STATUS_SOLD = 'sold';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getStatusAllowableValues()
+ {
+ return [
+ self::STATUS_AVAILABLE,
+ self::STATUS_PENDING,
+ self::STATUS_SOLD,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ $this->setIfExists('category', $data ?? [], null);
+ $this->setIfExists('photo_urls', $data ?? [], null);
+ $this->setIfExists('tags', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ if ($this->container['name'] === null) {
+ $invalidProperties[] = "'name' can't be null";
+ }
+ if ($this->container['photo_urls'] === null) {
+ $invalidProperties[] = "'photo_urls' can't be null";
+ }
+ $allowedValues = $this->getStatusAllowableValues();
+ if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'status', must be one of '%s'",
+ $this->container['status'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId(): ?int
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return $this
+ */
+ public function setId(?int $id): static
+ {
+ if (is_null($id)) {
+ throw new InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string $name name
+ *
+ * @return $this
+ */
+ public function setName(string $name): static
+ {
+ if (is_null($name)) {
+ throw new InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+
+ /**
+ * Gets category
+ *
+ * @return \OpenAPI\Client\Model\Category|null
+ */
+ public function getCategory(): ?\OpenAPI\Client\Model\Category
+ {
+ return $this->container['category'];
+ }
+
+ /**
+ * Sets category
+ *
+ * @param \OpenAPI\Client\Model\Category|null $category category
+ *
+ * @return $this
+ */
+ public function setCategory(?\OpenAPI\Client\Model\Category $category): static
+ {
+ if (is_null($category)) {
+ throw new InvalidArgumentException('non-nullable category cannot be null');
+ }
+ $this->container['category'] = $category;
+
+ return $this;
+ }
+
+ /**
+ * Gets photo_urls
+ *
+ * @return string[]
+ */
+ public function getPhotoUrls(): array
+ {
+ return $this->container['photo_urls'];
+ }
+
+ /**
+ * Sets photo_urls
+ *
+ * @param string[] $photo_urls photo_urls
+ *
+ * @return $this
+ */
+ public function setPhotoUrls(array $photo_urls): static
+ {
+ if (is_null($photo_urls)) {
+ throw new InvalidArgumentException('non-nullable photo_urls cannot be null');
+ }
+ $this->container['photo_urls'] = $photo_urls;
+
+ return $this;
+ }
+
+ /**
+ * Gets tags
+ *
+ * @return \OpenAPI\Client\Model\Tag[]|null
+ */
+ public function getTags(): ?array
+ {
+ return $this->container['tags'];
+ }
+
+ /**
+ * Sets tags
+ *
+ * @param \OpenAPI\Client\Model\Tag[]|null $tags tags
+ *
+ * @return $this
+ */
+ public function setTags(?array $tags): static
+ {
+ if (is_null($tags)) {
+ throw new InvalidArgumentException('non-nullable tags cannot be null');
+ }
+ $this->container['tags'] = $tags;
+
+ return $this;
+ }
+
+ /**
+ * Gets status
+ *
+ * @return string|null
+ */
+ public function getStatus(): ?string
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param string|null $status pet status in the store
+ *
+ * @return $this
+ */
+ public function setStatus(?string $status): static
+ {
+ if (is_null($status)) {
+ throw new InvalidArgumentException('non-nullable status cannot be null');
+ }
+ $allowedValues = $this->getStatusAllowableValues();
+ if (!in_array($status, $allowedValues, true)) {
+ throw new InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'status', must be one of '%s'",
+ $status,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php
new file mode 100644
index 00000000000..66bc3cc9038
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php
@@ -0,0 +1,468 @@
+
+ */
+class Query implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'Query';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'id' => 'int',
+ 'outcomes' => 'string[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'id' => 'int64',
+ 'outcomes' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'outcomes' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'id' => 'id',
+ 'outcomes' => 'outcomes'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'id' => 'setId',
+ 'outcomes' => 'setOutcomes'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'id' => 'getId',
+ 'outcomes' => 'getOutcomes'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const OUTCOMES_SUCCESS = 'SUCCESS';
+ public const OUTCOMES_FAILURE = 'FAILURE';
+ public const OUTCOMES_SKIPPED = 'SKIPPED';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getOutcomesAllowableValues()
+ {
+ return [
+ self::OUTCOMES_SUCCESS,
+ self::OUTCOMES_FAILURE,
+ self::OUTCOMES_SKIPPED,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId(): ?int
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id Query
+ *
+ * @return $this
+ */
+ public function setId(?int $id): static
+ {
+ if (is_null($id)) {
+ throw new InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets outcomes
+ *
+ * @return string[]|null
+ */
+ public function getOutcomes(): ?array
+ {
+ return $this->container['outcomes'];
+ }
+
+ /**
+ * Sets outcomes
+ *
+ * @param string[]|null $outcomes outcomes
+ *
+ * @return $this
+ */
+ public function setOutcomes(?array $outcomes): static
+ {
+ if (is_null($outcomes)) {
+ throw new InvalidArgumentException('non-nullable outcomes cannot be null');
+ }
+ $allowedValues = $this->getOutcomesAllowableValues();
+ if (array_diff($outcomes, $allowedValues)) {
+ throw new InvalidArgumentException(
+ sprintf(
+ "Invalid value for 'outcomes', must be one of '%s'",
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+ $this->container['outcomes'] = $outcomes;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/StringEnumRef.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/StringEnumRef.php
new file mode 100644
index 00000000000..c7b3a7f5df7
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/StringEnumRef.php
@@ -0,0 +1,48 @@
+
+ */
+class Tag implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'Tag';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'id' => 'int',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'id' => 'int64',
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'id' => 'id',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'id' => 'setId',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'id' => 'getId',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId(): ?int
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return $this
+ */
+ public function setId(?int $id): static
+ {
+ if (is_null($id)) {
+ throw new InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName(): ?string
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return $this
+ */
+ public function setName(?string $name): static
+ {
+ if (is_null($name)) {
+ throw new InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/TestFormObjectMultipartRequestMarker.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/TestFormObjectMultipartRequestMarker.php
new file mode 100644
index 00000000000..6fc141fd0da
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/TestFormObjectMultipartRequestMarker.php
@@ -0,0 +1,408 @@
+
+ */
+class TestFormObjectMultipartRequestMarker implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'test_form_object_multipart_request_marker';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName(): ?string
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return $this
+ */
+ public function setName(?string $name): static
+ {
+ if (is_null($name)) {
+ throw new InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php
new file mode 100644
index 00000000000..e113ebe789b
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php
@@ -0,0 +1,510 @@
+
+ */
+class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'test_query_style_deepObject_explode_true_object_allOf_query_object_parameter';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'size' => 'string',
+ 'color' => 'string',
+ 'id' => 'int',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'size' => null,
+ 'color' => null,
+ 'id' => 'int64',
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'size' => false,
+ 'color' => false,
+ 'id' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'size' => 'size',
+ 'color' => 'color',
+ 'id' => 'id',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'size' => 'setSize',
+ 'color' => 'setColor',
+ 'id' => 'setId',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'size' => 'getSize',
+ 'color' => 'getColor',
+ 'id' => 'getId',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('size', $data ?? [], null);
+ $this->setIfExists('color', $data ?? [], null);
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets size
+ *
+ * @return string|null
+ */
+ public function getSize(): ?string
+ {
+ return $this->container['size'];
+ }
+
+ /**
+ * Sets size
+ *
+ * @param string|null $size size
+ *
+ * @return $this
+ */
+ public function setSize(?string $size): static
+ {
+ if (is_null($size)) {
+ throw new InvalidArgumentException('non-nullable size cannot be null');
+ }
+ $this->container['size'] = $size;
+
+ return $this;
+ }
+
+ /**
+ * Gets color
+ *
+ * @return string|null
+ */
+ public function getColor(): ?string
+ {
+ return $this->container['color'];
+ }
+
+ /**
+ * Sets color
+ *
+ * @param string|null $color color
+ *
+ * @return $this
+ */
+ public function setColor(?string $color): static
+ {
+ if (is_null($color)) {
+ throw new InvalidArgumentException('non-nullable color cannot be null');
+ }
+ $this->container['color'] = $color;
+
+ return $this;
+ }
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId(): ?int
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return $this
+ */
+ public function setId(?int $id): static
+ {
+ if (is_null($id)) {
+ throw new InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName(): ?string
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return $this
+ */
+ public function setName(?string $name): static
+ {
+ if (is_null($name)) {
+ throw new InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php
new file mode 100644
index 00000000000..99d2c88e9a8
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php
@@ -0,0 +1,408 @@
+
+ */
+class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'test_query_style_form_explode_true_array_string_query_object_parameter';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'values' => 'string[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'values' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'values' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var array
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes(): array
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats(): array
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return array
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param array $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var array
+ */
+ protected static array $attributeMap = [
+ 'values' => 'values'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'values' => 'setValues'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'values' => 'getValues'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap(): array
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters(): array
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters(): array
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName(): string
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var array
+ */
+ protected array $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param array $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('values', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return string[] invalid properties with reasons
+ */
+ public function listInvalidProperties(): array
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets values
+ *
+ * @return string[]|null
+ */
+ public function getValues(): ?array
+ {
+ return $this->container['values'];
+ }
+
+ /**
+ * Sets values
+ *
+ * @param string[]|null $values values
+ *
+ * @return $this
+ */
+ public function setValues(?array $values): static
+ {
+ if (is_null($values)) {
+ throw new InvalidArgumentException('non-nullable values cannot be null');
+ }
+ $this->container['values'] = $values;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[ReturnTypeWillChange]
+ public function offsetGet(mixed $offset): mixed
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset(mixed $offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[ReturnTypeWillChange]
+ public function jsonSerialize(): mixed
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue(): string
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php b/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php
new file mode 100644
index 00000000000..c37d6e7b0c0
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php
@@ -0,0 +1,603 @@
+format('Y-m-d') : $data->format(self::$dateTimeFormat);
+ }
+
+ if ($data instanceof \BackedEnum) {
+ return $data->value;
+ }
+
+ if (is_array($data)) {
+ foreach ($data as $property => $value) {
+ $data[$property] = self::sanitizeForSerialization($value);
+ }
+ return $data;
+ }
+
+ if (is_object($data)) {
+ $values = [];
+ if ($data instanceof ModelInterface) {
+ $formats = $data::openAPIFormats();
+ foreach ($data::openAPITypes() as $property => $openAPIType) {
+ $getter = $data::getters()[$property];
+ $value = $data->$getter();
+ if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
+ if (is_subclass_of($openAPIType, '\BackedEnum')) {
+ if (is_scalar($value)) {
+ $value = $openAPIType::tryFrom($value);
+ if ($value === null) {
+ $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases()));
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value for enum '%s', must be one of: '%s'",
+ $openAPIType::class,
+ $imploded
+ )
+ );
+ }
+ }
+ }
+ }
+ if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
+ $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
+ }
+ }
+ } else {
+ foreach($data as $property => $value) {
+ $values[$property] = self::sanitizeForSerialization($value);
+ }
+ }
+ return (object)$values;
+ } else {
+ return (string)$data;
+ }
+ }
+
+ /**
+ * Sanitize filename by removing path.
+ * e.g. ../../sun.gif becomes sun.gif
+ *
+ * @param string $filename filename to be sanitized
+ *
+ * @return string the sanitized filename
+ */
+ public static function sanitizeFilename(string $filename): string
+ {
+ if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
+ return $match[1];
+ } else {
+ return $filename;
+ }
+ }
+
+ /**
+ * Shorter timestamp microseconds to 6 digits length.
+ *
+ * @param string $timestamp Original timestamp
+ *
+ * @return string the shorten timestamp
+ */
+ public static function sanitizeTimestamp(string $timestamp): string
+ {
+ return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the path, by url-encoding.
+ *
+ * @param string $value a string which will be part of the path
+ *
+ * @return string the serialized object
+ */
+ public static function toPathValue(string $value): string
+ {
+ return rawurlencode(self::toString($value));
+ }
+
+ /**
+ * Checks if a value is empty, based on its OpenAPI type.
+ *
+ * @param mixed $value
+ * @param string $openApiType
+ *
+ * @return bool true if $value is empty
+ */
+ private static function isEmptyValue(mixed $value, string $openApiType): bool
+ {
+ # If empty() returns false, it is not empty regardless of its type.
+ if (!empty($value)) {
+ return false;
+ }
+
+ # Null is always empty, as we cannot send a real "null" value in a query parameter.
+ if ($value === null) {
+ return true;
+ }
+
+ return match ($openApiType) {
+ # For numeric values, false and '' are considered empty.
+ # This comparison is safe for floating point values, since the previous call to empty() will
+ # filter out values that don't match 0.
+ 'int','integer' => $value !== 0,
+ 'number'|'float' => $value !== 0 && $value !== 0.0,
+
+ # For boolean values, '' is considered empty
+ 'bool','boolean' => !in_array($value, [false, 0], true),
+
+ # For all the other types, any value at this point can be considered empty.
+ default => true
+ };
+ }
+
+ /**
+ * Take query parameter properties and turn it into an array suitable for
+ * native http_build_query or GuzzleHttp\Psr7\Query::build.
+ *
+ * @param mixed $value Parameter value
+ * @param string $paramName Parameter name
+ * @param string $openApiType OpenAPIType e.g. array or object
+ * @param string $style Parameter serialization style
+ * @param bool $explode Parameter explode option
+ * @param bool $required Whether query param is required or not
+ *
+ * @return array
+ */
+ public static function toQueryValue(
+ mixed $value,
+ string $paramName,
+ string $openApiType = 'string',
+ string $style = 'form',
+ bool $explode = true,
+ bool $required = true
+ ): array {
+
+ # Check if we should omit this parameter from the query. This should only happen when:
+ # - Parameter is NOT required; AND
+ # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For
+ # example, 0 as "int" or "boolean" is NOT an empty value.
+ if (self::isEmptyValue($value, $openApiType)) {
+ if ($required) {
+ return ["{$paramName}" => ''];
+ } else {
+ return [];
+ }
+ }
+
+ # Handle DateTime objects in query
+ if($openApiType === "\DateTime" && $value instanceof DateTime) {
+ return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
+ }
+
+ $query = [];
+ $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value;
+
+ // since \GuzzleHttp\Psr7\Query::build fails with nested arrays
+ // need to flatten array first
+ $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) {
+ if (!is_array($arr)) return $arr;
+
+ foreach ($arr as $k => $v) {
+ $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k;
+
+ if (is_array($v)) {
+ $flattenArray($v, $prop, $result);
+ } else {
+ if ($style !== 'deepObject' && !$explode) {
+ // push key itself
+ $result[] = $prop;
+ }
+ $result[$prop] = $v;
+ }
+ }
+ return $result;
+ };
+
+ $value = $flattenArray($value, $paramName);
+
+ if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) {
+ return $value;
+ }
+
+ if ('boolean' === $openApiType && is_bool($value)) {
+ $value = self::convertBoolToQueryStringFormat($value);
+ }
+
+ // handle style in serializeCollection
+ $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style);
+
+ return $query;
+ }
+
+ /**
+ * Convert boolean value to format for query string.
+ *
+ * @param bool $value Boolean value
+ *
+ * @return int|string Boolean value in format
+ */
+ public static function convertBoolToQueryStringFormat(bool $value): int|string
+ {
+ if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
+ return $value ? 'true' : 'false';
+ }
+
+ return (int) $value;
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the header. If it's a string, pass through unchanged
+ * If it's a datetime object, format it in ISO8601
+ *
+ * @param string $value a string which will be part of the header
+ *
+ * @return string the header string
+ */
+ public static function toHeaderValue(string $value): string
+ {
+ $callable = [$value, 'toHeaderValue'];
+ if (is_callable($callable)) {
+ return $callable();
+ }
+
+ return self::toString($value);
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the http body (form parameter). If it's a string, pass through unchanged
+ * If it's a datetime object, format it in ISO8601
+ *
+ * @param string|\SplFileObject $value the value of the form parameter
+ *
+ * @return string the form string
+ */
+ public static function toFormValue(string|\SplFileObject $value): string
+ {
+ if ($value instanceof \SplFileObject) {
+ return $value->getRealPath();
+ } else {
+ return self::toString($value);
+ }
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the parameter. If it's a string, pass through unchanged
+ * If it's a datetime object, format it in ISO8601
+ * If it's a boolean, convert it to "true" or "false".
+ *
+ * @param string|bool|DateTime $value the value of the parameter
+ *
+ * @return string the header string
+ */
+ public static function toString(string|bool|DateTime $value): string
+ {
+ if ($value instanceof DateTime) { // datetime in ISO8601 format
+ return $value->format(self::$dateTimeFormat);
+ } elseif (is_bool($value)) {
+ return $value ? 'true' : 'false';
+ } else {
+ return (string) $value;
+ }
+ }
+
+ /**
+ * Serialize an array to a string.
+ *
+ * @param array $collection collection to serialize to a string
+ * @param string $style the format use for serialization (csv,
+ * ssv, tsv, pipes, multi)
+ * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array
+ *
+ * @return string
+ */
+ public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string
+ {
+ if ($allowCollectionFormatMulti && ('multi' === $style)) {
+ // http_build_query() almost does the job for us. We just
+ // need to fix the result of multidimensional arrays.
+ return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
+ }
+ return match ($style) {
+ 'pipeDelimited', 'pipes' => implode('|', $collection),
+ 'tsv' => implode("\t", $collection),
+ 'spaceDelimited', 'ssv' => implode(' ', $collection),
+ default => implode(',', $collection),
+ };
+ }
+
+ /**
+ * Deserialize a JSON string into an object
+ *
+ * @param mixed $data object or primitive to be deserialized
+ * @param string $class class name is passed as a string
+ * @param string[]|null $httpHeaders HTTP headers
+ *
+ * @return mixed a single or an array of $class instances
+ */
+ public static function deserialize(mixed $data, string $class, array $httpHeaders = null): mixed
+ {
+ if (null === $data) {
+ return null;
+ }
+
+ if (strcasecmp(substr($class, -2), '[]') === 0) {
+ $data = is_string($data) ? json_decode($data) : $data;
+
+ if (!is_array($data)) {
+ throw new \InvalidArgumentException("Invalid array '$class'");
+ }
+
+ $subClass = substr($class, 0, -2);
+ $values = [];
+ foreach ($data as $key => $value) {
+ $values[] = self::deserialize($value, $subClass, null);
+ }
+ return $values;
+ }
+
+ if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array
+ $data = is_string($data) ? json_decode($data) : $data;
+ settype($data, 'array');
+ $inner = substr($class, 4, -1);
+ $deserialized = [];
+ if (strrpos($inner, ",") !== false) {
+ $subClass_array = explode(',', $inner, 2);
+ $subClass = $subClass_array[1];
+ foreach ($data as $key => $value) {
+ $deserialized[$key] = self::deserialize($value, $subClass, null);
+ }
+ }
+ return $deserialized;
+ }
+
+ if ($class === 'mixed') {
+ settype($data, gettype($data));
+ return $data;
+ }
+
+ if ($class === '\DateTime') {
+ // Some APIs return an invalid, empty string as a
+ // date-time property. DateTime::__construct() will return
+ // the current time for empty input which is probably not
+ // what is meant. The invalid empty string is probably to
+ // be interpreted as a missing field/value. Let's handle
+ // this graceful.
+ if (!empty($data)) {
+ try {
+ return new DateTime($data);
+ } catch (\Exception $exception) {
+ // Some APIs return a date-time with too high nanosecond
+ // precision for php's DateTime to handle.
+ // With provided regexp 6 digits of microseconds saved
+ return new DateTime(self::sanitizeTimestamp($data));
+ }
+ } else {
+ return null;
+ }
+ }
+
+ if ($class === '\Psr\Http\Message\StreamInterface') {
+ return Utils::streamFor($data);
+ }
+
+ if ($class === '\SplFileObject') {
+ $data = Utils::streamFor($data);
+
+ /** @var \Psr\Http\Message\StreamInterface $data */
+
+ // determine file name
+ if (
+ is_array($httpHeaders)
+ && array_key_exists('Content-Disposition', $httpHeaders)
+ && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)
+ ) {
+ $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
+ } else {
+ $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
+ }
+
+ $file = fopen($filename, 'w');
+ while ($chunk = $data->read(200)) {
+ fwrite($file, $chunk);
+ }
+ fclose($file);
+
+ return new \SplFileObject($filename, 'r');
+ }
+
+ /** @psalm-suppress ParadoxicalCondition */
+ // handle primitive types
+ if (in_array($class, ['\DateTime', '\SplFileObject'], true)) {
+ return $data;
+ } elseif (in_array($class, ['array', 'bool', 'boolean', 'float', 'double', 'int', 'integer', 'object', 'string', 'null'], true)) {
+ // type ref: https://www.php.net/manual/en/function.settype.php
+ // byte, mixed, void in the old php client were removed
+ settype($data, $class);
+ return $data;
+ }
+
+
+ if (is_subclass_of($class, '\BackedEnum')) {
+ $data = $class::tryFrom($data);
+ if ($data === null) {
+ $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases()));
+ throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
+ }
+ return $data;
+ } else {
+ $data = is_string($data) ? json_decode($data) : $data;
+
+ if (is_array($data)) {
+ $data = (object)$data;
+ }
+
+ // If a discriminator is defined and points to a valid subclass, use it.
+ $discriminator = $class::DISCRIMINATOR;
+ if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
+ $subclass = '\OpenAPI\Client\Model\\' . $data->{$discriminator};
+ if (is_subclass_of($subclass, $class)) {
+ $class = $subclass;
+ }
+ }
+
+ /** @var ModelInterface $instance */
+ $instance = new $class();
+ foreach ($instance::openAPITypes() as $property => $type) {
+ $propertySetter = $instance::setters()[$property];
+
+ if (!isset($propertySetter)) {
+ continue;
+ }
+
+ if (!isset($data->{$instance::attributeMap()[$property]})) {
+ if ($instance::isNullable($property)) {
+ $instance->$propertySetter(null);
+ }
+
+ continue;
+ }
+
+ if (isset($data->{$instance::attributeMap()[$property]})) {
+ $propertyValue = $data->{$instance::attributeMap()[$property]};
+ $instance->$propertySetter(self::deserialize($propertyValue, $type, null));
+ }
+ }
+ return $instance;
+ }
+ }
+
+ /**
+ * Build a query string from an array of key value pairs.
+ *
+ * This function can use the return value of `parse()` to build a query
+ * string. This function does not modify the provided keys when an array is
+ * encountered (like `http_build_query()` would).
+ *
+ * @param array $params Query string parameters.
+ * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
+ * to encode using RFC3986, or PHP_QUERY_RFC1738
+ * to encode using RFC1738.
+ */
+ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string
+ {
+ if (!$params) {
+ return '';
+ }
+
+ if ($encoding === false) {
+ $encoder = function (string $str): string {
+ return $str;
+ };
+ } elseif ($encoding === PHP_QUERY_RFC3986) {
+ $encoder = 'rawurlencode';
+ } elseif ($encoding === PHP_QUERY_RFC1738) {
+ $encoder = 'urlencode';
+ } else {
+ throw new \InvalidArgumentException('Invalid type');
+ }
+
+ $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()
+ ? function ($v) { return (int) $v; }
+ : function ($v) { return $v ? 'true' : 'false'; };
+
+ $qs = '';
+ foreach ($params as $k => $v) {
+ $k = $encoder((string) $k);
+ if (!is_array($v)) {
+ $qs .= $k;
+ $v = is_bool($v) ? $castBool($v) : $v;
+ if ($v !== null) {
+ $qs .= '='.$encoder((string) $v);
+ }
+ $qs .= '&';
+ } else {
+ foreach ($v as $vv) {
+ $qs .= $k;
+ $vv = is_bool($vv) ? $castBool($vv) : $vv;
+ if ($vv !== null) {
+ $qs .= '='.$encoder((string) $vv);
+ }
+ $qs .= '&';
+ }
+ }
+ }
+
+ return $qs ? (string) substr($qs, 0, -1) : '';
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen-streaming/tests/Api/AuthApiTest.php b/samples/client/echo_api/php-nextgen-streaming/tests/Api/AuthApiTest.php
new file mode 100644
index 00000000000..ae29180cc95
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen-streaming/tests/Api/AuthApiTest.php
@@ -0,0 +1,96 @@
+getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -228,7 +228,7 @@ class AuthApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -313,7 +313,7 @@ class AuthApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -500,7 +500,7 @@ class AuthApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -529,7 +529,7 @@ class AuthApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -614,7 +614,7 @@ class AuthApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php
index 1618dc17930..aea4becf6ab 100644
--- a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php
+++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php
@@ -223,7 +223,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('\SplFileObject' === '\SplFileObject') {
+ if (in_array('\SplFileObject', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -252,7 +252,7 @@ class BodyApi
}
$returnType = '\SplFileObject';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -337,7 +337,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -524,7 +524,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -553,7 +553,7 @@ class BodyApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -642,7 +642,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -839,7 +839,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -868,7 +868,7 @@ class BodyApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -957,7 +957,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1028,10 +1028,12 @@ class BodyApi
$formParams['files'] = [];
$paramFiles = is_array($files) ? $files : [$files];
foreach ($paramFiles as $paramFile) {
- $formParams['files'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
- ObjectSerializer::toFormValue($paramFile),
- 'rb'
- );
+ $formParams['files'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
}
}
@@ -1165,7 +1167,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1194,7 +1196,7 @@ class BodyApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1283,7 +1285,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1348,10 +1350,12 @@ class BodyApi
$formParams['my-file'] = [];
$paramFiles = is_array($my_file) ? $my_file : [$my_file];
foreach ($paramFiles as $paramFile) {
- $formParams['my-file'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
- ObjectSerializer::toFormValue($paramFile),
- 'rb'
- );
+ $formParams['my-file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
}
}
@@ -1485,7 +1489,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1514,7 +1518,7 @@ class BodyApi
}
$returnType = '\OpenAPI\Client\Model\Pet';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1603,7 +1607,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1800,7 +1804,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1829,7 +1833,7 @@ class BodyApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1918,7 +1922,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2115,7 +2119,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2144,7 +2148,7 @@ class BodyApi
}
$returnType = '\OpenAPI\Client\Model\Pet';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2233,7 +2237,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2430,7 +2434,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2459,7 +2463,7 @@ class BodyApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2548,7 +2552,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2745,7 +2749,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\StringEnumRef' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\StringEnumRef', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2774,7 +2778,7 @@ class BodyApi
}
$returnType = '\OpenAPI\Client\Model\StringEnumRef';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2863,7 +2867,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3060,7 +3064,7 @@ class BodyApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3089,7 +3093,7 @@ class BodyApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3178,7 +3182,7 @@ class BodyApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php
index 592d4db6f19..254e7fe7f9d 100644
--- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php
+++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php
@@ -214,7 +214,7 @@ class FormApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -243,7 +243,7 @@ class FormApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -340,7 +340,7 @@ class FormApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -548,7 +548,7 @@ class FormApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -577,7 +577,7 @@ class FormApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -666,7 +666,7 @@ class FormApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -886,7 +886,7 @@ class FormApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -915,7 +915,7 @@ class FormApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1024,7 +1024,7 @@ class FormApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php
index faf66ac600d..c9430f11fdc 100644
--- a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php
+++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php
@@ -216,7 +216,7 @@ class HeaderApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -245,7 +245,7 @@ class HeaderApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -350,7 +350,7 @@ class HeaderApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php
index 260ba8872f7..123f7b09d3c 100644
--- a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php
+++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php
@@ -212,7 +212,7 @@ class PathApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -241,7 +241,7 @@ class PathApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -342,7 +342,7 @@ class PathApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php
index 9e58145d730..2a8a9becf93 100644
--- a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php
+++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php
@@ -231,7 +231,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -260,7 +260,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -353,7 +353,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -572,7 +572,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -601,7 +601,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -698,7 +698,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -929,7 +929,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -958,7 +958,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1055,7 +1055,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1278,7 +1278,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1307,7 +1307,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1396,7 +1396,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1595,7 +1595,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1624,7 +1624,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1713,7 +1713,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1912,7 +1912,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1941,7 +1941,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2030,7 +2030,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2229,7 +2229,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2258,7 +2258,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2347,7 +2347,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2546,7 +2546,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2575,7 +2575,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2664,7 +2664,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2863,7 +2863,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2892,7 +2892,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2981,7 +2981,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3180,7 +3180,7 @@ class QueryApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3209,7 +3209,7 @@ class QueryApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3298,7 +3298,7 @@ class QueryApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php
index 8b928cb4300..c37d6e7b0c0 100644
--- a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php
+++ b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php
@@ -452,6 +452,10 @@ class ObjectSerializer
}
}
+ if ($class === '\Psr\Http\Message\StreamInterface') {
+ return Utils::streamFor($data);
+ }
+
if ($class === '\SplFileObject') {
$data = Utils::streamFor($data);
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php
index 2ed26bb695a..3a4a04b5854 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php
@@ -199,7 +199,7 @@ class AnotherFakeApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Client', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -228,7 +228,7 @@ class AnotherFakeApi
}
$returnType = '\OpenAPI\Client\Model\Client';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -317,7 +317,7 @@ class AnotherFakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php
index 91eb0a5a2b3..a6e8fd23898 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php
@@ -191,7 +191,7 @@ class DefaultApi
switch($statusCode) {
default:
- if ('\OpenAPI\Client\Model\FooGetDefaultResponse' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\FooGetDefaultResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -220,7 +220,7 @@ class DefaultApi
}
$returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -301,7 +301,7 @@ class DefaultApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php
index b08f02796a2..eee1223c583 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php
@@ -255,7 +255,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\FakeBigDecimalMap200Response' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\FakeBigDecimalMap200Response', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -284,7 +284,7 @@ class FakeApi
}
$returnType = '\OpenAPI\Client\Model\FakeBigDecimalMap200Response';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -365,7 +365,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -548,7 +548,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\HealthCheckResult' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\HealthCheckResult', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -577,7 +577,7 @@ class FakeApi
}
$returnType = '\OpenAPI\Client\Model\HealthCheckResult';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -662,7 +662,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1123,7 +1123,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('bool' === '\SplFileObject') {
+ if (in_array('bool', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1152,7 +1152,7 @@ class FakeApi
}
$returnType = 'bool';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1237,7 +1237,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1430,7 +1430,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\OuterComposite' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\OuterComposite', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1459,7 +1459,7 @@ class FakeApi
}
$returnType = '\OpenAPI\Client\Model\OuterComposite';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1544,7 +1544,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1737,7 +1737,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('float' === '\SplFileObject') {
+ if (in_array('float', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1766,7 +1766,7 @@ class FakeApi
}
$returnType = 'float';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1851,7 +1851,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2044,7 +2044,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2073,7 +2073,7 @@ class FakeApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2158,7 +2158,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2351,7 +2351,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\OuterObjectWithEnumProperty' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\OuterObjectWithEnumProperty', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2380,7 +2380,7 @@ class FakeApi
}
$returnType = '\OpenAPI\Client\Model\OuterObjectWithEnumProperty';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2465,7 +2465,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3642,7 +3642,7 @@ class FakeApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Client', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3671,7 +3671,7 @@ class FakeApi
}
$returnType = '\OpenAPI\Client\Model\Client';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3760,7 +3760,7 @@ class FakeApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -4310,10 +4310,12 @@ class FakeApi
$formParams['binary'] = [];
$paramFiles = is_array($binary) ? $binary : [$binary];
foreach ($paramFiles as $paramFile) {
- $formParams['binary'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
- ObjectSerializer::toFormValue($paramFile),
- 'rb'
- );
+ $formParams['binary'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
}
}
// form params
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php
index 781639b9e31..a0022fd294c 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php
@@ -199,7 +199,7 @@ class FakeClassnameTags123Api
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Client', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -228,7 +228,7 @@ class FakeClassnameTags123Api
}
$returnType = '\OpenAPI\Client\Model\Client';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -317,7 +317,7 @@ class FakeClassnameTags123Api
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php
index 421925c4c44..75bc6fcd252 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php
@@ -887,7 +887,7 @@ class PetApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Pet[]' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Pet[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -916,7 +916,7 @@ class PetApi
}
$returnType = '\OpenAPI\Client\Model\Pet[]';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1005,7 +1005,7 @@ class PetApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1216,7 +1216,7 @@ class PetApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Pet[]' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Pet[]', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1245,7 +1245,7 @@ class PetApi
}
$returnType = '\OpenAPI\Client\Model\Pet[]';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1336,7 +1336,7 @@ class PetApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1546,7 +1546,7 @@ class PetApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1575,7 +1575,7 @@ class PetApi
}
$returnType = '\OpenAPI\Client\Model\Pet';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1664,7 +1664,7 @@ class PetApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2558,7 +2558,7 @@ class PetApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\ApiResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2587,7 +2587,7 @@ class PetApi
}
$returnType = '\OpenAPI\Client\Model\ApiResponse';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2684,7 +2684,7 @@ class PetApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2773,10 +2773,12 @@ class PetApi
$formParams['file'] = [];
$paramFiles = is_array($file) ? $file : [$file];
foreach ($paramFiles as $paramFile) {
- $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
- ObjectSerializer::toFormValue($paramFile),
- 'rb'
- );
+ $formParams['file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
}
}
@@ -2922,7 +2924,7 @@ class PetApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\ApiResponse', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -2951,7 +2953,7 @@ class PetApi
}
$returnType = '\OpenAPI\Client\Model\ApiResponse';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3048,7 +3050,7 @@ class PetApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -3143,10 +3145,12 @@ class PetApi
$formParams['requiredFile'] = [];
$paramFiles = is_array($required_file) ? $required_file : [$required_file];
foreach ($paramFiles as $paramFile) {
- $formParams['requiredFile'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
- ObjectSerializer::toFormValue($paramFile),
- 'rb'
- );
+ $formParams['requiredFile'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
+ ? $paramFile
+ : \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
}
}
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php
index aae3a78e509..bac31d3fbf6 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php
@@ -448,7 +448,7 @@ class StoreApi
switch($statusCode) {
case 200:
- if ('array' === '\SplFileObject') {
+ if (in_array('array', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -477,7 +477,7 @@ class StoreApi
}
$returnType = 'array';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -562,7 +562,7 @@ class StoreApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -754,7 +754,7 @@ class StoreApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Order' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Order', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -783,7 +783,7 @@ class StoreApi
}
$returnType = '\OpenAPI\Client\Model\Order';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -872,7 +872,7 @@ class StoreApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1082,7 +1082,7 @@ class StoreApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\Order' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\Order', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1111,7 +1111,7 @@ class StoreApi
}
$returnType = '\OpenAPI\Client\Model\Order';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1200,7 +1200,7 @@ class StoreApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php
index d4b2b7e6e4c..8d7f3b3e0c1 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php
@@ -1193,7 +1193,7 @@ class UserApi
switch($statusCode) {
case 200:
- if ('\OpenAPI\Client\Model\User' === '\SplFileObject') {
+ if (in_array('\OpenAPI\Client\Model\User', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1222,7 +1222,7 @@ class UserApi
}
$returnType = '\OpenAPI\Client\Model\User';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1311,7 +1311,7 @@ class UserApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1519,7 +1519,7 @@ class UserApi
switch($statusCode) {
case 200:
- if ('string' === '\SplFileObject') {
+ if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1548,7 +1548,7 @@ class UserApi
}
$returnType = 'string';
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
@@ -1641,7 +1641,7 @@ class UserApi
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php
index 56329faf1dd..4c63b783aba 100644
--- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php
+++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php
@@ -451,6 +451,10 @@ class ObjectSerializer
}
}
+ if ($class === '\Psr\Http\Message\StreamInterface') {
+ return Utils::streamFor($data);
+ }
+
if ($class === '\SplFileObject') {
$data = Utils::streamFor($data);