diff --git a/src/Client.php b/src/Client.php index cc0de8b..bb9fd54 100644 --- a/src/Client.php +++ b/src/Client.php @@ -84,6 +84,7 @@ public function getCommissionRates(array $products): Model\BulkCommissionRatesMu 'consumes' => 'application/vnd.retailer.v10+json', ]; $responseTypes = [ + '207' => Model\BulkCommissionRatesMultiStatusResponse::class, ]; return $this->request('POST', $url, $options, $responseTypes); diff --git a/src/OpenApi/ClientGenerator.php b/src/OpenApi/ClientGenerator.php index e2e1e12..00ba329 100644 --- a/src/OpenApi/ClientGenerator.php +++ b/src/OpenApi/ClientGenerator.php @@ -133,22 +133,22 @@ protected function generateMethod(string $path, string $httpMethod, array &$code $this->addBodyParam($arguments, $code); $this->addFormData($arguments, $code); - $responseContent = $methodDefinition['responses']['200']['content'] ?? $methodDefinition['responses']['202']['content'] ?? $methodDefinition['responses']['400']['content'] ?? null; + $responseContent = $methodDefinition['responses']['200']['content'] ?? $methodDefinition['responses']['202']['content'] ?? $methodDefinition['responses']['207']['content'] ?? $methodDefinition['responses']['400']['content'] ?? null; $code[] = sprintf(' \'produces\' => \'%s\',', array_key_first($responseContent)); if ($methodDefinition['requestBody']['content'] ?? false) { $code[] = sprintf(' \'consumes\' => \'%s\',', array_key_first($methodDefinition['requestBody']['content'])); } - $code[] = ' ];'; - $options = '$options'; - $acceptLanguage = $this->findMethodDefinitionParameter($methodDefinition, 'Accept-Language'); if ($acceptLanguage !== null) { $code[] = sprintf(' \'language\' => %s,', '$AcceptLanguage'); } + $code[] = ' ];'; + $options = '$options'; + $this->addResponseTypes($methodDefinition['responses'], $code); $code[] = ''; @@ -507,7 +507,7 @@ protected function addResponseTypes(array $responses, array &$code): void $code[] = ' $responseTypes = ['; foreach ($responses as $httpStatus => $response) { $type = null; - if (in_array($httpStatus, ['200', '202'])) { + if (in_array($httpStatus, ['200', '202', '207'])) { $response = current($response['content'] ?? []); if (! isset($response['schema'])) {