From eb7c63b82c2eea8831c818e8078a54e70c113d69 Mon Sep 17 00:00:00 2001 From: "WoutervanderLoop.nl" Date: Mon, 16 Sep 2024 13:12:11 +0200 Subject: [PATCH] Added 207 response type. Fixes: #51 --- src/Client.php | 1 + src/OpenApi/ClientGenerator.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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..0a2769a 100644 --- a/src/OpenApi/ClientGenerator.php +++ b/src/OpenApi/ClientGenerator.php @@ -133,7 +133,7 @@ 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) { @@ -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'])) {