Skip to content

Commit

Permalink
Manual patch to decode exception error messages on all API services
Browse files Browse the repository at this point in the history
Issue already patched in OpenAPI Gen OpenAPITools/openapi-generator#757
  • Loading branch information
Caffe1neAdd1ct committed Apr 6, 2022
1 parent d9cff4b commit af09157
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 59 deletions.
20 changes: 10 additions & 10 deletions lib/AddressesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ public function addressesCreateWithHttpInfo($body, $xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -456,23 +456,23 @@ public function addressesDeleteWithHttpInfo($xRMGAuthToken, $addressId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -756,7 +756,7 @@ public function addressesGetWithHttpInfo($xRMGAuthToken, $addressId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\Address',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -1038,7 +1038,7 @@ public function addressesGetAllWithHttpInfo($xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\Address[]',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -1307,23 +1307,23 @@ public function addressesUpdateWithHttpInfo($body, $xRMGAuthToken, $addressId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\AddressResponse',
$e->getResponseHeaders()
);
Expand Down
14 changes: 7 additions & 7 deletions lib/ItemsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ public function itemsCreateWithHttpInfo($body, $xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ItemResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ItemResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -456,7 +456,7 @@ public function itemsDeleteWithHttpInfo($xRMGAuthToken, $itemId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ItemResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -740,7 +740,7 @@ public function itemsGetWithHttpInfo($xRMGAuthToken, $itemId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\Item',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -1022,7 +1022,7 @@ public function itemsGetAllWithHttpInfo($xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\Item[]',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -1291,15 +1291,15 @@ public function itemsUpdateWithHttpInfo($body, $xRMGAuthToken, $itemId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ItemResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ItemResponse',
$e->getResponseHeaders()
);
Expand Down
12 changes: 6 additions & 6 deletions lib/ManifestsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ public function manifestsCreateWithHttpInfo($body, $xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ManifestResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ManifestResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -456,15 +456,15 @@ public function manifestsCreateByCarrierWithHttpInfo($body, $xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ManifestResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ManifestResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -743,15 +743,15 @@ public function manifestsCreateByServiceWithHttpInfo($body, $xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ManifestResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\ManifestResponse',
$e->getResponseHeaders()
);
Expand Down
14 changes: 7 additions & 7 deletions lib/PackagingApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ public function packagingCreateWithHttpInfo($body, $xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\PackagingResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\PackagingResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -456,7 +456,7 @@ public function packagingDeleteWithHttpInfo($xRMGAuthToken, $packagingId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\PackagingResponse',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -740,7 +740,7 @@ public function packagingGetWithHttpInfo($xRMGAuthToken, $packagingId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\Packaging',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -1022,7 +1022,7 @@ public function packagingGetAllWithHttpInfo($xRMGAuthToken)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\Packaging[]',
$e->getResponseHeaders()
);
Expand Down Expand Up @@ -1291,15 +1291,15 @@ public function packagingUpdateWithHttpInfo($body, $xRMGAuthToken, $packagingId)
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\PackagingResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
json_decode($e->getResponseBody()),
'\RoyalMail\Shipping\Rest\Api\models\PackagingResponse',
$e->getResponseHeaders()
);
Expand Down
Loading

0 comments on commit af09157

Please sign in to comment.