From 454ba2d6bef3cf4a3f854ed1bf99599db177561a Mon Sep 17 00:00:00 2001 From: Nabil Azahaf Date: Fri, 7 Aug 2026 11:00:24 +0200 Subject: [PATCH 1/2] fix: replace deprecated JSON encoding --- openapi/templates/api.mustache | 880 ++++++++++++++++++ .../Generated/CoreApi/Api/DefaultApi.php | 7 +- .../Generated/CoreApi/Api/NotificationApi.php | 74 +- .../Generated/CoreApi/Api/ShipmentApi.php | 115 ++- .../Generated/CoreApi/Api/WebhookApi.php | 30 +- .../CoreApiPrivate/Api/ShippingRuleApi.php | 62 +- .../Generated/IamApi/Api/DefaultApi.php | 7 +- .../Generated/OrderApi/Api/DefaultApi.php | 129 ++- .../CoreApi/ShipmentApiPostShipmentsTest.php | 16 + test/Client/GeneratedJsonEncodingTest.php | 27 + 10 files changed, 1270 insertions(+), 77 deletions(-) create mode 100644 openapi/templates/api.mustache create mode 100644 test/Client/GeneratedJsonEncodingTest.php diff --git a/openapi/templates/api.mustache b/openapi/templates/api.mustache new file mode 100644 index 00000000..ce998c53 --- /dev/null +++ b/openapi/templates/api.mustache @@ -0,0 +1,880 @@ +{{! + Override of the stock api.mustache from openapi-generator v7.12.0. + + Delta vs stock: \GuzzleHttp\Utils::jsonEncode() is replaced by + json_encode(..., JSON_THROW_ON_ERROR), and the resulting JsonException is + documented on generated request methods. Guzzle deprecated the helper in + 7.15 and removes it in 8.0. Fail-fast semantics are preserved, with the + native JsonException replacing Guzzle's InvalidArgumentException. + + When the pinned generator version changes, refresh this file from the new + stock template and re-apply the delta. +}} +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{apiPackage}}; + +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 {{invokerPackage}}\ApiException; +use {{invokerPackage}}\Configuration; +use {{invokerPackage}}\HeaderSelector; +use {{invokerPackage}}\ObjectSerializer; + +/** + * {{classname}} Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +{{#operations}}class {{classname}} +{ + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + + /** @var string[] $contentTypes **/ + public const contentTypes = [{{#operation}} + '{{{operationId}}}' => [{{#consumes}} + '{{{mediaType}}}',{{/consumes}} + {{^consumes}} + 'application/json', +{{/consumes}} ],{{/operation}} + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + +{{#operation}} + /** + * Operation {{{operationId}}} +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @throws \JsonException + * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + return $response;{{/returnType}} + } + + /** + * Operation {{{operationId}}}WithHttpInfo +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @throws \JsonException + * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + {{#returnType}} + {{#responses}} + {{#-first}} + + switch($statusCode) { + {{/-first}} + {{#dataType}} + {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + if ('{{{dataType}}}' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('{{{dataType}}}' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '{{{dataType}}}', []), + $response->getStatusCode(), + $response->getHeaders() + ];{{/isRange}} + {{/dataType}} + {{#-last}} + } + {{/-last}} + {{/responses}} + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '{{{returnType}}}'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + + return [null, $statusCode, $response->getHeaders()]; + {{/returnType}} + + } catch (ApiException $e) { + switch ($e->getCode()) { + {{#responses}} + {{#dataType}} + {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '{{{dataType}}}', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break;{{/isRange}} + {{/dataType}} + {{/responses}} + } + throw $e; + } + } + + /** + * Operation {{{operationId}}}Async + * +{{#summary}} + * {{.}} + * +{{/summary}} +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @throws \JsonException + * @return \GuzzleHttp\Promise\PromiseInterface + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation {{{operationId}}}AsyncWithHttpInfo + * +{{#summary}} + * {{.}} + * +{{/summary}} +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @throws \JsonException + * @return \GuzzleHttp\Promise\PromiseInterface + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + $returnType = '{{{returnType}}}'; + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + {{#returnType}} + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $response->getStatusCode(), $response->getHeaders()]; + {{/returnType}} + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation '{{{operationId}}}' + * +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. +{{/-first}} + * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @throws \JsonException + * @return \GuzzleHttp\Psr7\Request + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + {{#vendorExtensions.x-group-parameters}} + // unbox the parameters from the associative array +{{#allParams}} + ${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; +{{/allParams}}{{#servers.0}} + $hostIndex = $associative_array['hostIndex']; + $variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : []; +{{/servers.0}} + $contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0]; + {{/vendorExtensions.x-group-parameters}}{{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter ${{paramName}} when calling {{operationId}}' + ); + } + {{/required}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { + throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + } + {{/maxItems}} + {{#minItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) { + 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}} + + $resourcePath = '{{{path}}}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + {{#queryParams}} + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + ${{paramName}}, + '{{baseName}}', // param base name + '{{#schema}}{{openApiType}}{{/schema}}', // openApiType + '{{style}}', // style + {{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode + {{required}} // required + ) ?? []); + {{/queryParams}} + + {{#headerParams}} + // header params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); + } + {{/headerParams}} + + {{#pathParams}} + // path params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $resourcePath = str_replace( + '{' . '{{baseName}}' . '}', + ObjectSerializer::toPathValue(${{paramName}}), + $resourcePath + ); + } + {{/pathParams}} + + {{#formParams}} + // form params + if (${{paramName}} !== null) { + {{#isFile}} + $multipart = true; + $formParams['{{baseName}}'] = []; + $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; + foreach ($paramFiles as $paramFile) { + $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + {{/isFile}} + {{^isFile}} + $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); + {{/isFile}} + } + {{/formParams}} + + {{#isMultipart}} + $multipart = true; + {{/isMultipart}} + $headers = $this->headerSelector->selectHeaders( + [{{#produces}}'{{{mediaType}}}', {{/produces}}], + $contentType, + $multipart + ); + + // for model (json/xml) + {{#bodyParams}} + if (isset(${{paramName}})) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization(${{paramName}}), JSON_THROW_ON_ERROR); + } else { + $httpBody = ${{paramName}}; + } + } elseif (count($formParams) > 0) { + {{/bodyParams}} + {{^bodyParams}} + if (count($formParams) > 0) { + {{/bodyParams}} + 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 = json_encode($formParams, JSON_THROW_ON_ERROR); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + {{#authMethods}} + {{#isApiKey}} + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}'); + if ($apiKey !== null) { + {{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}} + } + {{/isApiKey}} + {{#isBasic}} + {{#isBasicBasic}} + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isBasicBearer}} + {{/isBasic}} + {{#isOAuth}} + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isOAuth}} + {{/authMethods}} + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + {{#servers.0}} + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFor{{operationId}}(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + {{/servers.0}} + {{^servers.0}} + $operationHost = $this->config->getHost(); + {{/servers.0}} + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + '{{httpMethod}}', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + {{#servers.0}} + /** + * Returns an array of host settings for Operation {{operationId}} + * + * @return array an array of host settings + */ + protected function getHostSettingsFor{{operationId}}(): array + { + return [ + {{#servers}} + [ + "url" => "{{{url}}}", + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + "variables" => [ + {{/-first}} + "{{{name}}}" => [ + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + "default_value" => "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + "enum_values" => [ + {{/-first}} + "{{{.}}}", + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + ]{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/variables}} + ]{{^-last}},{{/-last}} + {{/servers}} + ]; + } + + {{/servers.0}} + {{/operation}} + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} +{{/operations}} diff --git a/src/Client/Generated/CoreApi/Api/DefaultApi.php b/src/Client/Generated/CoreApi/Api/DefaultApi.php index 6f827e72..293a9629 100644 --- a/src/Client/Generated/CoreApi/Api/DefaultApi.php +++ b/src/Client/Generated/CoreApi/Api/DefaultApi.php @@ -131,6 +131,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\GetIndex200Response|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getIndex($user_agent = null, string $contentType = self::contentTypes['getIndex'][0]) @@ -147,6 +148,7 @@ public function getIndex($user_agent = null, string $contentType = self::content * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\GetIndex200Response|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getIndexWithHttpInfo($user_agent = null, string $contentType = self::contentTypes['getIndex'][0]) @@ -271,6 +273,7 @@ public function getIndexWithHttpInfo($user_agent = null, string $contentType = s * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIndex'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getIndexAsync($user_agent = null, string $contentType = self::contentTypes['getIndex'][0]) @@ -290,6 +293,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIndex'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getIndexAsyncWithHttpInfo($user_agent = null, string $contentType = self::contentTypes['getIndex'][0]) @@ -340,6 +344,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIndex'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getIndexRequest($user_agent = null, string $contentType = self::contentTypes['getIndex'][0]) @@ -386,7 +391,7 @@ public function getIndexRequest($user_agent = null, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/Client/Generated/CoreApi/Api/NotificationApi.php b/src/Client/Generated/CoreApi/Api/NotificationApi.php index adf939da..a782b18f 100644 --- a/src/Client/Generated/CoreApi/Api/NotificationApi.php +++ b/src/Client/Generated/CoreApi/Api/NotificationApi.php @@ -161,6 +161,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function deleteNotificationGroups($ids, $user_agent = null, string $contentType = self::contentTypes['deleteNotificationGroups'][0]) @@ -179,6 +180,7 @@ public function deleteNotificationGroups($ids, $user_agent = null, string $conte * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteNotificationGroupsWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['deleteNotificationGroups'][0]) @@ -229,6 +231,7 @@ public function deleteNotificationGroupsWithHttpInfo($ids, $user_agent = null, s * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteNotificationGroupsAsync($ids, $user_agent = null, string $contentType = self::contentTypes['deleteNotificationGroups'][0]) @@ -251,6 +254,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteNotificationGroupsAsyncWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['deleteNotificationGroups'][0]) @@ -289,6 +293,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function deleteNotificationGroupsRequest($ids, $user_agent = null, string $contentType = self::contentTypes['deleteNotificationGroups'][0]) @@ -350,7 +355,7 @@ public function deleteNotificationGroupsRequest($ids, $user_agent = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -399,6 +404,7 @@ public function deleteNotificationGroupsRequest($ids, $user_agent = null, string * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function disableAllNotificationTemplatesByGroup($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['disableAllNotificationTemplatesByGroup'][0]) @@ -417,6 +423,7 @@ public function disableAllNotificationTemplatesByGroup($notification_group_id, $ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function disableAllNotificationTemplatesByGroupWithHttpInfo($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['disableAllNotificationTemplatesByGroup'][0]) @@ -467,6 +474,7 @@ public function disableAllNotificationTemplatesByGroupWithHttpInfo($notification * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableAllNotificationTemplatesByGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function disableAllNotificationTemplatesByGroupAsync($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['disableAllNotificationTemplatesByGroup'][0]) @@ -489,6 +497,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableAllNotificationTemplatesByGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function disableAllNotificationTemplatesByGroupAsyncWithHttpInfo($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['disableAllNotificationTemplatesByGroup'][0]) @@ -527,6 +536,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableAllNotificationTemplatesByGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function disableAllNotificationTemplatesByGroupRequest($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['disableAllNotificationTemplatesByGroup'][0]) @@ -588,7 +598,7 @@ public function disableAllNotificationTemplatesByGroupRequest($notification_grou } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,6 +648,7 @@ public function disableAllNotificationTemplatesByGroupRequest($notification_grou * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function disableNotificationTemplate($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['disableNotificationTemplate'][0]) @@ -657,6 +668,7 @@ public function disableNotificationTemplate($notification_group_id, $notificatio * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function disableNotificationTemplateWithHttpInfo($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['disableNotificationTemplate'][0]) @@ -708,6 +720,7 @@ public function disableNotificationTemplateWithHttpInfo($notification_group_id, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function disableNotificationTemplateAsync($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['disableNotificationTemplate'][0]) @@ -731,6 +744,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function disableNotificationTemplateAsyncWithHttpInfo($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['disableNotificationTemplate'][0]) @@ -770,6 +784,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function disableNotificationTemplateRequest($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['disableNotificationTemplate'][0]) @@ -846,7 +861,7 @@ public function disableNotificationTemplateRequest($notification_group_id, $noti } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -895,6 +910,7 @@ public function disableNotificationTemplateRequest($notification_group_id, $noti * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function enableAllNotificationTemplatesByGroup($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['enableAllNotificationTemplatesByGroup'][0]) @@ -913,6 +929,7 @@ public function enableAllNotificationTemplatesByGroup($notification_group_id, $u * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function enableAllNotificationTemplatesByGroupWithHttpInfo($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['enableAllNotificationTemplatesByGroup'][0]) @@ -963,6 +980,7 @@ public function enableAllNotificationTemplatesByGroupWithHttpInfo($notification_ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableAllNotificationTemplatesByGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function enableAllNotificationTemplatesByGroupAsync($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['enableAllNotificationTemplatesByGroup'][0]) @@ -985,6 +1003,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableAllNotificationTemplatesByGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function enableAllNotificationTemplatesByGroupAsyncWithHttpInfo($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['enableAllNotificationTemplatesByGroup'][0]) @@ -1023,6 +1042,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableAllNotificationTemplatesByGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function enableAllNotificationTemplatesByGroupRequest($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['enableAllNotificationTemplatesByGroup'][0]) @@ -1084,7 +1104,7 @@ public function enableAllNotificationTemplatesByGroupRequest($notification_group } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1134,6 +1154,7 @@ public function enableAllNotificationTemplatesByGroupRequest($notification_group * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function enableNotificationTemplate($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['enableNotificationTemplate'][0]) @@ -1153,6 +1174,7 @@ public function enableNotificationTemplate($notification_group_id, $notification * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function enableNotificationTemplateWithHttpInfo($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['enableNotificationTemplate'][0]) @@ -1204,6 +1226,7 @@ public function enableNotificationTemplateWithHttpInfo($notification_group_id, $ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function enableNotificationTemplateAsync($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['enableNotificationTemplate'][0]) @@ -1227,6 +1250,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function enableNotificationTemplateAsyncWithHttpInfo($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['enableNotificationTemplate'][0]) @@ -1266,6 +1290,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function enableNotificationTemplateRequest($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['enableNotificationTemplate'][0]) @@ -1342,7 +1367,7 @@ public function enableNotificationTemplateRequest($notification_group_id, $notif } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1391,6 +1416,7 @@ public function enableNotificationTemplateRequest($notification_group_id, $notif * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\NotificationResponsesNotificationGroups|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getNotificationGroups($shop_id = null, $user_agent = null, string $contentType = self::contentTypes['getNotificationGroups'][0]) @@ -1410,6 +1436,7 @@ public function getNotificationGroups($shop_id = null, $user_agent = null, strin * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\NotificationResponsesNotificationGroups|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getNotificationGroupsWithHttpInfo($shop_id = null, $user_agent = null, string $contentType = self::contentTypes['getNotificationGroups'][0]) @@ -1539,6 +1566,7 @@ public function getNotificationGroupsWithHttpInfo($shop_id = null, $user_agent = * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getNotificationGroupsAsync($shop_id = null, $user_agent = null, string $contentType = self::contentTypes['getNotificationGroups'][0]) @@ -1561,6 +1589,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getNotificationGroupsAsyncWithHttpInfo($shop_id = null, $user_agent = null, string $contentType = self::contentTypes['getNotificationGroups'][0]) @@ -1612,6 +1641,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getNotificationGroupsRequest($shop_id = null, $user_agent = null, string $contentType = self::contentTypes['getNotificationGroups'][0]) @@ -1668,7 +1698,7 @@ public function getNotificationGroupsRequest($shop_id = null, $user_agent = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1717,6 +1747,7 @@ public function getNotificationGroupsRequest($shop_id = null, $user_agent = null * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\NotificationResponsesNotificationTemplates|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getNotificationTemplates($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['getNotificationTemplates'][0]) @@ -1736,6 +1767,7 @@ public function getNotificationTemplates($notification_group_id, $user_agent = n * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\NotificationResponsesNotificationTemplates|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getNotificationTemplatesWithHttpInfo($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['getNotificationTemplates'][0]) @@ -1865,6 +1897,7 @@ public function getNotificationTemplatesWithHttpInfo($notification_group_id, $us * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getNotificationTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getNotificationTemplatesAsync($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['getNotificationTemplates'][0]) @@ -1887,6 +1920,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getNotificationTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getNotificationTemplatesAsyncWithHttpInfo($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['getNotificationTemplates'][0]) @@ -1938,6 +1972,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getNotificationTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getNotificationTemplatesRequest($notification_group_id, $user_agent = null, string $contentType = self::contentTypes['getNotificationTemplates'][0]) @@ -1999,7 +2034,7 @@ public function getNotificationTemplatesRequest($notification_group_id, $user_ag } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2048,6 +2083,7 @@ public function getNotificationTemplatesRequest($notification_group_id, $user_ag * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\NotificationResponsesNotificationGroups|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postNotificationGroups($notification_post_notification_group_request, $user_agent = null, string $contentType = self::contentTypes['postNotificationGroups'][0]) @@ -2067,6 +2103,7 @@ public function postNotificationGroups($notification_post_notification_group_req * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\NotificationResponsesNotificationGroups|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postNotificationGroupsWithHttpInfo($notification_post_notification_group_request, $user_agent = null, string $contentType = self::contentTypes['postNotificationGroups'][0]) @@ -2196,6 +2233,7 @@ public function postNotificationGroupsWithHttpInfo($notification_post_notificati * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postNotificationGroupsAsync($notification_post_notification_group_request, $user_agent = null, string $contentType = self::contentTypes['postNotificationGroups'][0]) @@ -2218,6 +2256,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postNotificationGroupsAsyncWithHttpInfo($notification_post_notification_group_request, $user_agent = null, string $contentType = self::contentTypes['postNotificationGroups'][0]) @@ -2269,6 +2308,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postNotificationGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postNotificationGroupsRequest($notification_post_notification_group_request, $user_agent = null, string $contentType = self::contentTypes['postNotificationGroups'][0]) @@ -2308,7 +2348,7 @@ public function postNotificationGroupsRequest($notification_post_notification_gr if (isset($notification_post_notification_group_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($notification_post_notification_group_request)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($notification_post_notification_group_request), JSON_THROW_ON_ERROR); } else { $httpBody = $notification_post_notification_group_request; } @@ -2329,7 +2369,7 @@ public function postNotificationGroupsRequest($notification_post_notification_gr } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2380,6 +2420,7 @@ public function postNotificationGroupsRequest($notification_post_notification_gr * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function putNotificationTemplate($notification_group_id, $notification_template_id, $notification_put_notification_template_request, $user_agent = null, string $contentType = self::contentTypes['putNotificationTemplate'][0]) @@ -2400,6 +2441,7 @@ public function putNotificationTemplate($notification_group_id, $notification_te * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function putNotificationTemplateWithHttpInfo($notification_group_id, $notification_template_id, $notification_put_notification_template_request, $user_agent = null, string $contentType = self::contentTypes['putNotificationTemplate'][0]) @@ -2452,6 +2494,7 @@ public function putNotificationTemplateWithHttpInfo($notification_group_id, $not * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function putNotificationTemplateAsync($notification_group_id, $notification_template_id, $notification_put_notification_template_request, $user_agent = null, string $contentType = self::contentTypes['putNotificationTemplate'][0]) @@ -2476,6 +2519,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function putNotificationTemplateAsyncWithHttpInfo($notification_group_id, $notification_template_id, $notification_put_notification_template_request, $user_agent = null, string $contentType = self::contentTypes['putNotificationTemplate'][0]) @@ -2516,6 +2560,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putNotificationTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function putNotificationTemplateRequest($notification_group_id, $notification_template_id, $notification_put_notification_template_request, $user_agent = null, string $contentType = self::contentTypes['putNotificationTemplate'][0]) @@ -2585,7 +2630,7 @@ public function putNotificationTemplateRequest($notification_group_id, $notifica if (isset($notification_put_notification_template_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($notification_put_notification_template_request)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($notification_put_notification_template_request), JSON_THROW_ON_ERROR); } else { $httpBody = $notification_put_notification_template_request; } @@ -2606,7 +2651,7 @@ public function putNotificationTemplateRequest($notification_group_id, $notifica } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2656,6 +2701,7 @@ public function putNotificationTemplateRequest($notification_group_id, $notifica * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function sendTestNotification($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['sendTestNotification'][0]) @@ -2675,6 +2721,7 @@ public function sendTestNotification($notification_group_id, $notification_templ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function sendTestNotificationWithHttpInfo($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['sendTestNotification'][0]) @@ -2726,6 +2773,7 @@ public function sendTestNotificationWithHttpInfo($notification_group_id, $notifi * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestNotification'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function sendTestNotificationAsync($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['sendTestNotification'][0]) @@ -2749,6 +2797,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestNotification'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function sendTestNotificationAsyncWithHttpInfo($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['sendTestNotification'][0]) @@ -2788,6 +2837,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestNotification'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function sendTestNotificationRequest($notification_group_id, $notification_template_id, $user_agent = null, string $contentType = self::contentTypes['sendTestNotification'][0]) @@ -2864,7 +2914,7 @@ public function sendTestNotificationRequest($notification_group_id, $notificatio } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/Client/Generated/CoreApi/Api/ShipmentApi.php b/src/Client/Generated/CoreApi/Api/ShipmentApi.php index 9a779cc0..482f14fa 100644 --- a/src/Client/Generated/CoreApi/Api/ShipmentApi.php +++ b/src/Client/Generated/CoreApi/Api/ShipmentApi.php @@ -183,6 +183,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function deleteShipments($ids, $user_agent = null, string $contentType = self::contentTypes['deleteShipments'][0]) @@ -201,6 +202,7 @@ public function deleteShipments($ids, $user_agent = null, string $contentType = * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteShipmentsWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['deleteShipments'][0]) @@ -251,6 +253,7 @@ public function deleteShipmentsWithHttpInfo($ids, $user_agent = null, string $co * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteShipmentsAsync($ids, $user_agent = null, string $contentType = self::contentTypes['deleteShipments'][0]) @@ -273,6 +276,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteShipmentsAsyncWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['deleteShipments'][0]) @@ -311,6 +315,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function deleteShipmentsRequest($ids, $user_agent = null, string $contentType = self::contentTypes['deleteShipments'][0]) @@ -372,7 +377,7 @@ public function deleteShipmentsRequest($ids, $user_agent = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -438,6 +443,7 @@ public function deleteShipmentsRequest($ids, $user_agent = null, string $content * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesDeliveryOptionsV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getDeliveryOptions($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getDeliveryOptions'][0]) @@ -474,6 +480,7 @@ public function getDeliveryOptions($cc = null, $postal_code = null, $number = nu * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesDeliveryOptionsV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getDeliveryOptionsWithHttpInfo($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getDeliveryOptions'][0]) @@ -620,6 +627,7 @@ public function getDeliveryOptionsWithHttpInfo($cc = null, $postal_code = null, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryOptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getDeliveryOptionsAsync($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getDeliveryOptions'][0]) @@ -659,6 +667,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryOptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getDeliveryOptionsAsyncWithHttpInfo($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getDeliveryOptions'][0]) @@ -727,6 +736,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryOptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getDeliveryOptionsRequest($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getDeliveryOptions'][0]) @@ -1009,7 +1019,7 @@ public function getDeliveryOptionsRequest($cc = null, $postal_code = null, $numb } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1074,6 +1084,7 @@ public function getDeliveryOptionsRequest($cc = null, $postal_code = null, $numb * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesDropOffPoints|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getDropOffPoints($postal_code = null, $number = null, $distance = null, $cc = null, $limit = null, $carrier_id = null, $shop_id = null, $reference = null, $location_name = null, $external_identifier = null, $city = null, $cut_off_time = null, $min_cut_off_time = null, $max_cut_off_time = null, $latitude = null, $longitude = null, $exclude_parcel_lockers = null, $user_agent = null, string $contentType = self::contentTypes['getDropOffPoints'][0]) @@ -1109,6 +1120,7 @@ public function getDropOffPoints($postal_code = null, $number = null, $distance * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesDropOffPoints|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getDropOffPointsWithHttpInfo($postal_code = null, $number = null, $distance = null, $cc = null, $limit = null, $carrier_id = null, $shop_id = null, $reference = null, $location_name = null, $external_identifier = null, $city = null, $cut_off_time = null, $min_cut_off_time = null, $max_cut_off_time = null, $latitude = null, $longitude = null, $exclude_parcel_lockers = null, $user_agent = null, string $contentType = self::contentTypes['getDropOffPoints'][0]) @@ -1254,6 +1266,7 @@ public function getDropOffPointsWithHttpInfo($postal_code = null, $number = null * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDropOffPoints'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getDropOffPointsAsync($postal_code = null, $number = null, $distance = null, $cc = null, $limit = null, $carrier_id = null, $shop_id = null, $reference = null, $location_name = null, $external_identifier = null, $city = null, $cut_off_time = null, $min_cut_off_time = null, $max_cut_off_time = null, $latitude = null, $longitude = null, $exclude_parcel_lockers = null, $user_agent = null, string $contentType = self::contentTypes['getDropOffPoints'][0]) @@ -1292,6 +1305,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDropOffPoints'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getDropOffPointsAsyncWithHttpInfo($postal_code = null, $number = null, $distance = null, $cc = null, $limit = null, $carrier_id = null, $shop_id = null, $reference = null, $location_name = null, $external_identifier = null, $city = null, $cut_off_time = null, $min_cut_off_time = null, $max_cut_off_time = null, $latitude = null, $longitude = null, $exclude_parcel_lockers = null, $user_agent = null, string $contentType = self::contentTypes['getDropOffPoints'][0]) @@ -1359,6 +1373,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDropOffPoints'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getDropOffPointsRequest($postal_code = null, $number = null, $distance = null, $cc = null, $limit = null, $carrier_id = null, $shop_id = null, $reference = null, $location_name = null, $external_identifier = null, $city = null, $cut_off_time = null, $min_cut_off_time = null, $max_cut_off_time = null, $latitude = null, $longitude = null, $exclude_parcel_lockers = null, $user_agent = null, string $contentType = self::contentTypes['getDropOffPoints'][0]) @@ -1614,7 +1629,7 @@ public function getDropOffPointsRequest($postal_code = null, $number = null, $di } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1680,6 +1695,7 @@ public function getDropOffPointsRequest($postal_code = null, $number = null, $di * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesPickupLocations|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getPickupLocations($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getPickupLocations'][0]) @@ -1716,6 +1732,7 @@ public function getPickupLocations($cc = null, $postal_code = null, $number = nu * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesPickupLocations|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getPickupLocationsWithHttpInfo($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getPickupLocations'][0]) @@ -1862,6 +1879,7 @@ public function getPickupLocationsWithHttpInfo($cc = null, $postal_code = null, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPickupLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getPickupLocationsAsync($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getPickupLocations'][0]) @@ -1901,6 +1919,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPickupLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getPickupLocationsAsyncWithHttpInfo($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getPickupLocations'][0]) @@ -1969,6 +1988,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPickupLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getPickupLocationsRequest($cc = null, $postal_code = null, $number = null, $city = null, $street = null, $platform = null, $shop_id = null, $carrier = null, $delivery_date = null, $delivery_time = null, $cutoff_time = null, $dropoff_days = null, $monday_delivery = null, $dropoff_delay = null, $deliverydays_window = null, $exclude_delivery_type = null, $exclude_parcel_lockers = null, $latitude = null, $longitude = null, string $contentType = self::contentTypes['getPickupLocations'][0]) @@ -2251,7 +2271,7 @@ public function getPickupLocationsRequest($cc = null, $postal_code = null, $numb } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2320,6 +2340,7 @@ public function getPickupLocationsRequest($cc = null, $postal_code = null, $numb * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesShipments|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getShipments($barcode = null, $carrier_id = null, $created = null, $delayed = null, $delivered = null, $dropoff_today = null, $filter_hidden_shops = null, $hidden = null, $link_consumer_portal = null, $order = null, $package_type = null, $page = null, $q = null, $reference_identifier = null, $region = null, $shipment_type = null, $shop_id = null, $size = null, $sort = null, $status = null, $transaction_status = null, $user_agent = null, string $contentType = self::contentTypes['getShipments'][0]) @@ -2359,6 +2380,7 @@ public function getShipments($barcode = null, $carrier_id = null, $created = nul * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesShipments|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getShipmentsWithHttpInfo($barcode = null, $carrier_id = null, $created = null, $delayed = null, $delivered = null, $dropoff_today = null, $filter_hidden_shops = null, $hidden = null, $link_consumer_portal = null, $order = null, $package_type = null, $page = null, $q = null, $reference_identifier = null, $region = null, $shipment_type = null, $shop_id = null, $size = null, $sort = null, $status = null, $transaction_status = null, $user_agent = null, string $contentType = self::contentTypes['getShipments'][0]) @@ -2508,6 +2530,7 @@ public function getShipmentsWithHttpInfo($barcode = null, $carrier_id = null, $c * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShipmentsAsync($barcode = null, $carrier_id = null, $created = null, $delayed = null, $delivered = null, $dropoff_today = null, $filter_hidden_shops = null, $hidden = null, $link_consumer_portal = null, $order = null, $package_type = null, $page = null, $q = null, $reference_identifier = null, $region = null, $shipment_type = null, $shop_id = null, $size = null, $sort = null, $status = null, $transaction_status = null, $user_agent = null, string $contentType = self::contentTypes['getShipments'][0]) @@ -2550,6 +2573,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShipmentsAsyncWithHttpInfo($barcode = null, $carrier_id = null, $created = null, $delayed = null, $delivered = null, $dropoff_today = null, $filter_hidden_shops = null, $hidden = null, $link_consumer_portal = null, $order = null, $package_type = null, $page = null, $q = null, $reference_identifier = null, $region = null, $shipment_type = null, $shop_id = null, $size = null, $sort = null, $status = null, $transaction_status = null, $user_agent = null, string $contentType = self::contentTypes['getShipments'][0]) @@ -2621,6 +2645,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShipmentsRequest($barcode = null, $carrier_id = null, $created = null, $delayed = null, $delivered = null, $dropoff_today = null, $filter_hidden_shops = null, $hidden = null, $link_consumer_portal = null, $order = null, $package_type = null, $page = null, $q = null, $reference_identifier = null, $region = null, $shipment_type = null, $shop_id = null, $size = null, $sort = null, $status = null, $transaction_status = null, $user_agent = null, string $contentType = self::contentTypes['getShipments'][0]) @@ -2898,7 +2923,7 @@ public function getShipmentsRequest($barcode = null, $carrier_id = null, $create } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2948,6 +2973,7 @@ public function getShipmentsRequest($barcode = null, $carrier_id = null, $create * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesShipments|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getShipmentsById($ids, $link_consumer_portal = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsById'][0]) @@ -2968,6 +2994,7 @@ public function getShipmentsById($ids, $link_consumer_portal = null, $user_agent * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesShipments|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getShipmentsByIdWithHttpInfo($ids, $link_consumer_portal = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsById'][0]) @@ -3098,6 +3125,7 @@ public function getShipmentsByIdWithHttpInfo($ids, $link_consumer_portal = null, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipmentsById'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShipmentsByIdAsync($ids, $link_consumer_portal = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsById'][0]) @@ -3121,6 +3149,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipmentsById'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShipmentsByIdAsyncWithHttpInfo($ids, $link_consumer_portal = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsById'][0]) @@ -3173,6 +3202,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipmentsById'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShipmentsByIdRequest($ids, $link_consumer_portal = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsById'][0]) @@ -3244,7 +3274,7 @@ public function getShipmentsByIdRequest($ids, $link_consumer_portal = null, $use } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3297,6 +3327,7 @@ public function getShipmentsByIdRequest($ids, $link_consumer_portal = null, $use * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function getShipmentsLabels($ids, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsLabels'][0]) @@ -3319,6 +3350,7 @@ public function getShipmentsLabels($ids, $format = null, $positions = null, $col * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function getShipmentsLabelsWithHttpInfo($ids, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsLabels'][0]) @@ -3406,6 +3438,7 @@ public function getShipmentsLabelsWithHttpInfo($ids, $format = null, $positions * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipmentsLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShipmentsLabelsAsync($ids, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsLabels'][0]) @@ -3432,6 +3465,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipmentsLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShipmentsLabelsAsyncWithHttpInfo($ids, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsLabels'][0]) @@ -3474,6 +3508,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShipmentsLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShipmentsLabelsRequest($ids, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['getShipmentsLabels'][0]) @@ -3578,7 +3613,7 @@ public function getShipmentsLabelsRequest($ids, $format = null, $positions = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3632,6 +3667,7 @@ public function getShipmentsLabelsRequest($ids, $format = null, $positions = nul * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesTracktraces|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorNotFound|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getTrackTraces($barcode = null, $country_code = null, $external_identifier = null, $extra_info = null, $postal_code = null, $sort = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTraces'][0]) @@ -3656,6 +3692,7 @@ public function getTrackTraces($barcode = null, $country_code = null, $external_ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesTracktraces|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorNotFound|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getTrackTracesWithHttpInfo($barcode = null, $country_code = null, $external_identifier = null, $extra_info = null, $postal_code = null, $sort = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTraces'][0]) @@ -3825,6 +3862,7 @@ public function getTrackTracesWithHttpInfo($barcode = null, $country_code = null * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackTraces'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getTrackTracesAsync($barcode = null, $country_code = null, $external_identifier = null, $extra_info = null, $postal_code = null, $sort = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTraces'][0]) @@ -3852,6 +3890,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackTraces'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getTrackTracesAsyncWithHttpInfo($barcode = null, $country_code = null, $external_identifier = null, $extra_info = null, $postal_code = null, $sort = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTraces'][0]) @@ -3908,6 +3947,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackTraces'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getTrackTracesRequest($barcode = null, $country_code = null, $external_identifier = null, $extra_info = null, $postal_code = null, $sort = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTraces'][0]) @@ -4053,7 +4093,7 @@ public function getTrackTracesRequest($barcode = null, $country_code = null, $ex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4104,6 +4144,7 @@ public function getTrackTracesRequest($barcode = null, $country_code = null, $ex * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesTracktraces|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getTrackTracesByIds($ids, $sort = null, $extra_info = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTracesByIds'][0]) @@ -4125,6 +4166,7 @@ public function getTrackTracesByIds($ids, $sort = null, $extra_info = null, $use * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesTracktraces|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getTrackTracesByIdsWithHttpInfo($ids, $sort = null, $extra_info = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTracesByIds'][0]) @@ -4256,6 +4298,7 @@ public function getTrackTracesByIdsWithHttpInfo($ids, $sort = null, $extra_info * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackTracesByIds'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getTrackTracesByIdsAsync($ids, $sort = null, $extra_info = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTracesByIds'][0]) @@ -4280,6 +4323,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackTracesByIds'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getTrackTracesByIdsAsyncWithHttpInfo($ids, $sort = null, $extra_info = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTracesByIds'][0]) @@ -4333,6 +4377,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackTracesByIds'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getTrackTracesByIdsRequest($ids, $sort = null, $extra_info = null, $user_agent = null, string $contentType = self::contentTypes['getTrackTracesByIds'][0]) @@ -4417,7 +4462,7 @@ public function getTrackTracesByIdsRequest($ids, $sort = null, $extra_info = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4466,6 +4511,7 @@ public function getTrackTracesByIdsRequest($ids, $sort = null, $extra_info = nul * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CapabilitiesResponsesCapabilitiesV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postCapabilities($capabilities_post_capabilities_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilities'][0]) @@ -4485,6 +4531,7 @@ public function postCapabilities($capabilities_post_capabilities_request_v2, $us * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CapabilitiesResponsesCapabilitiesV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postCapabilitiesWithHttpInfo($capabilities_post_capabilities_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilities'][0]) @@ -4649,6 +4696,7 @@ public function postCapabilitiesWithHttpInfo($capabilities_post_capabilities_req * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCapabilities'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postCapabilitiesAsync($capabilities_post_capabilities_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilities'][0]) @@ -4671,6 +4719,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCapabilities'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postCapabilitiesAsyncWithHttpInfo($capabilities_post_capabilities_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilities'][0]) @@ -4722,6 +4771,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCapabilities'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postCapabilitiesRequest($capabilities_post_capabilities_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilities'][0]) @@ -4761,7 +4811,7 @@ public function postCapabilitiesRequest($capabilities_post_capabilities_request_ if (isset($capabilities_post_capabilities_request_v2)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($capabilities_post_capabilities_request_v2)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($capabilities_post_capabilities_request_v2), JSON_THROW_ON_ERROR); } else { $httpBody = $capabilities_post_capabilities_request_v2; } @@ -4782,7 +4832,7 @@ public function postCapabilitiesRequest($capabilities_post_capabilities_request_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4831,6 +4881,7 @@ public function postCapabilitiesRequest($capabilities_post_capabilities_request_ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CapabilitiesResponsesContractDefinitionsV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postCapabilitiesContractDefinitions($capabilities_post_contract_definitions_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilitiesContractDefinitions'][0]) @@ -4850,6 +4901,7 @@ public function postCapabilitiesContractDefinitions($capabilities_post_contract_ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CapabilitiesResponsesContractDefinitionsV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postCapabilitiesContractDefinitionsWithHttpInfo($capabilities_post_contract_definitions_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilitiesContractDefinitions'][0]) @@ -5014,6 +5066,7 @@ public function postCapabilitiesContractDefinitionsWithHttpInfo($capabilities_po * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCapabilitiesContractDefinitions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postCapabilitiesContractDefinitionsAsync($capabilities_post_contract_definitions_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilitiesContractDefinitions'][0]) @@ -5036,6 +5089,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCapabilitiesContractDefinitions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postCapabilitiesContractDefinitionsAsyncWithHttpInfo($capabilities_post_contract_definitions_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilitiesContractDefinitions'][0]) @@ -5087,6 +5141,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCapabilitiesContractDefinitions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postCapabilitiesContractDefinitionsRequest($capabilities_post_contract_definitions_request_v2, $user_agent = null, string $contentType = self::contentTypes['postCapabilitiesContractDefinitions'][0]) @@ -5126,7 +5181,7 @@ public function postCapabilitiesContractDefinitionsRequest($capabilities_post_co if (isset($capabilities_post_contract_definitions_request_v2)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($capabilities_post_contract_definitions_request_v2)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($capabilities_post_contract_definitions_request_v2), JSON_THROW_ON_ERROR); } else { $httpBody = $capabilities_post_contract_definitions_request_v2; } @@ -5147,7 +5202,7 @@ public function postCapabilitiesContractDefinitionsRequest($capabilities_post_co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5196,6 +5251,7 @@ public function postCapabilitiesContractDefinitionsRequest($capabilities_post_co * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefRatesResponseRateV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postRates($rates_post_rates_request_v2, $user_agent = null, string $contentType = self::contentTypes['postRates'][0]) @@ -5215,6 +5271,7 @@ public function postRates($rates_post_rates_request_v2, $user_agent = null, stri * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefRatesResponseRateV2|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postRatesWithHttpInfo($rates_post_rates_request_v2, $user_agent = null, string $contentType = self::contentTypes['postRates'][0]) @@ -5379,6 +5436,7 @@ public function postRatesWithHttpInfo($rates_post_rates_request_v2, $user_agent * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postRates'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postRatesAsync($rates_post_rates_request_v2, $user_agent = null, string $contentType = self::contentTypes['postRates'][0]) @@ -5401,6 +5459,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postRates'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postRatesAsyncWithHttpInfo($rates_post_rates_request_v2, $user_agent = null, string $contentType = self::contentTypes['postRates'][0]) @@ -5452,6 +5511,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postRates'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postRatesRequest($rates_post_rates_request_v2, $user_agent = null, string $contentType = self::contentTypes['postRates'][0]) @@ -5491,7 +5551,7 @@ public function postRatesRequest($rates_post_rates_request_v2, $user_agent = nul if (isset($rates_post_rates_request_v2)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rates_post_rates_request_v2)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($rates_post_rates_request_v2), JSON_THROW_ON_ERROR); } else { $httpBody = $rates_post_rates_request_v2; } @@ -5512,7 +5572,7 @@ public function postRatesRequest($rates_post_rates_request_v2, $user_agent = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5565,6 +5625,7 @@ public function postRatesRequest($rates_post_rates_request_v2, $user_agent = nul * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesPostShipmentsV12|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postShipments($shipment_post_shipments_request_v11, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['postShipments'][0]) @@ -5588,6 +5649,7 @@ public function postShipments($shipment_post_shipments_request_v11, $format = nu * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesPostShipmentsV12|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postShipmentsWithHttpInfo($shipment_post_shipments_request_v11, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['postShipments'][0]) @@ -5756,6 +5818,7 @@ public function postShipmentsWithHttpInfo($shipment_post_shipments_request_v11, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postShipmentsAsync($shipment_post_shipments_request_v11, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['postShipments'][0]) @@ -5782,6 +5845,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postShipmentsAsyncWithHttpInfo($shipment_post_shipments_request_v11, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['postShipments'][0]) @@ -5837,6 +5901,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postShipmentsRequest($shipment_post_shipments_request_v11, $format = null, $positions = null, $collect_date = null, $delivery_options_identifier = null, $user_agent = null, string $contentType = self::contentTypes['postShipments'][0]) @@ -5919,7 +5984,7 @@ public function postShipmentsRequest($shipment_post_shipments_request_v11, $form if (isset($shipment_post_shipments_request_v11)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shipment_post_shipments_request_v11)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($shipment_post_shipments_request_v11), JSON_THROW_ON_ERROR); } else { $httpBody = $shipment_post_shipments_request_v11; } @@ -5940,7 +6005,7 @@ public function postShipmentsRequest($shipment_post_shipments_request_v11, $form } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5988,6 +6053,7 @@ public function postShipmentsRequest($shipment_post_shipments_request_v11, $form * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesDownloadUrl|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorNotFound|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postUnrelatedReturnShipments($user_agent = null, string $contentType = self::contentTypes['postUnrelatedReturnShipments'][0]) @@ -6006,6 +6072,7 @@ public function postUnrelatedReturnShipments($user_agent = null, string $content * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesDownloadUrl|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorNotFound|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postUnrelatedReturnShipmentsWithHttpInfo($user_agent = null, string $contentType = self::contentTypes['postUnrelatedReturnShipments'][0]) @@ -6169,6 +6236,7 @@ public function postUnrelatedReturnShipmentsWithHttpInfo($user_agent = null, str * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postUnrelatedReturnShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postUnrelatedReturnShipmentsAsync($user_agent = null, string $contentType = self::contentTypes['postUnrelatedReturnShipments'][0]) @@ -6190,6 +6258,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postUnrelatedReturnShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postUnrelatedReturnShipmentsAsyncWithHttpInfo($user_agent = null, string $contentType = self::contentTypes['postUnrelatedReturnShipments'][0]) @@ -6240,6 +6309,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postUnrelatedReturnShipments'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postUnrelatedReturnShipmentsRequest($user_agent = null, string $contentType = self::contentTypes['postUnrelatedReturnShipments'][0]) @@ -6286,7 +6356,7 @@ public function postUnrelatedReturnShipmentsRequest($user_agent = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6335,6 +6405,7 @@ public function postUnrelatedReturnShipmentsRequest($user_agent = null, string $ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesPutShipmentsV12|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function putShipment($shipment_put_shipments_request_v11, $user_agent = null, string $contentType = self::contentTypes['putShipment'][0]) @@ -6354,6 +6425,7 @@ public function putShipment($shipment_put_shipments_request_v11, $user_agent = n * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentResponsesPutShipmentsV12|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserErrorInvalidContentType|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function putShipmentWithHttpInfo($shipment_put_shipments_request_v11, $user_agent = null, string $contentType = self::contentTypes['putShipment'][0]) @@ -6518,6 +6590,7 @@ public function putShipmentWithHttpInfo($shipment_put_shipments_request_v11, $us * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putShipment'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function putShipmentAsync($shipment_put_shipments_request_v11, $user_agent = null, string $contentType = self::contentTypes['putShipment'][0]) @@ -6540,6 +6613,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putShipment'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function putShipmentAsyncWithHttpInfo($shipment_put_shipments_request_v11, $user_agent = null, string $contentType = self::contentTypes['putShipment'][0]) @@ -6591,6 +6665,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putShipment'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function putShipmentRequest($shipment_put_shipments_request_v11, $user_agent = null, string $contentType = self::contentTypes['putShipment'][0]) @@ -6630,7 +6705,7 @@ public function putShipmentRequest($shipment_put_shipments_request_v11, $user_ag if (isset($shipment_put_shipments_request_v11)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shipment_put_shipments_request_v11)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($shipment_put_shipments_request_v11), JSON_THROW_ON_ERROR); } else { $httpBody = $shipment_put_shipments_request_v11; } @@ -6651,7 +6726,7 @@ public function putShipmentRequest($shipment_put_shipments_request_v11, $user_ag } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/Client/Generated/CoreApi/Api/WebhookApi.php b/src/Client/Generated/CoreApi/Api/WebhookApi.php index 3731e89e..360bcb87 100644 --- a/src/Client/Generated/CoreApi/Api/WebhookApi.php +++ b/src/Client/Generated/CoreApi/Api/WebhookApi.php @@ -144,6 +144,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function deleteWebhookSubscriptions($ids, $user_agent = null, string $contentType = self::contentTypes['deleteWebhookSubscriptions'][0]) @@ -162,6 +163,7 @@ public function deleteWebhookSubscriptions($ids, $user_agent = null, string $con * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteWebhookSubscriptionsWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['deleteWebhookSubscriptions'][0]) @@ -212,6 +214,7 @@ public function deleteWebhookSubscriptionsWithHttpInfo($ids, $user_agent = null, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteWebhookSubscriptionsAsync($ids, $user_agent = null, string $contentType = self::contentTypes['deleteWebhookSubscriptions'][0]) @@ -234,6 +237,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteWebhookSubscriptionsAsyncWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['deleteWebhookSubscriptions'][0]) @@ -272,6 +276,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function deleteWebhookSubscriptionsRequest($ids, $user_agent = null, string $contentType = self::contentTypes['deleteWebhookSubscriptions'][0]) @@ -333,7 +338,7 @@ public function deleteWebhookSubscriptionsRequest($ids, $user_agent = null, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -382,6 +387,7 @@ public function deleteWebhookSubscriptionsRequest($ids, $user_agent = null, stri * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\WebhooksResponsesWebhookSubscriptionsV11|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getWebhookSubscriptions($hook = null, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptions'][0]) @@ -401,6 +407,7 @@ public function getWebhookSubscriptions($hook = null, $user_agent = null, string * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\WebhooksResponsesWebhookSubscriptionsV11|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getWebhookSubscriptionsWithHttpInfo($hook = null, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptions'][0]) @@ -530,6 +537,7 @@ public function getWebhookSubscriptionsWithHttpInfo($hook = null, $user_agent = * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getWebhookSubscriptionsAsync($hook = null, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptions'][0]) @@ -552,6 +560,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getWebhookSubscriptionsAsyncWithHttpInfo($hook = null, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptions'][0]) @@ -603,6 +612,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getWebhookSubscriptionsRequest($hook = null, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptions'][0]) @@ -659,7 +669,7 @@ public function getWebhookSubscriptionsRequest($hook = null, $user_agent = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -708,6 +718,7 @@ public function getWebhookSubscriptionsRequest($hook = null, $user_agent = null, * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\WebhooksResponsesWebhookSubscriptionsV11|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function getWebhookSubscriptionsById($ids, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptionsById'][0]) @@ -727,6 +738,7 @@ public function getWebhookSubscriptionsById($ids, $user_agent = null, string $co * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\WebhooksResponsesWebhookSubscriptionsV11|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getWebhookSubscriptionsByIdWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptionsById'][0]) @@ -856,6 +868,7 @@ public function getWebhookSubscriptionsByIdWithHttpInfo($ids, $user_agent = null * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookSubscriptionsById'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getWebhookSubscriptionsByIdAsync($ids, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptionsById'][0]) @@ -878,6 +891,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookSubscriptionsById'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getWebhookSubscriptionsByIdAsyncWithHttpInfo($ids, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptionsById'][0]) @@ -929,6 +943,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookSubscriptionsById'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getWebhookSubscriptionsByIdRequest($ids, $user_agent = null, string $contentType = self::contentTypes['getWebhookSubscriptionsById'][0]) @@ -990,7 +1005,7 @@ public function getWebhookSubscriptionsByIdRequest($ids, $user_agent = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1039,6 +1054,7 @@ public function getWebhookSubscriptionsByIdRequest($ids, $user_agent = null, str * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\WebhooksResponsesPostWebhookSubscriptions|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError */ public function postWebhookSubscriptions($webhooks_post_webhook_subscriptions_request_v11, $user_agent = null, string $contentType = self::contentTypes['postWebhookSubscriptions'][0]) @@ -1058,6 +1074,7 @@ public function postWebhookSubscriptions($webhooks_post_webhook_subscriptions_re * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApi\Model\WebhooksResponsesPostWebhookSubscriptions|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApi\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postWebhookSubscriptionsWithHttpInfo($webhooks_post_webhook_subscriptions_request_v11, $user_agent = null, string $contentType = self::contentTypes['postWebhookSubscriptions'][0]) @@ -1187,6 +1204,7 @@ public function postWebhookSubscriptionsWithHttpInfo($webhooks_post_webhook_subs * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postWebhookSubscriptionsAsync($webhooks_post_webhook_subscriptions_request_v11, $user_agent = null, string $contentType = self::contentTypes['postWebhookSubscriptions'][0]) @@ -1209,6 +1227,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postWebhookSubscriptionsAsyncWithHttpInfo($webhooks_post_webhook_subscriptions_request_v11, $user_agent = null, string $contentType = self::contentTypes['postWebhookSubscriptions'][0]) @@ -1260,6 +1279,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postWebhookSubscriptions'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postWebhookSubscriptionsRequest($webhooks_post_webhook_subscriptions_request_v11, $user_agent = null, string $contentType = self::contentTypes['postWebhookSubscriptions'][0]) @@ -1299,7 +1319,7 @@ public function postWebhookSubscriptionsRequest($webhooks_post_webhook_subscript if (isset($webhooks_post_webhook_subscriptions_request_v11)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($webhooks_post_webhook_subscriptions_request_v11)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($webhooks_post_webhook_subscriptions_request_v11), JSON_THROW_ON_ERROR); } else { $httpBody = $webhooks_post_webhook_subscriptions_request_v11; } @@ -1320,7 +1340,7 @@ public function postWebhookSubscriptionsRequest($webhooks_post_webhook_subscript } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php b/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php index e303d384..166fa6ac 100644 --- a/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php +++ b/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php @@ -155,6 +155,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return void */ public function deleteShippingRule($shipping_rule_id, $user_agent = null, string $contentType = self::contentTypes['deleteShippingRule'][0]) @@ -173,6 +174,7 @@ public function deleteShippingRule($shipping_rule_id, $user_agent = null, string * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteShippingRuleWithHttpInfo($shipping_rule_id, $user_agent = null, string $contentType = self::contentTypes['deleteShippingRule'][0]) @@ -223,6 +225,7 @@ public function deleteShippingRuleWithHttpInfo($shipping_rule_id, $user_agent = * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteShippingRule'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteShippingRuleAsync($shipping_rule_id, $user_agent = null, string $contentType = self::contentTypes['deleteShippingRule'][0]) @@ -245,6 +248,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteShippingRule'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteShippingRuleAsyncWithHttpInfo($shipping_rule_id, $user_agent = null, string $contentType = self::contentTypes['deleteShippingRule'][0]) @@ -283,6 +287,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteShippingRule'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function deleteShippingRuleRequest($shipping_rule_id, $user_agent = null, string $contentType = self::contentTypes['deleteShippingRule'][0]) @@ -350,7 +355,7 @@ public function deleteShippingRuleRequest($shipping_rule_id, $user_agent = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -402,6 +407,7 @@ public function deleteShippingRuleRequest($shipping_rule_id, $user_agent = null, * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesImplications|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function getShippingRuleImplications($shop_id, $country = null, $region = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRuleImplications'][0]) @@ -424,6 +430,7 @@ public function getShippingRuleImplications($shop_id, $country = null, $region = * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesImplications|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getShippingRuleImplicationsWithHttpInfo($shop_id, $country = null, $region = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRuleImplications'][0]) @@ -556,6 +563,7 @@ public function getShippingRuleImplicationsWithHttpInfo($shop_id, $country = nul * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRuleImplications'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRuleImplicationsAsync($shop_id, $country = null, $region = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRuleImplications'][0]) @@ -581,6 +589,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRuleImplications'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRuleImplicationsAsyncWithHttpInfo($shop_id, $country = null, $region = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRuleImplications'][0]) @@ -635,6 +644,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRuleImplications'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShippingRuleImplicationsRequest($shop_id, $country = null, $region = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRuleImplications'][0]) @@ -741,7 +751,7 @@ public function getShippingRuleImplicationsRequest($shop_id, $country = null, $r } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -793,6 +803,7 @@ public function getShippingRuleImplicationsRequest($shop_id, $country = null, $r * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRulesPaginated|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function getShippingRules($page = null, $size = null, $shop_ids = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRules'][0]) @@ -815,6 +826,7 @@ public function getShippingRules($page = null, $size = null, $shop_ids = null, $ * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRulesPaginated|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getShippingRulesWithHttpInfo($page = null, $size = null, $shop_ids = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRules'][0]) @@ -947,6 +959,7 @@ public function getShippingRulesWithHttpInfo($page = null, $size = null, $shop_i * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRulesAsync($page = null, $size = null, $shop_ids = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRules'][0]) @@ -972,6 +985,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRulesAsyncWithHttpInfo($page = null, $size = null, $shop_ids = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRules'][0]) @@ -1026,6 +1040,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShippingRulesRequest($page = null, $size = null, $shop_ids = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRules'][0]) @@ -1127,7 +1142,7 @@ public function getShippingRulesRequest($page = null, $size = null, $shop_ids = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1176,6 +1191,7 @@ public function getShippingRulesRequest($page = null, $size = null, $shop_ids = * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function getShippingRulesByIds($shipping_rule_ids, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByIds'][0]) @@ -1195,6 +1211,7 @@ public function getShippingRulesByIds($shipping_rule_ids, $user_agent = null, st * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getShippingRulesByIdsWithHttpInfo($shipping_rule_ids, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByIds'][0]) @@ -1324,6 +1341,7 @@ public function getShippingRulesByIdsWithHttpInfo($shipping_rule_ids, $user_agen * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRulesByIds'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRulesByIdsAsync($shipping_rule_ids, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByIds'][0]) @@ -1346,6 +1364,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRulesByIds'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRulesByIdsAsyncWithHttpInfo($shipping_rule_ids, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByIds'][0]) @@ -1397,6 +1416,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRulesByIds'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShippingRulesByIdsRequest($shipping_rule_ids, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByIds'][0]) @@ -1458,7 +1478,7 @@ public function getShippingRulesByIdsRequest($shipping_rule_ids, $user_agent = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1510,6 +1530,7 @@ public function getShippingRulesByIdsRequest($shipping_rule_ids, $user_agent = n * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRulesPaginated|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function getShippingRulesByShop($shop_id, $page = null, $size = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByShop'][0]) @@ -1532,6 +1553,7 @@ public function getShippingRulesByShop($shop_id, $page = null, $size = null, $ty * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRulesPaginated|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function getShippingRulesByShopWithHttpInfo($shop_id, $page = null, $size = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByShop'][0]) @@ -1664,6 +1686,7 @@ public function getShippingRulesByShopWithHttpInfo($shop_id, $page = null, $size * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRulesByShop'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRulesByShopAsync($shop_id, $page = null, $size = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByShop'][0]) @@ -1689,6 +1712,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRulesByShop'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getShippingRulesByShopAsyncWithHttpInfo($shop_id, $page = null, $size = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByShop'][0]) @@ -1743,6 +1767,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getShippingRulesByShop'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function getShippingRulesByShopRequest($shop_id, $page = null, $size = null, $type = null, $user_agent = null, string $contentType = self::contentTypes['getShippingRulesByShop'][0]) @@ -1852,7 +1877,7 @@ public function getShippingRulesByShopRequest($shop_id, $page = null, $size = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1901,6 +1926,7 @@ public function getShippingRulesByShopRequest($shop_id, $page = null, $size = nu * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function patchShippingRules($shipping_rules_patch_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['patchShippingRules'][0]) @@ -1920,6 +1946,7 @@ public function patchShippingRules($shipping_rules_patch_shipping_rules, $user_a * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function patchShippingRulesWithHttpInfo($shipping_rules_patch_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['patchShippingRules'][0]) @@ -2049,6 +2076,7 @@ public function patchShippingRulesWithHttpInfo($shipping_rules_patch_shipping_ru * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function patchShippingRulesAsync($shipping_rules_patch_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['patchShippingRules'][0]) @@ -2071,6 +2099,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function patchShippingRulesAsyncWithHttpInfo($shipping_rules_patch_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['patchShippingRules'][0]) @@ -2122,6 +2151,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function patchShippingRulesRequest($shipping_rules_patch_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['patchShippingRules'][0]) @@ -2161,7 +2191,7 @@ public function patchShippingRulesRequest($shipping_rules_patch_shipping_rules, if (isset($shipping_rules_patch_shipping_rules)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shipping_rules_patch_shipping_rules)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($shipping_rules_patch_shipping_rules), JSON_THROW_ON_ERROR); } else { $httpBody = $shipping_rules_patch_shipping_rules; } @@ -2182,7 +2212,7 @@ public function patchShippingRulesRequest($shipping_rules_patch_shipping_rules, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2231,6 +2261,7 @@ public function patchShippingRulesRequest($shipping_rules_patch_shipping_rules, * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function postShippingRules($shipping_rules_post_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['postShippingRules'][0]) @@ -2250,6 +2281,7 @@ public function postShippingRules($shipping_rules_post_shipping_rules, $user_age * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function postShippingRulesWithHttpInfo($shipping_rules_post_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['postShippingRules'][0]) @@ -2379,6 +2411,7 @@ public function postShippingRulesWithHttpInfo($shipping_rules_post_shipping_rule * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postShippingRulesAsync($shipping_rules_post_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['postShippingRules'][0]) @@ -2401,6 +2434,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function postShippingRulesAsyncWithHttpInfo($shipping_rules_post_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['postShippingRules'][0]) @@ -2452,6 +2486,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function postShippingRulesRequest($shipping_rules_post_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['postShippingRules'][0]) @@ -2491,7 +2526,7 @@ public function postShippingRulesRequest($shipping_rules_post_shipping_rules, $u if (isset($shipping_rules_post_shipping_rules)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shipping_rules_post_shipping_rules)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($shipping_rules_post_shipping_rules), JSON_THROW_ON_ERROR); } else { $httpBody = $shipping_rules_post_shipping_rules; } @@ -2512,7 +2547,7 @@ public function postShippingRulesRequest($shipping_rules_post_shipping_rules, $u } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2561,6 +2596,7 @@ public function postShippingRulesRequest($shipping_rules_post_shipping_rules, $u * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError */ public function putShippingRules($shipping_rules_put_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['putShippingRules'][0]) @@ -2580,6 +2616,7 @@ public function putShippingRules($shipping_rules_put_shipping_rules, $user_agent * * @throws \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\ShippingRulesResponsesShippingRules|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesUserError|\MyParcelNL\Sdk\Client\Generated\CoreApiPrivate\Model\CommonResponsesSystemError, HTTP status code, HTTP response headers (array of strings) */ public function putShippingRulesWithHttpInfo($shipping_rules_put_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['putShippingRules'][0]) @@ -2709,6 +2746,7 @@ public function putShippingRulesWithHttpInfo($shipping_rules_put_shipping_rules, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function putShippingRulesAsync($shipping_rules_put_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['putShippingRules'][0]) @@ -2731,6 +2769,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function putShippingRulesAsyncWithHttpInfo($shipping_rules_put_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['putShippingRules'][0]) @@ -2782,6 +2821,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putShippingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function putShippingRulesRequest($shipping_rules_put_shipping_rules, $user_agent = null, string $contentType = self::contentTypes['putShippingRules'][0]) @@ -2821,7 +2861,7 @@ public function putShippingRulesRequest($shipping_rules_put_shipping_rules, $use if (isset($shipping_rules_put_shipping_rules)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shipping_rules_put_shipping_rules)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($shipping_rules_put_shipping_rules), JSON_THROW_ON_ERROR); } else { $httpBody = $shipping_rules_put_shipping_rules; } @@ -2842,7 +2882,7 @@ public function putShippingRulesRequest($shipping_rules_put_shipping_rules, $use } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/Client/Generated/IamApi/Api/DefaultApi.php b/src/Client/Generated/IamApi/Api/DefaultApi.php index ab6b17d9..180476dd 100644 --- a/src/Client/Generated/IamApi/Api/DefaultApi.php +++ b/src/Client/Generated/IamApi/Api/DefaultApi.php @@ -131,6 +131,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\IamApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\IamApi\Model\FixedPrincipal */ public function whoamiGet(string $contentType = self::contentTypes['whoamiGet'][0]) @@ -148,6 +149,7 @@ public function whoamiGet(string $contentType = self::contentTypes['whoamiGet'][ * * @throws \MyParcelNL\Sdk\Client\Generated\IamApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\IamApi\Model\FixedPrincipal, HTTP status code, HTTP response headers (array of strings) */ public function whoamiGetWithHttpInfo(string $contentType = self::contentTypes['whoamiGet'][0]) @@ -271,6 +273,7 @@ public function whoamiGetWithHttpInfo(string $contentType = self::contentTypes[' * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whoamiGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function whoamiGetAsync(string $contentType = self::contentTypes['whoamiGet'][0]) @@ -291,6 +294,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whoamiGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function whoamiGetAsyncWithHttpInfo(string $contentType = self::contentTypes['whoamiGet'][0]) @@ -340,6 +344,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whoamiGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function whoamiGetRequest(string $contentType = self::contentTypes['whoamiGet'][0]) @@ -381,7 +386,7 @@ public function whoamiGetRequest(string $contentType = self::contentTypes['whoam } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/Client/Generated/OrderApi/Api/DefaultApi.php b/src/Client/Generated/OrderApi/Api/DefaultApi.php index 4efe84e5..21255488 100644 --- a/src/Client/Generated/OrderApi/Api/DefaultApi.php +++ b/src/Client/Generated/OrderApi/Api/DefaultApi.php @@ -174,6 +174,7 @@ public function getConfig() * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AddNotePost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function addNotePost($add_note_post_request_inner, string $contentType = self::contentTypes['addNotePost'][0]) @@ -192,6 +193,7 @@ public function addNotePost($add_note_post_request_inner, string $contentType = * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AddNotePost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function addNotePostWithHttpInfo($add_note_post_request_inner, string $contentType = self::contentTypes['addNotePost'][0]) @@ -351,6 +353,7 @@ public function addNotePostWithHttpInfo($add_note_post_request_inner, string $co * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addNotePost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function addNotePostAsync($add_note_post_request_inner, string $contentType = self::contentTypes['addNotePost'][0]) @@ -372,6 +375,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addNotePost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function addNotePostAsyncWithHttpInfo($add_note_post_request_inner, string $contentType = self::contentTypes['addNotePost'][0]) @@ -422,6 +426,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addNotePost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function addNotePostRequest($add_note_post_request_inner, string $contentType = self::contentTypes['addNotePost'][0]) @@ -462,7 +467,7 @@ public function addNotePostRequest($add_note_post_request_inner, string $content if (isset($add_note_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_note_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_note_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $add_note_post_request_inner; } @@ -483,7 +488,7 @@ public function addNotePostRequest($add_note_post_request_inner, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -522,6 +527,7 @@ public function addNotePostRequest($add_note_post_request_inner, string $content * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AddNotePost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function addPackagesPost($add_packages, string $contentType = self::contentTypes['addPackagesPost'][0]) @@ -540,6 +546,7 @@ public function addPackagesPost($add_packages, string $contentType = self::conte * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AddNotePost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function addPackagesPostWithHttpInfo($add_packages, string $contentType = self::contentTypes['addPackagesPost'][0]) @@ -699,6 +706,7 @@ public function addPackagesPostWithHttpInfo($add_packages, string $contentType = * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPackagesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function addPackagesPostAsync($add_packages, string $contentType = self::contentTypes['addPackagesPost'][0]) @@ -720,6 +728,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPackagesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function addPackagesPostAsyncWithHttpInfo($add_packages, string $contentType = self::contentTypes['addPackagesPost'][0]) @@ -770,6 +779,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPackagesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function addPackagesPostRequest($add_packages, string $contentType = self::contentTypes['addPackagesPost'][0]) @@ -810,7 +820,7 @@ public function addPackagesPostRequest($add_packages, string $contentType = self if (isset($add_packages)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_packages)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_packages), JSON_THROW_ON_ERROR); } else { $httpBody = $add_packages; } @@ -831,7 +841,7 @@ public function addPackagesPostRequest($add_packages, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -868,6 +878,7 @@ public function addPackagesPostRequest($add_packages, string $contentType = self * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function assignToUserPost($assign_to_user_post_request_inner, string $contentType = self::contentTypes['assignToUserPost'][0]) @@ -884,6 +895,7 @@ public function assignToUserPost($assign_to_user_post_request_inner, string $con * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function assignToUserPostWithHttpInfo($assign_to_user_post_request_inner, string $contentType = self::contentTypes['assignToUserPost'][0]) @@ -1041,6 +1053,7 @@ public function assignToUserPostWithHttpInfo($assign_to_user_post_request_inner, * @param string $contentType The value for the Content-Type header. Check self::contentTypes['assignToUserPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function assignToUserPostAsync($assign_to_user_post_request_inner, string $contentType = self::contentTypes['assignToUserPost'][0]) @@ -1060,6 +1073,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['assignToUserPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function assignToUserPostAsyncWithHttpInfo($assign_to_user_post_request_inner, string $contentType = self::contentTypes['assignToUserPost'][0]) @@ -1110,6 +1124,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['assignToUserPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function assignToUserPostRequest($assign_to_user_post_request_inner, string $contentType = self::contentTypes['assignToUserPost'][0]) @@ -1150,7 +1165,7 @@ public function assignToUserPostRequest($assign_to_user_post_request_inner, stri if (isset($assign_to_user_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($assign_to_user_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($assign_to_user_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $assign_to_user_post_request_inner; } @@ -1171,7 +1186,7 @@ public function assignToUserPostRequest($assign_to_user_post_request_inner, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1210,6 +1225,7 @@ public function assignToUserPostRequest($assign_to_user_post_request_inner, stri * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function cancelPost($cancel_post_request_inner, string $contentType = self::contentTypes['cancelPost'][0]) @@ -1228,6 +1244,7 @@ public function cancelPost($cancel_post_request_inner, string $contentType = sel * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function cancelPostWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['cancelPost'][0]) @@ -1387,6 +1404,7 @@ public function cancelPostWithHttpInfo($cancel_post_request_inner, string $conte * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function cancelPostAsync($cancel_post_request_inner, string $contentType = self::contentTypes['cancelPost'][0]) @@ -1408,6 +1426,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function cancelPostAsyncWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['cancelPost'][0]) @@ -1458,6 +1477,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function cancelPostRequest($cancel_post_request_inner, string $contentType = self::contentTypes['cancelPost'][0]) @@ -1498,7 +1518,7 @@ public function cancelPostRequest($cancel_post_request_inner, string $contentTyp if (isset($cancel_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $cancel_post_request_inner; } @@ -1519,7 +1539,7 @@ public function cancelPostRequest($cancel_post_request_inner, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1558,6 +1578,7 @@ public function cancelPostRequest($cancel_post_request_inner, string $contentTyp * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\CreateFromShippablePackagesPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function createFromShippablePackagesPost($create_order_from_shippable_packages, string $contentType = self::contentTypes['createFromShippablePackagesPost'][0]) @@ -1576,6 +1597,7 @@ public function createFromShippablePackagesPost($create_order_from_shippable_pac * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\CreateFromShippablePackagesPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function createFromShippablePackagesPostWithHttpInfo($create_order_from_shippable_packages, string $contentType = self::contentTypes['createFromShippablePackagesPost'][0]) @@ -1735,6 +1757,7 @@ public function createFromShippablePackagesPostWithHttpInfo($create_order_from_s * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFromShippablePackagesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function createFromShippablePackagesPostAsync($create_order_from_shippable_packages, string $contentType = self::contentTypes['createFromShippablePackagesPost'][0]) @@ -1756,6 +1779,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFromShippablePackagesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function createFromShippablePackagesPostAsyncWithHttpInfo($create_order_from_shippable_packages, string $contentType = self::contentTypes['createFromShippablePackagesPost'][0]) @@ -1806,6 +1830,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFromShippablePackagesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function createFromShippablePackagesPostRequest($create_order_from_shippable_packages, string $contentType = self::contentTypes['createFromShippablePackagesPost'][0]) @@ -1846,7 +1871,7 @@ public function createFromShippablePackagesPostRequest($create_order_from_shippa if (isset($create_order_from_shippable_packages)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_order_from_shippable_packages)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_order_from_shippable_packages), JSON_THROW_ON_ERROR); } else { $httpBody = $create_order_from_shippable_packages; } @@ -1867,7 +1892,7 @@ public function createFromShippablePackagesPostRequest($create_order_from_shippa } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1906,6 +1931,7 @@ public function createFromShippablePackagesPostRequest($create_order_from_shippa * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function editNotePost($edit_note_post_request_inner, string $contentType = self::contentTypes['editNotePost'][0]) @@ -1924,6 +1950,7 @@ public function editNotePost($edit_note_post_request_inner, string $contentType * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function editNotePostWithHttpInfo($edit_note_post_request_inner, string $contentType = self::contentTypes['editNotePost'][0]) @@ -2083,6 +2110,7 @@ public function editNotePostWithHttpInfo($edit_note_post_request_inner, string $ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editNotePost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function editNotePostAsync($edit_note_post_request_inner, string $contentType = self::contentTypes['editNotePost'][0]) @@ -2104,6 +2132,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editNotePost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function editNotePostAsyncWithHttpInfo($edit_note_post_request_inner, string $contentType = self::contentTypes['editNotePost'][0]) @@ -2154,6 +2183,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editNotePost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function editNotePostRequest($edit_note_post_request_inner, string $contentType = self::contentTypes['editNotePost'][0]) @@ -2194,7 +2224,7 @@ public function editNotePostRequest($edit_note_post_request_inner, string $conte if (isset($edit_note_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($edit_note_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($edit_note_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $edit_note_post_request_inner; } @@ -2215,7 +2245,7 @@ public function editNotePostRequest($edit_note_post_request_inner, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2254,6 +2284,7 @@ public function editNotePostRequest($edit_note_post_request_inner, string $conte * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function evaluateRulesPost($cancel_post_request_inner, string $contentType = self::contentTypes['evaluateRulesPost'][0]) @@ -2272,6 +2303,7 @@ public function evaluateRulesPost($cancel_post_request_inner, string $contentTyp * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function evaluateRulesPostWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['evaluateRulesPost'][0]) @@ -2431,6 +2463,7 @@ public function evaluateRulesPostWithHttpInfo($cancel_post_request_inner, string * @param string $contentType The value for the Content-Type header. Check self::contentTypes['evaluateRulesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function evaluateRulesPostAsync($cancel_post_request_inner, string $contentType = self::contentTypes['evaluateRulesPost'][0]) @@ -2452,6 +2485,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['evaluateRulesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function evaluateRulesPostAsyncWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['evaluateRulesPost'][0]) @@ -2502,6 +2536,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['evaluateRulesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function evaluateRulesPostRequest($cancel_post_request_inner, string $contentType = self::contentTypes['evaluateRulesPost'][0]) @@ -2542,7 +2577,7 @@ public function evaluateRulesPostRequest($cancel_post_request_inner, string $con if (isset($cancel_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $cancel_post_request_inner; } @@ -2563,7 +2598,7 @@ public function evaluateRulesPostRequest($cancel_post_request_inner, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2602,6 +2637,7 @@ public function evaluateRulesPostRequest($cancel_post_request_inner, string $con * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function importPost($cancel_post_request_inner, string $contentType = self::contentTypes['importPost'][0]) @@ -2620,6 +2656,7 @@ public function importPost($cancel_post_request_inner, string $contentType = sel * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function importPostWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['importPost'][0]) @@ -2779,6 +2816,7 @@ public function importPostWithHttpInfo($cancel_post_request_inner, string $conte * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function importPostAsync($cancel_post_request_inner, string $contentType = self::contentTypes['importPost'][0]) @@ -2800,6 +2838,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function importPostAsyncWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['importPost'][0]) @@ -2850,6 +2889,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function importPostRequest($cancel_post_request_inner, string $contentType = self::contentTypes['importPost'][0]) @@ -2890,7 +2930,7 @@ public function importPostRequest($cancel_post_request_inner, string $contentTyp if (isset($cancel_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $cancel_post_request_inner; } @@ -2911,7 +2951,7 @@ public function importPostRequest($cancel_post_request_inner, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2955,6 +2995,7 @@ public function importPostRequest($cancel_post_request_inner, string $contentTyp * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\OrdersGet200Response|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function ordersGet($aggregations = null, $filter = null, $limit = 50, $page_token = null, $query = null, $sort = null, string $contentType = self::contentTypes['ordersGet'][0]) @@ -2978,6 +3019,7 @@ public function ordersGet($aggregations = null, $filter = null, $limit = 50, $pa * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\OrdersGet200Response|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function ordersGetWithHttpInfo($aggregations = null, $filter = null, $limit = 50, $page_token = null, $query = null, $sort = null, string $contentType = self::contentTypes['ordersGet'][0]) @@ -3142,6 +3184,7 @@ public function ordersGetWithHttpInfo($aggregations = null, $filter = null, $lim * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ordersGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function ordersGetAsync($aggregations = null, $filter = null, $limit = 50, $page_token = null, $query = null, $sort = null, string $contentType = self::contentTypes['ordersGet'][0]) @@ -3168,6 +3211,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ordersGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function ordersGetAsyncWithHttpInfo($aggregations = null, $filter = null, $limit = 50, $page_token = null, $query = null, $sort = null, string $contentType = self::contentTypes['ordersGet'][0]) @@ -3223,6 +3267,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['ordersGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function ordersGetRequest($aggregations = null, $filter = null, $limit = 50, $page_token = null, $query = null, $sort = null, string $contentType = self::contentTypes['ordersGet'][0]) @@ -3348,7 +3393,7 @@ public function ordersGetRequest($aggregations = null, $filter = null, $limit = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3390,6 +3435,7 @@ public function ordersGetRequest($aggregations = null, $filter = null, $limit = * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \SplFileObject|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function packingSlipsGet($order_id, $accept, $shipment_labels_layout = null, $package_id = null, string $contentType = self::contentTypes['packingSlipsGet'][0]) @@ -3411,6 +3457,7 @@ public function packingSlipsGet($order_id, $accept, $shipment_labels_layout = nu * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \SplFileObject|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function packingSlipsGetWithHttpInfo($order_id, $accept, $shipment_labels_layout = null, $package_id = null, string $contentType = self::contentTypes['packingSlipsGet'][0]) @@ -3573,6 +3620,7 @@ public function packingSlipsGetWithHttpInfo($order_id, $accept, $shipment_labels * @param string $contentType The value for the Content-Type header. Check self::contentTypes['packingSlipsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function packingSlipsGetAsync($order_id, $accept, $shipment_labels_layout = null, $package_id = null, string $contentType = self::contentTypes['packingSlipsGet'][0]) @@ -3597,6 +3645,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['packingSlipsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function packingSlipsGetAsyncWithHttpInfo($order_id, $accept, $shipment_labels_layout = null, $package_id = null, string $contentType = self::contentTypes['packingSlipsGet'][0]) @@ -3650,6 +3699,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['packingSlipsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function packingSlipsGetRequest($order_id, $accept, $shipment_labels_layout = null, $package_id = null, string $contentType = self::contentTypes['packingSlipsGet'][0]) @@ -3750,7 +3800,7 @@ public function packingSlipsGetRequest($order_id, $accept, $shipment_labels_layo } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3790,6 +3840,7 @@ public function packingSlipsGetRequest($order_id, $accept, $shipment_labels_layo * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \SplFileObject|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function picklistGet($order_id, $accept, string $contentType = self::contentTypes['picklistGet'][0]) @@ -3809,6 +3860,7 @@ public function picklistGet($order_id, $accept, string $contentType = self::cont * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \SplFileObject|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function picklistGetWithHttpInfo($order_id, $accept, string $contentType = self::contentTypes['picklistGet'][0]) @@ -3969,6 +4021,7 @@ public function picklistGetWithHttpInfo($order_id, $accept, string $contentType * @param string $contentType The value for the Content-Type header. Check self::contentTypes['picklistGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function picklistGetAsync($order_id, $accept, string $contentType = self::contentTypes['picklistGet'][0]) @@ -3991,6 +4044,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['picklistGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function picklistGetAsyncWithHttpInfo($order_id, $accept, string $contentType = self::contentTypes['picklistGet'][0]) @@ -4042,6 +4096,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['picklistGet'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function picklistGetRequest($order_id, $accept, string $contentType = self::contentTypes['picklistGet'][0]) @@ -4116,7 +4171,7 @@ public function picklistGetRequest($order_id, $accept, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4155,6 +4210,7 @@ public function picklistGetRequest($order_id, $accept, string $contentType = sel * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function preparePackagesForShipmentPost($prepare_packages_for_shipment, string $contentType = self::contentTypes['preparePackagesForShipmentPost'][0]) @@ -4173,6 +4229,7 @@ public function preparePackagesForShipmentPost($prepare_packages_for_shipment, s * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function preparePackagesForShipmentPostWithHttpInfo($prepare_packages_for_shipment, string $contentType = self::contentTypes['preparePackagesForShipmentPost'][0]) @@ -4332,6 +4389,7 @@ public function preparePackagesForShipmentPostWithHttpInfo($prepare_packages_for * @param string $contentType The value for the Content-Type header. Check self::contentTypes['preparePackagesForShipmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function preparePackagesForShipmentPostAsync($prepare_packages_for_shipment, string $contentType = self::contentTypes['preparePackagesForShipmentPost'][0]) @@ -4353,6 +4411,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['preparePackagesForShipmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function preparePackagesForShipmentPostAsyncWithHttpInfo($prepare_packages_for_shipment, string $contentType = self::contentTypes['preparePackagesForShipmentPost'][0]) @@ -4403,6 +4462,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['preparePackagesForShipmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function preparePackagesForShipmentPostRequest($prepare_packages_for_shipment, string $contentType = self::contentTypes['preparePackagesForShipmentPost'][0]) @@ -4443,7 +4503,7 @@ public function preparePackagesForShipmentPostRequest($prepare_packages_for_ship if (isset($prepare_packages_for_shipment)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($prepare_packages_for_shipment)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($prepare_packages_for_shipment), JSON_THROW_ON_ERROR); } else { $httpBody = $prepare_packages_for_shipment; } @@ -4464,7 +4524,7 @@ public function preparePackagesForShipmentPostRequest($prepare_packages_for_ship } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4503,6 +4563,7 @@ public function preparePackagesForShipmentPostRequest($prepare_packages_for_ship * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function removeNotesPost($remove_notes_post_request_inner, string $contentType = self::contentTypes['removeNotesPost'][0]) @@ -4521,6 +4582,7 @@ public function removeNotesPost($remove_notes_post_request_inner, string $conten * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function removeNotesPostWithHttpInfo($remove_notes_post_request_inner, string $contentType = self::contentTypes['removeNotesPost'][0]) @@ -4680,6 +4742,7 @@ public function removeNotesPostWithHttpInfo($remove_notes_post_request_inner, st * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeNotesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function removeNotesPostAsync($remove_notes_post_request_inner, string $contentType = self::contentTypes['removeNotesPost'][0]) @@ -4701,6 +4764,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeNotesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function removeNotesPostAsyncWithHttpInfo($remove_notes_post_request_inner, string $contentType = self::contentTypes['removeNotesPost'][0]) @@ -4751,6 +4815,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeNotesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function removeNotesPostRequest($remove_notes_post_request_inner, string $contentType = self::contentTypes['removeNotesPost'][0]) @@ -4791,7 +4856,7 @@ public function removeNotesPostRequest($remove_notes_post_request_inner, string if (isset($remove_notes_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($remove_notes_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($remove_notes_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $remove_notes_post_request_inner; } @@ -4812,7 +4877,7 @@ public function removeNotesPostRequest($remove_notes_post_request_inner, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4849,6 +4914,7 @@ public function removeNotesPostRequest($remove_notes_post_request_inner, string * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function unassignFromUserPost($cancel_post_request_inner, string $contentType = self::contentTypes['unassignFromUserPost'][0]) @@ -4865,6 +4931,7 @@ public function unassignFromUserPost($cancel_post_request_inner, string $content * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function unassignFromUserPostWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['unassignFromUserPost'][0]) @@ -5022,6 +5089,7 @@ public function unassignFromUserPostWithHttpInfo($cancel_post_request_inner, str * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unassignFromUserPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function unassignFromUserPostAsync($cancel_post_request_inner, string $contentType = self::contentTypes['unassignFromUserPost'][0]) @@ -5041,6 +5109,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unassignFromUserPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function unassignFromUserPostAsyncWithHttpInfo($cancel_post_request_inner, string $contentType = self::contentTypes['unassignFromUserPost'][0]) @@ -5091,6 +5160,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unassignFromUserPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function unassignFromUserPostRequest($cancel_post_request_inner, string $contentType = self::contentTypes['unassignFromUserPost'][0]) @@ -5131,7 +5201,7 @@ public function unassignFromUserPostRequest($cancel_post_request_inner, string $ if (isset($cancel_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($cancel_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $cancel_post_request_inner; } @@ -5152,7 +5222,7 @@ public function unassignFromUserPostRequest($cancel_post_request_inner, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5191,6 +5261,7 @@ public function unassignFromUserPostRequest($cancel_post_request_inner, string $ * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax */ public function unpreparePackagesForShipmentPost($unprepare_packages_for_shipment_post_request_inner, string $contentType = self::contentTypes['unpreparePackagesForShipmentPost'][0]) @@ -5209,6 +5280,7 @@ public function unpreparePackagesForShipmentPost($unprepare_packages_for_shipmen * * @throws \MyParcelNL\Sdk\Client\Generated\OrderApi\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException + * @throws \JsonException * @return array of \MyParcelNL\Sdk\Client\Generated\OrderApi\Model\AssignToUserPost200ResponseInner[]|\MyParcelNL\Sdk\Client\Generated\OrderApi\Model\ProblemDetailsInvalidRequestSyntax, HTTP status code, HTTP response headers (array of strings) */ public function unpreparePackagesForShipmentPostWithHttpInfo($unprepare_packages_for_shipment_post_request_inner, string $contentType = self::contentTypes['unpreparePackagesForShipmentPost'][0]) @@ -5368,6 +5440,7 @@ public function unpreparePackagesForShipmentPostWithHttpInfo($unprepare_packages * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpreparePackagesForShipmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function unpreparePackagesForShipmentPostAsync($unprepare_packages_for_shipment_post_request_inner, string $contentType = self::contentTypes['unpreparePackagesForShipmentPost'][0]) @@ -5389,6 +5462,7 @@ function ($response) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpreparePackagesForShipmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Promise\PromiseInterface */ public function unpreparePackagesForShipmentPostAsyncWithHttpInfo($unprepare_packages_for_shipment_post_request_inner, string $contentType = self::contentTypes['unpreparePackagesForShipmentPost'][0]) @@ -5439,6 +5513,7 @@ function ($exception) { * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpreparePackagesForShipmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException + * @throws \JsonException * @return \GuzzleHttp\Psr7\Request */ public function unpreparePackagesForShipmentPostRequest($unprepare_packages_for_shipment_post_request_inner, string $contentType = self::contentTypes['unpreparePackagesForShipmentPost'][0]) @@ -5479,7 +5554,7 @@ public function unpreparePackagesForShipmentPostRequest($unprepare_packages_for_ if (isset($unprepare_packages_for_shipment_post_request_inner)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unprepare_packages_for_shipment_post_request_inner)); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($unprepare_packages_for_shipment_post_request_inner), JSON_THROW_ON_ERROR); } else { $httpBody = $unprepare_packages_for_shipment_post_request_inner; } @@ -5500,7 +5575,7 @@ public function unpreparePackagesForShipmentPostRequest($unprepare_packages_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php b/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php index 3a2e4b41..0cb75ade 100644 --- a/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php +++ b/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php @@ -6,6 +6,7 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Psr7\Response; +use JsonException; use MyParcelNL\Sdk\Client\Generated\CoreApi\Api\ShipmentApi; use MyParcelNL\Sdk\Client\Generated\CoreApi\Configuration; use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentPostShipmentsRequestV11; @@ -16,6 +17,21 @@ final class ShipmentApiPostShipmentsTest extends TestCase { + public function testPostShipmentsRequestThrowsForInvalidJson(): void + { + $data = new ShipmentPostShipmentsRequestV11Data(); + $data->setShipments([(new ShipmentRequest())->setNote("\xB1\x31")]); + $data->setUserAgent('SDK-Test/1.0'); + + $request = new ShipmentPostShipmentsRequestV11(); + $request->setData($data); + + $api = new ShipmentApi($this->createMock(ClientInterface::class), new Configuration()); + + $this->expectException(JsonException::class); + $api->postShipmentsRequest($request, null, null, null, null, null, 'application/json'); + } + public function testPostShipmentsDeserializesMultiColloRegionsAsStrings(): void { $client = $this->createMock(ClientInterface::class); diff --git a/test/Client/GeneratedJsonEncodingTest.php b/test/Client/GeneratedJsonEncodingTest.php new file mode 100644 index 00000000..9725f8b1 --- /dev/null +++ b/test/Client/GeneratedJsonEncodingTest.php @@ -0,0 +1,27 @@ + false !== strpos( + (string) file_get_contents($file), + '\\GuzzleHttp\\Utils::jsonEncode' + ) + ); + + self::assertSame([], array_values($deprecatedFiles)); + } +} From 5d55871713b52ee16da6d5d0b5b2c42615c099fb Mon Sep 17 00:00:00 2001 From: Nabil Azahaf Date: Fri, 7 Aug 2026 11:29:01 +0200 Subject: [PATCH 2/2] fix: handle invalid async JSON --- openapi/templates/api.mustache | 20 +- .../Generated/CoreApi/Api/DefaultApi.php | 16 +- .../Generated/CoreApi/Api/NotificationApi.php | 48 +++- .../Generated/CoreApi/Api/ShipmentApi.php | 212 ++++++++++++++-- .../Generated/CoreApi/Api/WebhookApi.php | 50 +++- .../CoreApiPrivate/Api/ShippingRuleApi.php | 114 +++++++-- .../Generated/IamApi/Api/DefaultApi.php | 16 +- .../Generated/OrderApi/Api/DefaultApi.php | 240 +++++++++++++++--- .../CoreApi/ShipmentApiPostShipmentsTest.php | 34 +++ test/Client/GeneratedJsonEncodingTest.php | 17 ++ 10 files changed, 674 insertions(+), 93 deletions(-) diff --git a/openapi/templates/api.mustache b/openapi/templates/api.mustache index ce998c53..986ef2dc 100644 --- a/openapi/templates/api.mustache +++ b/openapi/templates/api.mustache @@ -5,7 +5,9 @@ json_encode(..., JSON_THROW_ON_ERROR), and the resulting JsonException is documented on generated request methods. Guzzle deprecated the helper in 7.15 and removes it in 8.0. Fail-fast semantics are preserved, with the - native JsonException replacing Guzzle's InvalidArgumentException. + native JsonException replacing Guzzle's InvalidArgumentException. Async + response decoding also uses JSON_THROW_ON_ERROR and maps failures to an + ApiException, matching the synchronous response path. When the pinned generator version changes, refresh this file from the new stock template and re-apply the delta. @@ -497,14 +499,26 @@ use {{invokerPackage}}\ObjectSerializer; return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { {{#returnType}} if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/CoreApi/Api/DefaultApi.php b/src/Client/Generated/CoreApi/Api/DefaultApi.php index 293a9629..e412f18d 100644 --- a/src/Client/Generated/CoreApi/Api/DefaultApi.php +++ b/src/Client/Generated/CoreApi/Api/DefaultApi.php @@ -304,13 +304,25 @@ public function getIndexAsyncWithHttpInfo($user_agent = null, string $contentTyp return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/CoreApi/Api/NotificationApi.php b/src/Client/Generated/CoreApi/Api/NotificationApi.php index a782b18f..435d7ffb 100644 --- a/src/Client/Generated/CoreApi/Api/NotificationApi.php +++ b/src/Client/Generated/CoreApi/Api/NotificationApi.php @@ -1600,13 +1600,25 @@ public function getNotificationGroupsAsyncWithHttpInfo($shop_id = null, $user_ag return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1931,13 +1943,25 @@ public function getNotificationTemplatesAsyncWithHttpInfo($notification_group_id return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2267,13 +2291,25 @@ public function postNotificationGroupsAsyncWithHttpInfo($notification_post_notif return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/CoreApi/Api/ShipmentApi.php b/src/Client/Generated/CoreApi/Api/ShipmentApi.php index 482f14fa..bb6d7f61 100644 --- a/src/Client/Generated/CoreApi/Api/ShipmentApi.php +++ b/src/Client/Generated/CoreApi/Api/ShipmentApi.php @@ -287,7 +287,7 @@ public function deleteShipmentsAsyncWithHttpInfo($ids, $user_agent = null, strin return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { @@ -678,13 +678,25 @@ public function getDeliveryOptionsAsyncWithHttpInfo($cc = null, $postal_code = n return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1316,13 +1328,25 @@ public function getDropOffPointsAsyncWithHttpInfo($postal_code = null, $number = return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1930,13 +1954,25 @@ public function getPickupLocationsAsyncWithHttpInfo($cc = null, $postal_code = n return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2584,13 +2620,25 @@ public function getShipmentsAsyncWithHttpInfo($barcode = null, $carrier_id = nul return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -3160,13 +3208,25 @@ public function getShipmentsByIdAsyncWithHttpInfo($ids, $link_consumer_portal = return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -3476,7 +3536,7 @@ public function getShipmentsLabelsAsyncWithHttpInfo($ids, $format = null, $posit return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { @@ -3901,13 +3961,25 @@ public function getTrackTracesAsyncWithHttpInfo($barcode = null, $country_code = return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -4334,13 +4406,25 @@ public function getTrackTracesByIdsAsyncWithHttpInfo($ids, $sort = null, $extra_ return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -4730,13 +4814,25 @@ public function postCapabilitiesAsyncWithHttpInfo($capabilities_post_capabilitie return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -5100,13 +5196,25 @@ public function postCapabilitiesContractDefinitionsAsyncWithHttpInfo($capabiliti return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -5470,13 +5578,25 @@ public function postRatesAsyncWithHttpInfo($rates_post_rates_request_v2, $user_a return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -5856,13 +5976,25 @@ public function postShipmentsAsyncWithHttpInfo($shipment_post_shipments_request_ return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -6269,13 +6401,25 @@ public function postUnrelatedReturnShipmentsAsyncWithHttpInfo($user_agent = null return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -6624,13 +6768,25 @@ public function putShipmentAsyncWithHttpInfo($shipment_put_shipments_request_v11 return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/CoreApi/Api/WebhookApi.php b/src/Client/Generated/CoreApi/Api/WebhookApi.php index 360bcb87..9e3d1b4e 100644 --- a/src/Client/Generated/CoreApi/Api/WebhookApi.php +++ b/src/Client/Generated/CoreApi/Api/WebhookApi.php @@ -248,7 +248,7 @@ public function deleteWebhookSubscriptionsAsyncWithHttpInfo($ids, $user_agent = return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { @@ -571,13 +571,25 @@ public function getWebhookSubscriptionsAsyncWithHttpInfo($hook = null, $user_age return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -902,13 +914,25 @@ public function getWebhookSubscriptionsByIdAsyncWithHttpInfo($ids, $user_agent = return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1238,13 +1262,25 @@ public function postWebhookSubscriptionsAsyncWithHttpInfo($webhooks_post_webhook return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php b/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php index 166fa6ac..07c9751f 100644 --- a/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php +++ b/src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php @@ -259,7 +259,7 @@ public function deleteShippingRuleAsyncWithHttpInfo($shipping_rule_id, $user_age return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { @@ -600,13 +600,25 @@ public function getShippingRuleImplicationsAsyncWithHttpInfo($shop_id, $country return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -996,13 +1008,25 @@ public function getShippingRulesAsyncWithHttpInfo($page = null, $size = null, $s return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1375,13 +1399,25 @@ public function getShippingRulesByIdsAsyncWithHttpInfo($shipping_rule_ids, $user return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1723,13 +1759,25 @@ public function getShippingRulesByShopAsyncWithHttpInfo($shop_id, $page = null, return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2110,13 +2158,25 @@ public function patchShippingRulesAsyncWithHttpInfo($shipping_rules_patch_shippi return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2445,13 +2505,25 @@ public function postShippingRulesAsyncWithHttpInfo($shipping_rules_post_shipping return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2780,13 +2852,25 @@ public function putShippingRulesAsyncWithHttpInfo($shipping_rules_put_shipping_r return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/IamApi/Api/DefaultApi.php b/src/Client/Generated/IamApi/Api/DefaultApi.php index 180476dd..4589ecd2 100644 --- a/src/Client/Generated/IamApi/Api/DefaultApi.php +++ b/src/Client/Generated/IamApi/Api/DefaultApi.php @@ -305,13 +305,25 @@ public function whoamiGetAsyncWithHttpInfo(string $contentType = self::contentTy return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/src/Client/Generated/OrderApi/Api/DefaultApi.php b/src/Client/Generated/OrderApi/Api/DefaultApi.php index 21255488..d25b828a 100644 --- a/src/Client/Generated/OrderApi/Api/DefaultApi.php +++ b/src/Client/Generated/OrderApi/Api/DefaultApi.php @@ -386,13 +386,25 @@ public function addNotePostAsyncWithHttpInfo($add_note_post_request_inner, strin return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -739,13 +751,25 @@ public function addPackagesPostAsyncWithHttpInfo($add_packages, string $contentT return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1084,13 +1108,25 @@ public function assignToUserPostAsyncWithHttpInfo($assign_to_user_post_request_i return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1437,13 +1473,25 @@ public function cancelPostAsyncWithHttpInfo($cancel_post_request_inner, string $ return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -1790,13 +1838,25 @@ public function createFromShippablePackagesPostAsyncWithHttpInfo($create_order_f return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2143,13 +2203,25 @@ public function editNotePostAsyncWithHttpInfo($edit_note_post_request_inner, str return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2496,13 +2568,25 @@ public function evaluateRulesPostAsyncWithHttpInfo($cancel_post_request_inner, s return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -2849,13 +2933,25 @@ public function importPostAsyncWithHttpInfo($cancel_post_request_inner, string $ return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -3222,13 +3318,25 @@ public function ordersGetAsyncWithHttpInfo($aggregations = null, $filter = null, return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -3656,13 +3764,25 @@ public function packingSlipsGetAsyncWithHttpInfo($order_id, $accept, $shipment_l return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -4055,13 +4175,25 @@ public function picklistGetAsyncWithHttpInfo($order_id, $accept, string $content return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -4422,13 +4554,25 @@ public function preparePackagesForShipmentPostAsyncWithHttpInfo($prepare_package return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -4775,13 +4919,25 @@ public function removeNotesPostAsyncWithHttpInfo($remove_notes_post_request_inne return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -5120,13 +5276,25 @@ public function unassignFromUserPostAsyncWithHttpInfo($cancel_post_request_inner return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } @@ -5473,13 +5641,25 @@ public function unpreparePackagesForShipmentPostAsyncWithHttpInfo($unprepare_pac return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( - function ($response) use ($returnType) { + function ($response) use ($returnType, $request) { if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } } } diff --git a/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php b/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php index 0cb75ade..65d6eb16 100644 --- a/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php +++ b/test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php @@ -5,8 +5,10 @@ namespace MyParcelNL\Sdk\Test\Client\Generated\CoreApi; use GuzzleHttp\ClientInterface; +use GuzzleHttp\Promise\FulfilledPromise; use GuzzleHttp\Psr7\Response; use JsonException; +use MyParcelNL\Sdk\Client\Generated\CoreApi\ApiException; use MyParcelNL\Sdk\Client\Generated\CoreApi\Api\ShipmentApi; use MyParcelNL\Sdk\Client\Generated\CoreApi\Configuration; use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\ShipmentPostShipmentsRequestV11; @@ -32,6 +34,38 @@ public function testPostShipmentsRequestThrowsForInvalidJson(): void $api->postShipmentsRequest($request, null, null, null, null, null, 'application/json'); } + public function testPostShipmentsAsyncThrowsForInvalidJsonResponse(): void + { + $client = $this->createMock(ClientInterface::class); + $client->expects(self::once()) + ->method('sendAsync') + ->willReturn(new FulfilledPromise(new Response(200, [], '{"invalid"'))); + + $config = new Configuration(); + $config->setHost('https://api.myparcel.nl'); + + $data = new ShipmentPostShipmentsRequestV11Data(); + $data->setShipments([new ShipmentRequest()]); + $data->setUserAgent('SDK-Test/1.0'); + + $request = new ShipmentPostShipmentsRequestV11(); + $request->setData($data); + + $api = new ShipmentApi($client, $config); + + try { + $api->postShipmentsAsync($request)->wait(); + self::fail('Expected invalid JSON to reject the promise.'); + } catch (ApiException $exception) { + self::assertSame(200, $exception->getCode()); + self::assertSame('{"invalid"', $exception->getResponseBody()); + self::assertSame( + 'Error JSON decoding server response (https://api.myparcel.nl/shipments)', + $exception->getMessage() + ); + } + } + public function testPostShipmentsDeserializesMultiColloRegionsAsStrings(): void { $client = $this->createMock(ClientInterface::class); diff --git a/test/Client/GeneratedJsonEncodingTest.php b/test/Client/GeneratedJsonEncodingTest.php index 9725f8b1..45ba60d6 100644 --- a/test/Client/GeneratedJsonEncodingTest.php +++ b/test/Client/GeneratedJsonEncodingTest.php @@ -24,4 +24,21 @@ public function testGeneratedClientsDoNotUseDeprecatedGuzzleJsonEncoder(): void self::assertSame([], array_values($deprecatedFiles)); } + + public function testGeneratedClientsFailOnInvalidAsyncJsonResponses(): void + { + $apiFiles = glob(dirname(__DIR__, 2) . '/src/Client/Generated/*/Api/*.php') ?: []; + + self::assertNotEmpty($apiFiles); + + $unsafeFiles = array_filter( + $apiFiles, + static fn(string $file): bool => false !== strpos( + (string) file_get_contents($file), + '$content = json_decode($content);' + ) + ); + + self::assertSame([], array_values($unsafeFiles)); + } }