euromedica-client/lib/Api/EshopApi.php

869 lines
36 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* EshopApi
* PHP version 8.1
*
* @category Class
* @package Europharmacy\EuromedicaClient
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* Euromedica Two Web Api
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1
* Contact: development@europharmacy.gr
* Generated by: https://openapi-generator.tech
* Generator version: 7.20.0
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace Europharmacy\EuromedicaClient\Api;
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 Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Europharmacy\EuromedicaClient\ApiException;
use Europharmacy\EuromedicaClient\Configuration;
use Europharmacy\EuromedicaClient\FormDataProcessor;
use Europharmacy\EuromedicaClient\HeaderSelector;
use Europharmacy\EuromedicaClient\ObjectSerializer;
/**
* EshopApi Class Doc Comment
*
* @category Class
* @package Europharmacy\EuromedicaClient
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class EshopApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'apiEshopOrderIdPost' => [
'application/json',
],
'apiEshopStatusGet' => [
'application/json',
],
];
/**
* @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 apiEshopOrderIdPost
*
* Εισαγωγή / Τροποποίηση παραγγελίας
*
* @param int $order_id Ο αριθμός της παραγγελίας (required)
* @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation
*
* @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return \Europharmacy\EuromedicaClient\Model\EOrderPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse
*/
public function apiEshopOrderIdPost($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0])
{
list($response) = $this->apiEshopOrderIdPostWithHttpInfo($order_id, $e_order, $contentType);
return $response;
}
/**
* Operation apiEshopOrderIdPostWithHttpInfo
*
* Εισαγωγή / Τροποποίηση παραγγελίας
*
* @param int $order_id Ο αριθμός της παραγγελίας (required)
* @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation
*
* @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return array of \Europharmacy\EuromedicaClient\Model\EOrderPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function apiEshopOrderIdPostWithHttpInfo($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0])
{
$request = $this->apiEshopOrderIdPostRequest($order_id, $e_order, $contentType);
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();
switch($statusCode) {
case 200:
return $this->handleResponseWithDataType(
'\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse',
$request,
$response,
);
case 400:
return $this->handleResponseWithDataType(
'\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse',
$request,
$response,
);
}
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()
);
}
return $this->handleResponseWithDataType(
'\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse',
$request,
$response,
);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
throw $e;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
throw $e;
}
throw $e;
}
}
/**
* Operation apiEshopOrderIdPostAsync
*
* Εισαγωγή / Τροποποίηση παραγγελίας
*
* @param int $order_id Ο αριθμός της παραγγελίας (required)
* @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function apiEshopOrderIdPostAsync($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0])
{
return $this->apiEshopOrderIdPostAsyncWithHttpInfo($order_id, $e_order, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation apiEshopOrderIdPostAsyncWithHttpInfo
*
* Εισαγωγή / Τροποποίηση παραγγελίας
*
* @param int $order_id Ο αριθμός της παραγγελίας (required)
* @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function apiEshopOrderIdPostAsyncWithHttpInfo($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0])
{
$returnType = '\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse';
$request = $this->apiEshopOrderIdPostRequest($order_id, $e_order, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($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()
];
},
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 'apiEshopOrderIdPost'
*
* @param int $order_id Ο αριθμός της παραγγελίας (required)
* @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function apiEshopOrderIdPostRequest($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0])
{
// verify the required parameter 'order_id' is set
if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $order_id when calling apiEshopOrderIdPost'
);
}
$resourcePath = '/api/Eshop/{orderId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($order_id !== null) {
$resourcePath = str_replace(
'{' . 'orderId' . '}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['application/json', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($e_order)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($e_order));
} else {
$httpBody = $e_order;
}
} elseif (count($formParams) > 0) {
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 = \GuzzleHttp\Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// 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());
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation apiEshopStatusGet
*
* Κατάσταση παραγγελιών
*
* @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60)
* @param int|null $order_id Αν έχει τιμή &gt; 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0)
* @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional)
* @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false)
* @param int|null $page (optional, default to 1)
* @param int|null $size (optional, default to 1000)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation
*
* @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return \Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse
*/
public function apiEshopStatusGet($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0])
{
list($response) = $this->apiEshopStatusGetWithHttpInfo($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType);
return $response;
}
/**
* Operation apiEshopStatusGetWithHttpInfo
*
* Κατάσταση παραγγελιών
*
* @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60)
* @param int|null $order_id Αν έχει τιμή &gt; 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0)
* @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional)
* @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false)
* @param int|null $page (optional, default to 1)
* @param int|null $size (optional, default to 1000)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation
*
* @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return array of \Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function apiEshopStatusGetWithHttpInfo($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0])
{
$request = $this->apiEshopStatusGetRequest($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType);
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();
switch($statusCode) {
case 200:
return $this->handleResponseWithDataType(
'\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse',
$request,
$response,
);
case 400:
return $this->handleResponseWithDataType(
'\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse',
$request,
$response,
);
}
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()
);
}
return $this->handleResponseWithDataType(
'\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse',
$request,
$response,
);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
throw $e;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
throw $e;
}
throw $e;
}
}
/**
* Operation apiEshopStatusGetAsync
*
* Κατάσταση παραγγελιών
*
* @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60)
* @param int|null $order_id Αν έχει τιμή &gt; 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0)
* @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional)
* @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false)
* @param int|null $page (optional, default to 1)
* @param int|null $size (optional, default to 1000)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function apiEshopStatusGetAsync($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0])
{
return $this->apiEshopStatusGetAsyncWithHttpInfo($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation apiEshopStatusGetAsyncWithHttpInfo
*
* Κατάσταση παραγγελιών
*
* @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60)
* @param int|null $order_id Αν έχει τιμή &gt; 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0)
* @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional)
* @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false)
* @param int|null $page (optional, default to 1)
* @param int|null $size (optional, default to 1000)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function apiEshopStatusGetAsyncWithHttpInfo($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0])
{
$returnType = '\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse';
$request = $this->apiEshopStatusGetRequest($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($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()
];
},
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 'apiEshopStatusGet'
*
* @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60)
* @param int|null $order_id Αν έχει τιμή &gt; 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0)
* @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional)
* @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false)
* @param int|null $page (optional, default to 1)
* @param int|null $size (optional, default to 1000)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function apiEshopStatusGetRequest($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0])
{
if ($modified_last_days !== null && $modified_last_days > 360) {
throw new \InvalidArgumentException('invalid value for "$modified_last_days" when calling EshopApi.apiEshopStatusGet, must be smaller than or equal to 360.');
}
if ($modified_last_days !== null && $modified_last_days < 0) {
throw new \InvalidArgumentException('invalid value for "$modified_last_days" when calling EshopApi.apiEshopStatusGet, must be bigger than or equal to 0.');
}
if ($size !== null && $size > 1000) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EshopApi.apiEshopStatusGet, must be smaller than or equal to 1000.');
}
if ($size !== null && $size < 1) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EshopApi.apiEshopStatusGet, must be bigger than or equal to 1.');
}
$resourcePath = '/api/Eshop/Status';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$modified_last_days,
'modifiedLastDays', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$order_id,
'orderId', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$modified_after,
'modifiedAfter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$include_creata_date,
'includeCreataDate', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['application/json', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
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 = \GuzzleHttp\Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// 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());
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* 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());
}
}
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options;
}
private function handleResponseWithDataType(
string $dataType,
RequestInterface $request,
ResponseInterface $response
): array {
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()
),
$response->getStatusCode(),
$response->getHeaders(),
$content
);
}
}
}
return [
ObjectSerializer::deserialize($content, $dataType, []),
$response->getStatusCode(),
$response->getHeaders()
];
}
private function responseWithinRangeCode(
string $rangeCode,
int $statusCode
): bool {
$left = (int) ($rangeCode[0].'00');
$right = (int) ($rangeCode[0].'99');
return $statusCode >= $left && $statusCode <= $right;
}
}