Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
894 changes: 894 additions & 0 deletions openapi/templates/api.mustache

Large diffs are not rendered by default.

23 changes: 20 additions & 3 deletions src/Client/Generated/CoreApi/Api/DefaultApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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])
Expand Down Expand Up @@ -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])
Expand All @@ -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])
Expand All @@ -300,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
);
}
}
}

Expand Down Expand Up @@ -340,6 +356,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])
Expand Down Expand Up @@ -386,7 +403,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);
Expand Down
Loading
Loading