2942 lines
123 KiB
PHP
2942 lines
123 KiB
PHP
<?php
|
|
/**
|
|
* MasterDataApi
|
|
* PHP version 7.4
|
|
*
|
|
* @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.12.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 Europharmacy\EuromedicaClient\ApiException;
|
|
use Europharmacy\EuromedicaClient\Configuration;
|
|
use Europharmacy\EuromedicaClient\HeaderSelector;
|
|
use Europharmacy\EuromedicaClient\ObjectSerializer;
|
|
|
|
/**
|
|
* MasterDataApi Class Doc Comment
|
|
*
|
|
* @category Class
|
|
* @package Europharmacy\EuromedicaClient
|
|
* @author OpenAPI Generator team
|
|
* @link https://openapi-generator.tech
|
|
*/
|
|
class MasterDataApi
|
|
{
|
|
/**
|
|
* @var ClientInterface
|
|
*/
|
|
protected $client;
|
|
|
|
/**
|
|
* @var Configuration
|
|
*/
|
|
protected $config;
|
|
|
|
/**
|
|
* @var HeaderSelector
|
|
*/
|
|
protected $headerSelector;
|
|
|
|
/**
|
|
* @var int Host index
|
|
*/
|
|
protected $hostIndex;
|
|
|
|
/** @var string[] $contentTypes **/
|
|
public const contentTypes = [
|
|
'apiMasterDataCategoriesGet' => [
|
|
'application/json',
|
|
],
|
|
'apiMasterDataMainCategoriesGet' => [
|
|
'application/json',
|
|
],
|
|
'apiMasterDataOikoiGet' => [
|
|
'application/json',
|
|
],
|
|
'apiMasterDataOwnersGet' => [
|
|
'application/json',
|
|
],
|
|
'apiMasterDataPersonalCategoriesGet' => [
|
|
'application/json',
|
|
],
|
|
'apiMasterDataSubCategoriesGet' => [
|
|
'application/json',
|
|
],
|
|
'apiMasterDataVatCaterogiesGet' => [
|
|
'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 apiMasterDataCategoriesGet
|
|
*
|
|
* Κατηγορίες (Product.categId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataCategoriesGet'] 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\CategoryDtoListPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataCategoriesGet(string $contentType = self::contentTypes['apiMasterDataCategoriesGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataCategoriesGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataCategoriesGetWithHttpInfo
|
|
*
|
|
* Κατηγορίες (Product.categId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataCategoriesGet'] 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\CategoryDtoListPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataCategoriesGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataCategoriesGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataCategoriesGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataCategoriesGetAsync
|
|
*
|
|
* Κατηγορίες (Product.categId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataCategoriesGetAsync(string $contentType = self::contentTypes['apiMasterDataCategoriesGet'][0])
|
|
{
|
|
return $this->apiMasterDataCategoriesGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataCategoriesGetAsyncWithHttpInfo
|
|
*
|
|
* Κατηγορίες (Product.categId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataCategoriesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataCategoriesGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse';
|
|
$request = $this->apiMasterDataCategoriesGetRequest($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 'apiMasterDataCategoriesGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataCategoriesGetRequest(string $contentType = self::contentTypes['apiMasterDataCategoriesGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/Categories';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataMainCategoriesGet
|
|
*
|
|
* Κύριες κατηγορίες (Product.mainCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataMainCategoriesGet'] 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\MainCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataMainCategoriesGet(string $contentType = self::contentTypes['apiMasterDataMainCategoriesGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataMainCategoriesGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataMainCategoriesGetWithHttpInfo
|
|
*
|
|
* Κύριες κατηγορίες (Product.mainCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataMainCategoriesGet'] 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\MainCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataMainCategoriesGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataMainCategoriesGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataMainCategoriesGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataMainCategoriesGetAsync
|
|
*
|
|
* Κύριες κατηγορίες (Product.mainCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataMainCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataMainCategoriesGetAsync(string $contentType = self::contentTypes['apiMasterDataMainCategoriesGet'][0])
|
|
{
|
|
return $this->apiMasterDataMainCategoriesGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataMainCategoriesGetAsyncWithHttpInfo
|
|
*
|
|
* Κύριες κατηγορίες (Product.mainCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataMainCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataMainCategoriesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataMainCategoriesGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse';
|
|
$request = $this->apiMasterDataMainCategoriesGetRequest($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 'apiMasterDataMainCategoriesGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataMainCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataMainCategoriesGetRequest(string $contentType = self::contentTypes['apiMasterDataMainCategoriesGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/MainCategories';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOikoiGet
|
|
*
|
|
* Οίκοι (Product.oikosId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOikoiGet'] 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\OikosDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataOikoiGet(string $contentType = self::contentTypes['apiMasterDataOikoiGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataOikoiGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOikoiGetWithHttpInfo
|
|
*
|
|
* Οίκοι (Product.oikosId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOikoiGet'] 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\OikosDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataOikoiGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataOikoiGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataOikoiGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOikoiGetAsync
|
|
*
|
|
* Οίκοι (Product.oikosId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOikoiGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataOikoiGetAsync(string $contentType = self::contentTypes['apiMasterDataOikoiGet'][0])
|
|
{
|
|
return $this->apiMasterDataOikoiGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOikoiGetAsyncWithHttpInfo
|
|
*
|
|
* Οίκοι (Product.oikosId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOikoiGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataOikoiGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataOikoiGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse';
|
|
$request = $this->apiMasterDataOikoiGetRequest($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 'apiMasterDataOikoiGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOikoiGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataOikoiGetRequest(string $contentType = self::contentTypes['apiMasterDataOikoiGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/Oikoi';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOwnersGet
|
|
*
|
|
* Εταιρία (Product.ownerId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOwnersGet'] 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\OwnerDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataOwnersGet(string $contentType = self::contentTypes['apiMasterDataOwnersGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataOwnersGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOwnersGetWithHttpInfo
|
|
*
|
|
* Εταιρία (Product.ownerId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOwnersGet'] 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\OwnerDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataOwnersGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataOwnersGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataOwnersGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOwnersGetAsync
|
|
*
|
|
* Εταιρία (Product.ownerId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOwnersGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataOwnersGetAsync(string $contentType = self::contentTypes['apiMasterDataOwnersGet'][0])
|
|
{
|
|
return $this->apiMasterDataOwnersGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataOwnersGetAsyncWithHttpInfo
|
|
*
|
|
* Εταιρία (Product.ownerId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOwnersGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataOwnersGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataOwnersGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse';
|
|
$request = $this->apiMasterDataOwnersGetRequest($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 'apiMasterDataOwnersGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataOwnersGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataOwnersGetRequest(string $contentType = self::contentTypes['apiMasterDataOwnersGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/Owners';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataPersonalCategoriesGet
|
|
*
|
|
* Προσωπικές Κατηγορίες (Product.perCatId , Product.perCat2Id , Product.perCat3Id)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataPersonalCategoriesGet'] 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\PersonalCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataPersonalCategoriesGet(string $contentType = self::contentTypes['apiMasterDataPersonalCategoriesGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataPersonalCategoriesGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataPersonalCategoriesGetWithHttpInfo
|
|
*
|
|
* Προσωπικές Κατηγορίες (Product.perCatId , Product.perCat2Id , Product.perCat3Id)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataPersonalCategoriesGet'] 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\PersonalCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataPersonalCategoriesGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataPersonalCategoriesGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataPersonalCategoriesGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataPersonalCategoriesGetAsync
|
|
*
|
|
* Προσωπικές Κατηγορίες (Product.perCatId , Product.perCat2Id , Product.perCat3Id)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataPersonalCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataPersonalCategoriesGetAsync(string $contentType = self::contentTypes['apiMasterDataPersonalCategoriesGet'][0])
|
|
{
|
|
return $this->apiMasterDataPersonalCategoriesGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataPersonalCategoriesGetAsyncWithHttpInfo
|
|
*
|
|
* Προσωπικές Κατηγορίες (Product.perCatId , Product.perCat2Id , Product.perCat3Id)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataPersonalCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataPersonalCategoriesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataPersonalCategoriesGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse';
|
|
$request = $this->apiMasterDataPersonalCategoriesGetRequest($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 'apiMasterDataPersonalCategoriesGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataPersonalCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataPersonalCategoriesGetRequest(string $contentType = self::contentTypes['apiMasterDataPersonalCategoriesGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/PersonalCategories';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataSubCategoriesGet
|
|
*
|
|
* Κατηγορίες (Product.subCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataSubCategoriesGet'] 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\SubCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataSubCategoriesGet(string $contentType = self::contentTypes['apiMasterDataSubCategoriesGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataSubCategoriesGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataSubCategoriesGetWithHttpInfo
|
|
*
|
|
* Κατηγορίες (Product.subCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataSubCategoriesGet'] 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\SubCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataSubCategoriesGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataSubCategoriesGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataSubCategoriesGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataSubCategoriesGetAsync
|
|
*
|
|
* Κατηγορίες (Product.subCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataSubCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataSubCategoriesGetAsync(string $contentType = self::contentTypes['apiMasterDataSubCategoriesGet'][0])
|
|
{
|
|
return $this->apiMasterDataSubCategoriesGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataSubCategoriesGetAsyncWithHttpInfo
|
|
*
|
|
* Κατηγορίες (Product.subCategId)
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataSubCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataSubCategoriesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataSubCategoriesGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse';
|
|
$request = $this->apiMasterDataSubCategoriesGetRequest($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 'apiMasterDataSubCategoriesGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataSubCategoriesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataSubCategoriesGetRequest(string $contentType = self::contentTypes['apiMasterDataSubCategoriesGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/SubCategories';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataVatCaterogiesGet
|
|
*
|
|
* Κατηφορίες ΦΠΑ
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataVatCaterogiesGet'] 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\VatCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails
|
|
*/
|
|
public function apiMasterDataVatCaterogiesGet(string $contentType = self::contentTypes['apiMasterDataVatCaterogiesGet'][0])
|
|
{
|
|
list($response) = $this->apiMasterDataVatCaterogiesGetWithHttpInfo($contentType);
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataVatCaterogiesGetWithHttpInfo
|
|
*
|
|
* Κατηφορίες ΦΠΑ
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataVatCaterogiesGet'] 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\VatCategoryDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
*/
|
|
public function apiMasterDataVatCaterogiesGetWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataVatCaterogiesGet'][0])
|
|
{
|
|
$request = $this->apiMasterDataVatCaterogiesGetRequest($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:
|
|
if ('\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse' !== '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, '\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 404:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 400:
|
|
if ('string' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('string' !== '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, 'string', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
case 401:
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' === '\SplFileObject') {
|
|
$content = $response->getBody(); //stream goes to serializer
|
|
} else {
|
|
$content = (string) $response->getBody();
|
|
if ('\Europharmacy\EuromedicaClient\Model\ProblemDetails' !== '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, '\Europharmacy\EuromedicaClient\Model\ProblemDetails', []),
|
|
$response->getStatusCode(),
|
|
$response->getHeaders()
|
|
];
|
|
}
|
|
|
|
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 = '\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse';
|
|
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()
|
|
];
|
|
|
|
} catch (ApiException $e) {
|
|
switch ($e->getCode()) {
|
|
case 200:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 404:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 400:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'string',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
case 401:
|
|
$data = ObjectSerializer::deserialize(
|
|
$e->getResponseBody(),
|
|
'\Europharmacy\EuromedicaClient\Model\ProblemDetails',
|
|
$e->getResponseHeaders()
|
|
);
|
|
$e->setResponseObject($data);
|
|
break;
|
|
}
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataVatCaterogiesGetAsync
|
|
*
|
|
* Κατηφορίες ΦΠΑ
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataVatCaterogiesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataVatCaterogiesGetAsync(string $contentType = self::contentTypes['apiMasterDataVatCaterogiesGet'][0])
|
|
{
|
|
return $this->apiMasterDataVatCaterogiesGetAsyncWithHttpInfo($contentType)
|
|
->then(
|
|
function ($response) {
|
|
return $response[0];
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Operation apiMasterDataVatCaterogiesGetAsyncWithHttpInfo
|
|
*
|
|
* Κατηφορίες ΦΠΑ
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataVatCaterogiesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
|
*/
|
|
public function apiMasterDataVatCaterogiesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiMasterDataVatCaterogiesGet'][0])
|
|
{
|
|
$returnType = '\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse';
|
|
$request = $this->apiMasterDataVatCaterogiesGetRequest($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 'apiMasterDataVatCaterogiesGet'
|
|
*
|
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiMasterDataVatCaterogiesGet'] to see the possible values for this operation
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
* @return \GuzzleHttp\Psr7\Request
|
|
*/
|
|
public function apiMasterDataVatCaterogiesGetRequest(string $contentType = self::contentTypes['apiMasterDataVatCaterogiesGet'][0])
|
|
{
|
|
|
|
|
|
$resourcePath = '/api/MasterData/VatCaterogies';
|
|
$formParams = [];
|
|
$queryParams = [];
|
|
$headerParams = [];
|
|
$httpBody = '';
|
|
$multipart = false;
|
|
|
|
|
|
|
|
|
|
|
|
$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());
|
|
}
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
}
|