[ '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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\CategoryDtoListPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\MainCategoryDtoPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\OikosDtoPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\OwnerDtoPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\PersonalCategoryDtoPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\SubCategoryDtoPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse', $request, $response, ); case 404: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $request, $response, ); case 400: return $this->handleResponseWithDataType( 'string', $request, $response, ); case 401: return $this->handleResponseWithDataType( '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $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\VatCategoryDtoPagedResponse', $request, $response, ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), 'string', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; case 401: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\Europharmacy\EuromedicaClient\Model\ProblemDetails', $e->getResponseHeaders() ); $e->setResponseObject($data); throw $e; } 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()); } } 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; } }