From af0915736567d1329b2acbb62cf402041195c85b Mon Sep 17 00:00:00 2001 From: Kevin Andrews Date: Wed, 6 Apr 2022 15:59:18 +0100 Subject: [PATCH] Manual patch to decode exception error messages on all API services Issue already patched in OpenAPI Gen https://github.com/OpenAPITools/openapi-generator/pull/757 --- lib/AddressesApi.php | 20 ++++++++++---------- lib/ItemsApi.php | 14 +++++++------- lib/ManifestsApi.php | 12 ++++++------ lib/PackagingApi.php | 14 +++++++------- lib/ShipmentsApi.php | 44 ++++++++++++++++++++++---------------------- lib/TokenApi.php | 14 +++++++------- 6 files changed, 59 insertions(+), 59 deletions(-) diff --git a/lib/AddressesApi.php b/lib/AddressesApi.php index 3573649..916e313 100644 --- a/lib/AddressesApi.php +++ b/lib/AddressesApi.php @@ -169,7 +169,7 @@ 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() ); @@ -177,7 +177,7 @@ public function addressesCreateWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\AddressResponse', $e->getResponseHeaders() ); @@ -456,7 +456,7 @@ 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() ); @@ -464,7 +464,7 @@ public function addressesDeleteWithHttpInfo($xRMGAuthToken, $addressId) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\AddressResponse', $e->getResponseHeaders() ); @@ -472,7 +472,7 @@ public function addressesDeleteWithHttpInfo($xRMGAuthToken, $addressId) break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\AddressResponse', $e->getResponseHeaders() ); @@ -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() ); @@ -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() ); @@ -1307,7 +1307,7 @@ 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() ); @@ -1315,7 +1315,7 @@ public function addressesUpdateWithHttpInfo($body, $xRMGAuthToken, $addressId) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\AddressResponse', $e->getResponseHeaders() ); @@ -1323,7 +1323,7 @@ public function addressesUpdateWithHttpInfo($body, $xRMGAuthToken, $addressId) break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\AddressResponse', $e->getResponseHeaders() ); diff --git a/lib/ItemsApi.php b/lib/ItemsApi.php index 60dc875..2dc1f27 100644 --- a/lib/ItemsApi.php +++ b/lib/ItemsApi.php @@ -169,7 +169,7 @@ 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() ); @@ -177,7 +177,7 @@ public function itemsCreateWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ItemResponse', $e->getResponseHeaders() ); @@ -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() ); @@ -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() ); @@ -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() ); @@ -1291,7 +1291,7 @@ 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() ); @@ -1299,7 +1299,7 @@ public function itemsUpdateWithHttpInfo($body, $xRMGAuthToken, $itemId) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ItemResponse', $e->getResponseHeaders() ); diff --git a/lib/ManifestsApi.php b/lib/ManifestsApi.php index 207e836..e529e46 100644 --- a/lib/ManifestsApi.php +++ b/lib/ManifestsApi.php @@ -169,7 +169,7 @@ 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() ); @@ -177,7 +177,7 @@ public function manifestsCreateWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ManifestResponse', $e->getResponseHeaders() ); @@ -456,7 +456,7 @@ 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() ); @@ -464,7 +464,7 @@ public function manifestsCreateByCarrierWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ManifestResponse', $e->getResponseHeaders() ); @@ -743,7 +743,7 @@ 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() ); @@ -751,7 +751,7 @@ public function manifestsCreateByServiceWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ManifestResponse', $e->getResponseHeaders() ); diff --git a/lib/PackagingApi.php b/lib/PackagingApi.php index f1adc6f..00929b6 100644 --- a/lib/PackagingApi.php +++ b/lib/PackagingApi.php @@ -169,7 +169,7 @@ 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() ); @@ -177,7 +177,7 @@ public function packagingCreateWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PackagingResponse', $e->getResponseHeaders() ); @@ -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() ); @@ -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() ); @@ -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() ); @@ -1291,7 +1291,7 @@ 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() ); @@ -1299,7 +1299,7 @@ public function packagingUpdateWithHttpInfo($body, $xRMGAuthToken, $packagingId) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PackagingResponse', $e->getResponseHeaders() ); diff --git a/lib/ShipmentsApi.php b/lib/ShipmentsApi.php index c275a3c..14a631e 100644 --- a/lib/ShipmentsApi.php +++ b/lib/ShipmentsApi.php @@ -169,7 +169,7 @@ public function shipmentsCancelWithHttpInfo($body, $xRMGAuthToken) switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsCancelResponse', $e->getResponseHeaders() ); @@ -177,7 +177,7 @@ public function shipmentsCancelWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsCancelResponse', $e->getResponseHeaders() ); @@ -185,7 +185,7 @@ public function shipmentsCancelWithHttpInfo($body, $xRMGAuthToken) break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsCancelResponse', $e->getResponseHeaders() ); @@ -464,7 +464,7 @@ public function shipmentsCreateWithHttpInfo($body, $xRMGAuthToken) switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentCreateResponse', $e->getResponseHeaders() ); @@ -472,7 +472,7 @@ public function shipmentsCreateWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentCreateResponse', $e->getResponseHeaders() ); @@ -751,7 +751,7 @@ public function shipmentsDeferWithHttpInfo($body, $xRMGAuthToken) switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsDeferResponse', $e->getResponseHeaders() ); @@ -759,7 +759,7 @@ public function shipmentsDeferWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsDeferResponse', $e->getResponseHeaders() ); @@ -767,7 +767,7 @@ public function shipmentsDeferWithHttpInfo($body, $xRMGAuthToken) break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsDeferResponse', $e->getResponseHeaders() ); @@ -1046,7 +1046,7 @@ public function shipmentsHoldWithHttpInfo($body, $xRMGAuthToken) switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsHoldResponse', $e->getResponseHeaders() ); @@ -1054,7 +1054,7 @@ public function shipmentsHoldWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsHoldResponse', $e->getResponseHeaders() ); @@ -1062,7 +1062,7 @@ public function shipmentsHoldWithHttpInfo($body, $xRMGAuthToken) break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsHoldResponse', $e->getResponseHeaders() ); @@ -1343,7 +1343,7 @@ public function shipmentsPrintDocumentWithHttpInfo($body, $xRMGAuthToken, $shipm switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PrintDocumentResponse', $e->getResponseHeaders() ); @@ -1351,7 +1351,7 @@ public function shipmentsPrintDocumentWithHttpInfo($body, $xRMGAuthToken, $shipm break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PrintDocumentResponse', $e->getResponseHeaders() ); @@ -1359,7 +1359,7 @@ public function shipmentsPrintDocumentWithHttpInfo($body, $xRMGAuthToken, $shipm break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PrintDocumentResponse', $e->getResponseHeaders() ); @@ -1657,7 +1657,7 @@ public function shipmentsPrintLabelWithHttpInfo($body, $xRMGAuthToken, $shipment switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PrintLabelResponse', $e->getResponseHeaders() ); @@ -1665,7 +1665,7 @@ public function shipmentsPrintLabelWithHttpInfo($body, $xRMGAuthToken, $shipment break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PrintLabelResponse', $e->getResponseHeaders() ); @@ -1673,7 +1673,7 @@ public function shipmentsPrintLabelWithHttpInfo($body, $xRMGAuthToken, $shipment break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\PrintLabelResponse', $e->getResponseHeaders() ); @@ -1969,7 +1969,7 @@ public function shipmentsReleaseWithHttpInfo($body, $xRMGAuthToken) switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsReleaseResponse', $e->getResponseHeaders() ); @@ -1977,7 +1977,7 @@ public function shipmentsReleaseWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsReleaseResponse', $e->getResponseHeaders() ); @@ -1985,7 +1985,7 @@ public function shipmentsReleaseWithHttpInfo($body, $xRMGAuthToken) break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ShipmentsReleaseResponse', $e->getResponseHeaders() ); @@ -2264,7 +2264,7 @@ public function shipmentsServiceAvailabilityWithHttpInfo($body, $xRMGAuthToken) switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ServiceAvailabilityResponse', $e->getResponseHeaders() ); @@ -2272,7 +2272,7 @@ public function shipmentsServiceAvailabilityWithHttpInfo($body, $xRMGAuthToken) break; case 400: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ServiceAvailabilityResponse', $e->getResponseHeaders() ); diff --git a/lib/TokenApi.php b/lib/TokenApi.php index f14304d..3f0a0bc 100644 --- a/lib/TokenApi.php +++ b/lib/TokenApi.php @@ -169,7 +169,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\Token', $e->getResponseHeaders() ); @@ -177,7 +177,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit break; case 401: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ErrorResponse', $e->getResponseHeaders() ); @@ -185,7 +185,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit break; case 403: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ErrorResponse', $e->getResponseHeaders() ); @@ -193,7 +193,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit break; case 404: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ErrorResponse', $e->getResponseHeaders() ); @@ -201,7 +201,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit break; case 405: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ErrorResponse', $e->getResponseHeaders() ); @@ -209,7 +209,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit break; case 429: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ErrorResponse', $e->getResponseHeaders() ); @@ -217,7 +217,7 @@ public function authenticatePostWithHttpInfo($xRMGSecurityUsername, $xRMGSecurit break; case 503: $data = ObjectSerializer::deserialize( - $e->getResponseBody(), + json_decode($e->getResponseBody()), '\RoyalMail\Shipping\Rest\Api\models\ErrorResponse', $e->getResponseHeaders() );