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 a16f59353e01..b25a293e68c8 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache @@ -23,7 +23,6 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -32,7 +31,6 @@ use Psr\Http\Message\ResponseInterface; use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\HeaderSelector; -use {{invokerPackage}}\FormDataProcessor; use {{invokerPackage}}\ObjectSerializer; /** @@ -631,7 +629,8 @@ use {{invokerPackage}}\ObjectSerializer; $variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : []; {{/servers.0}} $contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0]; - {{/exts.x-group-parameters}}{{#allParams}} + {{/exts.x-group-parameters}} + {{#allParams}} {{#required}} // verify the required parameter '{{paramName}}' is set if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { @@ -676,11 +675,16 @@ use {{invokerPackage}}\ObjectSerializer; throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); } {{/minItems}} - {{/hasValidation}}{{/allParams}} + {{/hasValidation}} + {{/allParams}} $resourcePath = '{{{path}}}'; + {{#hasBodyOrFormParams}} $formParams = []; + {{/hasBodyOrFormParams}} + {{#hasQueryParams}} $queryParams = []; + {{/hasQueryParams}} $headerParams = []; $httpBody = ''; $multipart = false; @@ -728,7 +732,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#formParams}} {{#-first}} // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \{{invokerPackage}}\FormDataProcessor(); $formData = $formDataProcessor->prepare([ {{/-first}} @@ -747,6 +751,7 @@ use {{invokerPackage}}\ObjectSerializer; $multipart ); + {{#hasBodyOrFormParams}} // for model (json/xml) {{#bodyParams}} if (isset(${{paramName}})) { @@ -773,7 +778,7 @@ use {{invokerPackage}}\ObjectSerializer; } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -783,6 +788,7 @@ use {{invokerPackage}}\ObjectSerializer; $httpBody = ObjectSerializer::buildQuery($formParams); } } + {{/hasBodyOrFormParams}} {{#authMethods}} {{#isApiKey}} 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 index 88ad980ac167..17c85a2ab68b 100644 --- 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 @@ -215,4 +215,63 @@ public void testDifferentResponseSchemasWithEmpty() throws IOException { Assert.assertListContains(modelContent, a -> a.equals("): int|string|null"), "Expected to find nullable return type declaration."); Assert.assertListNotContains(modelContent, a -> a.equals("): ?int|string"), "Expected to not find invalid union type with '?'."); } + + @Test + public void testFormParamsBlockOnlyEmittedWhenBodyOrFormParamsExist() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/php-nextgen/form-body-params.yaml", null, new ParseOptions()) + .getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + Map files = generator.opts(input).generate().stream() + .collect(Collectors.toMap(File::getName, Function.identity())); + + String apiContent = Files.readString(files.get("DefaultApi.php").toPath()); + + // Each operation produces a "*Request" helper holding its own httpBody handling. + String noBodyNoForm = extractMethod(apiContent, "noBodyNoFormRequest"); + String bodyParam = extractMethod(apiContent, "bodyParamRequest"); + String formParam = extractMethod(apiContent, "formParamRequest"); + + // No body, no form: the dead form-params block must not be generated at all. + Assert.assertFalse(noBodyNoForm.contains("if (count($formParams) > 0)"), + "Operation without body or form params must not emit the form-params block"); + Assert.assertFalse(noBodyNoForm.contains("// for model (json/xml)"), + "Operation without body or form params must not emit the json/xml comment"); + + // Body param: emits the body block followed by the elseif form-params branch. + Assert.assertTrue(bodyParam.contains("if (isset($thing)) {"), + "Body param operation must emit the body serialization block"); + Assert.assertTrue(bodyParam.contains("} elseif (count($formParams) > 0) {"), + "Body param operation must keep the elseif form-params branch"); + + // Form param: emits the standalone form-params block. + Assert.assertTrue(formParam.contains("if (count($formParams) > 0) {"), + "Form param operation must emit the standalone form-params block"); + Assert.assertFalse(formParam.contains("} elseif (count($formParams) > 0) {"), + "Form-only operation must not have an elseif (no body branch precedes it)"); + } + + /** + * Extracts the source of a single PHP method (from its declaration up to, but not + * including, the next method declaration) so per-operation assertions don't leak + * across operations sharing the same generated file. + */ + private static String extractMethod(String content, String methodName) { + int start = content.indexOf("function " + methodName + "("); + Assert.assertTrue(start >= 0, "Expected to find method " + methodName + " in generated API"); + int next = content.indexOf("\n public function ", start + 1); + if (next < 0) { + next = content.indexOf("\n protected function ", start + 1); + } + return next < 0 ? content.substring(start) : content.substring(start, next); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/php-nextgen/form-body-params.yaml b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/form-body-params.yaml new file mode 100644 index 000000000000..209bc96e5cfd --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/form-body-params.yaml @@ -0,0 +1,52 @@ +openapi: 3.0.0 +info: + title: Form and body params test + version: 1.0.0 +paths: + /no-body-no-form: + get: + operationId: noBodyNoForm + parameters: + - name: filter + in: query + schema: + type: string + responses: + '200': + description: OK + /body-param: + post: + operationId: bodyParam + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Thing' + responses: + '200': + description: OK + /form-param: + post: + operationId: formParam + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + count: + type: integer + responses: + '200': + description: OK +components: + schemas: + Thing: + type: object + properties: + id: + type: integer + name: + type: string diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php index 07ad20252f69..386cac3596eb 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -319,10 +317,7 @@ public function testAuthHttpBasicRequest( ): Request { - $resourcePath = '/auth/http/basic'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -337,30 +332,6 @@ public function testAuthHttpBasicRequest( $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()))) { @@ -578,10 +549,7 @@ public function testAuthHttpBearerRequest( ): Request { - $resourcePath = '/auth/http/bearer'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -596,30 +564,6 @@ public function testAuthHttpBearerRequest( $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())) { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php index 938054ae2bae..424440f6989b 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -343,10 +341,7 @@ public function testBinaryGifRequest( ): Request { - $resourcePath = '/binary/gif'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -361,30 +356,6 @@ public function testBinaryGifRequest( $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()) { @@ -607,11 +578,8 @@ public function testBodyApplicationOctetstreamBinaryRequest( ): Request { - - $resourcePath = '/body/application/octetstream/binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -647,7 +615,7 @@ public function testBodyApplicationOctetstreamBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -878,7 +846,6 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( 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( @@ -886,10 +853,8 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( ); } - $resourcePath = '/body/application/octetstream/array_of_binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -898,7 +863,7 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'files' => $files, @@ -927,7 +892,7 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1159,11 +1124,8 @@ public function testBodyMultipartFormdataSingleBinaryRequest( ): Request { - - $resourcePath = '/body/application/octetstream/single_binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1172,7 +1134,7 @@ public function testBodyMultipartFormdataSingleBinaryRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'my-file' => $my_file, @@ -1201,7 +1163,7 @@ public function testBodyMultipartFormdataSingleBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1433,11 +1395,8 @@ public function testEchoBodyAllOfPetRequest( ): Request { - - $resourcePath = '/echo/body/allOf/Pet'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1473,7 +1432,7 @@ public function testEchoBodyAllOfPetRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1705,11 +1664,8 @@ public function testEchoBodyFreeFormObjectResponseStringRequest( ): Request { - - $resourcePath = '/echo/body/FreeFormObject/response_string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1745,7 +1701,7 @@ public function testEchoBodyFreeFormObjectResponseStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1977,11 +1933,8 @@ public function testEchoBodyPetRequest( ): Request { - - $resourcePath = '/echo/body/Pet'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2017,7 +1970,7 @@ public function testEchoBodyPetRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2249,11 +2202,8 @@ public function testEchoBodyPetResponseStringRequest( ): Request { - - $resourcePath = '/echo/body/Pet/response_string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2289,7 +2239,7 @@ public function testEchoBodyPetResponseStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2521,11 +2471,8 @@ public function testEchoBodyStringEnumRequest( ): Request { - - $resourcePath = '/echo/body/string_enum'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2561,7 +2508,7 @@ public function testEchoBodyStringEnumRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2793,11 +2740,8 @@ public function testEchoBodyTagResponseStringRequest( ): Request { - - $resourcePath = '/echo/body/Tag/response_string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2833,7 +2777,7 @@ public function testEchoBodyTagResponseStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php index b2e8dca3cea1..d67355d7ec11 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -352,13 +350,8 @@ public function testFormIntegerBooleanStringRequest( ): Request { - - - - $resourcePath = '/form/integer/boolean/string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -367,7 +360,7 @@ public function testFormIntegerBooleanStringRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'integer_form' => $integer_form, @@ -398,7 +391,7 @@ public function testFormIntegerBooleanStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -629,7 +622,6 @@ public function testFormObjectMultipartRequest( 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( @@ -637,10 +629,8 @@ public function testFormObjectMultipartRequest( ); } - $resourcePath = '/form/object/multipart'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -649,7 +639,7 @@ public function testFormObjectMultipartRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'marker' => $marker, @@ -678,7 +668,7 @@ public function testFormObjectMultipartRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -960,16 +950,8 @@ public function testFormOneofRequest( ): Request { - - - - - - - $resourcePath = '/form/oneof'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -978,7 +960,7 @@ public function testFormOneofRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'form1' => $form1, @@ -1012,7 +994,7 @@ public function testFormOneofRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php index 91c02521145f..56a13c1ef738 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -366,15 +364,7 @@ public function testHeaderIntegerBooleanStringEnumsRequest( ): Request { - - - - - - $resourcePath = '/header/integer/boolean/string/enums'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -409,30 +399,6 @@ public function testHeaderIntegerBooleanStringEnumsRequest( $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()) { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php index ab484c88b076..89dbdf31621c 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -355,28 +353,24 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE 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( @@ -384,10 +378,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE ); } - $resourcePath = '/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -434,30 +425,6 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE $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()) { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php index edb574695642..7d9841365462 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -366,11 +364,7 @@ public function testEnumRefStringRequest( ): Request { - - - $resourcePath = '/query/enum_ref_string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -404,30 +398,6 @@ public function testEnumRefStringRequest( $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()) { @@ -670,12 +640,7 @@ public function testQueryDatetimeDateStringRequest( ): Request { - - - - $resourcePath = '/query/datetime/date/string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -718,30 +683,6 @@ public function testQueryDatetimeDateStringRequest( $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()) { @@ -984,12 +925,7 @@ public function testQueryIntegerBooleanStringRequest( ): Request { - - - - $resourcePath = '/query/integer/boolean/string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1032,30 +968,6 @@ public function testQueryIntegerBooleanStringRequest( $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()) { @@ -1278,10 +1190,7 @@ public function testQueryStyleDeepObjectExplodeTrueObjectRequest( ): Request { - - $resourcePath = '/query/style_deepObject/explode_true/object'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1306,30 +1215,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectRequest( $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()) { @@ -1552,10 +1437,7 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( ): Request { - - $resourcePath = '/query/style_deepObject/explode_true/object/allOf'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1580,30 +1462,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( $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()) { @@ -1826,10 +1684,7 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( ): Request { - - $resourcePath = '/query/style_form/explode_false/array_integer'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1854,30 +1709,6 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( $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()) { @@ -2100,10 +1931,7 @@ public function testQueryStyleFormExplodeFalseArrayStringRequest( ): Request { - - $resourcePath = '/query/style_form/explode_false/array_string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2128,30 +1956,6 @@ public function testQueryStyleFormExplodeFalseArrayStringRequest( $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()) { @@ -2374,10 +2178,7 @@ public function testQueryStyleFormExplodeTrueArrayStringRequest( ): Request { - - $resourcePath = '/query/style_form/explode_true/array_string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2402,30 +2203,6 @@ public function testQueryStyleFormExplodeTrueArrayStringRequest( $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()) { @@ -2648,10 +2425,7 @@ public function testQueryStyleFormExplodeTrueObjectRequest( ): Request { - - $resourcePath = '/query/style_form/explode_true/object'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2676,30 +2450,6 @@ public function testQueryStyleFormExplodeTrueObjectRequest( $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()) { @@ -2922,10 +2672,7 @@ public function testQueryStyleFormExplodeTrueObjectAllOfRequest( ): Request { - - $resourcePath = '/query/style_form/explode_true/object/allOf'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2950,30 +2697,6 @@ public function testQueryStyleFormExplodeTrueObjectAllOfRequest( $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()) { @@ -3206,11 +2929,7 @@ public function testQueryStyleJsonSerializationObjectRequest( ): Request { - - - $resourcePath = '/query/style_jsonSerialization/object'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -3244,30 +2963,6 @@ public function testQueryStyleJsonSerializationObjectRequest( $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()) { diff --git a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php index 07ad20252f69..386cac3596eb 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -319,10 +317,7 @@ public function testAuthHttpBasicRequest( ): Request { - $resourcePath = '/auth/http/basic'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -337,30 +332,6 @@ public function testAuthHttpBasicRequest( $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()))) { @@ -578,10 +549,7 @@ public function testAuthHttpBearerRequest( ): Request { - $resourcePath = '/auth/http/bearer'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -596,30 +564,6 @@ public function testAuthHttpBearerRequest( $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())) { 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 921eb5ee17c8..fb3566f5d8c2 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -343,10 +341,7 @@ public function testBinaryGifRequest( ): Request { - $resourcePath = '/binary/gif'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -361,30 +356,6 @@ public function testBinaryGifRequest( $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()) { @@ -607,11 +578,8 @@ public function testBodyApplicationOctetstreamBinaryRequest( ): Request { - - $resourcePath = '/body/application/octetstream/binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -647,7 +615,7 @@ public function testBodyApplicationOctetstreamBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -878,7 +846,6 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( 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( @@ -886,10 +853,8 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( ); } - $resourcePath = '/body/application/octetstream/array_of_binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -898,7 +863,7 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'files' => $files, @@ -927,7 +892,7 @@ public function testBodyMultipartFormdataArrayOfBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1159,11 +1124,8 @@ public function testBodyMultipartFormdataSingleBinaryRequest( ): Request { - - $resourcePath = '/body/application/octetstream/single_binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1172,7 +1134,7 @@ public function testBodyMultipartFormdataSingleBinaryRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'my-file' => $my_file, @@ -1201,7 +1163,7 @@ public function testBodyMultipartFormdataSingleBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1433,11 +1395,8 @@ public function testEchoBodyAllOfPetRequest( ): Request { - - $resourcePath = '/echo/body/allOf/Pet'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1473,7 +1432,7 @@ public function testEchoBodyAllOfPetRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1705,11 +1664,8 @@ public function testEchoBodyFreeFormObjectResponseStringRequest( ): Request { - - $resourcePath = '/echo/body/FreeFormObject/response_string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1745,7 +1701,7 @@ public function testEchoBodyFreeFormObjectResponseStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1977,11 +1933,8 @@ public function testEchoBodyPetRequest( ): Request { - - $resourcePath = '/echo/body/Pet'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2017,7 +1970,7 @@ public function testEchoBodyPetRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2249,11 +2202,8 @@ public function testEchoBodyPetResponseStringRequest( ): Request { - - $resourcePath = '/echo/body/Pet/response_string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2289,7 +2239,7 @@ public function testEchoBodyPetResponseStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2521,11 +2471,8 @@ public function testEchoBodyStringEnumRequest( ): Request { - - $resourcePath = '/echo/body/string_enum'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2561,7 +2508,7 @@ public function testEchoBodyStringEnumRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2793,11 +2740,8 @@ public function testEchoBodyTagResponseStringRequest( ): Request { - - $resourcePath = '/echo/body/Tag/response_string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2833,7 +2777,7 @@ public function testEchoBodyTagResponseStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 b2e8dca3cea1..d67355d7ec11 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -352,13 +350,8 @@ public function testFormIntegerBooleanStringRequest( ): Request { - - - - $resourcePath = '/form/integer/boolean/string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -367,7 +360,7 @@ public function testFormIntegerBooleanStringRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'integer_form' => $integer_form, @@ -398,7 +391,7 @@ public function testFormIntegerBooleanStringRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -629,7 +622,6 @@ public function testFormObjectMultipartRequest( 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( @@ -637,10 +629,8 @@ public function testFormObjectMultipartRequest( ); } - $resourcePath = '/form/object/multipart'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -649,7 +639,7 @@ public function testFormObjectMultipartRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'marker' => $marker, @@ -678,7 +668,7 @@ public function testFormObjectMultipartRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -960,16 +950,8 @@ public function testFormOneofRequest( ): Request { - - - - - - - $resourcePath = '/form/oneof'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -978,7 +960,7 @@ public function testFormOneofRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'form1' => $form1, @@ -1012,7 +994,7 @@ public function testFormOneofRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 91c02521145f..56a13c1ef738 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -366,15 +364,7 @@ public function testHeaderIntegerBooleanStringEnumsRequest( ): Request { - - - - - - $resourcePath = '/header/integer/boolean/string/enums'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -409,30 +399,6 @@ public function testHeaderIntegerBooleanStringEnumsRequest( $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()) { 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 ab484c88b076..89dbdf31621c 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -355,28 +353,24 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE 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( @@ -384,10 +378,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE ); } - $resourcePath = '/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -434,30 +425,6 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE $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()) { 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 edb574695642..7d9841365462 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -366,11 +364,7 @@ public function testEnumRefStringRequest( ): Request { - - - $resourcePath = '/query/enum_ref_string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -404,30 +398,6 @@ public function testEnumRefStringRequest( $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()) { @@ -670,12 +640,7 @@ public function testQueryDatetimeDateStringRequest( ): Request { - - - - $resourcePath = '/query/datetime/date/string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -718,30 +683,6 @@ public function testQueryDatetimeDateStringRequest( $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()) { @@ -984,12 +925,7 @@ public function testQueryIntegerBooleanStringRequest( ): Request { - - - - $resourcePath = '/query/integer/boolean/string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1032,30 +968,6 @@ public function testQueryIntegerBooleanStringRequest( $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()) { @@ -1278,10 +1190,7 @@ public function testQueryStyleDeepObjectExplodeTrueObjectRequest( ): Request { - - $resourcePath = '/query/style_deepObject/explode_true/object'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1306,30 +1215,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectRequest( $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()) { @@ -1552,10 +1437,7 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( ): Request { - - $resourcePath = '/query/style_deepObject/explode_true/object/allOf'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1580,30 +1462,6 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( $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()) { @@ -1826,10 +1684,7 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( ): Request { - - $resourcePath = '/query/style_form/explode_false/array_integer'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1854,30 +1709,6 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( $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()) { @@ -2100,10 +1931,7 @@ public function testQueryStyleFormExplodeFalseArrayStringRequest( ): Request { - - $resourcePath = '/query/style_form/explode_false/array_string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2128,30 +1956,6 @@ public function testQueryStyleFormExplodeFalseArrayStringRequest( $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()) { @@ -2374,10 +2178,7 @@ public function testQueryStyleFormExplodeTrueArrayStringRequest( ): Request { - - $resourcePath = '/query/style_form/explode_true/array_string'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2402,30 +2203,6 @@ public function testQueryStyleFormExplodeTrueArrayStringRequest( $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()) { @@ -2648,10 +2425,7 @@ public function testQueryStyleFormExplodeTrueObjectRequest( ): Request { - - $resourcePath = '/query/style_form/explode_true/object'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2676,30 +2450,6 @@ public function testQueryStyleFormExplodeTrueObjectRequest( $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()) { @@ -2922,10 +2672,7 @@ public function testQueryStyleFormExplodeTrueObjectAllOfRequest( ): Request { - - $resourcePath = '/query/style_form/explode_true/object/allOf'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -2950,30 +2697,6 @@ public function testQueryStyleFormExplodeTrueObjectAllOfRequest( $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()) { @@ -3206,11 +2929,7 @@ public function testQueryStyleJsonSerializationObjectRequest( ): Request { - - - $resourcePath = '/query/style_jsonSerialization/object'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -3244,30 +2963,6 @@ public function testQueryStyleJsonSerializationObjectRequest( $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()) { 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 670444efd6f3..3d15068d1072 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -324,7 +322,6 @@ public function call123TestSpecialTagsRequest( string $contentType = self::contentTypes['call123TestSpecialTags'][0] ): Request { - // verify the required parameter 'client' is set if ($client === null || (is_array($client) && count($client) === 0)) { throw new InvalidArgumentException( @@ -332,10 +329,8 @@ public function call123TestSpecialTagsRequest( ); } - $resourcePath = '/another-fake/dummy'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -371,7 +366,7 @@ public function call123TestSpecialTagsRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 a843ce12b1a5..dc8a52bbf6b1 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -303,10 +301,7 @@ public function errorRequest( ): Request { - $resourcePath = '/error'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -321,30 +316,6 @@ public function errorRequest( $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()) { @@ -549,10 +520,7 @@ public function fooGetRequest( ): Request { - $resourcePath = '/foo'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -567,30 +535,6 @@ public function fooGetRequest( $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()) { 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 ea9cf90967db..7db77e146c22 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -397,10 +395,7 @@ public function fakeBigDecimalMapRequest( ): Request { - $resourcePath = '/fake/BigDecimalMap'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -415,30 +410,6 @@ public function fakeBigDecimalMapRequest( $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()) { @@ -637,7 +608,6 @@ public function fakeDeletePetRequest( string $contentType = self::contentTypes['fakeDeletePet'][0] ): Request { - // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { throw new InvalidArgumentException( @@ -645,10 +615,7 @@ public function fakeDeletePetRequest( ); } - $resourcePath = '/fake/pet/{pet_id}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -671,30 +638,6 @@ public function fakeDeletePetRequest( $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()) { @@ -936,21 +879,18 @@ public function fakeEnumEndpointRequest( string $contentType = self::contentTypes['fakeEnumEndpoint'][0] ): Request { - // verify the required parameter 'enum_class' is set if ($enum_class === null || (is_array($enum_class) && count($enum_class) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $enum_class when calling fakeEnumEndpoint' ); } - // verify the required parameter 'enum_class_array' is set if ($enum_class_array === null || (is_array($enum_class_array) && count($enum_class_array) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $enum_class_array when calling fakeEnumEndpoint' ); } - // verify the required parameter 'enum_class_map' is set if ($enum_class_map === null || (is_array($enum_class_map) && count($enum_class_map) === 0)) { throw new InvalidArgumentException( @@ -958,9 +898,7 @@ public function fakeEnumEndpointRequest( ); } - $resourcePath = '/fake/enum/endpoint'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1003,30 +941,6 @@ public function fakeEnumEndpointRequest( $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()) { @@ -1239,10 +1153,7 @@ public function fakeHealthGetRequest( ): Request { - $resourcePath = '/fake/health'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1257,30 +1168,6 @@ public function fakeHealthGetRequest( $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()) { @@ -1474,7 +1361,6 @@ public function fakeHttpSignatureTestRequest( string $contentType = self::contentTypes['fakeHttpSignatureTest'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -1482,9 +1368,6 @@ public function fakeHttpSignatureTestRequest( ); } - - - $resourcePath = '/fake/http-signature-test'; $formParams = []; $queryParams = []; @@ -1536,7 +1419,7 @@ public function fakeHttpSignatureTestRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -1760,11 +1643,8 @@ public function fakeOuterBooleanSerializeRequest( ): Request { - - $resourcePath = '/fake/outer/boolean'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1800,7 +1680,7 @@ public function fakeOuterBooleanSerializeRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2024,11 +1904,8 @@ public function fakeOuterCompositeSerializeRequest( ): Request { - - $resourcePath = '/fake/outer/composite'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2064,7 +1941,7 @@ public function fakeOuterCompositeSerializeRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2288,11 +2165,8 @@ public function fakeOuterNumberSerializeRequest( ): Request { - - $resourcePath = '/fake/outer/number'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2328,7 +2202,7 @@ public function fakeOuterNumberSerializeRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2552,11 +2426,8 @@ public function fakeOuterStringSerializeRequest( ): Request { - - $resourcePath = '/fake/outer/string'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2592,7 +2463,7 @@ public function fakeOuterStringSerializeRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2815,7 +2686,6 @@ public function fakePropertyEnumIntegerSerializeRequest( string $contentType = self::contentTypes['fakePropertyEnumIntegerSerialize'][0] ): Request { - // verify the required parameter 'outer_object_with_enum_property' is set if ($outer_object_with_enum_property === null || (is_array($outer_object_with_enum_property) && count($outer_object_with_enum_property) === 0)) { throw new InvalidArgumentException( @@ -2823,10 +2693,8 @@ public function fakePropertyEnumIntegerSerializeRequest( ); } - $resourcePath = '/fake/property/enum-int'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2862,7 +2730,7 @@ public function fakePropertyEnumIntegerSerializeRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -3125,7 +2993,6 @@ public function fakeWith400And4xxRangeResponseEndpointRequest( string $contentType = self::contentTypes['fakeWith400And4xxRangeResponseEndpoint'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -3133,10 +3000,8 @@ public function fakeWith400And4xxRangeResponseEndpointRequest( ); } - $resourcePath = '/fake/with_400_and_4xx_range_response/endpoint'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -3172,7 +3037,7 @@ public function fakeWith400And4xxRangeResponseEndpointRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -3403,7 +3268,6 @@ public function fakeWith400And4xxRangeResponseNo4xxDatatypeEndpointRequest( string $contentType = self::contentTypes['fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -3411,10 +3275,8 @@ public function fakeWith400And4xxRangeResponseNo4xxDatatypeEndpointRequest( ); } - $resourcePath = '/fake/with_400_and_4xx_range_response_no_4xx_datatype/endpoint'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -3450,7 +3312,7 @@ public function fakeWith400And4xxRangeResponseNo4xxDatatypeEndpointRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -3695,7 +3557,6 @@ public function fakeWith400ResponseEndpointRequest( string $contentType = self::contentTypes['fakeWith400ResponseEndpoint'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -3703,10 +3564,8 @@ public function fakeWith400ResponseEndpointRequest( ); } - $resourcePath = '/fake/with_400_response/endpoint'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -3742,7 +3601,7 @@ public function fakeWith400ResponseEndpointRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -3991,7 +3850,6 @@ public function fakeWith4xxRangeResponseEndpointRequest( string $contentType = self::contentTypes['fakeWith4xxRangeResponseEndpoint'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -3999,10 +3857,8 @@ public function fakeWith4xxRangeResponseEndpointRequest( ); } - $resourcePath = '/fake/with_4xx_range_response/endpoint'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -4038,7 +3894,7 @@ public function fakeWith4xxRangeResponseEndpointRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -4269,7 +4125,6 @@ public function fakeWith4xxRangeResponseNo4xxDatatypeEndpointRequest( string $contentType = self::contentTypes['fakeWith4xxRangeResponseNo4xxDatatypeEndpoint'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -4277,10 +4132,8 @@ public function fakeWith4xxRangeResponseNo4xxDatatypeEndpointRequest( ); } - $resourcePath = '/fake/with_4xx_range_response_no_4xx_datatype/endpoint'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -4316,7 +4169,7 @@ public function fakeWith4xxRangeResponseNo4xxDatatypeEndpointRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -4499,7 +4352,6 @@ public function testAdditionalPropertiesReferenceRequest( string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] ): Request { - // verify the required parameter 'request_body' is set if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { throw new InvalidArgumentException( @@ -4507,10 +4359,8 @@ public function testAdditionalPropertiesReferenceRequest( ); } - $resourcePath = '/fake/additionalProperties-reference'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -4546,7 +4396,7 @@ public function testAdditionalPropertiesReferenceRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -4721,7 +4571,6 @@ public function testBodyWithBinaryRequest( string $contentType = self::contentTypes['testBodyWithBinary'][0] ): Request { - // verify the required parameter 'body' is set if ($body === null || (is_array($body) && count($body) === 0)) { throw new InvalidArgumentException( @@ -4729,10 +4578,8 @@ public function testBodyWithBinaryRequest( ); } - $resourcePath = '/fake/body-with-binary'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -4768,7 +4615,7 @@ public function testBodyWithBinaryRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -4943,7 +4790,6 @@ public function testBodyWithFileSchemaRequest( string $contentType = self::contentTypes['testBodyWithFileSchema'][0] ): Request { - // verify the required parameter 'file_schema_test_class' is set if ($file_schema_test_class === null || (is_array($file_schema_test_class) && count($file_schema_test_class) === 0)) { throw new InvalidArgumentException( @@ -4951,10 +4797,8 @@ public function testBodyWithFileSchemaRequest( ); } - $resourcePath = '/fake/body-with-file-schema'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -4990,7 +4834,7 @@ public function testBodyWithFileSchemaRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -5175,14 +5019,12 @@ public function testBodyWithQueryParamsRequest( string $contentType = self::contentTypes['testBodyWithQueryParams'][0] ): Request { - // verify the required parameter 'query' is set if ($query === null || (is_array($query) && count($query) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $query when calling testBodyWithQueryParams' ); } - // verify the required parameter 'user' is set if ($user === null || (is_array($user) && count($user) === 0)) { throw new InvalidArgumentException( @@ -5190,7 +5032,6 @@ public function testBodyWithQueryParamsRequest( ); } - $resourcePath = '/fake/body-with-query-params'; $formParams = []; $queryParams = []; @@ -5238,7 +5079,7 @@ public function testBodyWithQueryParamsRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -5469,7 +5310,6 @@ public function testClientModelRequest( string $contentType = self::contentTypes['testClientModel'][0] ): Request { - // verify the required parameter 'client' is set if ($client === null || (is_array($client) && count($client) === 0)) { throw new InvalidArgumentException( @@ -5477,10 +5317,8 @@ public function testClientModelRequest( ); } - $resourcePath = '/fake'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -5516,7 +5354,7 @@ public function testClientModelRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -5829,7 +5667,6 @@ public function testEndpointParametersRequest( string $contentType = self::contentTypes['testEndpointParameters'][0] ): Request { - // verify the required parameter 'number' is set if ($number === null || (is_array($number) && count($number) === 0)) { throw new InvalidArgumentException( @@ -5842,7 +5679,6 @@ public function testEndpointParametersRequest( if ($number < 32.1) { throw new InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); } - // verify the required parameter 'double' is set if ($double === null || (is_array($double) && count($double) === 0)) { throw new InvalidArgumentException( @@ -5855,7 +5691,6 @@ public function testEndpointParametersRequest( if ($double < 67.8) { throw new InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); } - // verify the required parameter 'pattern_without_delimiter' is set if ($pattern_without_delimiter === null || (is_array($pattern_without_delimiter) && count($pattern_without_delimiter) === 0)) { throw new InvalidArgumentException( @@ -5865,52 +5700,39 @@ public function testEndpointParametersRequest( if (!preg_match("/^[A-Z].*/", $pattern_without_delimiter)) { throw new InvalidArgumentException("invalid value for \"pattern_without_delimiter\" when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z].*/."); } - // verify the required parameter 'byte' is set if ($byte === null || (is_array($byte) && count($byte) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $byte when calling testEndpointParameters' ); } - if ($integer !== null && $integer > 100) { throw new InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.'); } if ($integer !== null && $integer < 10) { throw new InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); } - if ($int32 !== null && $int32 > 200) { throw new InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.'); } if ($int32 !== null && $int32 < 20) { throw new InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.'); } - - if ($float !== null && $float > 987.6) { throw new InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); } - if ($string !== null && !preg_match("/[a-z]/i", $string)) { throw new InvalidArgumentException("invalid value for \"string\" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i."); } - - - - if ($password !== null && strlen($password) > 64) { throw new InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); } if ($password !== null && strlen($password) < 10) { throw new InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); } - - $resourcePath = '/fake'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -5919,7 +5741,7 @@ public function testEndpointParametersRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'integer' => $integer, @@ -5961,7 +5783,7 @@ public function testEndpointParametersRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -6230,16 +6052,6 @@ public function testEnumParametersRequest( ): Request { - - - - - - - - - - $resourcePath = '/fake'; $formParams = []; $queryParams = []; @@ -6307,7 +6119,7 @@ public function testEnumParametersRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'enum_form_string_array' => $enum_form_string_array, @@ -6337,7 +6149,7 @@ public function testEnumParametersRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -6558,21 +6370,18 @@ public function testGroupParametersRequest( $boolean_group = array_key_exists('boolean_group', $associative_array) ? $associative_array['boolean_group'] : null; $int64_group = array_key_exists('int64_group', $associative_array) ? $associative_array['int64_group'] : null; $contentType = $associative_array['contentType'] ?? self::contentTypes['testGroupParameters'][0]; - // verify the required parameter 'required_string_group' is set if ($required_string_group === null || (is_array($required_string_group) && count($required_string_group) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $required_string_group when calling testGroupParameters' ); } - // verify the required parameter 'required_boolean_group' is set if ($required_boolean_group === null || (is_array($required_boolean_group) && count($required_boolean_group) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $required_boolean_group when calling testGroupParameters' ); } - // verify the required parameter 'required_int64_group' is set if ($required_int64_group === null || (is_array($required_int64_group) && count($required_int64_group) === 0)) { throw new InvalidArgumentException( @@ -6580,12 +6389,7 @@ public function testGroupParametersRequest( ); } - - - - $resourcePath = '/fake'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -6645,30 +6449,6 @@ public function testGroupParametersRequest( $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 (JWT) authentication (access token) if (!empty($this->config->getAccessToken())) { @@ -6847,7 +6627,6 @@ public function testInlineAdditionalPropertiesRequest( string $contentType = self::contentTypes['testInlineAdditionalProperties'][0] ): Request { - // verify the required parameter 'request_body' is set if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { throw new InvalidArgumentException( @@ -6855,10 +6634,8 @@ public function testInlineAdditionalPropertiesRequest( ); } - $resourcePath = '/fake/inline-additionalProperties'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -6894,7 +6671,7 @@ public function testInlineAdditionalPropertiesRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -7077,7 +6854,6 @@ public function testInlineFreeformAdditionalPropertiesRequest( string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] ): Request { - // verify the required parameter 'test_inline_freeform_additional_properties_request' is set if ($test_inline_freeform_additional_properties_request === null || (is_array($test_inline_freeform_additional_properties_request) && count($test_inline_freeform_additional_properties_request) === 0)) { throw new InvalidArgumentException( @@ -7085,10 +6861,8 @@ public function testInlineFreeformAdditionalPropertiesRequest( ); } - $resourcePath = '/fake/inline-freeform-additionalProperties'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -7124,7 +6898,7 @@ public function testInlineFreeformAdditionalPropertiesRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -7317,14 +7091,12 @@ public function testJsonFormDataRequest( string $contentType = self::contentTypes['testJsonFormData'][0] ): Request { - // verify the required parameter 'param' is set if ($param === null || (is_array($param) && count($param) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $param when calling testJsonFormData' ); } - // verify the required parameter 'param2' is set if ($param2 === null || (is_array($param2) && count($param2) === 0)) { throw new InvalidArgumentException( @@ -7332,10 +7104,8 @@ public function testJsonFormDataRequest( ); } - $resourcePath = '/fake/jsonFormData'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -7344,7 +7114,7 @@ public function testJsonFormDataRequest( // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'param' => $param, @@ -7374,7 +7144,7 @@ public function testJsonFormDataRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -7557,7 +7327,6 @@ public function testNullableRequest( string $contentType = self::contentTypes['testNullable'][0] ): Request { - // verify the required parameter 'child_with_nullable' is set if ($child_with_nullable === null || (is_array($child_with_nullable) && count($child_with_nullable) === 0)) { throw new InvalidArgumentException( @@ -7565,10 +7334,8 @@ public function testNullableRequest( ); } - $resourcePath = '/fake/nullable'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -7604,7 +7371,7 @@ public function testNullableRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -7839,42 +7606,36 @@ public function testQueryParameterCollectionFormatRequest( string $contentType = self::contentTypes['testQueryParameterCollectionFormat'][0] ): Request { - // verify the required parameter 'pipe' is set if ($pipe === null || (is_array($pipe) && count($pipe) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $pipe when calling testQueryParameterCollectionFormat' ); } - // verify the required parameter 'ioutil' is set if ($ioutil === null || (is_array($ioutil) && count($ioutil) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $ioutil when calling testQueryParameterCollectionFormat' ); } - // verify the required parameter 'http' is set if ($http === null || (is_array($http) && count($http) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $http when calling testQueryParameterCollectionFormat' ); } - // verify the required parameter 'url' is set if ($url === null || (is_array($url) && count($url) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $url when calling testQueryParameterCollectionFormat' ); } - // verify the required parameter 'context' is set if ($context === null || (is_array($context) && count($context) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $context when calling testQueryParameterCollectionFormat' ); } - // verify the required parameter 'allow_empty' is set if ($allow_empty === null || (is_array($allow_empty) && count($allow_empty) === 0)) { throw new InvalidArgumentException( @@ -7882,10 +7643,7 @@ public function testQueryParameterCollectionFormatRequest( ); } - - $resourcePath = '/fake/test-query-parameters'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -7964,30 +7722,6 @@ public function testQueryParameterCollectionFormatRequest( $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()) { @@ -8161,7 +7895,6 @@ public function testStringMapReferenceRequest( string $contentType = self::contentTypes['testStringMapReference'][0] ): Request { - // verify the required parameter 'request_body' is set if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { throw new InvalidArgumentException( @@ -8169,10 +7902,8 @@ public function testStringMapReferenceRequest( ); } - $resourcePath = '/fake/stringMap-reference'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -8208,7 +7939,7 @@ public function testStringMapReferenceRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 9953f5f3ef68..dcb89d4e7393 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -324,7 +322,6 @@ public function testClassnameRequest( string $contentType = self::contentTypes['testClassname'][0] ): Request { - // verify the required parameter 'client' is set if ($client === null || (is_array($client) && count($client) === 0)) { throw new InvalidArgumentException( @@ -332,10 +329,8 @@ public function testClassnameRequest( ); } - $resourcePath = '/fake_classname_test'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -371,7 +366,7 @@ public function testClassnameRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 cfd6a07f61ff..f9a538ac259c 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -407,7 +405,6 @@ public function addPetRequest( string $contentType = self::contentTypes['addPet'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -415,10 +412,8 @@ public function addPetRequest( ); } - $resourcePath = '/pet'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -454,7 +449,7 @@ public function addPetRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -708,7 +703,6 @@ public function deletePetRequest( string $contentType = self::contentTypes['deletePet'][0] ): Request { - // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { throw new InvalidArgumentException( @@ -716,11 +710,7 @@ public function deletePetRequest( ); } - - $resourcePath = '/pet/{petId}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -747,30 +737,6 @@ public function deletePetRequest( $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 OAuth (access token) if (!empty($this->config->getAccessToken())) { @@ -997,7 +963,6 @@ public function findPetsByStatusRequest( string $contentType = self::contentTypes['findPetsByStatus'][0] ): Request { - // verify the required parameter 'status' is set if ($status === null || (is_array($status) && count($status) === 0)) { throw new InvalidArgumentException( @@ -1005,9 +970,7 @@ public function findPetsByStatusRequest( ); } - $resourcePath = '/pet/findByStatus'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1032,30 +995,6 @@ public function findPetsByStatusRequest( $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 OAuth (access token) if (!empty($this->config->getAccessToken())) { @@ -1287,17 +1226,14 @@ public function findPetsByTagsRequest( string $contentType = self::contentTypes['findPetsByTags'][0] ): Request { - // verify the required parameter 'tags' is set if ($tags === null || (is_array($tags) && count($tags) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $tags when calling findPetsByTags' ); } - $resourcePath = '/pet/findByTags'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1322,30 +1258,6 @@ public function findPetsByTagsRequest( $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 OAuth (access token) if (!empty($this->config->getAccessToken())) { @@ -1572,7 +1484,6 @@ public function getPetByIdRequest( string $contentType = self::contentTypes['getPetById'][0] ): Request { - // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { throw new InvalidArgumentException( @@ -1580,10 +1491,7 @@ public function getPetByIdRequest( ); } - $resourcePath = '/pet/{petId}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1606,30 +1514,6 @@ public function getPetByIdRequest( $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 API key authentication $apiKey = $this->config->getApiKeyWithPrefix('api_key'); @@ -1914,7 +1798,6 @@ public function updatePetRequest( string $contentType = self::contentTypes['updatePet'][0] ): Request { - // verify the required parameter 'pet' is set if ($pet === null || (is_array($pet) && count($pet) === 0)) { throw new InvalidArgumentException( @@ -1922,10 +1805,8 @@ public function updatePetRequest( ); } - $resourcePath = '/pet'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1961,7 +1842,7 @@ public function updatePetRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2225,7 +2106,6 @@ public function updatePetWithFormRequest( string $contentType = self::contentTypes['updatePetWithForm'][0] ): Request { - // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { throw new InvalidArgumentException( @@ -2233,12 +2113,8 @@ public function updatePetWithFormRequest( ); } - - - $resourcePath = '/pet/{petId}'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2255,7 +2131,7 @@ public function updatePetWithFormRequest( } // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'name' => $name, @@ -2285,7 +2161,7 @@ public function updatePetWithFormRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2541,7 +2417,6 @@ public function uploadFileRequest( string $contentType = self::contentTypes['uploadFile'][0] ): Request { - // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { throw new InvalidArgumentException( @@ -2549,12 +2424,8 @@ public function uploadFileRequest( ); } - - - $resourcePath = '/pet/{petId}/uploadImage'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2571,7 +2442,7 @@ public function uploadFileRequest( } // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'additionalMetadata' => $additional_metadata, @@ -2601,7 +2472,7 @@ public function uploadFileRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -2857,14 +2728,12 @@ public function uploadFileWithRequiredFileRequest( string $contentType = self::contentTypes['uploadFileWithRequiredFile'][0] ): Request { - // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $pet_id when calling uploadFileWithRequiredFile' ); } - // verify the required parameter 'required_file' is set if ($required_file === null || (is_array($required_file) && count($required_file) === 0)) { throw new InvalidArgumentException( @@ -2872,11 +2741,8 @@ public function uploadFileWithRequiredFileRequest( ); } - - $resourcePath = '/fake/{petId}/uploadImageWithRequiredFile'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2893,7 +2759,7 @@ public function uploadFileWithRequiredFileRequest( } // form params - $formDataProcessor = new FormDataProcessor(); + $formDataProcessor = new \OpenAPI\Client\FormDataProcessor(); $formData = $formDataProcessor->prepare([ 'additionalMetadata' => $additional_metadata, @@ -2923,7 +2789,7 @@ public function uploadFileWithRequiredFileRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 f32d47ff6765..87a8e3ddca03 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -285,7 +283,6 @@ public function deleteOrderRequest( string $contentType = self::contentTypes['deleteOrder'][0] ): Request { - // verify the required parameter 'order_id' is set if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { throw new InvalidArgumentException( @@ -293,10 +290,7 @@ public function deleteOrderRequest( ); } - $resourcePath = '/store/order/{order_id}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -319,30 +313,6 @@ public function deleteOrderRequest( $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()) { @@ -555,10 +525,7 @@ public function getInventoryRequest( ): Request { - $resourcePath = '/store/inventory'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -573,30 +540,6 @@ public function getInventoryRequest( $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 API key authentication $apiKey = $this->config->getApiKeyWithPrefix('api_key'); @@ -824,7 +767,6 @@ public function getOrderByIdRequest( string $contentType = self::contentTypes['getOrderById'][0] ): Request { - // verify the required parameter 'order_id' is set if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { throw new InvalidArgumentException( @@ -837,11 +779,8 @@ public function getOrderByIdRequest( if ($order_id < 1) { throw new InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.'); } - $resourcePath = '/store/order/{order_id}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -864,30 +803,6 @@ public function getOrderByIdRequest( $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()) { @@ -1109,7 +1024,6 @@ public function placeOrderRequest( string $contentType = self::contentTypes['placeOrder'][0] ): Request { - // verify the required parameter 'order' is set if ($order === null || (is_array($order) && count($order) === 0)) { throw new InvalidArgumentException( @@ -1117,10 +1031,8 @@ public function placeOrderRequest( ); } - $resourcePath = '/store/order'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1156,7 +1068,7 @@ public function placeOrderRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters 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 fb7f5c9bc6da..5af6a2005083 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 @@ -31,7 +31,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -40,7 +39,6 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; -use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -297,7 +295,6 @@ public function createUserRequest( string $contentType = self::contentTypes['createUser'][0] ): Request { - // verify the required parameter 'user' is set if ($user === null || (is_array($user) && count($user) === 0)) { throw new InvalidArgumentException( @@ -305,10 +302,8 @@ public function createUserRequest( ); } - $resourcePath = '/user'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -344,7 +339,7 @@ public function createUserRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -527,7 +522,6 @@ public function createUsersWithArrayInputRequest( string $contentType = self::contentTypes['createUsersWithArrayInput'][0] ): Request { - // verify the required parameter 'user' is set if ($user === null || (is_array($user) && count($user) === 0)) { throw new InvalidArgumentException( @@ -535,10 +529,8 @@ public function createUsersWithArrayInputRequest( ); } - $resourcePath = '/user/createWithArray'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -574,7 +566,7 @@ public function createUsersWithArrayInputRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -757,7 +749,6 @@ public function createUsersWithListInputRequest( string $contentType = self::contentTypes['createUsersWithListInput'][0] ): Request { - // verify the required parameter 'user' is set if ($user === null || (is_array($user) && count($user) === 0)) { throw new InvalidArgumentException( @@ -765,10 +756,8 @@ public function createUsersWithListInputRequest( ); } - $resourcePath = '/user/createWithList'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -804,7 +793,7 @@ public function createUsersWithListInputRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters @@ -987,7 +976,6 @@ public function deleteUserRequest( string $contentType = self::contentTypes['deleteUser'][0] ): Request { - // verify the required parameter 'username' is set if ($username === null || (is_array($username) && count($username) === 0)) { throw new InvalidArgumentException( @@ -995,10 +983,7 @@ public function deleteUserRequest( ); } - $resourcePath = '/user/{username}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1021,30 +1006,6 @@ public function deleteUserRequest( $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()) { @@ -1266,7 +1227,6 @@ public function getUserByNameRequest( string $contentType = self::contentTypes['getUserByName'][0] ): Request { - // verify the required parameter 'username' is set if ($username === null || (is_array($username) && count($username) === 0)) { throw new InvalidArgumentException( @@ -1274,10 +1234,7 @@ public function getUserByNameRequest( ); } - $resourcePath = '/user/{username}'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1300,30 +1257,6 @@ public function getUserByNameRequest( $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()) { @@ -1555,14 +1488,12 @@ public function loginUserRequest( string $contentType = self::contentTypes['loginUser'][0] ): Request { - // verify the required parameter 'username' is set if ($username === null || (is_array($username) && count($username) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $username when calling loginUser' ); } - // verify the required parameter 'password' is set if ($password === null || (is_array($password) && count($password) === 0)) { throw new InvalidArgumentException( @@ -1570,9 +1501,7 @@ public function loginUserRequest( ); } - $resourcePath = '/user/login'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -1606,30 +1535,6 @@ public function loginUserRequest( $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()) { @@ -1794,10 +1699,7 @@ public function logoutUserRequest( ): Request { - $resourcePath = '/user/logout'; - $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -1812,30 +1714,6 @@ public function logoutUserRequest( $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()) { @@ -2019,14 +1897,12 @@ public function updateUserRequest( string $contentType = self::contentTypes['updateUser'][0] ): Request { - // verify the required parameter 'username' is set if ($username === null || (is_array($username) && count($username) === 0)) { throw new InvalidArgumentException( 'Missing the required parameter $username when calling updateUser' ); } - // verify the required parameter 'user' is set if ($user === null || (is_array($user) && count($user) === 0)) { throw new InvalidArgumentException( @@ -2034,10 +1910,8 @@ public function updateUserRequest( ); } - $resourcePath = '/user/{username}'; $formParams = []; - $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; @@ -2081,7 +1955,7 @@ public function updateUserRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters