diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f1681c --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache +.phpunit.result.cache diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..f742669 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,124 @@ +.gitignore +.openapi-generator-ignore +.php-cs-fixer.dist.php +.travis.yml +README.md +composer.json +docs/Api/CustomersApi.md +docs/Api/EshopApi.md +docs/Api/MasterDataApi.md +docs/Api/ProductsApi.md +docs/Api/WelcomeApi.md +docs/Model/Billing.md +docs/Model/CategoryDto.md +docs/Model/CategoryDtoListPagedResponse.md +docs/Model/Coupon.md +docs/Model/Coupons.md +docs/Model/Customer.md +docs/Model/CustomerDto.md +docs/Model/CustomerPagedResponse.md +docs/Model/EOrder.md +docs/Model/EOrderPagedResponse.md +docs/Model/EOrderStatus.md +docs/Model/EOrderStatusPagedResponse.md +docs/Model/Fee.md +docs/Model/Fees.md +docs/Model/Item.md +docs/Model/Items.md +docs/Model/MainCategoryDto.md +docs/Model/MainCategoryDtoPagedResponse.md +docs/Model/OikosDto.md +docs/Model/OikosDtoPagedResponse.md +docs/Model/OwnerDto.md +docs/Model/OwnerDtoPagedResponse.md +docs/Model/PersonalCategoryDto.md +docs/Model/PersonalCategoryDtoPagedResponse.md +docs/Model/ProblemDetails.md +docs/Model/ProductDto.md +docs/Model/ProductDtoPagedResponse.md +docs/Model/Shipping.md +docs/Model/SubCategoryDto.md +docs/Model/SubCategoryDtoPagedResponse.md +docs/Model/VatCategoryDto.md +docs/Model/VatCategoryDtoPagedResponse.md +git_push.sh +lib/Api/CustomersApi.php +lib/Api/EshopApi.php +lib/Api/MasterDataApi.php +lib/Api/ProductsApi.php +lib/Api/WelcomeApi.php +lib/ApiException.php +lib/Configuration.php +lib/HeaderSelector.php +lib/Model/Billing.php +lib/Model/CategoryDto.php +lib/Model/CategoryDtoListPagedResponse.php +lib/Model/Coupon.php +lib/Model/Coupons.php +lib/Model/Customer.php +lib/Model/CustomerDto.php +lib/Model/CustomerPagedResponse.php +lib/Model/EOrder.php +lib/Model/EOrderPagedResponse.php +lib/Model/EOrderStatus.php +lib/Model/EOrderStatusPagedResponse.php +lib/Model/Fee.php +lib/Model/Fees.php +lib/Model/Item.php +lib/Model/Items.php +lib/Model/MainCategoryDto.php +lib/Model/MainCategoryDtoPagedResponse.php +lib/Model/ModelInterface.php +lib/Model/OikosDto.php +lib/Model/OikosDtoPagedResponse.php +lib/Model/OwnerDto.php +lib/Model/OwnerDtoPagedResponse.php +lib/Model/PersonalCategoryDto.php +lib/Model/PersonalCategoryDtoPagedResponse.php +lib/Model/ProblemDetails.php +lib/Model/ProductDto.php +lib/Model/ProductDtoPagedResponse.php +lib/Model/Shipping.php +lib/Model/SubCategoryDto.php +lib/Model/SubCategoryDtoPagedResponse.php +lib/Model/VatCategoryDto.php +lib/Model/VatCategoryDtoPagedResponse.php +lib/ObjectSerializer.php +phpunit.xml.dist +test/Api/CustomersApiTest.php +test/Api/EshopApiTest.php +test/Api/MasterDataApiTest.php +test/Api/ProductsApiTest.php +test/Api/WelcomeApiTest.php +test/Model/BillingTest.php +test/Model/CategoryDtoListPagedResponseTest.php +test/Model/CategoryDtoTest.php +test/Model/CouponTest.php +test/Model/CouponsTest.php +test/Model/CustomerDtoTest.php +test/Model/CustomerPagedResponseTest.php +test/Model/CustomerTest.php +test/Model/EOrderPagedResponseTest.php +test/Model/EOrderStatusPagedResponseTest.php +test/Model/EOrderStatusTest.php +test/Model/EOrderTest.php +test/Model/FeeTest.php +test/Model/FeesTest.php +test/Model/ItemTest.php +test/Model/ItemsTest.php +test/Model/MainCategoryDtoPagedResponseTest.php +test/Model/MainCategoryDtoTest.php +test/Model/OikosDtoPagedResponseTest.php +test/Model/OikosDtoTest.php +test/Model/OwnerDtoPagedResponseTest.php +test/Model/OwnerDtoTest.php +test/Model/PersonalCategoryDtoPagedResponseTest.php +test/Model/PersonalCategoryDtoTest.php +test/Model/ProblemDetailsTest.php +test/Model/ProductDtoPagedResponseTest.php +test/Model/ProductDtoTest.php +test/Model/ShippingTest.php +test/Model/SubCategoryDtoPagedResponseTest.php +test/Model/SubCategoryDtoTest.php +test/Model/VatCategoryDtoPagedResponseTest.php +test/Model/VatCategoryDtoTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..5f84a81 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.12.0 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..667b815 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic +php: + - 7.4 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..924c7af --- /dev/null +++ b/composer.json @@ -0,0 +1,39 @@ +{ + "name": "europharmacy/euromedica-client", + "description": "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^1.7 || ^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0 || ^9.0", + "friendsofphp/php-cs-fixer": "^3.5" + }, + "autoload": { + "psr-4": { "Europharmacy\\EuromedicaClient\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "Europharmacy\\EuromedicaClient\\Test\\" : "test/" } + } +} diff --git a/docs/Api/CustomersApi.md b/docs/Api/CustomersApi.md new file mode 100644 index 0000000..6b1c671 --- /dev/null +++ b/docs/Api/CustomersApi.md @@ -0,0 +1,200 @@ +# Europharmacy\EuromedicaClient\CustomersApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**apiCustomersGet()**](CustomersApi.md#apiCustomersGet) | **GET** /api/Customers | Αναζήτηση πελατών | +| [**apiCustomersIdGet()**](CustomersApi.md#apiCustomersIdGet) | **GET** /api/Customers/{id} | Προβολή πελάτη βάσει Id | +| [**apiCustomersPost()**](CustomersApi.md#apiCustomersPost) | **POST** /api/Customers | Εισαγωγή ή επεξεργασία πελάτη | + + +## `apiCustomersGet()` + +```php +apiCustomersGet($search_by_name, $search_by_phone, $search_by_amka, $search_by_afm, $page, $size): \Europharmacy\EuromedicaClient\Model\CustomerPagedResponse +``` + +Αναζήτηση πελατών + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\CustomersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$search_by_name = ''; // string | +$search_by_phone = ''; // string | +$search_by_amka = ''; // string | +$search_by_afm = ''; // string | +$page = 1; // int | +$size = 1000; // int | + +try { + $result = $apiInstance->apiCustomersGet($search_by_name, $search_by_phone, $search_by_amka, $search_by_afm, $page, $size); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->apiCustomersGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **search_by_name** | **string**| | [optional] [default to ''] | +| **search_by_phone** | **string**| | [optional] [default to ''] | +| **search_by_amka** | **string**| | [optional] [default to ''] | +| **search_by_afm** | **string**| | [optional] [default to ''] | +| **page** | **int**| | [optional] [default to 1] | +| **size** | **int**| | [optional] [default to 1000] | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse**](../Model/CustomerPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiCustomersIdGet()` + +```php +apiCustomersIdGet($id): \Europharmacy\EuromedicaClient\Model\CustomerPagedResponse +``` + +Προβολή πελάτη βάσει Id + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\CustomersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 56; // int | + +try { + $result = $apiInstance->apiCustomersIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->apiCustomersIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| | | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse**](../Model/CustomerPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiCustomersPost()` + +```php +apiCustomersPost($customer_dto): \Europharmacy\EuromedicaClient\Model\CustomerPagedResponse +``` + +Εισαγωγή ή επεξεργασία πελάτη + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\CustomersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$customer_dto = new \Europharmacy\EuromedicaClient\Model\CustomerDto(); // \Europharmacy\EuromedicaClient\Model\CustomerDto | + +try { + $result = $apiInstance->apiCustomersPost($customer_dto); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->apiCustomersPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customer_dto** | [**\Europharmacy\EuromedicaClient\Model\CustomerDto**](../Model/CustomerDto.md)| | [optional] | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse**](../Model/CustomerPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: `application/json-patch+json`, `application/json`, `application/*+json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/EshopApi.md b/docs/Api/EshopApi.md new file mode 100644 index 0000000..fd46dac --- /dev/null +++ b/docs/Api/EshopApi.md @@ -0,0 +1,141 @@ +# Europharmacy\EuromedicaClient\EshopApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**apiEshopOrderIdPost()**](EshopApi.md#apiEshopOrderIdPost) | **POST** /api/Eshop/{orderId} | Εισαγωγή / Τροποποίηση παραγγελίας | +| [**apiEshopStatusGet()**](EshopApi.md#apiEshopStatusGet) | **GET** /api/Eshop/Status | Κατάσταση παραγγελιών | + + +## `apiEshopOrderIdPost()` + +```php +apiEshopOrderIdPost($order_id, $e_order): \Europharmacy\EuromedicaClient\Model\EOrderPagedResponse +``` + +Εισαγωγή / Τροποποίηση παραγγελίας + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\EshopApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$order_id = 56; // int | Ο αριθμός της παραγγελίας +$e_order = new \Europharmacy\EuromedicaClient\Model\EOrder(); // \Europharmacy\EuromedicaClient\Model\EOrder | + +try { + $result = $apiInstance->apiEshopOrderIdPost($order_id, $e_order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EshopApi->apiEshopOrderIdPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **order_id** | **int**| Ο αριθμός της παραγγελίας | | +| **e_order** | [**\Europharmacy\EuromedicaClient\Model\EOrder**](../Model/EOrder.md)| | [optional] | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse**](../Model/EOrderPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiEshopStatusGet()` + +```php +apiEshopStatusGet($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size): \Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse +``` + +Κατάσταση παραγγελιών + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\EshopApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$modified_last_days = 60; // int | Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες +$order_id = 0; // int | Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων +$modified_after = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays +$include_creata_date = false; // bool | By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων +$page = 1; // int | +$size = 1000; // int | + +try { + $result = $apiInstance->apiEshopStatusGet($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EshopApi->apiEshopStatusGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **modified_last_days** | **int**| Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες | [optional] [default to 60] | +| **order_id** | **int**| Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων | [optional] [default to 0] | +| **modified_after** | **\DateTime**| Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays | [optional] | +| **include_creata_date** | **bool**| By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων | [optional] [default to false] | +| **page** | **int**| | [optional] [default to 1] | +| **size** | **int**| | [optional] [default to 1000] | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse**](../Model/EOrderStatusPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/MasterDataApi.md b/docs/Api/MasterDataApi.md new file mode 100644 index 0000000..db814aa --- /dev/null +++ b/docs/Api/MasterDataApi.md @@ -0,0 +1,413 @@ +# Europharmacy\EuromedicaClient\MasterDataApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**apiMasterDataCategoriesGet()**](MasterDataApi.md#apiMasterDataCategoriesGet) | **GET** /api/MasterData/Categories | Κατηγορίες (Product.categId) | +| [**apiMasterDataMainCategoriesGet()**](MasterDataApi.md#apiMasterDataMainCategoriesGet) | **GET** /api/MasterData/MainCategories | Κύριες κατηγορίες (Product.mainCategId) | +| [**apiMasterDataOikoiGet()**](MasterDataApi.md#apiMasterDataOikoiGet) | **GET** /api/MasterData/Oikoi | Οίκοι (Product.oikosId) | +| [**apiMasterDataOwnersGet()**](MasterDataApi.md#apiMasterDataOwnersGet) | **GET** /api/MasterData/Owners | Εταιρία (Product.ownerId) | +| [**apiMasterDataPersonalCategoriesGet()**](MasterDataApi.md#apiMasterDataPersonalCategoriesGet) | **GET** /api/MasterData/PersonalCategories | Προσωπικές Κατηγορίες (Product.perCatId , Product.perCat2Id , Product.perCat3Id) | +| [**apiMasterDataSubCategoriesGet()**](MasterDataApi.md#apiMasterDataSubCategoriesGet) | **GET** /api/MasterData/SubCategories | Κατηγορίες (Product.subCategId) | +| [**apiMasterDataVatCaterogiesGet()**](MasterDataApi.md#apiMasterDataVatCaterogiesGet) | **GET** /api/MasterData/VatCaterogies | Κατηφορίες ΦΠΑ | + + +## `apiMasterDataCategoriesGet()` + +```php +apiMasterDataCategoriesGet(): \Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse +``` + +Κατηγορίες (Product.categId) + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataCategoriesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataCategoriesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\CategoryDtoListPagedResponse**](../Model/CategoryDtoListPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiMasterDataMainCategoriesGet()` + +```php +apiMasterDataMainCategoriesGet(): \Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse +``` + +Κύριες κατηγορίες (Product.mainCategId) + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataMainCategoriesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataMainCategoriesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\MainCategoryDtoPagedResponse**](../Model/MainCategoryDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiMasterDataOikoiGet()` + +```php +apiMasterDataOikoiGet(): \Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse +``` + +Οίκοι (Product.oikosId) + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataOikoiGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataOikoiGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\OikosDtoPagedResponse**](../Model/OikosDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiMasterDataOwnersGet()` + +```php +apiMasterDataOwnersGet(): \Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse +``` + +Εταιρία (Product.ownerId) + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataOwnersGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataOwnersGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\OwnerDtoPagedResponse**](../Model/OwnerDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiMasterDataPersonalCategoriesGet()` + +```php +apiMasterDataPersonalCategoriesGet(): \Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse +``` + +Προσωπικές Κατηγορίες (Product.perCatId , Product.perCat2Id , Product.perCat3Id) + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataPersonalCategoriesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataPersonalCategoriesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\PersonalCategoryDtoPagedResponse**](../Model/PersonalCategoryDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiMasterDataSubCategoriesGet()` + +```php +apiMasterDataSubCategoriesGet(): \Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse +``` + +Κατηγορίες (Product.subCategId) + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataSubCategoriesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataSubCategoriesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\SubCategoryDtoPagedResponse**](../Model/SubCategoryDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiMasterDataVatCaterogiesGet()` + +```php +apiMasterDataVatCaterogiesGet(): \Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse +``` + +Κατηφορίες ΦΠΑ + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\MasterDataApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiMasterDataVatCaterogiesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MasterDataApi->apiMasterDataVatCaterogiesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\VatCategoryDtoPagedResponse**](../Model/VatCategoryDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ProductsApi.md b/docs/Api/ProductsApi.md new file mode 100644 index 0000000..1a861e7 --- /dev/null +++ b/docs/Api/ProductsApi.md @@ -0,0 +1,202 @@ +# Europharmacy\EuromedicaClient\ProductsApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**apiProductsBarcodeGet()**](ProductsApi.md#apiProductsBarcodeGet) | **GET** /api/Products/{barcode} | Αναζήτηση βάσει barcode | +| [**apiProductsDataboxBarcodePost()**](ProductsApi.md#apiProductsDataboxBarcodePost) | **POST** /api/Products/Databox/{Barcode} | | +| [**apiProductsGet()**](ProductsApi.md#apiProductsGet) | **GET** /api/Products | Αναζήτηση ειδών | + + +## `apiProductsBarcodeGet()` + +```php +apiProductsBarcodeGet($barcode): \Europharmacy\EuromedicaClient\Model\ProductDto +``` + +Αναζήτηση βάσει barcode + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\ProductsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$barcode = 'barcode_example'; // string | + +try { + $result = $apiInstance->apiProductsBarcodeGet($barcode); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->apiProductsBarcodeGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **barcode** | **string**| | | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\ProductDto**](../Model/ProductDto.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiProductsDataboxBarcodePost()` + +```php +apiProductsDataboxBarcodePost($barcode): \Europharmacy\EuromedicaClient\Model\ProductDto +``` + + + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\ProductsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$barcode = 'barcode_example'; // string + +try { + $result = $apiInstance->apiProductsDataboxBarcodePost($barcode); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->apiProductsDataboxBarcodePost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **barcode** | **string**| | | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\ProductDto**](../Model/ProductDto.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiProductsGet()` + +```php +apiProductsGet($search_text, $search_meds, $search_user_items, $visibly_web, $modified_after, $page, $size): \Europharmacy\EuromedicaClient\Model\ProductDtoPagedResponse +``` + +Αναζήτηση ειδών + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\ProductsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$search_text = 'search_text_example'; // string | Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό +$search_meds = true; // bool | Αναζήτηση φαρμάκων +$search_user_items = true; // bool | Αναζήτηση παραφαρμάκων +$visibly_web = True; // bool | Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) +$modified_after = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) +$page = 1; // int | +$size = 1000; // int | + +try { + $result = $apiInstance->apiProductsGet($search_text, $search_meds, $search_user_items, $visibly_web, $modified_after, $page, $size); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->apiProductsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **search_text** | **string**| Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό | [optional] | +| **search_meds** | **bool**| Αναζήτηση φαρμάκων | [optional] [default to true] | +| **search_user_items** | **bool**| Αναζήτηση παραφαρμάκων | [optional] [default to true] | +| **visibly_web** | **bool**| Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) | [optional] | +| **modified_after** | **\DateTime**| Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) | [optional] | +| **page** | **int**| | [optional] [default to 1] | +| **size** | **int**| | [optional] [default to 1000] | + +### Return type + +[**\Europharmacy\EuromedicaClient\Model\ProductDtoPagedResponse**](../Model/ProductDtoPagedResponse.md) + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/WelcomeApi.md b/docs/Api/WelcomeApi.md new file mode 100644 index 0000000..8534f45 --- /dev/null +++ b/docs/Api/WelcomeApi.md @@ -0,0 +1,168 @@ +# Europharmacy\EuromedicaClient\WelcomeApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**apiWelcomeGet()**](WelcomeApi.md#apiWelcomeGet) | **GET** /api/Welcome | | +| [**apiWelcomeHead()**](WelcomeApi.md#apiWelcomeHead) | **HEAD** /api/Welcome | | +| [**apiWelcomeSecureGet()**](WelcomeApi.md#apiWelcomeSecureGet) | **GET** /api/Welcome/Secure | | + + +## `apiWelcomeGet()` + +```php +apiWelcomeGet(): string +``` + + + +### Example + +```php +apiWelcomeGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WelcomeApi->apiWelcomeGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiWelcomeHead()` + +```php +apiWelcomeHead() +``` + + + +### Example + +```php +apiWelcomeHead(); +} catch (Exception $e) { + echo 'Exception when calling WelcomeApi->apiWelcomeHead: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `apiWelcomeSecureGet()` + +```php +apiWelcomeSecureGet(): string +``` + + + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Europharmacy\EuromedicaClient\Api\WelcomeApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->apiWelcomeSecureGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling WelcomeApi->apiWelcomeSecureGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string** + +### Authorization + +[basic](../../README.md#basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Model/Billing.md b/docs/Model/Billing.md new file mode 100644 index 0000000..29a0532 --- /dev/null +++ b/docs/Model/Billing.md @@ -0,0 +1,24 @@ +# # Billing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**last_name** | **string** | Επίθετο | [optional] +**first_name** | **string** | Όνομα | [optional] +**address** | **string** | Διεύθυνση | [optional] +**city** | **string** | | [optional] +**postcode** | **string** | | [optional] +**state** | **string** | | [optional] +**country** | **string** | | [optional] +**country_code** | **string** | ΚΩΔΙΚΟΣ ΧΩΡΑΣ ISO 3166 ALPHA-2 | [optional] +**phone** | **string** | | [optional] +**cellphone** | **string** | | [optional] +**email** | **string** | | [optional] +**is_invoice** | **int** | Αν ο πελάτης θέλει τιμολόγιο τιμή 1 | [optional] +**commercial_name** | **string** | η επωνυμία που θα κοπεί το τιμολόγιο | [optional] +**tax_number** | **string** | Αφμ πελάτη , υποχρεωτικό σε περίπτωση τιμολογίου | [optional] +**tax_office** | **string** | ΔΟΥ πελάτη , υποχρεωτικό σε περίπτωση τιμολογίου | [optional] +**activity** | **string** | Επάγγελμα , υποχρεωτικό σε περίπτωση τιμολογίου | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CategoryDto.md b/docs/Model/CategoryDto.md new file mode 100644 index 0000000..25fa46e --- /dev/null +++ b/docs/Model/CategoryDto.md @@ -0,0 +1,10 @@ +# # CategoryDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**categ_id** | **string** | | [optional] +**categ_desc** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CategoryDtoListPagedResponse.md b/docs/Model/CategoryDtoListPagedResponse.md new file mode 100644 index 0000000..5039b9b --- /dev/null +++ b/docs/Model/CategoryDtoListPagedResponse.md @@ -0,0 +1,18 @@ +# # CategoryDtoListPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | **\Europharmacy\EuromedicaClient\Model\CategoryDto[][]** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Coupon.md b/docs/Model/Coupon.md new file mode 100644 index 0000000..c52d113 --- /dev/null +++ b/docs/Model/Coupon.md @@ -0,0 +1,10 @@ +# # Coupon + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | προαιρετικό πεδίο , όνομα κουπονιού | [optional] +**amount** | **float** | αξία κουπονιού | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Coupons.md b/docs/Model/Coupons.md new file mode 100644 index 0000000..3a118e1 --- /dev/null +++ b/docs/Model/Coupons.md @@ -0,0 +1,9 @@ +# # Coupons + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**coupon_list** | [**\Europharmacy\EuromedicaClient\Model\Coupon[]**](Coupon.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Customer.md b/docs/Model/Customer.md new file mode 100644 index 0000000..bb93ddb --- /dev/null +++ b/docs/Model/Customer.md @@ -0,0 +1,30 @@ +# # Customer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**last_name** | **string** | | [optional] +**first_name** | **string** | | [optional] +**nikcname** | **string** | | [optional] +**phone** | **string** | ΣΤΑΘΕΡΟ ΤΗΛΕΦΩΝΟ | [optional] +**mobile** | **string** | ΚΙΝΗΤΟ ΤΗΛΕΦΩΝΟ | [optional] +**family_name** | **string** | ΟΝΟΜΑ ΟΙΚΟΓΕΝΕΙΑΣ ΕΦΟΣΟΝ ΑΝΗΚΕΙ ΣΕ ΚΑΠΟΙΑ | [optional] +**amka** | **string** | ΑΜΚΑ | [optional] +**bonus_card** | **string** | | [optional] +**address** | **string** | ΔΙΕΥΘΥΝΣΗ | [optional] +**post_code** | **string** | ΤΑΧΥΔΡΟΜΙΚΟΣ ΚΩΔΙΚΑΣ | [optional] +**city** | **string** | | [optional] +**country_code** | **string** | ΚΩΔΙΚΟΣ ΧΩΡΑΣ ISO 3166 ALPHA-2 | [optional] +**country_name** | **string** | | [optional] +**birth_day** | **\DateTime** | | [optional] +**tax_number** | **string** | ΑΦΜ ΠΕΛΑΤΗ | [optional] +**tax_office** | **string** | ΔΟΥ | [optional] +**profession** | **string** | ΕΠΑΓΓΕΛΜΑ | [optional] +**brand_id** | **int** | ΚΩΔΙΚΟΣ ΕΓΚΑΤΑΣΤΑΣΗΣ | [optional] +**email** | **string** | | [optional] +**notes** | **string** | | [optional] +**eshop_id** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerDto.md b/docs/Model/CustomerDto.md new file mode 100644 index 0000000..b267daa --- /dev/null +++ b/docs/Model/CustomerDto.md @@ -0,0 +1,28 @@ +# # CustomerDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Id πελάτη , -1 αν πρόκειται για καινούριο πελάτη | [optional] [default to -1] +**last_name** | **string** | | [optional] [default to ''] +**first_name** | **string** | | [optional] [default to ''] +**nikcname** | **string** | | [optional] [default to ''] +**phone** | **string** | ΣΤΑΘΕΡΟ ΤΗΛΕΦΩΝΟ | [optional] +**mobile** | **string** | ΚΙΝΗΤΟ ΤΗΛΕΦΩΝΟ | [optional] +**amka** | **string** | ΑΜΚΑ | [optional] +**address** | **string** | ΔΙΕΥΘΥΝΣΗ | [optional] +**post_code** | **string** | ΤΑΧΥΔΡΟΜΙΚΟΣ ΚΩΔΙΚΑΣ | [optional] +**city** | **string** | | [optional] +**country_code** | **string** | ΚΩΔΙΚΟΣ ΧΩΡΑΣ ISO 3166 ALPHA-2 | [optional] [default to 'GR'] +**country_name** | **string** | | [optional] +**birth_day** | **\DateTime** | | [optional] +**tax_number** | **string** | ΑΦΜ ΠΕΛΑΤΗ | [optional] +**tax_office** | **string** | ΔΟΥ | [optional] +**profession** | **string** | ΕΠΑΓΓΕΛΜΑ | [optional] +**brand_id** | **int** | ΚΩΔΙΚΟΣ ΕΓΚΑΤΑΣΤΑΣΗΣ | [optional] [default to 0] +**email** | **string** | | [optional] +**notes** | **string** | | [optional] +**eshop_id** | **int** | | [optional] [default to 0] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerPagedResponse.md b/docs/Model/CustomerPagedResponse.md new file mode 100644 index 0000000..80287cf --- /dev/null +++ b/docs/Model/CustomerPagedResponse.md @@ -0,0 +1,18 @@ +# # CustomerPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\Customer[]**](Customer.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EOrder.md b/docs/Model/EOrder.md new file mode 100644 index 0000000..d1eadc9 --- /dev/null +++ b/docs/Model/EOrder.md @@ -0,0 +1,29 @@ +# # EOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **int** | | [optional] +**status_id** | **int** | ΚΑΤΑΣΤΑΣΗ ΠΑΡΑΓΓΕΛΙΑΣ {1,\"Σε διεκπεραίωση\" }, {2,\"Εκκρεμεί πληρωμή\" }, {3,\"Ολοκληρωμένη\" }, { 4,\"Αναμονή τραπεζικής πληρώμης\" }, { 5,\"Αποτυχία πληρωμής\" }, { 6,\"Ακυρωμένη\" }, { 7,\"Επιστροφή χρημάτων\" }, { 8,\"Τιμολογημένη\" } | [optional] +**admin_url** | **string** | προαιρετικό πεδίο , διαχειριστικό eshop | [optional] +**status** | **string** | προαιρετικό πεδίο , λεκτικό της κατάστασης | [optional] +**date_created** | **\DateTime** | | [optional] +**date_completed** | **\DateTime** | συμπληρώνεται από το erp όταν ολοκληρωθεί η παραγγελία | [optional] +**date_modified** | **\DateTime** | | [optional] +**date_paid** | **\DateTime** | συμπληρώνεται από το eshop οταν γίνει πληρωμή με κάρτα | [optional] +**payment_method_id** | **int** | ΤΡΟΠΟΙ ΠΛΗΡΩΜΗΣ { 1 ,\"Aντικαταβολή\" },{ 2 ,\"Τραπεζική κατάθεση\" }, { 3 ,\"Paypal\" }, { 4 ,\"Πιστ./Χρεωσ. Κάρτα\" },{ 5 ,\"Κατάστημα\" },{ 6 ,\"Eshop\" } | [optional] +**payment_method** | **string** | προαιρετικό πεδίο , λεκτικό του τρόπου πληρωμής | [optional] +**shipping_method** | **string** | Τρόπος αποστολής | [optional] +**client_id** | **int** | το id πελατη στο eshop , επισκέπτης -1 | [optional] +**notes** | **string** | | [optional] +**net_amount** | **float** | προαιρετικό πεδίο , Αξία παραγγελίας προ ΦΠΑ | [optional] +**vat_amount** | **float** | προαιρετικό πεδίο , Αξία ΦΠΑ | [optional] +**total_amount** | **float** | Συνολική αξία παραγγελίας | [optional] +**billing** | [**\Europharmacy\EuromedicaClient\Model\Billing**](Billing.md) | | [optional] +**shipping** | [**\Europharmacy\EuromedicaClient\Model\Shipping**](Shipping.md) | | [optional] +**items** | [**\Europharmacy\EuromedicaClient\Model\Items**](Items.md) | | [optional] +**fees** | [**\Europharmacy\EuromedicaClient\Model\Fees**](Fees.md) | | [optional] +**coupons** | [**\Europharmacy\EuromedicaClient\Model\Coupons**](Coupons.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EOrderPagedResponse.md b/docs/Model/EOrderPagedResponse.md new file mode 100644 index 0000000..20a021a --- /dev/null +++ b/docs/Model/EOrderPagedResponse.md @@ -0,0 +1,18 @@ +# # EOrderPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\EOrder[]**](EOrder.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EOrderStatus.md b/docs/Model/EOrderStatus.md new file mode 100644 index 0000000..e980587 --- /dev/null +++ b/docs/Model/EOrderStatus.md @@ -0,0 +1,16 @@ +# # EOrderStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_id** | **int** | | [optional] +**status_id** | **int** | | [optional] +**status** | **string** | | [optional] [readonly] +**date_created** | **\DateTime** | | [optional] +**date_completed** | **\DateTime** | Συμπληρώνεται από το erp όταν ολοκληρωθεί η παραγγελία | [optional] +**date_modified** | **\DateTime** | Συμπληρώνεται από το erp όταν τροποποιηθεί η παραγγελία | [optional] +**date_paid** | **\DateTime** | Συμπληρώνεται από το eshop όταν γίνει πληρωμή με κάρτα | [optional] +**qr_url** | **string** | Συμπληρώνεται από το erp όταν έχει εκδοθεί απόδειξη από πάροχο | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EOrderStatusPagedResponse.md b/docs/Model/EOrderStatusPagedResponse.md new file mode 100644 index 0000000..d42a6c7 --- /dev/null +++ b/docs/Model/EOrderStatusPagedResponse.md @@ -0,0 +1,18 @@ +# # EOrderStatusPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\EOrderStatus[]**](EOrderStatus.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Fee.md b/docs/Model/Fee.md new file mode 100644 index 0000000..f655449 --- /dev/null +++ b/docs/Model/Fee.md @@ -0,0 +1,13 @@ +# # Fee + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fee_id** | **int** | { \"1\" ,ΕΞΟΔΑ ΑΝΤΙΚΑΤΑΒΟΛΗΣ } { \"2\" ,ΕΞΟΔΑ ΑΠΟΣΤΟΛΗΣ } { \"3\" ,ΕΞΟΔΑ ΣΥΣΚΕΥΑΣΙΑΣ } | [optional] +**fee_name** | **string** | | [optional] +**amount** | **float** | | [optional] +**vat_amount** | **float** | | [optional] +**total** | **float** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Fees.md b/docs/Model/Fees.md new file mode 100644 index 0000000..a25c360 --- /dev/null +++ b/docs/Model/Fees.md @@ -0,0 +1,9 @@ +# # Fees + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fee_list** | [**\Europharmacy\EuromedicaClient\Model\Fee[]**](Fee.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Item.md b/docs/Model/Item.md new file mode 100644 index 0000000..b18c99e --- /dev/null +++ b/docs/Model/Item.md @@ -0,0 +1,15 @@ +# # Item + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**product_title** | **string** | όνομα προϊόντος | [optional] +**erp_id** | **string** | to uniqId του Product | [optional] +**barcode** | **string** | barcode προϊόντος μόνο ένα σε περίπτωση που υπάρχουν περισσότερα του ενός | [optional] +**qty** | **float** | | [optional] +**unit_price** | **float** | λιανική τιμή προ έκπτωσης | [optional] +**discount_percentage** | **float** | ποσοστιαία έκπτωση | [optional] +**total** | **float** | Συνολική αξία προϊόντων μετά την έκπτωση (qty * unitPrice * ((100 - discountPercentage)/100)) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Items.md b/docs/Model/Items.md new file mode 100644 index 0000000..017292e --- /dev/null +++ b/docs/Model/Items.md @@ -0,0 +1,9 @@ +# # Items + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_list** | [**\Europharmacy\EuromedicaClient\Model\Item[]**](Item.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MainCategoryDto.md b/docs/Model/MainCategoryDto.md new file mode 100644 index 0000000..22166d4 --- /dev/null +++ b/docs/Model/MainCategoryDto.md @@ -0,0 +1,10 @@ +# # MainCategoryDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**main_id** | **string** | | [optional] +**main_desc** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MainCategoryDtoPagedResponse.md b/docs/Model/MainCategoryDtoPagedResponse.md new file mode 100644 index 0000000..f2c75ac --- /dev/null +++ b/docs/Model/MainCategoryDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # MainCategoryDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\MainCategoryDto[]**](MainCategoryDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OikosDto.md b/docs/Model/OikosDto.md new file mode 100644 index 0000000..4ce21dc --- /dev/null +++ b/docs/Model/OikosDto.md @@ -0,0 +1,11 @@ +# # OikosDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**desc** | **string** | | [optional] +**owner_id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OikosDtoPagedResponse.md b/docs/Model/OikosDtoPagedResponse.md new file mode 100644 index 0000000..54709f5 --- /dev/null +++ b/docs/Model/OikosDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # OikosDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\OikosDto[]**](OikosDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OwnerDto.md b/docs/Model/OwnerDto.md new file mode 100644 index 0000000..2940ceb --- /dev/null +++ b/docs/Model/OwnerDto.md @@ -0,0 +1,10 @@ +# # OwnerDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**desc** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OwnerDtoPagedResponse.md b/docs/Model/OwnerDtoPagedResponse.md new file mode 100644 index 0000000..2768dcf --- /dev/null +++ b/docs/Model/OwnerDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # OwnerDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\OwnerDto[]**](OwnerDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PersonalCategoryDto.md b/docs/Model/PersonalCategoryDto.md new file mode 100644 index 0000000..b2c6710 --- /dev/null +++ b/docs/Model/PersonalCategoryDto.md @@ -0,0 +1,13 @@ +# # PersonalCategoryDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**name** | **string** | | [optional] +**parent_id** | **string** | | [optional] +**visible_web** | **bool** | | [optional] +**eng_name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PersonalCategoryDtoPagedResponse.md b/docs/Model/PersonalCategoryDtoPagedResponse.md new file mode 100644 index 0000000..2c2a731 --- /dev/null +++ b/docs/Model/PersonalCategoryDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # PersonalCategoryDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\PersonalCategoryDto[]**](PersonalCategoryDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProblemDetails.md b/docs/Model/ProblemDetails.md new file mode 100644 index 0000000..eb05e38 --- /dev/null +++ b/docs/Model/ProblemDetails.md @@ -0,0 +1,13 @@ +# # ProblemDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**title** | **string** | | [optional] +**status** | **int** | | [optional] +**detail** | **string** | | [optional] +**instance** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductDto.md b/docs/Model/ProductDto.md new file mode 100644 index 0000000..1f7ff24 --- /dev/null +++ b/docs/Model/ProductDto.md @@ -0,0 +1,44 @@ +# # ProductDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uniq_id** | **string** | Μοναδικός κωδικός είδους | [optional] +**product_name** | **string** | Τίτλος είδους | [optional] +**retail_price** | **float** | Λιανική τιμή | [optional] +**whole_price** | **float** | Χονδρική τιμή | [optional] +**vat** | **float** | Φπα είδους | [optional] +**suggest_price** | **float** | Τιμή καταλόγου | [optional] +**eshop_price** | **float** | Τιμή eshop | [optional] +**ref_price** | **float** | Τιμή Αναφοράς - Για φάρμακα | [optional] +**eshop_discount** | **float** | | [optional] +**stock** | **float** | Απόθεμα Φαρμακείου | [optional] +**reserved_stock** | **float** | Δεσμευμένο απόθεμα | [optional] +**available_stock** | **float** | Διαθέσιμο Απόθεμα | [optional] +**robot_stock** | **float** | | [optional] +**barcode** | **string** | | [optional] +**barcode_list** | **string[]** | | [optional] +**oikos_id** | **string** | Τιμή καταλόγου | [optional] +**owner_id** | **string** | | [optional] +**main_categ_id** | **string** | | [optional] +**categ_id** | **string** | | [optional] +**sub_categ_id** | **string** | | [optional] +**per_cat_id** | **string** | | [optional] +**per_cat2_id** | **string** | | [optional] +**per_cat3_id** | **string** | | [optional] +**mock_id** | **string** | Κωδικός Παραλλαγής | [optional] +**mock_name** | **string** | Όνομα Παραλλαγής | [optional] +**measurement_unit** | **string** | { \"\", \"\"}, { \"Size\", \"Μέγεθος\" } , {\"Mass\" , \"Όγκος (ml)\" }, {\"Pieces\" , \"Τεμάχια\" }, { \"Weight\", \"Βάρος (kg)\" } | [optional] +**measurement_value** | **string** | | [optional] +**weight** | **float** | Βάρος | [optional] +**color** | **string** | Χρώμα | [optional] +**shelf** | **string** | Ράφι | [optional] +**position** | **string** | Θέση | [optional] +**last_supplier** | **string** | | [optional] +**web_visible** | **bool** | Αν θα εμφανίζεται το site | [optional] +**img_url** | **string** | | [optional] +**is_med** | **bool** | | [optional] +**last_upd** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductDtoPagedResponse.md b/docs/Model/ProductDtoPagedResponse.md new file mode 100644 index 0000000..ea6ea52 --- /dev/null +++ b/docs/Model/ProductDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # ProductDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\ProductDto[]**](ProductDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Shipping.md b/docs/Model/Shipping.md new file mode 100644 index 0000000..a1ef828 --- /dev/null +++ b/docs/Model/Shipping.md @@ -0,0 +1,19 @@ +# # Shipping + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**last_name** | **string** | | [optional] +**first_name** | **string** | | [optional] +**address** | **string** | | [optional] +**city** | **string** | | [optional] +**postcode** | **string** | | [optional] +**state** | **string** | | [optional] +**country** | **string** | | [optional] +**country_code** | **string** | | [optional] +**phone** | **string** | | [optional] +**cellphone** | **string** | | [optional] +**email** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubCategoryDto.md b/docs/Model/SubCategoryDto.md new file mode 100644 index 0000000..f503bf2 --- /dev/null +++ b/docs/Model/SubCategoryDto.md @@ -0,0 +1,11 @@ +# # SubCategoryDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sc_id** | **string** | | [optional] +**sc_desc** | **string** | | [optional] +**ca_id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubCategoryDtoPagedResponse.md b/docs/Model/SubCategoryDtoPagedResponse.md new file mode 100644 index 0000000..95ff1fb --- /dev/null +++ b/docs/Model/SubCategoryDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # SubCategoryDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\SubCategoryDto[]**](SubCategoryDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VatCategoryDto.md b/docs/Model/VatCategoryDto.md new file mode 100644 index 0000000..2d0e65b --- /dev/null +++ b/docs/Model/VatCategoryDto.md @@ -0,0 +1,11 @@ +# # VatCategoryDto + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vat_code** | **int** | | [optional] +**vat_value** | **float** | | [optional] +**vat_desc** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VatCategoryDtoPagedResponse.md b/docs/Model/VatCategoryDtoPagedResponse.md new file mode 100644 index 0000000..e1fcd9e --- /dev/null +++ b/docs/Model/VatCategoryDtoPagedResponse.md @@ -0,0 +1,18 @@ +# # VatCategoryDtoPagedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time_stamp** | **\DateTime** | | [optional] [readonly] +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**total_items** | **int** | | [optional] +**total_pages** | **int** | | [optional] [readonly] +**last_page** | **bool** | | [optional] [readonly] +**data_size** | **int** | | [optional] [readonly] +**is_success** | **bool** | | [optional] [readonly] +**errors** | **string[]** | | [optional] +**data** | [**\Europharmacy\EuromedicaClient\Model\VatCategoryDto[]**](VatCategoryDto.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..67b52e2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/lib/Api/CustomersApi.php b/lib/Api/CustomersApi.php new file mode 100644 index 0000000..51f5bb6 --- /dev/null +++ b/lib/Api/CustomersApi.php @@ -0,0 +1,1536 @@ + [ + 'application/json', + ], + 'apiCustomersIdGet' => [ + 'application/json', + ], + 'apiCustomersPost' => [ + 'application/json-patch+json', + 'application/json', + '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 apiCustomersGet + * + * Αναζήτηση πελατών + * + * @param string|null $search_by_name (optional, default to '') + * @param string|null $search_by_phone (optional, default to '') + * @param string|null $search_by_amka (optional, default to '') + * @param string|null $search_by_afm (optional, default to '') + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersGet'] 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\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiCustomersGet($search_by_name = '', $search_by_phone = '', $search_by_amka = '', $search_by_afm = '', $page = 1, $size = 1000, string $contentType = self::contentTypes['apiCustomersGet'][0]) + { + list($response) = $this->apiCustomersGetWithHttpInfo($search_by_name, $search_by_phone, $search_by_amka, $search_by_afm, $page, $size, $contentType); + return $response; + } + + /** + * Operation apiCustomersGetWithHttpInfo + * + * Αναζήτηση πελατών + * + * @param string|null $search_by_name (optional, default to '') + * @param string|null $search_by_phone (optional, default to '') + * @param string|null $search_by_amka (optional, default to '') + * @param string|null $search_by_afm (optional, default to '') + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersGet'] 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\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiCustomersGetWithHttpInfo($search_by_name = '', $search_by_phone = '', $search_by_amka = '', $search_by_afm = '', $page = 1, $size = 1000, string $contentType = self::contentTypes['apiCustomersGet'][0]) + { + $request = $this->apiCustomersGetRequest($search_by_name, $search_by_phone, $search_by_amka, $search_by_afm, $page, $size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' !== '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\CustomerPagedResponse', []), + $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 ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' !== '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\CustomerPagedResponse', []), + $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() + ]; + case 403: + 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\CustomerPagedResponse'; + 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\CustomerPagedResponse', + $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(), + '\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiCustomersGetAsync + * + * Αναζήτηση πελατών + * + * @param string|null $search_by_name (optional, default to '') + * @param string|null $search_by_phone (optional, default to '') + * @param string|null $search_by_amka (optional, default to '') + * @param string|null $search_by_afm (optional, default to '') + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiCustomersGetAsync($search_by_name = '', $search_by_phone = '', $search_by_amka = '', $search_by_afm = '', $page = 1, $size = 1000, string $contentType = self::contentTypes['apiCustomersGet'][0]) + { + return $this->apiCustomersGetAsyncWithHttpInfo($search_by_name, $search_by_phone, $search_by_amka, $search_by_afm, $page, $size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiCustomersGetAsyncWithHttpInfo + * + * Αναζήτηση πελατών + * + * @param string|null $search_by_name (optional, default to '') + * @param string|null $search_by_phone (optional, default to '') + * @param string|null $search_by_amka (optional, default to '') + * @param string|null $search_by_afm (optional, default to '') + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiCustomersGetAsyncWithHttpInfo($search_by_name = '', $search_by_phone = '', $search_by_amka = '', $search_by_afm = '', $page = 1, $size = 1000, string $contentType = self::contentTypes['apiCustomersGet'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse'; + $request = $this->apiCustomersGetRequest($search_by_name, $search_by_phone, $search_by_amka, $search_by_afm, $page, $size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'apiCustomersGet' + * + * @param string|null $search_by_name (optional, default to '') + * @param string|null $search_by_phone (optional, default to '') + * @param string|null $search_by_amka (optional, default to '') + * @param string|null $search_by_afm (optional, default to '') + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiCustomersGetRequest($search_by_name = '', $search_by_phone = '', $search_by_amka = '', $search_by_afm = '', $page = 1, $size = 1000, string $contentType = self::contentTypes['apiCustomersGet'][0]) + { + + + + + + + + + $resourcePath = '/api/Customers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_by_name, + 'searchByName', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_by_phone, + 'searchByPhone', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_by_amka, + 'searchByAmka', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_by_afm, + 'searchByAfm', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation apiCustomersIdGet + * + * Προβολή πελάτη βάσει Id + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersIdGet'] 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\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiCustomersIdGet($id, string $contentType = self::contentTypes['apiCustomersIdGet'][0]) + { + list($response) = $this->apiCustomersIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation apiCustomersIdGetWithHttpInfo + * + * Προβολή πελάτη βάσει Id + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersIdGet'] 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\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiCustomersIdGetWithHttpInfo($id, string $contentType = self::contentTypes['apiCustomersIdGet'][0]) + { + $request = $this->apiCustomersIdGetRequest($id, $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\CustomerPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' !== '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\CustomerPagedResponse', []), + $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() + ]; + case 403: + 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\CustomerPagedResponse'; + 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\CustomerPagedResponse', + $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; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiCustomersIdGetAsync + * + * Προβολή πελάτη βάσει Id + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiCustomersIdGetAsync($id, string $contentType = self::contentTypes['apiCustomersIdGet'][0]) + { + return $this->apiCustomersIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiCustomersIdGetAsyncWithHttpInfo + * + * Προβολή πελάτη βάσει Id + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiCustomersIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['apiCustomersIdGet'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse'; + $request = $this->apiCustomersIdGetRequest($id, $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 'apiCustomersIdGet' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiCustomersIdGetRequest($id, string $contentType = self::contentTypes['apiCustomersIdGet'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling apiCustomersIdGet' + ); + } + + + $resourcePath = '/api/Customers/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $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 apiCustomersPost + * + * Εισαγωγή ή επεξεργασία πελάτη + * + * @param \Europharmacy\EuromedicaClient\Model\CustomerDto|null $customer_dto (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersPost'] 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\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiCustomersPost($customer_dto = null, string $contentType = self::contentTypes['apiCustomersPost'][0]) + { + list($response) = $this->apiCustomersPostWithHttpInfo($customer_dto, $contentType); + return $response; + } + + /** + * Operation apiCustomersPostWithHttpInfo + * + * Εισαγωγή ή επεξεργασία πελάτη + * + * @param \Europharmacy\EuromedicaClient\Model\CustomerDto|null $customer_dto (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersPost'] 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\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiCustomersPostWithHttpInfo($customer_dto = null, string $contentType = self::contentTypes['apiCustomersPost'][0]) + { + $request = $this->apiCustomersPostRequest($customer_dto, $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\CustomerPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' !== '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\CustomerPagedResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse' !== '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\CustomerPagedResponse', []), + $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() + ]; + case 403: + 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\CustomerPagedResponse'; + 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\CustomerPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiCustomersPostAsync + * + * Εισαγωγή ή επεξεργασία πελάτη + * + * @param \Europharmacy\EuromedicaClient\Model\CustomerDto|null $customer_dto (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiCustomersPostAsync($customer_dto = null, string $contentType = self::contentTypes['apiCustomersPost'][0]) + { + return $this->apiCustomersPostAsyncWithHttpInfo($customer_dto, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiCustomersPostAsyncWithHttpInfo + * + * Εισαγωγή ή επεξεργασία πελάτη + * + * @param \Europharmacy\EuromedicaClient\Model\CustomerDto|null $customer_dto (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiCustomersPostAsyncWithHttpInfo($customer_dto = null, string $contentType = self::contentTypes['apiCustomersPost'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\CustomerPagedResponse'; + $request = $this->apiCustomersPostRequest($customer_dto, $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 'apiCustomersPost' + * + * @param \Europharmacy\EuromedicaClient\Model\CustomerDto|null $customer_dto (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiCustomersPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiCustomersPostRequest($customer_dto = null, string $contentType = self::contentTypes['apiCustomersPost'][0]) + { + + + + $resourcePath = '/api/Customers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($customer_dto)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($customer_dto)); + } else { + $httpBody = $customer_dto; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * 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; + } +} diff --git a/lib/Api/EshopApi.php b/lib/Api/EshopApi.php new file mode 100644 index 0000000..7487bc6 --- /dev/null +++ b/lib/Api/EshopApi.php @@ -0,0 +1,936 @@ + [ + 'application/json', + ], + 'apiEshopStatusGet' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation apiEshopOrderIdPost + * + * Εισαγωγή / Τροποποίηση παραγγελίας + * + * @param int $order_id Ο αριθμός της παραγγελίας (required) + * @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation + * + * @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Europharmacy\EuromedicaClient\Model\EOrderPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse + */ + public function apiEshopOrderIdPost($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0]) + { + list($response) = $this->apiEshopOrderIdPostWithHttpInfo($order_id, $e_order, $contentType); + return $response; + } + + /** + * Operation apiEshopOrderIdPostWithHttpInfo + * + * Εισαγωγή / Τροποποίηση παραγγελίας + * + * @param int $order_id Ο αριθμός της παραγγελίας (required) + * @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation + * + * @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Europharmacy\EuromedicaClient\Model\EOrderPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function apiEshopOrderIdPostWithHttpInfo($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0]) + { + $request = $this->apiEshopOrderIdPostRequest($order_id, $e_order, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse' !== '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\EOrderPagedResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse' !== '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\EOrderPagedResponse', []), + $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\EOrderPagedResponse'; + 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\EOrderPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiEshopOrderIdPostAsync + * + * Εισαγωγή / Τροποποίηση παραγγελίας + * + * @param int $order_id Ο αριθμός της παραγγελίας (required) + * @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiEshopOrderIdPostAsync($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0]) + { + return $this->apiEshopOrderIdPostAsyncWithHttpInfo($order_id, $e_order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiEshopOrderIdPostAsyncWithHttpInfo + * + * Εισαγωγή / Τροποποίηση παραγγελίας + * + * @param int $order_id Ο αριθμός της παραγγελίας (required) + * @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiEshopOrderIdPostAsyncWithHttpInfo($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\EOrderPagedResponse'; + $request = $this->apiEshopOrderIdPostRequest($order_id, $e_order, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'apiEshopOrderIdPost' + * + * @param int $order_id Ο αριθμός της παραγγελίας (required) + * @param \Europharmacy\EuromedicaClient\Model\EOrder|null $e_order (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopOrderIdPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiEshopOrderIdPostRequest($order_id, $e_order = null, string $contentType = self::contentTypes['apiEshopOrderIdPost'][0]) + { + + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling apiEshopOrderIdPost' + ); + } + + + + $resourcePath = '/api/Eshop/{orderId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'orderId' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($e_order)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($e_order)); + } else { + $httpBody = $e_order; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation apiEshopStatusGet + * + * Κατάσταση παραγγελιών + * + * @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60) + * @param int|null $order_id Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0) + * @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional) + * @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation + * + * @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse + */ + public function apiEshopStatusGet($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0]) + { + list($response) = $this->apiEshopStatusGetWithHttpInfo($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType); + return $response; + } + + /** + * Operation apiEshopStatusGetWithHttpInfo + * + * Κατάσταση παραγγελιών + * + * @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60) + * @param int|null $order_id Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0) + * @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional) + * @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation + * + * @throws \Europharmacy\EuromedicaClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse|\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function apiEshopStatusGetWithHttpInfo($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0]) + { + $request = $this->apiEshopStatusGetRequest($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse' !== '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\EOrderStatusPagedResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse' !== '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\EOrderStatusPagedResponse', []), + $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\EOrderStatusPagedResponse'; + 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\EOrderStatusPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiEshopStatusGetAsync + * + * Κατάσταση παραγγελιών + * + * @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60) + * @param int|null $order_id Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0) + * @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional) + * @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiEshopStatusGetAsync($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0]) + { + return $this->apiEshopStatusGetAsyncWithHttpInfo($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiEshopStatusGetAsyncWithHttpInfo + * + * Κατάσταση παραγγελιών + * + * @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60) + * @param int|null $order_id Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0) + * @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional) + * @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiEshopStatusGetAsyncWithHttpInfo($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\EOrderStatusPagedResponse'; + $request = $this->apiEshopStatusGetRequest($modified_last_days, $order_id, $modified_after, $include_creata_date, $page, $size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'apiEshopStatusGet' + * + * @param int|null $modified_last_days Εμφανίζει τις παραγγελίες που τροποποιήθηκαν τις τελευταίες {60 :default} μέρες (optional, default to 60) + * @param int|null $order_id Αν έχει τιμή > 0 εμφανίζει κατάσταση της παραγγελίας ανεξαρτήτως των υπολοίπων παραμέτρων (optional, default to 0) + * @param \DateTime|null $modified_after Εμφανίζει τις παραγγελίες που τροποποιήθηκαν την επιλεγμένη ημερομηνία {null :default} αν έχει τιμή υπερισχύει της modifiedLastDays (optional) + * @param bool|null $include_creata_date By default δεν ελέγχει την ημερομηνία δημιουργίας για την εμφάνιση αποτελεσμάτων (optional, default to false) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiEshopStatusGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiEshopStatusGetRequest($modified_last_days = 60, $order_id = 0, $modified_after = null, $include_creata_date = false, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiEshopStatusGet'][0]) + { + + if ($modified_last_days !== null && $modified_last_days > 360) { + throw new \InvalidArgumentException('invalid value for "$modified_last_days" when calling EshopApi.apiEshopStatusGet, must be smaller than or equal to 360.'); + } + if ($modified_last_days !== null && $modified_last_days < 0) { + throw new \InvalidArgumentException('invalid value for "$modified_last_days" when calling EshopApi.apiEshopStatusGet, must be bigger than or equal to 0.'); + } + + + + + + if ($size !== null && $size > 1000) { + throw new \InvalidArgumentException('invalid value for "$size" when calling EshopApi.apiEshopStatusGet, must be smaller than or equal to 1000.'); + } + if ($size !== null && $size < 1) { + throw new \InvalidArgumentException('invalid value for "$size" when calling EshopApi.apiEshopStatusGet, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/api/Eshop/Status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modified_last_days, + 'modifiedLastDays', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order_id, + 'orderId', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modified_after, + 'modifiedAfter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_creata_date, + 'includeCreataDate', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/MasterDataApi.php b/lib/Api/MasterDataApi.php new file mode 100644 index 0000000..8e16e49 --- /dev/null +++ b/lib/Api/MasterDataApi.php @@ -0,0 +1,2941 @@ + [ + '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; + } +} diff --git a/lib/Api/ProductsApi.php b/lib/Api/ProductsApi.php new file mode 100644 index 0000000..2fed4b1 --- /dev/null +++ b/lib/Api/ProductsApi.php @@ -0,0 +1,1589 @@ + [ + 'application/json', + ], + 'apiProductsDataboxBarcodePost' => [ + 'application/json', + ], + 'apiProductsGet' => [ + '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 apiProductsBarcodeGet + * + * Αναζήτηση βάσει barcode + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsBarcodeGet'] 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\ProductDto|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiProductsBarcodeGet($barcode, string $contentType = self::contentTypes['apiProductsBarcodeGet'][0]) + { + list($response) = $this->apiProductsBarcodeGetWithHttpInfo($barcode, $contentType); + return $response; + } + + /** + * Operation apiProductsBarcodeGetWithHttpInfo + * + * Αναζήτηση βάσει barcode + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsBarcodeGet'] 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\ProductDto|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiProductsBarcodeGetWithHttpInfo($barcode, string $contentType = self::contentTypes['apiProductsBarcodeGet'][0]) + { + $request = $this->apiProductsBarcodeGetRequest($barcode, $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\ProductDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\ProductDto' !== '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\ProductDto', []), + $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() + ]; + case 403: + 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\ProductDto'; + 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\ProductDto', + $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; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiProductsBarcodeGetAsync + * + * Αναζήτηση βάσει barcode + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsBarcodeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiProductsBarcodeGetAsync($barcode, string $contentType = self::contentTypes['apiProductsBarcodeGet'][0]) + { + return $this->apiProductsBarcodeGetAsyncWithHttpInfo($barcode, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiProductsBarcodeGetAsyncWithHttpInfo + * + * Αναζήτηση βάσει barcode + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsBarcodeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiProductsBarcodeGetAsyncWithHttpInfo($barcode, string $contentType = self::contentTypes['apiProductsBarcodeGet'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\ProductDto'; + $request = $this->apiProductsBarcodeGetRequest($barcode, $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 'apiProductsBarcodeGet' + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsBarcodeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiProductsBarcodeGetRequest($barcode, string $contentType = self::contentTypes['apiProductsBarcodeGet'][0]) + { + + // verify the required parameter 'barcode' is set + if ($barcode === null || (is_array($barcode) && count($barcode) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $barcode when calling apiProductsBarcodeGet' + ); + } + + + $resourcePath = '/api/Products/{barcode}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($barcode !== null) { + $resourcePath = str_replace( + '{' . 'barcode' . '}', + ObjectSerializer::toPathValue($barcode), + $resourcePath + ); + } + + + $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 apiProductsDataboxBarcodePost + * + * @param string $barcode barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsDataboxBarcodePost'] 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\ProductDto|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiProductsDataboxBarcodePost($barcode, string $contentType = self::contentTypes['apiProductsDataboxBarcodePost'][0]) + { + list($response) = $this->apiProductsDataboxBarcodePostWithHttpInfo($barcode, $contentType); + return $response; + } + + /** + * Operation apiProductsDataboxBarcodePostWithHttpInfo + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsDataboxBarcodePost'] 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\ProductDto|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiProductsDataboxBarcodePostWithHttpInfo($barcode, string $contentType = self::contentTypes['apiProductsDataboxBarcodePost'][0]) + { + $request = $this->apiProductsDataboxBarcodePostRequest($barcode, $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\ProductDto' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\ProductDto' !== '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\ProductDto', []), + $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() + ]; + case 403: + 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\ProductDto'; + 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\ProductDto', + $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; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiProductsDataboxBarcodePostAsync + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsDataboxBarcodePost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiProductsDataboxBarcodePostAsync($barcode, string $contentType = self::contentTypes['apiProductsDataboxBarcodePost'][0]) + { + return $this->apiProductsDataboxBarcodePostAsyncWithHttpInfo($barcode, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiProductsDataboxBarcodePostAsyncWithHttpInfo + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsDataboxBarcodePost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiProductsDataboxBarcodePostAsyncWithHttpInfo($barcode, string $contentType = self::contentTypes['apiProductsDataboxBarcodePost'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\ProductDto'; + $request = $this->apiProductsDataboxBarcodePostRequest($barcode, $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 'apiProductsDataboxBarcodePost' + * + * @param string $barcode (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsDataboxBarcodePost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiProductsDataboxBarcodePostRequest($barcode, string $contentType = self::contentTypes['apiProductsDataboxBarcodePost'][0]) + { + + // verify the required parameter 'barcode' is set + if ($barcode === null || (is_array($barcode) && count($barcode) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $barcode when calling apiProductsDataboxBarcodePost' + ); + } + + + $resourcePath = '/api/Products/Databox/{Barcode}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($barcode !== null) { + $resourcePath = str_replace( + '{' . 'Barcode' . '}', + ObjectSerializer::toPathValue($barcode), + $resourcePath + ); + } + + + $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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation apiProductsGet + * + * Αναζήτηση ειδών + * + * @param string|null $search_text Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό (optional) + * @param bool|null $search_meds Αναζήτηση φαρμάκων (optional, default to true) + * @param bool|null $search_user_items Αναζήτηση παραφαρμάκων (optional, default to true) + * @param bool|null $visibly_web Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) (optional) + * @param \DateTime|null $modified_after Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) (optional) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsGet'] 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\ProductDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiProductsGet($search_text = null, $search_meds = true, $search_user_items = true, $visibly_web = null, $modified_after = null, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiProductsGet'][0]) + { + list($response) = $this->apiProductsGetWithHttpInfo($search_text, $search_meds, $search_user_items, $visibly_web, $modified_after, $page, $size, $contentType); + return $response; + } + + /** + * Operation apiProductsGetWithHttpInfo + * + * Αναζήτηση ειδών + * + * @param string|null $search_text Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό (optional) + * @param bool|null $search_meds Αναζήτηση φαρμάκων (optional, default to true) + * @param bool|null $search_user_items Αναζήτηση παραφαρμάκων (optional, default to true) + * @param bool|null $visibly_web Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) (optional) + * @param \DateTime|null $modified_after Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) (optional) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsGet'] 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\ProductDtoPagedResponse|\Europharmacy\EuromedicaClient\Model\ProblemDetails|string|\Europharmacy\EuromedicaClient\Model\ProblemDetails|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiProductsGetWithHttpInfo($search_text = null, $search_meds = true, $search_user_items = true, $visibly_web = null, $modified_after = null, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiProductsGet'][0]) + { + $request = $this->apiProductsGetRequest($search_text, $search_meds, $search_user_items, $visibly_web, $modified_after, $page, $size, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Europharmacy\EuromedicaClient\Model\ProductDtoPagedResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Europharmacy\EuromedicaClient\Model\ProductDtoPagedResponse' !== '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\ProductDtoPagedResponse', []), + $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() + ]; + case 403: + 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\ProductDtoPagedResponse'; + 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\ProductDtoPagedResponse', + $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; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Europharmacy\EuromedicaClient\Model\ProblemDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiProductsGetAsync + * + * Αναζήτηση ειδών + * + * @param string|null $search_text Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό (optional) + * @param bool|null $search_meds Αναζήτηση φαρμάκων (optional, default to true) + * @param bool|null $search_user_items Αναζήτηση παραφαρμάκων (optional, default to true) + * @param bool|null $visibly_web Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) (optional) + * @param \DateTime|null $modified_after Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) (optional) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiProductsGetAsync($search_text = null, $search_meds = true, $search_user_items = true, $visibly_web = null, $modified_after = null, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiProductsGet'][0]) + { + return $this->apiProductsGetAsyncWithHttpInfo($search_text, $search_meds, $search_user_items, $visibly_web, $modified_after, $page, $size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiProductsGetAsyncWithHttpInfo + * + * Αναζήτηση ειδών + * + * @param string|null $search_text Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό (optional) + * @param bool|null $search_meds Αναζήτηση φαρμάκων (optional, default to true) + * @param bool|null $search_user_items Αναζήτηση παραφαρμάκων (optional, default to true) + * @param bool|null $visibly_web Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) (optional) + * @param \DateTime|null $modified_after Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) (optional) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiProductsGetAsyncWithHttpInfo($search_text = null, $search_meds = true, $search_user_items = true, $visibly_web = null, $modified_after = null, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiProductsGet'][0]) + { + $returnType = '\Europharmacy\EuromedicaClient\Model\ProductDtoPagedResponse'; + $request = $this->apiProductsGetRequest($search_text, $search_meds, $search_user_items, $visibly_web, $modified_after, $page, $size, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'apiProductsGet' + * + * @param string|null $search_text Αναζήτηση είδους βάσει ονομασίας/barcode , μπορεί να είναι και κενό (optional) + * @param bool|null $search_meds Αναζήτηση φαρμάκων (optional, default to true) + * @param bool|null $search_user_items Αναζήτηση παραφαρμάκων (optional, default to true) + * @param bool|null $visibly_web Αν έχει τιμή θα επιστρέφει όσα πληρούν τη συνθήκη (Αυτόματα εξαιρεί τα φάρμακα) (optional) + * @param \DateTime|null $modified_after Αν έχει τιμή θα επιστρέφει όσα έχουν τροποποιηθεί μετά την επιλεγμένη ημερομηνία π.χ. (2024-3-12 12:01) (optional) + * @param int|null $page (optional, default to 1) + * @param int|null $size (optional, default to 1000) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiProductsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiProductsGetRequest($search_text = null, $search_meds = true, $search_user_items = true, $visibly_web = null, $modified_after = null, $page = 1, $size = 1000, string $contentType = self::contentTypes['apiProductsGet'][0]) + { + + + + + + + + if ($size !== null && $size > 1000) { + throw new \InvalidArgumentException('invalid value for "$size" when calling ProductsApi.apiProductsGet, must be smaller than or equal to 1000.'); + } + if ($size !== null && $size < 1) { + throw new \InvalidArgumentException('invalid value for "$size" when calling ProductsApi.apiProductsGet, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/api/Products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_text, + 'searchText', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_meds, + 'searchMeds', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_user_items, + 'searchUserItems', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $visibly_web, + 'visiblyWeb', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $modified_after, + 'modifiedAfter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/WelcomeApi.php b/lib/Api/WelcomeApi.php new file mode 100644 index 0000000..12680a1 --- /dev/null +++ b/lib/Api/WelcomeApi.php @@ -0,0 +1,938 @@ + [ + 'application/json', + ], + 'apiWelcomeHead' => [ + 'application/json', + ], + 'apiWelcomeSecureGet' => [ + '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 apiWelcomeGet + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeGet'] 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 string + */ + public function apiWelcomeGet(string $contentType = self::contentTypes['apiWelcomeGet'][0]) + { + list($response) = $this->apiWelcomeGetWithHttpInfo($contentType); + return $response; + } + + /** + * Operation apiWelcomeGetWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeGet'] 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 string, HTTP status code, HTTP response headers (array of strings) + */ + public function apiWelcomeGetWithHttpInfo(string $contentType = self::contentTypes['apiWelcomeGet'][0]) + { + $request = $this->apiWelcomeGetRequest($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 ('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() + ]; + } + + 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 = 'string'; + 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(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation apiWelcomeGetAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiWelcomeGetAsync(string $contentType = self::contentTypes['apiWelcomeGet'][0]) + { + return $this->apiWelcomeGetAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiWelcomeGetAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiWelcomeGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiWelcomeGet'][0]) + { + $returnType = 'string'; + $request = $this->apiWelcomeGetRequest($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 'apiWelcomeGet' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiWelcomeGetRequest(string $contentType = self::contentTypes['apiWelcomeGet'][0]) + { + + + $resourcePath = '/api/Welcome'; + $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); + } + } + + + $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 apiWelcomeHead + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeHead'] 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 void + */ + public function apiWelcomeHead(string $contentType = self::contentTypes['apiWelcomeHead'][0]) + { + $this->apiWelcomeHeadWithHttpInfo($contentType); + } + + /** + * Operation apiWelcomeHeadWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeHead'] 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 null, HTTP status code, HTTP response headers (array of strings) + */ + public function apiWelcomeHeadWithHttpInfo(string $contentType = self::contentTypes['apiWelcomeHead'][0]) + { + $request = $this->apiWelcomeHeadRequest($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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation apiWelcomeHeadAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeHead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiWelcomeHeadAsync(string $contentType = self::contentTypes['apiWelcomeHead'][0]) + { + return $this->apiWelcomeHeadAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiWelcomeHeadAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeHead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiWelcomeHeadAsyncWithHttpInfo(string $contentType = self::contentTypes['apiWelcomeHead'][0]) + { + $returnType = ''; + $request = $this->apiWelcomeHeadRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'apiWelcomeHead' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeHead'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiWelcomeHeadRequest(string $contentType = self::contentTypes['apiWelcomeHead'][0]) + { + + + $resourcePath = '/api/Welcome'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $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); + } + } + + + $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( + 'HEAD', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation apiWelcomeSecureGet + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeSecureGet'] 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 string|\Europharmacy\EuromedicaClient\Model\ProblemDetails + */ + public function apiWelcomeSecureGet(string $contentType = self::contentTypes['apiWelcomeSecureGet'][0]) + { + list($response) = $this->apiWelcomeSecureGetWithHttpInfo($contentType); + return $response; + } + + /** + * Operation apiWelcomeSecureGetWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeSecureGet'] 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 string|\Europharmacy\EuromedicaClient\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function apiWelcomeSecureGetWithHttpInfo(string $contentType = self::contentTypes['apiWelcomeSecureGet'][0]) + { + $request = $this->apiWelcomeSecureGetRequest($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 ('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 = 'string'; + 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(), + '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 apiWelcomeSecureGetAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeSecureGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiWelcomeSecureGetAsync(string $contentType = self::contentTypes['apiWelcomeSecureGet'][0]) + { + return $this->apiWelcomeSecureGetAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation apiWelcomeSecureGetAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeSecureGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function apiWelcomeSecureGetAsyncWithHttpInfo(string $contentType = self::contentTypes['apiWelcomeSecureGet'][0]) + { + $returnType = 'string'; + $request = $this->apiWelcomeSecureGetRequest($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 'apiWelcomeSecureGet' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiWelcomeSecureGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function apiWelcomeSecureGetRequest(string $contentType = self::contentTypes['apiWelcomeSecureGet'][0]) + { + + + $resourcePath = '/api/Welcome/Secure'; + $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; + } +} diff --git a/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 0000000..9628c8b --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,120 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 0000000..3813840 --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,532 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Europharmacy\EuromedicaClient) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v1' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 0000000..f5e7125 --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,274 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = $this->selectJsonMimeList($accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/lib/Model/Billing.php b/lib/Model/Billing.php new file mode 100644 index 0000000..cd849a5 --- /dev/null +++ b/lib/Model/Billing.php @@ -0,0 +1,1167 @@ + + */ +class Billing implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'billing'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'last_name' => 'string', + 'first_name' => 'string', + 'address' => 'string', + 'city' => 'string', + 'postcode' => 'string', + 'state' => 'string', + 'country' => 'string', + 'country_code' => 'string', + 'phone' => 'string', + 'cellphone' => 'string', + 'email' => 'string', + 'is_invoice' => 'int', + 'commercial_name' => 'string', + 'tax_number' => 'string', + 'tax_office' => 'string', + 'activity' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'last_name' => null, + 'first_name' => null, + 'address' => null, + 'city' => null, + 'postcode' => null, + 'state' => null, + 'country' => null, + 'country_code' => null, + 'phone' => null, + 'cellphone' => null, + 'email' => null, + 'is_invoice' => 'int32', + 'commercial_name' => null, + 'tax_number' => null, + 'tax_office' => null, + 'activity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'last_name' => true, + 'first_name' => true, + 'address' => true, + 'city' => true, + 'postcode' => true, + 'state' => true, + 'country' => true, + 'country_code' => true, + 'phone' => true, + 'cellphone' => true, + 'email' => true, + 'is_invoice' => false, + 'commercial_name' => true, + 'tax_number' => true, + 'tax_office' => true, + 'activity' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'last_name' => 'lastName', + 'first_name' => 'firstName', + 'address' => 'address', + 'city' => 'city', + 'postcode' => 'postcode', + 'state' => 'state', + 'country' => 'country', + 'country_code' => 'countryCode', + 'phone' => 'phone', + 'cellphone' => 'cellphone', + 'email' => 'email', + 'is_invoice' => 'isInvoice', + 'commercial_name' => 'commercialName', + 'tax_number' => 'taxNumber', + 'tax_office' => 'taxOffice', + 'activity' => 'activity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'last_name' => 'setLastName', + 'first_name' => 'setFirstName', + 'address' => 'setAddress', + 'city' => 'setCity', + 'postcode' => 'setPostcode', + 'state' => 'setState', + 'country' => 'setCountry', + 'country_code' => 'setCountryCode', + 'phone' => 'setPhone', + 'cellphone' => 'setCellphone', + 'email' => 'setEmail', + 'is_invoice' => 'setIsInvoice', + 'commercial_name' => 'setCommercialName', + 'tax_number' => 'setTaxNumber', + 'tax_office' => 'setTaxOffice', + 'activity' => 'setActivity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'last_name' => 'getLastName', + 'first_name' => 'getFirstName', + 'address' => 'getAddress', + 'city' => 'getCity', + 'postcode' => 'getPostcode', + 'state' => 'getState', + 'country' => 'getCountry', + 'country_code' => 'getCountryCode', + 'phone' => 'getPhone', + 'cellphone' => 'getCellphone', + 'email' => 'getEmail', + 'is_invoice' => 'getIsInvoice', + 'commercial_name' => 'getCommercialName', + 'tax_number' => 'getTaxNumber', + 'tax_office' => 'getTaxOffice', + 'activity' => 'getActivity' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('postcode', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('country_code', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('cellphone', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('is_invoice', $data ?? [], null); + $this->setIfExists('commercial_name', $data ?? [], null); + $this->setIfExists('tax_number', $data ?? [], null); + $this->setIfExists('tax_office', $data ?? [], null); + $this->setIfExists('activity', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) > 60)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) < 1)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) > 60)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) < 1)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['address']) && (mb_strlen($this->container['address']) > 120)) { + $invalidProperties[] = "invalid value for 'address', the character length must be smaller than or equal to 120."; + } + + if (!is_null($this->container['city']) && (mb_strlen($this->container['city']) > 60)) { + $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['postcode']) && (mb_strlen($this->container['postcode']) > 10)) { + $invalidProperties[] = "invalid value for 'postcode', the character length must be smaller than or equal to 10."; + } + + if (!is_null($this->container['state']) && (mb_strlen($this->container['state']) > 60)) { + $invalidProperties[] = "invalid value for 'state', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['country']) && (mb_strlen($this->container['country']) > 20)) { + $invalidProperties[] = "invalid value for 'country', the character length must be smaller than or equal to 20."; + } + + if (!is_null($this->container['country_code']) && (mb_strlen($this->container['country_code']) > 2)) { + $invalidProperties[] = "invalid value for 'country_code', the character length must be smaller than or equal to 2."; + } + + if (!is_null($this->container['phone']) && (mb_strlen($this->container['phone']) > 15)) { + $invalidProperties[] = "invalid value for 'phone', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['cellphone']) && (mb_strlen($this->container['cellphone']) > 15)) { + $invalidProperties[] = "invalid value for 'cellphone', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 60)) { + $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['is_invoice']) && ($this->container['is_invoice'] > 1)) { + $invalidProperties[] = "invalid value for 'is_invoice', must be smaller than or equal to 1."; + } + + if (!is_null($this->container['is_invoice']) && ($this->container['is_invoice'] < 0)) { + $invalidProperties[] = "invalid value for 'is_invoice', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['tax_number']) && (mb_strlen($this->container['tax_number']) > 15)) { + $invalidProperties[] = "invalid value for 'tax_number', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['tax_office']) && (mb_strlen($this->container['tax_office']) > 40)) { + $invalidProperties[] = "invalid value for 'tax_office', the character length must be smaller than or equal to 40."; + } + + if (!is_null($this->container['activity']) && (mb_strlen($this->container['activity']) > 80)) { + $invalidProperties[] = "invalid value for 'activity', the character length must be smaller than or equal to 80."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name Επίθετο + * + * @return self + */ + public function setLastName($last_name) + { + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($last_name) && (mb_strlen($last_name) > 60)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling Billing., must be smaller than or equal to 60.'); + } + if (!is_null($last_name) && (mb_strlen($last_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling Billing., must be bigger than or equal to 1.'); + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name Όνομα + * + * @return self + */ + public function setFirstName($first_name) + { + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($first_name) && (mb_strlen($first_name) > 60)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling Billing., must be smaller than or equal to 60.'); + } + if (!is_null($first_name) && (mb_strlen($first_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling Billing., must be bigger than or equal to 1.'); + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address Διεύθυνση + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($address) && (mb_strlen($address) > 120)) { + throw new \InvalidArgumentException('invalid length for $address when calling Billing., must be smaller than or equal to 120.'); + } + + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($city) && (mb_strlen($city) > 60)) { + throw new \InvalidArgumentException('invalid length for $city when calling Billing., must be smaller than or equal to 60.'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets postcode + * + * @return string|null + */ + public function getPostcode() + { + return $this->container['postcode']; + } + + /** + * Sets postcode + * + * @param string|null $postcode postcode + * + * @return self + */ + public function setPostcode($postcode) + { + if (is_null($postcode)) { + array_push($this->openAPINullablesSetToNull, 'postcode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postcode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($postcode) && (mb_strlen($postcode) > 10)) { + throw new \InvalidArgumentException('invalid length for $postcode when calling Billing., must be smaller than or equal to 10.'); + } + + $this->container['postcode'] = $postcode; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state state + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($state) && (mb_strlen($state) > 60)) { + throw new \InvalidArgumentException('invalid length for $state when calling Billing., must be smaller than or equal to 60.'); + } + + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($country) && (mb_strlen($country) > 20)) { + throw new \InvalidArgumentException('invalid length for $country when calling Billing., must be smaller than or equal to 20.'); + } + + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets country_code + * + * @return string|null + */ + public function getCountryCode() + { + return $this->container['country_code']; + } + + /** + * Sets country_code + * + * @param string|null $country_code ΚΩΔΙΚΟΣ ΧΩΡΑΣ ISO 3166 ALPHA-2 + * + * @return self + */ + public function setCountryCode($country_code) + { + if (is_null($country_code)) { + array_push($this->openAPINullablesSetToNull, 'country_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($country_code) && (mb_strlen($country_code) > 2)) { + throw new \InvalidArgumentException('invalid length for $country_code when calling Billing., must be smaller than or equal to 2.'); + } + + $this->container['country_code'] = $country_code; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone phone + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($phone) && (mb_strlen($phone) > 15)) { + throw new \InvalidArgumentException('invalid length for $phone when calling Billing., must be smaller than or equal to 15.'); + } + + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets cellphone + * + * @return string|null + */ + public function getCellphone() + { + return $this->container['cellphone']; + } + + /** + * Sets cellphone + * + * @param string|null $cellphone cellphone + * + * @return self + */ + public function setCellphone($cellphone) + { + if (is_null($cellphone)) { + array_push($this->openAPINullablesSetToNull, 'cellphone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cellphone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($cellphone) && (mb_strlen($cellphone) > 15)) { + throw new \InvalidArgumentException('invalid length for $cellphone when calling Billing., must be smaller than or equal to 15.'); + } + + $this->container['cellphone'] = $cellphone; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($email) && (mb_strlen($email) > 60)) { + throw new \InvalidArgumentException('invalid length for $email when calling Billing., must be smaller than or equal to 60.'); + } + + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets is_invoice + * + * @return int|null + */ + public function getIsInvoice() + { + return $this->container['is_invoice']; + } + + /** + * Sets is_invoice + * + * @param int|null $is_invoice Αν ο πελάτης θέλει τιμολόγιο τιμή 1 + * + * @return self + */ + public function setIsInvoice($is_invoice) + { + if (is_null($is_invoice)) { + throw new \InvalidArgumentException('non-nullable is_invoice cannot be null'); + } + + if (($is_invoice > 1)) { + throw new \InvalidArgumentException('invalid value for $is_invoice when calling Billing., must be smaller than or equal to 1.'); + } + if (($is_invoice < 0)) { + throw new \InvalidArgumentException('invalid value for $is_invoice when calling Billing., must be bigger than or equal to 0.'); + } + + $this->container['is_invoice'] = $is_invoice; + + return $this; + } + + /** + * Gets commercial_name + * + * @return string|null + */ + public function getCommercialName() + { + return $this->container['commercial_name']; + } + + /** + * Sets commercial_name + * + * @param string|null $commercial_name η επωνυμία που θα κοπεί το τιμολόγιο + * + * @return self + */ + public function setCommercialName($commercial_name) + { + if (is_null($commercial_name)) { + array_push($this->openAPINullablesSetToNull, 'commercial_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('commercial_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['commercial_name'] = $commercial_name; + + return $this; + } + + /** + * Gets tax_number + * + * @return string|null + */ + public function getTaxNumber() + { + return $this->container['tax_number']; + } + + /** + * Sets tax_number + * + * @param string|null $tax_number Αφμ πελάτη , υποχρεωτικό σε περίπτωση τιμολογίου + * + * @return self + */ + public function setTaxNumber($tax_number) + { + if (is_null($tax_number)) { + array_push($this->openAPINullablesSetToNull, 'tax_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($tax_number) && (mb_strlen($tax_number) > 15)) { + throw new \InvalidArgumentException('invalid length for $tax_number when calling Billing., must be smaller than or equal to 15.'); + } + + $this->container['tax_number'] = $tax_number; + + return $this; + } + + /** + * Gets tax_office + * + * @return string|null + */ + public function getTaxOffice() + { + return $this->container['tax_office']; + } + + /** + * Sets tax_office + * + * @param string|null $tax_office ΔΟΥ πελάτη , υποχρεωτικό σε περίπτωση τιμολογίου + * + * @return self + */ + public function setTaxOffice($tax_office) + { + if (is_null($tax_office)) { + array_push($this->openAPINullablesSetToNull, 'tax_office'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_office', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($tax_office) && (mb_strlen($tax_office) > 40)) { + throw new \InvalidArgumentException('invalid length for $tax_office when calling Billing., must be smaller than or equal to 40.'); + } + + $this->container['tax_office'] = $tax_office; + + return $this; + } + + /** + * Gets activity + * + * @return string|null + */ + public function getActivity() + { + return $this->container['activity']; + } + + /** + * Sets activity + * + * @param string|null $activity Επάγγελμα , υποχρεωτικό σε περίπτωση τιμολογίου + * + * @return self + */ + public function setActivity($activity) + { + if (is_null($activity)) { + array_push($this->openAPINullablesSetToNull, 'activity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($activity) && (mb_strlen($activity) > 80)) { + throw new \InvalidArgumentException('invalid length for $activity when calling Billing., must be smaller than or equal to 80.'); + } + + $this->container['activity'] = $activity; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CategoryDto.php b/lib/Model/CategoryDto.php new file mode 100644 index 0000000..c3f3734 --- /dev/null +++ b/lib/Model/CategoryDto.php @@ -0,0 +1,458 @@ + + */ +class CategoryDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoryDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'categ_id' => 'string', + 'categ_desc' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'categ_id' => null, + 'categ_desc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'categ_id' => true, + 'categ_desc' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'categ_id' => 'categId', + 'categ_desc' => 'categDesc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'categ_id' => 'setCategId', + 'categ_desc' => 'setCategDesc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'categ_id' => 'getCategId', + 'categ_desc' => 'getCategDesc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('categ_id', $data ?? [], null); + $this->setIfExists('categ_desc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets categ_id + * + * @return string|null + */ + public function getCategId() + { + return $this->container['categ_id']; + } + + /** + * Sets categ_id + * + * @param string|null $categ_id categ_id + * + * @return self + */ + public function setCategId($categ_id) + { + if (is_null($categ_id)) { + array_push($this->openAPINullablesSetToNull, 'categ_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categ_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categ_id'] = $categ_id; + + return $this; + } + + /** + * Gets categ_desc + * + * @return string|null + */ + public function getCategDesc() + { + return $this->container['categ_desc']; + } + + /** + * Sets categ_desc + * + * @param string|null $categ_desc categ_desc + * + * @return self + */ + public function setCategDesc($categ_desc) + { + if (is_null($categ_desc)) { + array_push($this->openAPINullablesSetToNull, 'categ_desc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categ_desc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categ_desc'] = $categ_desc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CategoryDtoListPagedResponse.php b/lib/Model/CategoryDtoListPagedResponse.php new file mode 100644 index 0000000..daec77e --- /dev/null +++ b/lib/Model/CategoryDtoListPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class CategoryDtoListPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoryDtoListPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\CategoryDto[][]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\CategoryDto[][]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\CategoryDto[][]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Coupon.php b/lib/Model/Coupon.php new file mode 100644 index 0000000..b04f321 --- /dev/null +++ b/lib/Model/Coupon.php @@ -0,0 +1,451 @@ + + */ +class Coupon implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'coupon'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'amount' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'code' => 'code', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'amount' => 'getAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code προαιρετικό πεδίο , όνομα κουπονιού + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount αξία κουπονιού + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Coupons.php b/lib/Model/Coupons.php new file mode 100644 index 0000000..77fa48c --- /dev/null +++ b/lib/Model/Coupons.php @@ -0,0 +1,418 @@ + + */ +class Coupons implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'coupons'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'coupon_list' => '\Europharmacy\EuromedicaClient\Model\Coupon[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'coupon_list' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'coupon_list' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'coupon_list' => 'couponList' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'coupon_list' => 'setCouponList' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'coupon_list' => 'getCouponList' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('coupon_list', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets coupon_list + * + * @return \Europharmacy\EuromedicaClient\Model\Coupon[]|null + */ + public function getCouponList() + { + return $this->container['coupon_list']; + } + + /** + * Sets coupon_list + * + * @param \Europharmacy\EuromedicaClient\Model\Coupon[]|null $coupon_list coupon_list + * + * @return self + */ + public function setCouponList($coupon_list) + { + if (is_null($coupon_list)) { + array_push($this->openAPINullablesSetToNull, 'coupon_list'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('coupon_list', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['coupon_list'] = $coupon_list; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Customer.php b/lib/Model/Customer.php new file mode 100644 index 0000000..94d78cf --- /dev/null +++ b/lib/Model/Customer.php @@ -0,0 +1,1257 @@ + + */ +class Customer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Customer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'last_name' => 'string', + 'first_name' => 'string', + 'nikcname' => 'string', + 'phone' => 'string', + 'mobile' => 'string', + 'family_name' => 'string', + 'amka' => 'string', + 'bonus_card' => 'string', + 'address' => 'string', + 'post_code' => 'string', + 'city' => 'string', + 'country_code' => 'string', + 'country_name' => 'string', + 'birth_day' => '\DateTime', + 'tax_number' => 'string', + 'tax_office' => 'string', + 'profession' => 'string', + 'brand_id' => 'int', + 'email' => 'string', + 'notes' => 'string', + 'eshop_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'int32', + 'last_name' => null, + 'first_name' => null, + 'nikcname' => null, + 'phone' => null, + 'mobile' => null, + 'family_name' => null, + 'amka' => null, + 'bonus_card' => null, + 'address' => null, + 'post_code' => null, + 'city' => null, + 'country_code' => null, + 'country_name' => null, + 'birth_day' => 'date-time', + 'tax_number' => null, + 'tax_office' => null, + 'profession' => null, + 'brand_id' => 'int32', + 'email' => null, + 'notes' => null, + 'eshop_id' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'last_name' => true, + 'first_name' => true, + 'nikcname' => true, + 'phone' => true, + 'mobile' => true, + 'family_name' => true, + 'amka' => true, + 'bonus_card' => true, + 'address' => true, + 'post_code' => true, + 'city' => true, + 'country_code' => true, + 'country_name' => true, + 'birth_day' => true, + 'tax_number' => true, + 'tax_office' => true, + 'profession' => true, + 'brand_id' => false, + 'email' => true, + 'notes' => true, + 'eshop_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'last_name' => 'lastName', + 'first_name' => 'firstName', + 'nikcname' => 'nikcname', + 'phone' => 'phone', + 'mobile' => 'mobile', + 'family_name' => 'familyName', + 'amka' => 'amka', + 'bonus_card' => 'bonusCard', + 'address' => 'address', + 'post_code' => 'postCode', + 'city' => 'city', + 'country_code' => 'countryCode', + 'country_name' => 'countryName', + 'birth_day' => 'birthDay', + 'tax_number' => 'taxNumber', + 'tax_office' => 'taxOffice', + 'profession' => 'profession', + 'brand_id' => 'brandId', + 'email' => 'email', + 'notes' => 'notes', + 'eshop_id' => 'eshopId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'last_name' => 'setLastName', + 'first_name' => 'setFirstName', + 'nikcname' => 'setNikcname', + 'phone' => 'setPhone', + 'mobile' => 'setMobile', + 'family_name' => 'setFamilyName', + 'amka' => 'setAmka', + 'bonus_card' => 'setBonusCard', + 'address' => 'setAddress', + 'post_code' => 'setPostCode', + 'city' => 'setCity', + 'country_code' => 'setCountryCode', + 'country_name' => 'setCountryName', + 'birth_day' => 'setBirthDay', + 'tax_number' => 'setTaxNumber', + 'tax_office' => 'setTaxOffice', + 'profession' => 'setProfession', + 'brand_id' => 'setBrandId', + 'email' => 'setEmail', + 'notes' => 'setNotes', + 'eshop_id' => 'setEshopId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'last_name' => 'getLastName', + 'first_name' => 'getFirstName', + 'nikcname' => 'getNikcname', + 'phone' => 'getPhone', + 'mobile' => 'getMobile', + 'family_name' => 'getFamilyName', + 'amka' => 'getAmka', + 'bonus_card' => 'getBonusCard', + 'address' => 'getAddress', + 'post_code' => 'getPostCode', + 'city' => 'getCity', + 'country_code' => 'getCountryCode', + 'country_name' => 'getCountryName', + 'birth_day' => 'getBirthDay', + 'tax_number' => 'getTaxNumber', + 'tax_office' => 'getTaxOffice', + 'profession' => 'getProfession', + 'brand_id' => 'getBrandId', + 'email' => 'getEmail', + 'notes' => 'getNotes', + 'eshop_id' => 'getEshopId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('nikcname', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('mobile', $data ?? [], null); + $this->setIfExists('family_name', $data ?? [], null); + $this->setIfExists('amka', $data ?? [], null); + $this->setIfExists('bonus_card', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('country_code', $data ?? [], null); + $this->setIfExists('country_name', $data ?? [], null); + $this->setIfExists('birth_day', $data ?? [], null); + $this->setIfExists('tax_number', $data ?? [], null); + $this->setIfExists('tax_office', $data ?? [], null); + $this->setIfExists('profession', $data ?? [], null); + $this->setIfExists('brand_id', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('eshop_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name last_name + * + * @return self + */ + public function setLastName($last_name) + { + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name first_name + * + * @return self + */ + public function setFirstName($first_name) + { + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets nikcname + * + * @return string|null + */ + public function getNikcname() + { + return $this->container['nikcname']; + } + + /** + * Sets nikcname + * + * @param string|null $nikcname nikcname + * + * @return self + */ + public function setNikcname($nikcname) + { + if (is_null($nikcname)) { + array_push($this->openAPINullablesSetToNull, 'nikcname'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nikcname', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nikcname'] = $nikcname; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone ΣΤΑΘΕΡΟ ΤΗΛΕΦΩΝΟ + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets mobile + * + * @return string|null + */ + public function getMobile() + { + return $this->container['mobile']; + } + + /** + * Sets mobile + * + * @param string|null $mobile ΚΙΝΗΤΟ ΤΗΛΕΦΩΝΟ + * + * @return self + */ + public function setMobile($mobile) + { + if (is_null($mobile)) { + array_push($this->openAPINullablesSetToNull, 'mobile'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mobile'] = $mobile; + + return $this; + } + + /** + * Gets family_name + * + * @return string|null + */ + public function getFamilyName() + { + return $this->container['family_name']; + } + + /** + * Sets family_name + * + * @param string|null $family_name ΟΝΟΜΑ ΟΙΚΟΓΕΝΕΙΑΣ ΕΦΟΣΟΝ ΑΝΗΚΕΙ ΣΕ ΚΑΠΟΙΑ + * + * @return self + */ + public function setFamilyName($family_name) + { + if (is_null($family_name)) { + array_push($this->openAPINullablesSetToNull, 'family_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('family_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['family_name'] = $family_name; + + return $this; + } + + /** + * Gets amka + * + * @return string|null + */ + public function getAmka() + { + return $this->container['amka']; + } + + /** + * Sets amka + * + * @param string|null $amka ΑΜΚΑ + * + * @return self + */ + public function setAmka($amka) + { + if (is_null($amka)) { + array_push($this->openAPINullablesSetToNull, 'amka'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amka', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amka'] = $amka; + + return $this; + } + + /** + * Gets bonus_card + * + * @return string|null + */ + public function getBonusCard() + { + return $this->container['bonus_card']; + } + + /** + * Sets bonus_card + * + * @param string|null $bonus_card bonus_card + * + * @return self + */ + public function setBonusCard($bonus_card) + { + if (is_null($bonus_card)) { + array_push($this->openAPINullablesSetToNull, 'bonus_card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bonus_card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bonus_card'] = $bonus_card; + + return $this; + } + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address ΔΙΕΥΘΥΝΣΗ + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets post_code + * + * @return string|null + */ + public function getPostCode() + { + return $this->container['post_code']; + } + + /** + * Sets post_code + * + * @param string|null $post_code ΤΑΧΥΔΡΟΜΙΚΟΣ ΚΩΔΙΚΑΣ + * + * @return self + */ + public function setPostCode($post_code) + { + if (is_null($post_code)) { + array_push($this->openAPINullablesSetToNull, 'post_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('post_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['post_code'] = $post_code; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets country_code + * + * @return string|null + */ + public function getCountryCode() + { + return $this->container['country_code']; + } + + /** + * Sets country_code + * + * @param string|null $country_code ΚΩΔΙΚΟΣ ΧΩΡΑΣ ISO 3166 ALPHA-2 + * + * @return self + */ + public function setCountryCode($country_code) + { + if (is_null($country_code)) { + array_push($this->openAPINullablesSetToNull, 'country_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country_code'] = $country_code; + + return $this; + } + + /** + * Gets country_name + * + * @return string|null + */ + public function getCountryName() + { + return $this->container['country_name']; + } + + /** + * Sets country_name + * + * @param string|null $country_name country_name + * + * @return self + */ + public function setCountryName($country_name) + { + if (is_null($country_name)) { + array_push($this->openAPINullablesSetToNull, 'country_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country_name'] = $country_name; + + return $this; + } + + /** + * Gets birth_day + * + * @return \DateTime|null + */ + public function getBirthDay() + { + return $this->container['birth_day']; + } + + /** + * Sets birth_day + * + * @param \DateTime|null $birth_day birth_day + * + * @return self + */ + public function setBirthDay($birth_day) + { + if (is_null($birth_day)) { + array_push($this->openAPINullablesSetToNull, 'birth_day'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birth_day', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birth_day'] = $birth_day; + + return $this; + } + + /** + * Gets tax_number + * + * @return string|null + */ + public function getTaxNumber() + { + return $this->container['tax_number']; + } + + /** + * Sets tax_number + * + * @param string|null $tax_number ΑΦΜ ΠΕΛΑΤΗ + * + * @return self + */ + public function setTaxNumber($tax_number) + { + if (is_null($tax_number)) { + array_push($this->openAPINullablesSetToNull, 'tax_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tax_number'] = $tax_number; + + return $this; + } + + /** + * Gets tax_office + * + * @return string|null + */ + public function getTaxOffice() + { + return $this->container['tax_office']; + } + + /** + * Sets tax_office + * + * @param string|null $tax_office ΔΟΥ + * + * @return self + */ + public function setTaxOffice($tax_office) + { + if (is_null($tax_office)) { + array_push($this->openAPINullablesSetToNull, 'tax_office'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_office', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tax_office'] = $tax_office; + + return $this; + } + + /** + * Gets profession + * + * @return string|null + */ + public function getProfession() + { + return $this->container['profession']; + } + + /** + * Sets profession + * + * @param string|null $profession ΕΠΑΓΓΕΛΜΑ + * + * @return self + */ + public function setProfession($profession) + { + if (is_null($profession)) { + array_push($this->openAPINullablesSetToNull, 'profession'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('profession', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['profession'] = $profession; + + return $this; + } + + /** + * Gets brand_id + * + * @return int|null + */ + public function getBrandId() + { + return $this->container['brand_id']; + } + + /** + * Sets brand_id + * + * @param int|null $brand_id ΚΩΔΙΚΟΣ ΕΓΚΑΤΑΣΤΑΣΗΣ + * + * @return self + */ + public function setBrandId($brand_id) + { + if (is_null($brand_id)) { + throw new \InvalidArgumentException('non-nullable brand_id cannot be null'); + } + $this->container['brand_id'] = $brand_id; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets notes + * + * @return string|null + */ + public function getNotes() + { + return $this->container['notes']; + } + + /** + * Sets notes + * + * @param string|null $notes notes + * + * @return self + */ + public function setNotes($notes) + { + if (is_null($notes)) { + array_push($this->openAPINullablesSetToNull, 'notes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notes'] = $notes; + + return $this; + } + + /** + * Gets eshop_id + * + * @return int|null + */ + public function getEshopId() + { + return $this->container['eshop_id']; + } + + /** + * Sets eshop_id + * + * @param int|null $eshop_id eshop_id + * + * @return self + */ + public function setEshopId($eshop_id) + { + if (is_null($eshop_id)) { + throw new \InvalidArgumentException('non-nullable eshop_id cannot be null'); + } + $this->container['eshop_id'] = $eshop_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CustomerDto.php b/lib/Model/CustomerDto.php new file mode 100644 index 0000000..b7f5148 --- /dev/null +++ b/lib/Model/CustomerDto.php @@ -0,0 +1,1295 @@ + + */ +class CustomerDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'last_name' => 'string', + 'first_name' => 'string', + 'nikcname' => 'string', + 'phone' => 'string', + 'mobile' => 'string', + 'amka' => 'string', + 'address' => 'string', + 'post_code' => 'string', + 'city' => 'string', + 'country_code' => 'string', + 'country_name' => 'string', + 'birth_day' => '\DateTime', + 'tax_number' => 'string', + 'tax_office' => 'string', + 'profession' => 'string', + 'brand_id' => 'int', + 'email' => 'string', + 'notes' => 'string', + 'eshop_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'int32', + 'last_name' => null, + 'first_name' => null, + 'nikcname' => null, + 'phone' => null, + 'mobile' => null, + 'amka' => null, + 'address' => null, + 'post_code' => null, + 'city' => null, + 'country_code' => null, + 'country_name' => null, + 'birth_day' => 'date-time', + 'tax_number' => null, + 'tax_office' => null, + 'profession' => null, + 'brand_id' => 'int32', + 'email' => 'email', + 'notes' => null, + 'eshop_id' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'last_name' => true, + 'first_name' => true, + 'nikcname' => true, + 'phone' => true, + 'mobile' => true, + 'amka' => true, + 'address' => true, + 'post_code' => true, + 'city' => true, + 'country_code' => true, + 'country_name' => true, + 'birth_day' => true, + 'tax_number' => true, + 'tax_office' => true, + 'profession' => true, + 'brand_id' => false, + 'email' => true, + 'notes' => true, + 'eshop_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'last_name' => 'lastName', + 'first_name' => 'firstName', + 'nikcname' => 'nikcname', + 'phone' => 'phone', + 'mobile' => 'mobile', + 'amka' => 'amka', + 'address' => 'address', + 'post_code' => 'postCode', + 'city' => 'city', + 'country_code' => 'countryCode', + 'country_name' => 'countryName', + 'birth_day' => 'birthDay', + 'tax_number' => 'taxNumber', + 'tax_office' => 'taxOffice', + 'profession' => 'profession', + 'brand_id' => 'brandId', + 'email' => 'email', + 'notes' => 'notes', + 'eshop_id' => 'eshopId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'last_name' => 'setLastName', + 'first_name' => 'setFirstName', + 'nikcname' => 'setNikcname', + 'phone' => 'setPhone', + 'mobile' => 'setMobile', + 'amka' => 'setAmka', + 'address' => 'setAddress', + 'post_code' => 'setPostCode', + 'city' => 'setCity', + 'country_code' => 'setCountryCode', + 'country_name' => 'setCountryName', + 'birth_day' => 'setBirthDay', + 'tax_number' => 'setTaxNumber', + 'tax_office' => 'setTaxOffice', + 'profession' => 'setProfession', + 'brand_id' => 'setBrandId', + 'email' => 'setEmail', + 'notes' => 'setNotes', + 'eshop_id' => 'setEshopId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'last_name' => 'getLastName', + 'first_name' => 'getFirstName', + 'nikcname' => 'getNikcname', + 'phone' => 'getPhone', + 'mobile' => 'getMobile', + 'amka' => 'getAmka', + 'address' => 'getAddress', + 'post_code' => 'getPostCode', + 'city' => 'getCity', + 'country_code' => 'getCountryCode', + 'country_name' => 'getCountryName', + 'birth_day' => 'getBirthDay', + 'tax_number' => 'getTaxNumber', + 'tax_office' => 'getTaxOffice', + 'profession' => 'getProfession', + 'brand_id' => 'getBrandId', + 'email' => 'getEmail', + 'notes' => 'getNotes', + 'eshop_id' => 'getEshopId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], -1); + $this->setIfExists('last_name', $data ?? [], ''); + $this->setIfExists('first_name', $data ?? [], ''); + $this->setIfExists('nikcname', $data ?? [], ''); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('mobile', $data ?? [], null); + $this->setIfExists('amka', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('country_code', $data ?? [], 'GR'); + $this->setIfExists('country_name', $data ?? [], null); + $this->setIfExists('birth_day', $data ?? [], null); + $this->setIfExists('tax_number', $data ?? [], null); + $this->setIfExists('tax_office', $data ?? [], null); + $this->setIfExists('profession', $data ?? [], null); + $this->setIfExists('brand_id', $data ?? [], 0); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('eshop_id', $data ?? [], 0); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) > 60)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) > 60)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['nikcname']) && (mb_strlen($this->container['nikcname']) > 60)) { + $invalidProperties[] = "invalid value for 'nikcname', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['phone']) && (mb_strlen($this->container['phone']) > 15)) { + $invalidProperties[] = "invalid value for 'phone', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['mobile']) && (mb_strlen($this->container['mobile']) > 15)) { + $invalidProperties[] = "invalid value for 'mobile', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['amka']) && (mb_strlen($this->container['amka']) > 25)) { + $invalidProperties[] = "invalid value for 'amka', the character length must be smaller than or equal to 25."; + } + + if (!is_null($this->container['address']) && (mb_strlen($this->container['address']) > 120)) { + $invalidProperties[] = "invalid value for 'address', the character length must be smaller than or equal to 120."; + } + + if (!is_null($this->container['post_code']) && (mb_strlen($this->container['post_code']) > 10)) { + $invalidProperties[] = "invalid value for 'post_code', the character length must be smaller than or equal to 10."; + } + + if (!is_null($this->container['city']) && (mb_strlen($this->container['city']) > 50)) { + $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 50."; + } + + if (!is_null($this->container['country_code']) && (mb_strlen($this->container['country_code']) > 2)) { + $invalidProperties[] = "invalid value for 'country_code', the character length must be smaller than or equal to 2."; + } + + if (!is_null($this->container['country_name']) && (mb_strlen($this->container['country_name']) > 20)) { + $invalidProperties[] = "invalid value for 'country_name', the character length must be smaller than or equal to 20."; + } + + if (!is_null($this->container['tax_number']) && (mb_strlen($this->container['tax_number']) > 30)) { + $invalidProperties[] = "invalid value for 'tax_number', the character length must be smaller than or equal to 30."; + } + + if (!is_null($this->container['tax_office']) && (mb_strlen($this->container['tax_office']) > 25)) { + $invalidProperties[] = "invalid value for 'tax_office', the character length must be smaller than or equal to 25."; + } + + if (!is_null($this->container['profession']) && (mb_strlen($this->container['profession']) > 60)) { + $invalidProperties[] = "invalid value for 'profession', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 50)) { + $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 50."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Id πελάτη , -1 αν πρόκειται για καινούριο πελάτη + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name last_name + * + * @return self + */ + public function setLastName($last_name) + { + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($last_name) && (mb_strlen($last_name) > 60)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling CustomerDto., must be smaller than or equal to 60.'); + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name first_name + * + * @return self + */ + public function setFirstName($first_name) + { + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($first_name) && (mb_strlen($first_name) > 60)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling CustomerDto., must be smaller than or equal to 60.'); + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets nikcname + * + * @return string|null + */ + public function getNikcname() + { + return $this->container['nikcname']; + } + + /** + * Sets nikcname + * + * @param string|null $nikcname nikcname + * + * @return self + */ + public function setNikcname($nikcname) + { + if (is_null($nikcname)) { + array_push($this->openAPINullablesSetToNull, 'nikcname'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nikcname', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($nikcname) && (mb_strlen($nikcname) > 60)) { + throw new \InvalidArgumentException('invalid length for $nikcname when calling CustomerDto., must be smaller than or equal to 60.'); + } + + $this->container['nikcname'] = $nikcname; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone ΣΤΑΘΕΡΟ ΤΗΛΕΦΩΝΟ + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($phone) && (mb_strlen($phone) > 15)) { + throw new \InvalidArgumentException('invalid length for $phone when calling CustomerDto., must be smaller than or equal to 15.'); + } + + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets mobile + * + * @return string|null + */ + public function getMobile() + { + return $this->container['mobile']; + } + + /** + * Sets mobile + * + * @param string|null $mobile ΚΙΝΗΤΟ ΤΗΛΕΦΩΝΟ + * + * @return self + */ + public function setMobile($mobile) + { + if (is_null($mobile)) { + array_push($this->openAPINullablesSetToNull, 'mobile'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($mobile) && (mb_strlen($mobile) > 15)) { + throw new \InvalidArgumentException('invalid length for $mobile when calling CustomerDto., must be smaller than or equal to 15.'); + } + + $this->container['mobile'] = $mobile; + + return $this; + } + + /** + * Gets amka + * + * @return string|null + */ + public function getAmka() + { + return $this->container['amka']; + } + + /** + * Sets amka + * + * @param string|null $amka ΑΜΚΑ + * + * @return self + */ + public function setAmka($amka) + { + if (is_null($amka)) { + array_push($this->openAPINullablesSetToNull, 'amka'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amka', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($amka) && (mb_strlen($amka) > 25)) { + throw new \InvalidArgumentException('invalid length for $amka when calling CustomerDto., must be smaller than or equal to 25.'); + } + + $this->container['amka'] = $amka; + + return $this; + } + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address ΔΙΕΥΘΥΝΣΗ + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($address) && (mb_strlen($address) > 120)) { + throw new \InvalidArgumentException('invalid length for $address when calling CustomerDto., must be smaller than or equal to 120.'); + } + + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets post_code + * + * @return string|null + */ + public function getPostCode() + { + return $this->container['post_code']; + } + + /** + * Sets post_code + * + * @param string|null $post_code ΤΑΧΥΔΡΟΜΙΚΟΣ ΚΩΔΙΚΑΣ + * + * @return self + */ + public function setPostCode($post_code) + { + if (is_null($post_code)) { + array_push($this->openAPINullablesSetToNull, 'post_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('post_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($post_code) && (mb_strlen($post_code) > 10)) { + throw new \InvalidArgumentException('invalid length for $post_code when calling CustomerDto., must be smaller than or equal to 10.'); + } + + $this->container['post_code'] = $post_code; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($city) && (mb_strlen($city) > 50)) { + throw new \InvalidArgumentException('invalid length for $city when calling CustomerDto., must be smaller than or equal to 50.'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets country_code + * + * @return string|null + */ + public function getCountryCode() + { + return $this->container['country_code']; + } + + /** + * Sets country_code + * + * @param string|null $country_code ΚΩΔΙΚΟΣ ΧΩΡΑΣ ISO 3166 ALPHA-2 + * + * @return self + */ + public function setCountryCode($country_code) + { + if (is_null($country_code)) { + array_push($this->openAPINullablesSetToNull, 'country_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($country_code) && (mb_strlen($country_code) > 2)) { + throw new \InvalidArgumentException('invalid length for $country_code when calling CustomerDto., must be smaller than or equal to 2.'); + } + + $this->container['country_code'] = $country_code; + + return $this; + } + + /** + * Gets country_name + * + * @return string|null + */ + public function getCountryName() + { + return $this->container['country_name']; + } + + /** + * Sets country_name + * + * @param string|null $country_name country_name + * + * @return self + */ + public function setCountryName($country_name) + { + if (is_null($country_name)) { + array_push($this->openAPINullablesSetToNull, 'country_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($country_name) && (mb_strlen($country_name) > 20)) { + throw new \InvalidArgumentException('invalid length for $country_name when calling CustomerDto., must be smaller than or equal to 20.'); + } + + $this->container['country_name'] = $country_name; + + return $this; + } + + /** + * Gets birth_day + * + * @return \DateTime|null + */ + public function getBirthDay() + { + return $this->container['birth_day']; + } + + /** + * Sets birth_day + * + * @param \DateTime|null $birth_day birth_day + * + * @return self + */ + public function setBirthDay($birth_day) + { + if (is_null($birth_day)) { + array_push($this->openAPINullablesSetToNull, 'birth_day'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birth_day', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birth_day'] = $birth_day; + + return $this; + } + + /** + * Gets tax_number + * + * @return string|null + */ + public function getTaxNumber() + { + return $this->container['tax_number']; + } + + /** + * Sets tax_number + * + * @param string|null $tax_number ΑΦΜ ΠΕΛΑΤΗ + * + * @return self + */ + public function setTaxNumber($tax_number) + { + if (is_null($tax_number)) { + array_push($this->openAPINullablesSetToNull, 'tax_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($tax_number) && (mb_strlen($tax_number) > 30)) { + throw new \InvalidArgumentException('invalid length for $tax_number when calling CustomerDto., must be smaller than or equal to 30.'); + } + + $this->container['tax_number'] = $tax_number; + + return $this; + } + + /** + * Gets tax_office + * + * @return string|null + */ + public function getTaxOffice() + { + return $this->container['tax_office']; + } + + /** + * Sets tax_office + * + * @param string|null $tax_office ΔΟΥ + * + * @return self + */ + public function setTaxOffice($tax_office) + { + if (is_null($tax_office)) { + array_push($this->openAPINullablesSetToNull, 'tax_office'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_office', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($tax_office) && (mb_strlen($tax_office) > 25)) { + throw new \InvalidArgumentException('invalid length for $tax_office when calling CustomerDto., must be smaller than or equal to 25.'); + } + + $this->container['tax_office'] = $tax_office; + + return $this; + } + + /** + * Gets profession + * + * @return string|null + */ + public function getProfession() + { + return $this->container['profession']; + } + + /** + * Sets profession + * + * @param string|null $profession ΕΠΑΓΓΕΛΜΑ + * + * @return self + */ + public function setProfession($profession) + { + if (is_null($profession)) { + array_push($this->openAPINullablesSetToNull, 'profession'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('profession', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($profession) && (mb_strlen($profession) > 60)) { + throw new \InvalidArgumentException('invalid length for $profession when calling CustomerDto., must be smaller than or equal to 60.'); + } + + $this->container['profession'] = $profession; + + return $this; + } + + /** + * Gets brand_id + * + * @return int|null + */ + public function getBrandId() + { + return $this->container['brand_id']; + } + + /** + * Sets brand_id + * + * @param int|null $brand_id ΚΩΔΙΚΟΣ ΕΓΚΑΤΑΣΤΑΣΗΣ + * + * @return self + */ + public function setBrandId($brand_id) + { + if (is_null($brand_id)) { + throw new \InvalidArgumentException('non-nullable brand_id cannot be null'); + } + $this->container['brand_id'] = $brand_id; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($email) && (mb_strlen($email) > 50)) { + throw new \InvalidArgumentException('invalid length for $email when calling CustomerDto., must be smaller than or equal to 50.'); + } + + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets notes + * + * @return string|null + */ + public function getNotes() + { + return $this->container['notes']; + } + + /** + * Sets notes + * + * @param string|null $notes notes + * + * @return self + */ + public function setNotes($notes) + { + if (is_null($notes)) { + array_push($this->openAPINullablesSetToNull, 'notes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notes'] = $notes; + + return $this; + } + + /** + * Gets eshop_id + * + * @return int|null + */ + public function getEshopId() + { + return $this->container['eshop_id']; + } + + /** + * Sets eshop_id + * + * @param int|null $eshop_id eshop_id + * + * @return self + */ + public function setEshopId($eshop_id) + { + if (is_null($eshop_id)) { + throw new \InvalidArgumentException('non-nullable eshop_id cannot be null'); + } + $this->container['eshop_id'] = $eshop_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CustomerPagedResponse.php b/lib/Model/CustomerPagedResponse.php new file mode 100644 index 0000000..b3bb1fe --- /dev/null +++ b/lib/Model/CustomerPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class CustomerPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\Customer[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\Customer[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\Customer[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EOrder.php b/lib/Model/EOrder.php new file mode 100644 index 0000000..fe172aa --- /dev/null +++ b/lib/Model/EOrder.php @@ -0,0 +1,1192 @@ + + */ +class EOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order_id' => 'int', + 'status_id' => 'int', + 'admin_url' => 'string', + 'status' => 'string', + 'date_created' => '\DateTime', + 'date_completed' => '\DateTime', + 'date_modified' => '\DateTime', + 'date_paid' => '\DateTime', + 'payment_method_id' => 'int', + 'payment_method' => 'string', + 'shipping_method' => 'string', + 'client_id' => 'int', + 'notes' => 'string', + 'net_amount' => 'float', + 'vat_amount' => 'float', + 'total_amount' => 'float', + 'billing' => '\Europharmacy\EuromedicaClient\Model\Billing', + 'shipping' => '\Europharmacy\EuromedicaClient\Model\Shipping', + 'items' => '\Europharmacy\EuromedicaClient\Model\Items', + 'fees' => '\Europharmacy\EuromedicaClient\Model\Fees', + 'coupons' => '\Europharmacy\EuromedicaClient\Model\Coupons' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order_id' => 'int32', + 'status_id' => 'int32', + 'admin_url' => null, + 'status' => null, + 'date_created' => 'date-time', + 'date_completed' => 'date-time', + 'date_modified' => 'date-time', + 'date_paid' => 'date-time', + 'payment_method_id' => 'int32', + 'payment_method' => null, + 'shipping_method' => null, + 'client_id' => 'int32', + 'notes' => null, + 'net_amount' => 'double', + 'vat_amount' => 'double', + 'total_amount' => 'double', + 'billing' => null, + 'shipping' => null, + 'items' => null, + 'fees' => null, + 'coupons' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order_id' => false, + 'status_id' => false, + 'admin_url' => true, + 'status' => true, + 'date_created' => false, + 'date_completed' => true, + 'date_modified' => true, + 'date_paid' => true, + 'payment_method_id' => false, + 'payment_method' => true, + 'shipping_method' => true, + 'client_id' => false, + 'notes' => true, + 'net_amount' => true, + 'vat_amount' => true, + 'total_amount' => false, + 'billing' => false, + 'shipping' => false, + 'items' => false, + 'fees' => false, + 'coupons' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'order_id' => 'orderId', + 'status_id' => 'statusId', + 'admin_url' => 'adminUrl', + 'status' => 'status', + 'date_created' => 'dateCreated', + 'date_completed' => 'dateCompleted', + 'date_modified' => 'dateModified', + 'date_paid' => 'datePaid', + 'payment_method_id' => 'paymentMethodId', + 'payment_method' => 'paymentMethod', + 'shipping_method' => 'shippingMethod', + 'client_id' => 'clientId', + 'notes' => 'notes', + 'net_amount' => 'netAmount', + 'vat_amount' => 'vatAmount', + 'total_amount' => 'totalAmount', + 'billing' => 'billing', + 'shipping' => 'shipping', + 'items' => 'items', + 'fees' => 'fees', + 'coupons' => 'coupons' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order_id' => 'setOrderId', + 'status_id' => 'setStatusId', + 'admin_url' => 'setAdminUrl', + 'status' => 'setStatus', + 'date_created' => 'setDateCreated', + 'date_completed' => 'setDateCompleted', + 'date_modified' => 'setDateModified', + 'date_paid' => 'setDatePaid', + 'payment_method_id' => 'setPaymentMethodId', + 'payment_method' => 'setPaymentMethod', + 'shipping_method' => 'setShippingMethod', + 'client_id' => 'setClientId', + 'notes' => 'setNotes', + 'net_amount' => 'setNetAmount', + 'vat_amount' => 'setVatAmount', + 'total_amount' => 'setTotalAmount', + 'billing' => 'setBilling', + 'shipping' => 'setShipping', + 'items' => 'setItems', + 'fees' => 'setFees', + 'coupons' => 'setCoupons' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order_id' => 'getOrderId', + 'status_id' => 'getStatusId', + 'admin_url' => 'getAdminUrl', + 'status' => 'getStatus', + 'date_created' => 'getDateCreated', + 'date_completed' => 'getDateCompleted', + 'date_modified' => 'getDateModified', + 'date_paid' => 'getDatePaid', + 'payment_method_id' => 'getPaymentMethodId', + 'payment_method' => 'getPaymentMethod', + 'shipping_method' => 'getShippingMethod', + 'client_id' => 'getClientId', + 'notes' => 'getNotes', + 'net_amount' => 'getNetAmount', + 'vat_amount' => 'getVatAmount', + 'total_amount' => 'getTotalAmount', + 'billing' => 'getBilling', + 'shipping' => 'getShipping', + 'items' => 'getItems', + 'fees' => 'getFees', + 'coupons' => 'getCoupons' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('order_id', $data ?? [], null); + $this->setIfExists('status_id', $data ?? [], null); + $this->setIfExists('admin_url', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('date_completed', $data ?? [], null); + $this->setIfExists('date_modified', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('payment_method_id', $data ?? [], null); + $this->setIfExists('payment_method', $data ?? [], null); + $this->setIfExists('shipping_method', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('net_amount', $data ?? [], null); + $this->setIfExists('vat_amount', $data ?? [], null); + $this->setIfExists('total_amount', $data ?? [], null); + $this->setIfExists('billing', $data ?? [], null); + $this->setIfExists('shipping', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('fees', $data ?? [], null); + $this->setIfExists('coupons', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['status_id']) && ($this->container['status_id'] > 8)) { + $invalidProperties[] = "invalid value for 'status_id', must be smaller than or equal to 8."; + } + + if (!is_null($this->container['status_id']) && ($this->container['status_id'] < 1)) { + $invalidProperties[] = "invalid value for 'status_id', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['payment_method_id']) && ($this->container['payment_method_id'] > 6)) { + $invalidProperties[] = "invalid value for 'payment_method_id', must be smaller than or equal to 6."; + } + + if (!is_null($this->container['payment_method_id']) && ($this->container['payment_method_id'] < 1)) { + $invalidProperties[] = "invalid value for 'payment_method_id', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets order_id + * + * @return int|null + */ + public function getOrderId() + { + return $this->container['order_id']; + } + + /** + * Sets order_id + * + * @param int|null $order_id order_id + * + * @return self + */ + public function setOrderId($order_id) + { + if (is_null($order_id)) { + throw new \InvalidArgumentException('non-nullable order_id cannot be null'); + } + $this->container['order_id'] = $order_id; + + return $this; + } + + /** + * Gets status_id + * + * @return int|null + */ + public function getStatusId() + { + return $this->container['status_id']; + } + + /** + * Sets status_id + * + * @param int|null $status_id ΚΑΤΑΣΤΑΣΗ ΠΑΡΑΓΓΕΛΙΑΣ {1,\"Σε διεκπεραίωση\" }, {2,\"Εκκρεμεί πληρωμή\" }, {3,\"Ολοκληρωμένη\" }, { 4,\"Αναμονή τραπεζικής πληρώμης\" }, { 5,\"Αποτυχία πληρωμής\" }, { 6,\"Ακυρωμένη\" }, { 7,\"Επιστροφή χρημάτων\" }, { 8,\"Τιμολογημένη\" } + * + * @return self + */ + public function setStatusId($status_id) + { + if (is_null($status_id)) { + throw new \InvalidArgumentException('non-nullable status_id cannot be null'); + } + + if (($status_id > 8)) { + throw new \InvalidArgumentException('invalid value for $status_id when calling EOrder., must be smaller than or equal to 8.'); + } + if (($status_id < 1)) { + throw new \InvalidArgumentException('invalid value for $status_id when calling EOrder., must be bigger than or equal to 1.'); + } + + $this->container['status_id'] = $status_id; + + return $this; + } + + /** + * Gets admin_url + * + * @return string|null + */ + public function getAdminUrl() + { + return $this->container['admin_url']; + } + + /** + * Sets admin_url + * + * @param string|null $admin_url προαιρετικό πεδίο , διαχειριστικό eshop + * + * @return self + */ + public function setAdminUrl($admin_url) + { + if (is_null($admin_url)) { + array_push($this->openAPINullablesSetToNull, 'admin_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('admin_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['admin_url'] = $admin_url; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status προαιρετικό πεδίο , λεκτικό της κατάστασης + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets date_created + * + * @return \DateTime|null + */ + public function getDateCreated() + { + return $this->container['date_created']; + } + + /** + * Sets date_created + * + * @param \DateTime|null $date_created date_created + * + * @return self + */ + public function setDateCreated($date_created) + { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } + $this->container['date_created'] = $date_created; + + return $this; + } + + /** + * Gets date_completed + * + * @return \DateTime|null + */ + public function getDateCompleted() + { + return $this->container['date_completed']; + } + + /** + * Sets date_completed + * + * @param \DateTime|null $date_completed συμπληρώνεται από το erp όταν ολοκληρωθεί η παραγγελία + * + * @return self + */ + public function setDateCompleted($date_completed) + { + if (is_null($date_completed)) { + array_push($this->openAPINullablesSetToNull, 'date_completed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date_completed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date_completed'] = $date_completed; + + return $this; + } + + /** + * Gets date_modified + * + * @return \DateTime|null + */ + public function getDateModified() + { + return $this->container['date_modified']; + } + + /** + * Sets date_modified + * + * @param \DateTime|null $date_modified + * + * @return self + */ + public function setDateModified($date_modified) + { + if (is_null($date_modified)) { + array_push($this->openAPINullablesSetToNull, 'date_modified'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date_modified', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date_modified'] = $date_modified; + + return $this; + } + + /** + * Gets date_paid + * + * @return \DateTime|null + */ + public function getDatePaid() + { + return $this->container['date_paid']; + } + + /** + * Sets date_paid + * + * @param \DateTime|null $date_paid συμπληρώνεται από το eshop οταν γίνει πληρωμή με κάρτα + * + * @return self + */ + public function setDatePaid($date_paid) + { + if (is_null($date_paid)) { + array_push($this->openAPINullablesSetToNull, 'date_paid'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date_paid', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date_paid'] = $date_paid; + + return $this; + } + + /** + * Gets payment_method_id + * + * @return int|null + */ + public function getPaymentMethodId() + { + return $this->container['payment_method_id']; + } + + /** + * Sets payment_method_id + * + * @param int|null $payment_method_id ΤΡΟΠΟΙ ΠΛΗΡΩΜΗΣ { 1 ,\"Aντικαταβολή\" },{ 2 ,\"Τραπεζική κατάθεση\" }, { 3 ,\"Paypal\" }, { 4 ,\"Πιστ./Χρεωσ. Κάρτα\" },{ 5 ,\"Κατάστημα\" },{ 6 ,\"Eshop\" } + * + * @return self + */ + public function setPaymentMethodId($payment_method_id) + { + if (is_null($payment_method_id)) { + throw new \InvalidArgumentException('non-nullable payment_method_id cannot be null'); + } + + if (($payment_method_id > 6)) { + throw new \InvalidArgumentException('invalid value for $payment_method_id when calling EOrder., must be smaller than or equal to 6.'); + } + if (($payment_method_id < 1)) { + throw new \InvalidArgumentException('invalid value for $payment_method_id when calling EOrder., must be bigger than or equal to 1.'); + } + + $this->container['payment_method_id'] = $payment_method_id; + + return $this; + } + + /** + * Gets payment_method + * + * @return string|null + */ + public function getPaymentMethod() + { + return $this->container['payment_method']; + } + + /** + * Sets payment_method + * + * @param string|null $payment_method προαιρετικό πεδίο , λεκτικό του τρόπου πληρωμής + * + * @return self + */ + public function setPaymentMethod($payment_method) + { + if (is_null($payment_method)) { + array_push($this->openAPINullablesSetToNull, 'payment_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('payment_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['payment_method'] = $payment_method; + + return $this; + } + + /** + * Gets shipping_method + * + * @return string|null + */ + public function getShippingMethod() + { + return $this->container['shipping_method']; + } + + /** + * Sets shipping_method + * + * @param string|null $shipping_method Τρόπος αποστολής + * + * @return self + */ + public function setShippingMethod($shipping_method) + { + if (is_null($shipping_method)) { + array_push($this->openAPINullablesSetToNull, 'shipping_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('shipping_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['shipping_method'] = $shipping_method; + + return $this; + } + + /** + * Gets client_id + * + * @return int|null + */ + public function getClientId() + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param int|null $client_id το id πελατη στο eshop , επισκέπτης -1 + * + * @return self + */ + public function setClientId($client_id) + { + if (is_null($client_id)) { + throw new \InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets notes + * + * @return string|null + */ + public function getNotes() + { + return $this->container['notes']; + } + + /** + * Sets notes + * + * @param string|null $notes notes + * + * @return self + */ + public function setNotes($notes) + { + if (is_null($notes)) { + array_push($this->openAPINullablesSetToNull, 'notes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notes'] = $notes; + + return $this; + } + + /** + * Gets net_amount + * + * @return float|null + */ + public function getNetAmount() + { + return $this->container['net_amount']; + } + + /** + * Sets net_amount + * + * @param float|null $net_amount προαιρετικό πεδίο , Αξία παραγγελίας προ ΦΠΑ + * + * @return self + */ + public function setNetAmount($net_amount) + { + if (is_null($net_amount)) { + array_push($this->openAPINullablesSetToNull, 'net_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('net_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['net_amount'] = $net_amount; + + return $this; + } + + /** + * Gets vat_amount + * + * @return float|null + */ + public function getVatAmount() + { + return $this->container['vat_amount']; + } + + /** + * Sets vat_amount + * + * @param float|null $vat_amount προαιρετικό πεδίο , Αξία ΦΠΑ + * + * @return self + */ + public function setVatAmount($vat_amount) + { + if (is_null($vat_amount)) { + array_push($this->openAPINullablesSetToNull, 'vat_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vat_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vat_amount'] = $vat_amount; + + return $this; + } + + /** + * Gets total_amount + * + * @return float|null + */ + public function getTotalAmount() + { + return $this->container['total_amount']; + } + + /** + * Sets total_amount + * + * @param float|null $total_amount Συνολική αξία παραγγελίας + * + * @return self + */ + public function setTotalAmount($total_amount) + { + if (is_null($total_amount)) { + throw new \InvalidArgumentException('non-nullable total_amount cannot be null'); + } + $this->container['total_amount'] = $total_amount; + + return $this; + } + + /** + * Gets billing + * + * @return \Europharmacy\EuromedicaClient\Model\Billing|null + */ + public function getBilling() + { + return $this->container['billing']; + } + + /** + * Sets billing + * + * @param \Europharmacy\EuromedicaClient\Model\Billing|null $billing billing + * + * @return self + */ + public function setBilling($billing) + { + if (is_null($billing)) { + throw new \InvalidArgumentException('non-nullable billing cannot be null'); + } + $this->container['billing'] = $billing; + + return $this; + } + + /** + * Gets shipping + * + * @return \Europharmacy\EuromedicaClient\Model\Shipping|null + */ + public function getShipping() + { + return $this->container['shipping']; + } + + /** + * Sets shipping + * + * @param \Europharmacy\EuromedicaClient\Model\Shipping|null $shipping shipping + * + * @return self + */ + public function setShipping($shipping) + { + if (is_null($shipping)) { + throw new \InvalidArgumentException('non-nullable shipping cannot be null'); + } + $this->container['shipping'] = $shipping; + + return $this; + } + + /** + * Gets items + * + * @return \Europharmacy\EuromedicaClient\Model\Items|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Europharmacy\EuromedicaClient\Model\Items|null $items items + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets fees + * + * @return \Europharmacy\EuromedicaClient\Model\Fees|null + */ + public function getFees() + { + return $this->container['fees']; + } + + /** + * Sets fees + * + * @param \Europharmacy\EuromedicaClient\Model\Fees|null $fees fees + * + * @return self + */ + public function setFees($fees) + { + if (is_null($fees)) { + throw new \InvalidArgumentException('non-nullable fees cannot be null'); + } + $this->container['fees'] = $fees; + + return $this; + } + + /** + * Gets coupons + * + * @return \Europharmacy\EuromedicaClient\Model\Coupons|null + */ + public function getCoupons() + { + return $this->container['coupons']; + } + + /** + * Sets coupons + * + * @param \Europharmacy\EuromedicaClient\Model\Coupons|null $coupons coupons + * + * @return self + */ + public function setCoupons($coupons) + { + if (is_null($coupons)) { + throw new \InvalidArgumentException('non-nullable coupons cannot be null'); + } + $this->container['coupons'] = $coupons; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EOrderPagedResponse.php b/lib/Model/EOrderPagedResponse.php new file mode 100644 index 0000000..7940617 --- /dev/null +++ b/lib/Model/EOrderPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class EOrderPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EOrderPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\EOrder[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\EOrder[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\EOrder[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EOrderStatus.php b/lib/Model/EOrderStatus.php new file mode 100644 index 0000000..4b45074 --- /dev/null +++ b/lib/Model/EOrderStatus.php @@ -0,0 +1,683 @@ + + */ +class EOrderStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EOrderStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order_id' => 'int', + 'status_id' => 'int', + 'status' => 'string', + 'date_created' => '\DateTime', + 'date_completed' => '\DateTime', + 'date_modified' => '\DateTime', + 'date_paid' => '\DateTime', + 'qr_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order_id' => 'int32', + 'status_id' => 'int32', + 'status' => null, + 'date_created' => 'date-time', + 'date_completed' => 'date-time', + 'date_modified' => 'date-time', + 'date_paid' => 'date-time', + 'qr_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order_id' => false, + 'status_id' => false, + 'status' => true, + 'date_created' => false, + 'date_completed' => true, + 'date_modified' => true, + 'date_paid' => true, + 'qr_url' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'order_id' => 'orderId', + 'status_id' => 'statusId', + 'status' => 'status', + 'date_created' => 'dateCreated', + 'date_completed' => 'dateCompleted', + 'date_modified' => 'dateModified', + 'date_paid' => 'datePaid', + 'qr_url' => 'qrUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order_id' => 'setOrderId', + 'status_id' => 'setStatusId', + 'status' => 'setStatus', + 'date_created' => 'setDateCreated', + 'date_completed' => 'setDateCompleted', + 'date_modified' => 'setDateModified', + 'date_paid' => 'setDatePaid', + 'qr_url' => 'setQrUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order_id' => 'getOrderId', + 'status_id' => 'getStatusId', + 'status' => 'getStatus', + 'date_created' => 'getDateCreated', + 'date_completed' => 'getDateCompleted', + 'date_modified' => 'getDateModified', + 'date_paid' => 'getDatePaid', + 'qr_url' => 'getQrUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('order_id', $data ?? [], null); + $this->setIfExists('status_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('date_completed', $data ?? [], null); + $this->setIfExists('date_modified', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('qr_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets order_id + * + * @return int|null + */ + public function getOrderId() + { + return $this->container['order_id']; + } + + /** + * Sets order_id + * + * @param int|null $order_id order_id + * + * @return self + */ + public function setOrderId($order_id) + { + if (is_null($order_id)) { + throw new \InvalidArgumentException('non-nullable order_id cannot be null'); + } + $this->container['order_id'] = $order_id; + + return $this; + } + + /** + * Gets status_id + * + * @return int|null + */ + public function getStatusId() + { + return $this->container['status_id']; + } + + /** + * Sets status_id + * + * @param int|null $status_id status_id + * + * @return self + */ + public function setStatusId($status_id) + { + if (is_null($status_id)) { + throw new \InvalidArgumentException('non-nullable status_id cannot be null'); + } + $this->container['status_id'] = $status_id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets date_created + * + * @return \DateTime|null + */ + public function getDateCreated() + { + return $this->container['date_created']; + } + + /** + * Sets date_created + * + * @param \DateTime|null $date_created date_created + * + * @return self + */ + public function setDateCreated($date_created) + { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } + $this->container['date_created'] = $date_created; + + return $this; + } + + /** + * Gets date_completed + * + * @return \DateTime|null + */ + public function getDateCompleted() + { + return $this->container['date_completed']; + } + + /** + * Sets date_completed + * + * @param \DateTime|null $date_completed Συμπληρώνεται από το erp όταν ολοκληρωθεί η παραγγελία + * + * @return self + */ + public function setDateCompleted($date_completed) + { + if (is_null($date_completed)) { + array_push($this->openAPINullablesSetToNull, 'date_completed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date_completed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date_completed'] = $date_completed; + + return $this; + } + + /** + * Gets date_modified + * + * @return \DateTime|null + */ + public function getDateModified() + { + return $this->container['date_modified']; + } + + /** + * Sets date_modified + * + * @param \DateTime|null $date_modified Συμπληρώνεται από το erp όταν τροποποιηθεί η παραγγελία + * + * @return self + */ + public function setDateModified($date_modified) + { + if (is_null($date_modified)) { + array_push($this->openAPINullablesSetToNull, 'date_modified'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date_modified', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date_modified'] = $date_modified; + + return $this; + } + + /** + * Gets date_paid + * + * @return \DateTime|null + */ + public function getDatePaid() + { + return $this->container['date_paid']; + } + + /** + * Sets date_paid + * + * @param \DateTime|null $date_paid Συμπληρώνεται από το eshop όταν γίνει πληρωμή με κάρτα + * + * @return self + */ + public function setDatePaid($date_paid) + { + if (is_null($date_paid)) { + array_push($this->openAPINullablesSetToNull, 'date_paid'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date_paid', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date_paid'] = $date_paid; + + return $this; + } + + /** + * Gets qr_url + * + * @return string|null + */ + public function getQrUrl() + { + return $this->container['qr_url']; + } + + /** + * Sets qr_url + * + * @param string|null $qr_url Συμπληρώνεται από το erp όταν έχει εκδοθεί απόδειξη από πάροχο + * + * @return self + */ + public function setQrUrl($qr_url) + { + if (is_null($qr_url)) { + array_push($this->openAPINullablesSetToNull, 'qr_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr_url'] = $qr_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EOrderStatusPagedResponse.php b/lib/Model/EOrderStatusPagedResponse.php new file mode 100644 index 0000000..42a5f59 --- /dev/null +++ b/lib/Model/EOrderStatusPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class EOrderStatusPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EOrderStatusPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\EOrderStatus[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\EOrderStatus[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\EOrderStatus[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Fee.php b/lib/Model/Fee.php new file mode 100644 index 0000000..422d771 --- /dev/null +++ b/lib/Model/Fee.php @@ -0,0 +1,583 @@ + + */ +class Fee implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'fee'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'fee_id' => 'int', + 'fee_name' => 'string', + 'amount' => 'float', + 'vat_amount' => 'float', + 'total' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'fee_id' => 'int32', + 'fee_name' => null, + 'amount' => 'double', + 'vat_amount' => 'double', + 'total' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fee_id' => false, + 'fee_name' => true, + 'amount' => true, + 'vat_amount' => true, + 'total' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'fee_id' => 'fee_id', + 'fee_name' => 'feeName', + 'amount' => 'amount', + 'vat_amount' => 'vatAmount', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'fee_id' => 'setFeeId', + 'fee_name' => 'setFeeName', + 'amount' => 'setAmount', + 'vat_amount' => 'setVatAmount', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'fee_id' => 'getFeeId', + 'fee_name' => 'getFeeName', + 'amount' => 'getAmount', + 'vat_amount' => 'getVatAmount', + 'total' => 'getTotal' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('fee_id', $data ?? [], null); + $this->setIfExists('fee_name', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('vat_amount', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['fee_id']) && ($this->container['fee_id'] > 3)) { + $invalidProperties[] = "invalid value for 'fee_id', must be smaller than or equal to 3."; + } + + if (!is_null($this->container['fee_id']) && ($this->container['fee_id'] < 1)) { + $invalidProperties[] = "invalid value for 'fee_id', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets fee_id + * + * @return int|null + */ + public function getFeeId() + { + return $this->container['fee_id']; + } + + /** + * Sets fee_id + * + * @param int|null $fee_id { \"1\" ,ΕΞΟΔΑ ΑΝΤΙΚΑΤΑΒΟΛΗΣ } { \"2\" ,ΕΞΟΔΑ ΑΠΟΣΤΟΛΗΣ } { \"3\" ,ΕΞΟΔΑ ΣΥΣΚΕΥΑΣΙΑΣ } + * + * @return self + */ + public function setFeeId($fee_id) + { + if (is_null($fee_id)) { + throw new \InvalidArgumentException('non-nullable fee_id cannot be null'); + } + + if (($fee_id > 3)) { + throw new \InvalidArgumentException('invalid value for $fee_id when calling Fee., must be smaller than or equal to 3.'); + } + if (($fee_id < 1)) { + throw new \InvalidArgumentException('invalid value for $fee_id when calling Fee., must be bigger than or equal to 1.'); + } + + $this->container['fee_id'] = $fee_id; + + return $this; + } + + /** + * Gets fee_name + * + * @return string|null + */ + public function getFeeName() + { + return $this->container['fee_name']; + } + + /** + * Sets fee_name + * + * @param string|null $fee_name fee_name + * + * @return self + */ + public function setFeeName($fee_name) + { + if (is_null($fee_name)) { + array_push($this->openAPINullablesSetToNull, 'fee_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fee_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fee_name'] = $fee_name; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets vat_amount + * + * @return float|null + */ + public function getVatAmount() + { + return $this->container['vat_amount']; + } + + /** + * Sets vat_amount + * + * @param float|null $vat_amount vat_amount + * + * @return self + */ + public function setVatAmount($vat_amount) + { + if (is_null($vat_amount)) { + array_push($this->openAPINullablesSetToNull, 'vat_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vat_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vat_amount'] = $vat_amount; + + return $this; + } + + /** + * Gets total + * + * @return float|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Fees.php b/lib/Model/Fees.php new file mode 100644 index 0000000..5b6186f --- /dev/null +++ b/lib/Model/Fees.php @@ -0,0 +1,418 @@ + + */ +class Fees implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'fees'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'fee_list' => '\Europharmacy\EuromedicaClient\Model\Fee[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'fee_list' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fee_list' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'fee_list' => 'feeList' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'fee_list' => 'setFeeList' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'fee_list' => 'getFeeList' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('fee_list', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets fee_list + * + * @return \Europharmacy\EuromedicaClient\Model\Fee[]|null + */ + public function getFeeList() + { + return $this->container['fee_list']; + } + + /** + * Sets fee_list + * + * @param \Europharmacy\EuromedicaClient\Model\Fee[]|null $fee_list fee_list + * + * @return self + */ + public function setFeeList($fee_list) + { + if (is_null($fee_list)) { + array_push($this->openAPINullablesSetToNull, 'fee_list'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fee_list', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fee_list'] = $fee_list; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Item.php b/lib/Model/Item.php new file mode 100644 index 0000000..478d905 --- /dev/null +++ b/lib/Model/Item.php @@ -0,0 +1,636 @@ + + */ +class Item implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'item'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'product_title' => 'string', + 'erp_id' => 'string', + 'barcode' => 'string', + 'qty' => 'float', + 'unit_price' => 'float', + 'discount_percentage' => 'float', + 'total' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'product_title' => null, + 'erp_id' => null, + 'barcode' => null, + 'qty' => 'double', + 'unit_price' => 'double', + 'discount_percentage' => 'double', + 'total' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'product_title' => true, + 'erp_id' => true, + 'barcode' => true, + 'qty' => false, + 'unit_price' => false, + 'discount_percentage' => false, + 'total' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'product_title' => 'productTitle', + 'erp_id' => 'erpId', + 'barcode' => 'barcode', + 'qty' => 'qty', + 'unit_price' => 'unitPrice', + 'discount_percentage' => 'discountPercentage', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'product_title' => 'setProductTitle', + 'erp_id' => 'setErpId', + 'barcode' => 'setBarcode', + 'qty' => 'setQty', + 'unit_price' => 'setUnitPrice', + 'discount_percentage' => 'setDiscountPercentage', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'product_title' => 'getProductTitle', + 'erp_id' => 'getErpId', + 'barcode' => 'getBarcode', + 'qty' => 'getQty', + 'unit_price' => 'getUnitPrice', + 'discount_percentage' => 'getDiscountPercentage', + 'total' => 'getTotal' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('product_title', $data ?? [], null); + $this->setIfExists('erp_id', $data ?? [], null); + $this->setIfExists('barcode', $data ?? [], null); + $this->setIfExists('qty', $data ?? [], null); + $this->setIfExists('unit_price', $data ?? [], null); + $this->setIfExists('discount_percentage', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets product_title + * + * @return string|null + */ + public function getProductTitle() + { + return $this->container['product_title']; + } + + /** + * Sets product_title + * + * @param string|null $product_title όνομα προϊόντος + * + * @return self + */ + public function setProductTitle($product_title) + { + if (is_null($product_title)) { + array_push($this->openAPINullablesSetToNull, 'product_title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product_title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product_title'] = $product_title; + + return $this; + } + + /** + * Gets erp_id + * + * @return string|null + */ + public function getErpId() + { + return $this->container['erp_id']; + } + + /** + * Sets erp_id + * + * @param string|null $erp_id to uniqId του Product + * + * @return self + */ + public function setErpId($erp_id) + { + if (is_null($erp_id)) { + array_push($this->openAPINullablesSetToNull, 'erp_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('erp_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['erp_id'] = $erp_id; + + return $this; + } + + /** + * Gets barcode + * + * @return string|null + */ + public function getBarcode() + { + return $this->container['barcode']; + } + + /** + * Sets barcode + * + * @param string|null $barcode barcode προϊόντος μόνο ένα σε περίπτωση που υπάρχουν περισσότερα του ενός + * + * @return self + */ + public function setBarcode($barcode) + { + if (is_null($barcode)) { + array_push($this->openAPINullablesSetToNull, 'barcode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('barcode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['barcode'] = $barcode; + + return $this; + } + + /** + * Gets qty + * + * @return float|null + */ + public function getQty() + { + return $this->container['qty']; + } + + /** + * Sets qty + * + * @param float|null $qty qty + * + * @return self + */ + public function setQty($qty) + { + if (is_null($qty)) { + throw new \InvalidArgumentException('non-nullable qty cannot be null'); + } + $this->container['qty'] = $qty; + + return $this; + } + + /** + * Gets unit_price + * + * @return float|null + */ + public function getUnitPrice() + { + return $this->container['unit_price']; + } + + /** + * Sets unit_price + * + * @param float|null $unit_price λιανική τιμή προ έκπτωσης + * + * @return self + */ + public function setUnitPrice($unit_price) + { + if (is_null($unit_price)) { + throw new \InvalidArgumentException('non-nullable unit_price cannot be null'); + } + $this->container['unit_price'] = $unit_price; + + return $this; + } + + /** + * Gets discount_percentage + * + * @return float|null + */ + public function getDiscountPercentage() + { + return $this->container['discount_percentage']; + } + + /** + * Sets discount_percentage + * + * @param float|null $discount_percentage ποσοστιαία έκπτωση + * + * @return self + */ + public function setDiscountPercentage($discount_percentage) + { + if (is_null($discount_percentage)) { + throw new \InvalidArgumentException('non-nullable discount_percentage cannot be null'); + } + $this->container['discount_percentage'] = $discount_percentage; + + return $this; + } + + /** + * Gets total + * + * @return float|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total Συνολική αξία προϊόντων μετά την έκπτωση (qty * unitPrice * ((100 - discountPercentage)/100)) + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Items.php b/lib/Model/Items.php new file mode 100644 index 0000000..c1185eb --- /dev/null +++ b/lib/Model/Items.php @@ -0,0 +1,418 @@ + + */ +class Items implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'items'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'item_list' => '\Europharmacy\EuromedicaClient\Model\Item[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'item_list' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'item_list' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'item_list' => 'itemList' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'item_list' => 'setItemList' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_list' => 'getItemList' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('item_list', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets item_list + * + * @return \Europharmacy\EuromedicaClient\Model\Item[]|null + */ + public function getItemList() + { + return $this->container['item_list']; + } + + /** + * Sets item_list + * + * @param \Europharmacy\EuromedicaClient\Model\Item[]|null $item_list item_list + * + * @return self + */ + public function setItemList($item_list) + { + if (is_null($item_list)) { + array_push($this->openAPINullablesSetToNull, 'item_list'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('item_list', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['item_list'] = $item_list; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/MainCategoryDto.php b/lib/Model/MainCategoryDto.php new file mode 100644 index 0000000..025c2d3 --- /dev/null +++ b/lib/Model/MainCategoryDto.php @@ -0,0 +1,458 @@ + + */ +class MainCategoryDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MainCategoryDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'main_id' => 'string', + 'main_desc' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'main_id' => null, + 'main_desc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'main_id' => true, + 'main_desc' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'main_id' => 'mainId', + 'main_desc' => 'mainDesc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'main_id' => 'setMainId', + 'main_desc' => 'setMainDesc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'main_id' => 'getMainId', + 'main_desc' => 'getMainDesc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('main_id', $data ?? [], null); + $this->setIfExists('main_desc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets main_id + * + * @return string|null + */ + public function getMainId() + { + return $this->container['main_id']; + } + + /** + * Sets main_id + * + * @param string|null $main_id main_id + * + * @return self + */ + public function setMainId($main_id) + { + if (is_null($main_id)) { + array_push($this->openAPINullablesSetToNull, 'main_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('main_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['main_id'] = $main_id; + + return $this; + } + + /** + * Gets main_desc + * + * @return string|null + */ + public function getMainDesc() + { + return $this->container['main_desc']; + } + + /** + * Sets main_desc + * + * @param string|null $main_desc main_desc + * + * @return self + */ + public function setMainDesc($main_desc) + { + if (is_null($main_desc)) { + array_push($this->openAPINullablesSetToNull, 'main_desc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('main_desc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['main_desc'] = $main_desc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/MainCategoryDtoPagedResponse.php b/lib/Model/MainCategoryDtoPagedResponse.php new file mode 100644 index 0000000..40d3b83 --- /dev/null +++ b/lib/Model/MainCategoryDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class MainCategoryDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MainCategoryDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\MainCategoryDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\MainCategoryDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\MainCategoryDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 0000000..2d5df31 --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class OikosDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OikosDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'desc' => 'string', + 'owner_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'desc' => null, + 'owner_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'desc' => true, + 'owner_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'desc' => 'desc', + 'owner_id' => 'ownerId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'desc' => 'setDesc', + 'owner_id' => 'setOwnerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'desc' => 'getDesc', + 'owner_id' => 'getOwnerId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('desc', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets desc + * + * @return string|null + */ + public function getDesc() + { + return $this->container['desc']; + } + + /** + * Sets desc + * + * @param string|null $desc desc + * + * @return self + */ + public function setDesc($desc) + { + if (is_null($desc)) { + array_push($this->openAPINullablesSetToNull, 'desc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('desc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['desc'] = $desc; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id owner_id + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + array_push($this->openAPINullablesSetToNull, 'owner_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('owner_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OikosDtoPagedResponse.php b/lib/Model/OikosDtoPagedResponse.php new file mode 100644 index 0000000..78739bf --- /dev/null +++ b/lib/Model/OikosDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class OikosDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OikosDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\OikosDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\OikosDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\OikosDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OwnerDto.php b/lib/Model/OwnerDto.php new file mode 100644 index 0000000..e691fa2 --- /dev/null +++ b/lib/Model/OwnerDto.php @@ -0,0 +1,458 @@ + + */ +class OwnerDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OwnerDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'desc' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'desc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'desc' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'desc' => 'desc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'desc' => 'setDesc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'desc' => 'getDesc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('desc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets desc + * + * @return string|null + */ + public function getDesc() + { + return $this->container['desc']; + } + + /** + * Sets desc + * + * @param string|null $desc desc + * + * @return self + */ + public function setDesc($desc) + { + if (is_null($desc)) { + array_push($this->openAPINullablesSetToNull, 'desc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('desc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['desc'] = $desc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OwnerDtoPagedResponse.php b/lib/Model/OwnerDtoPagedResponse.php new file mode 100644 index 0000000..3bd17df --- /dev/null +++ b/lib/Model/OwnerDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class OwnerDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OwnerDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\OwnerDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\OwnerDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\OwnerDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/PersonalCategoryDto.php b/lib/Model/PersonalCategoryDto.php new file mode 100644 index 0000000..236132b --- /dev/null +++ b/lib/Model/PersonalCategoryDto.php @@ -0,0 +1,574 @@ + + */ +class PersonalCategoryDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PersonalCategoryDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'parent_id' => 'string', + 'visible_web' => 'bool', + 'eng_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'parent_id' => null, + 'visible_web' => null, + 'eng_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'parent_id' => true, + 'visible_web' => false, + 'eng_name' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'parent_id' => 'parentId', + 'visible_web' => 'visibleWeb', + 'eng_name' => 'engName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'parent_id' => 'setParentId', + 'visible_web' => 'setVisibleWeb', + 'eng_name' => 'setEngName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'parent_id' => 'getParentId', + 'visible_web' => 'getVisibleWeb', + 'eng_name' => 'getEngName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('visible_web', $data ?? [], null); + $this->setIfExists('eng_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets parent_id + * + * @return string|null + */ + public function getParentId() + { + return $this->container['parent_id']; + } + + /** + * Sets parent_id + * + * @param string|null $parent_id parent_id + * + * @return self + */ + public function setParentId($parent_id) + { + if (is_null($parent_id)) { + array_push($this->openAPINullablesSetToNull, 'parent_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parent_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parent_id'] = $parent_id; + + return $this; + } + + /** + * Gets visible_web + * + * @return bool|null + */ + public function getVisibleWeb() + { + return $this->container['visible_web']; + } + + /** + * Sets visible_web + * + * @param bool|null $visible_web visible_web + * + * @return self + */ + public function setVisibleWeb($visible_web) + { + if (is_null($visible_web)) { + throw new \InvalidArgumentException('non-nullable visible_web cannot be null'); + } + $this->container['visible_web'] = $visible_web; + + return $this; + } + + /** + * Gets eng_name + * + * @return string|null + */ + public function getEngName() + { + return $this->container['eng_name']; + } + + /** + * Sets eng_name + * + * @param string|null $eng_name eng_name + * + * @return self + */ + public function setEngName($eng_name) + { + if (is_null($eng_name)) { + array_push($this->openAPINullablesSetToNull, 'eng_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('eng_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['eng_name'] = $eng_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/PersonalCategoryDtoPagedResponse.php b/lib/Model/PersonalCategoryDtoPagedResponse.php new file mode 100644 index 0000000..9cb5a51 --- /dev/null +++ b/lib/Model/PersonalCategoryDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class PersonalCategoryDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PersonalCategoryDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\PersonalCategoryDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\PersonalCategoryDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\PersonalCategoryDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ProblemDetails.php b/lib/Model/ProblemDetails.php new file mode 100644 index 0000000..de93e15 --- /dev/null +++ b/lib/Model/ProblemDetails.php @@ -0,0 +1,581 @@ + + */ +class ProblemDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProblemDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'title' => 'string', + 'status' => 'int', + 'detail' => 'string', + 'instance' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'title' => null, + 'status' => 'int32', + 'detail' => null, + 'instance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'title' => true, + 'status' => true, + 'detail' => true, + 'instance' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'title' => 'title', + 'status' => 'status', + 'detail' => 'detail', + 'instance' => 'instance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'title' => 'setTitle', + 'status' => 'setStatus', + 'detail' => 'setDetail', + 'instance' => 'setInstance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'title' => 'getTitle', + 'status' => 'getStatus', + 'detail' => 'getDetail', + 'instance' => 'getInstance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('instance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title title + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets detail + * + * @return string|null + */ + public function getDetail() + { + return $this->container['detail']; + } + + /** + * Sets detail + * + * @param string|null $detail detail + * + * @return self + */ + public function setDetail($detail) + { + if (is_null($detail)) { + array_push($this->openAPINullablesSetToNull, 'detail'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('detail', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['detail'] = $detail; + + return $this; + } + + /** + * Gets instance + * + * @return string|null + */ + public function getInstance() + { + return $this->container['instance']; + } + + /** + * Sets instance + * + * @param string|null $instance instance + * + * @return self + */ + public function setInstance($instance) + { + if (is_null($instance)) { + array_push($this->openAPINullablesSetToNull, 'instance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('instance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['instance'] = $instance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ProductDto.php b/lib/Model/ProductDto.php new file mode 100644 index 0000000..c23d399 --- /dev/null +++ b/lib/Model/ProductDto.php @@ -0,0 +1,1747 @@ + + */ +class ProductDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'uniq_id' => 'string', + 'product_name' => 'string', + 'retail_price' => 'float', + 'whole_price' => 'float', + 'vat' => 'float', + 'suggest_price' => 'float', + 'eshop_price' => 'float', + 'ref_price' => 'float', + 'eshop_discount' => 'float', + 'stock' => 'float', + 'reserved_stock' => 'float', + 'available_stock' => 'float', + 'robot_stock' => 'float', + 'barcode' => 'string', + 'barcode_list' => 'string[]', + 'oikos_id' => 'string', + 'owner_id' => 'string', + 'main_categ_id' => 'string', + 'categ_id' => 'string', + 'sub_categ_id' => 'string', + 'per_cat_id' => 'string', + 'per_cat2_id' => 'string', + 'per_cat3_id' => 'string', + 'mock_id' => 'string', + 'mock_name' => 'string', + 'measurement_unit' => 'string', + 'measurement_value' => 'string', + 'weight' => 'float', + 'color' => 'string', + 'shelf' => 'string', + 'position' => 'string', + 'last_supplier' => 'string', + 'web_visible' => 'bool', + 'img_url' => 'string', + 'is_med' => 'bool', + 'last_upd' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'uniq_id' => null, + 'product_name' => null, + 'retail_price' => 'double', + 'whole_price' => 'double', + 'vat' => 'double', + 'suggest_price' => 'double', + 'eshop_price' => 'double', + 'ref_price' => 'double', + 'eshop_discount' => 'double', + 'stock' => 'double', + 'reserved_stock' => 'double', + 'available_stock' => 'double', + 'robot_stock' => 'double', + 'barcode' => null, + 'barcode_list' => null, + 'oikos_id' => null, + 'owner_id' => null, + 'main_categ_id' => null, + 'categ_id' => null, + 'sub_categ_id' => null, + 'per_cat_id' => null, + 'per_cat2_id' => null, + 'per_cat3_id' => null, + 'mock_id' => null, + 'mock_name' => null, + 'measurement_unit' => null, + 'measurement_value' => null, + 'weight' => 'double', + 'color' => null, + 'shelf' => null, + 'position' => null, + 'last_supplier' => null, + 'web_visible' => null, + 'img_url' => null, + 'is_med' => null, + 'last_upd' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'uniq_id' => true, + 'product_name' => true, + 'retail_price' => false, + 'whole_price' => false, + 'vat' => false, + 'suggest_price' => false, + 'eshop_price' => false, + 'ref_price' => false, + 'eshop_discount' => false, + 'stock' => false, + 'reserved_stock' => false, + 'available_stock' => false, + 'robot_stock' => false, + 'barcode' => true, + 'barcode_list' => true, + 'oikos_id' => true, + 'owner_id' => true, + 'main_categ_id' => true, + 'categ_id' => true, + 'sub_categ_id' => true, + 'per_cat_id' => true, + 'per_cat2_id' => true, + 'per_cat3_id' => true, + 'mock_id' => true, + 'mock_name' => true, + 'measurement_unit' => true, + 'measurement_value' => true, + 'weight' => false, + 'color' => true, + 'shelf' => true, + 'position' => true, + 'last_supplier' => true, + 'web_visible' => false, + 'img_url' => true, + 'is_med' => false, + 'last_upd' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'uniq_id' => 'uniqId', + 'product_name' => 'productName', + 'retail_price' => 'retailPrice', + 'whole_price' => 'wholePrice', + 'vat' => 'vat', + 'suggest_price' => 'suggestPrice', + 'eshop_price' => 'eshopPrice', + 'ref_price' => 'refPrice', + 'eshop_discount' => 'eshopDiscount', + 'stock' => 'stock', + 'reserved_stock' => 'reservedStock', + 'available_stock' => 'availableStock', + 'robot_stock' => 'robotStock', + 'barcode' => 'barcode', + 'barcode_list' => 'barcodeList', + 'oikos_id' => 'oikosId', + 'owner_id' => 'ownerId', + 'main_categ_id' => 'mainCategId', + 'categ_id' => 'categId', + 'sub_categ_id' => 'subCategId', + 'per_cat_id' => 'perCatId', + 'per_cat2_id' => 'perCat2Id', + 'per_cat3_id' => 'perCat3Id', + 'mock_id' => 'mockId', + 'mock_name' => 'mockName', + 'measurement_unit' => 'measurementUnit', + 'measurement_value' => 'measurementValue', + 'weight' => 'weight', + 'color' => 'color', + 'shelf' => 'shelf', + 'position' => 'position', + 'last_supplier' => 'lastSupplier', + 'web_visible' => 'webVisible', + 'img_url' => 'imgUrl', + 'is_med' => 'isMed', + 'last_upd' => 'lastUpd' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'uniq_id' => 'setUniqId', + 'product_name' => 'setProductName', + 'retail_price' => 'setRetailPrice', + 'whole_price' => 'setWholePrice', + 'vat' => 'setVat', + 'suggest_price' => 'setSuggestPrice', + 'eshop_price' => 'setEshopPrice', + 'ref_price' => 'setRefPrice', + 'eshop_discount' => 'setEshopDiscount', + 'stock' => 'setStock', + 'reserved_stock' => 'setReservedStock', + 'available_stock' => 'setAvailableStock', + 'robot_stock' => 'setRobotStock', + 'barcode' => 'setBarcode', + 'barcode_list' => 'setBarcodeList', + 'oikos_id' => 'setOikosId', + 'owner_id' => 'setOwnerId', + 'main_categ_id' => 'setMainCategId', + 'categ_id' => 'setCategId', + 'sub_categ_id' => 'setSubCategId', + 'per_cat_id' => 'setPerCatId', + 'per_cat2_id' => 'setPerCat2Id', + 'per_cat3_id' => 'setPerCat3Id', + 'mock_id' => 'setMockId', + 'mock_name' => 'setMockName', + 'measurement_unit' => 'setMeasurementUnit', + 'measurement_value' => 'setMeasurementValue', + 'weight' => 'setWeight', + 'color' => 'setColor', + 'shelf' => 'setShelf', + 'position' => 'setPosition', + 'last_supplier' => 'setLastSupplier', + 'web_visible' => 'setWebVisible', + 'img_url' => 'setImgUrl', + 'is_med' => 'setIsMed', + 'last_upd' => 'setLastUpd' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'uniq_id' => 'getUniqId', + 'product_name' => 'getProductName', + 'retail_price' => 'getRetailPrice', + 'whole_price' => 'getWholePrice', + 'vat' => 'getVat', + 'suggest_price' => 'getSuggestPrice', + 'eshop_price' => 'getEshopPrice', + 'ref_price' => 'getRefPrice', + 'eshop_discount' => 'getEshopDiscount', + 'stock' => 'getStock', + 'reserved_stock' => 'getReservedStock', + 'available_stock' => 'getAvailableStock', + 'robot_stock' => 'getRobotStock', + 'barcode' => 'getBarcode', + 'barcode_list' => 'getBarcodeList', + 'oikos_id' => 'getOikosId', + 'owner_id' => 'getOwnerId', + 'main_categ_id' => 'getMainCategId', + 'categ_id' => 'getCategId', + 'sub_categ_id' => 'getSubCategId', + 'per_cat_id' => 'getPerCatId', + 'per_cat2_id' => 'getPerCat2Id', + 'per_cat3_id' => 'getPerCat3Id', + 'mock_id' => 'getMockId', + 'mock_name' => 'getMockName', + 'measurement_unit' => 'getMeasurementUnit', + 'measurement_value' => 'getMeasurementValue', + 'weight' => 'getWeight', + 'color' => 'getColor', + 'shelf' => 'getShelf', + 'position' => 'getPosition', + 'last_supplier' => 'getLastSupplier', + 'web_visible' => 'getWebVisible', + 'img_url' => 'getImgUrl', + 'is_med' => 'getIsMed', + 'last_upd' => 'getLastUpd' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('uniq_id', $data ?? [], null); + $this->setIfExists('product_name', $data ?? [], null); + $this->setIfExists('retail_price', $data ?? [], null); + $this->setIfExists('whole_price', $data ?? [], null); + $this->setIfExists('vat', $data ?? [], null); + $this->setIfExists('suggest_price', $data ?? [], null); + $this->setIfExists('eshop_price', $data ?? [], null); + $this->setIfExists('ref_price', $data ?? [], null); + $this->setIfExists('eshop_discount', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('reserved_stock', $data ?? [], null); + $this->setIfExists('available_stock', $data ?? [], null); + $this->setIfExists('robot_stock', $data ?? [], null); + $this->setIfExists('barcode', $data ?? [], null); + $this->setIfExists('barcode_list', $data ?? [], null); + $this->setIfExists('oikos_id', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + $this->setIfExists('main_categ_id', $data ?? [], null); + $this->setIfExists('categ_id', $data ?? [], null); + $this->setIfExists('sub_categ_id', $data ?? [], null); + $this->setIfExists('per_cat_id', $data ?? [], null); + $this->setIfExists('per_cat2_id', $data ?? [], null); + $this->setIfExists('per_cat3_id', $data ?? [], null); + $this->setIfExists('mock_id', $data ?? [], null); + $this->setIfExists('mock_name', $data ?? [], null); + $this->setIfExists('measurement_unit', $data ?? [], null); + $this->setIfExists('measurement_value', $data ?? [], null); + $this->setIfExists('weight', $data ?? [], null); + $this->setIfExists('color', $data ?? [], null); + $this->setIfExists('shelf', $data ?? [], null); + $this->setIfExists('position', $data ?? [], null); + $this->setIfExists('last_supplier', $data ?? [], null); + $this->setIfExists('web_visible', $data ?? [], null); + $this->setIfExists('img_url', $data ?? [], null); + $this->setIfExists('is_med', $data ?? [], null); + $this->setIfExists('last_upd', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets uniq_id + * + * @return string|null + */ + public function getUniqId() + { + return $this->container['uniq_id']; + } + + /** + * Sets uniq_id + * + * @param string|null $uniq_id Μοναδικός κωδικός είδους + * + * @return self + */ + public function setUniqId($uniq_id) + { + if (is_null($uniq_id)) { + array_push($this->openAPINullablesSetToNull, 'uniq_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uniq_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['uniq_id'] = $uniq_id; + + return $this; + } + + /** + * Gets product_name + * + * @return string|null + */ + public function getProductName() + { + return $this->container['product_name']; + } + + /** + * Sets product_name + * + * @param string|null $product_name Τίτλος είδους + * + * @return self + */ + public function setProductName($product_name) + { + if (is_null($product_name)) { + array_push($this->openAPINullablesSetToNull, 'product_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product_name'] = $product_name; + + return $this; + } + + /** + * Gets retail_price + * + * @return float|null + */ + public function getRetailPrice() + { + return $this->container['retail_price']; + } + + /** + * Sets retail_price + * + * @param float|null $retail_price Λιανική τιμή + * + * @return self + */ + public function setRetailPrice($retail_price) + { + if (is_null($retail_price)) { + throw new \InvalidArgumentException('non-nullable retail_price cannot be null'); + } + $this->container['retail_price'] = $retail_price; + + return $this; + } + + /** + * Gets whole_price + * + * @return float|null + */ + public function getWholePrice() + { + return $this->container['whole_price']; + } + + /** + * Sets whole_price + * + * @param float|null $whole_price Χονδρική τιμή + * + * @return self + */ + public function setWholePrice($whole_price) + { + if (is_null($whole_price)) { + throw new \InvalidArgumentException('non-nullable whole_price cannot be null'); + } + $this->container['whole_price'] = $whole_price; + + return $this; + } + + /** + * Gets vat + * + * @return float|null + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param float|null $vat Φπα είδους + * + * @return self + */ + public function setVat($vat) + { + if (is_null($vat)) { + throw new \InvalidArgumentException('non-nullable vat cannot be null'); + } + $this->container['vat'] = $vat; + + return $this; + } + + /** + * Gets suggest_price + * + * @return float|null + */ + public function getSuggestPrice() + { + return $this->container['suggest_price']; + } + + /** + * Sets suggest_price + * + * @param float|null $suggest_price Τιμή καταλόγου + * + * @return self + */ + public function setSuggestPrice($suggest_price) + { + if (is_null($suggest_price)) { + throw new \InvalidArgumentException('non-nullable suggest_price cannot be null'); + } + $this->container['suggest_price'] = $suggest_price; + + return $this; + } + + /** + * Gets eshop_price + * + * @return float|null + */ + public function getEshopPrice() + { + return $this->container['eshop_price']; + } + + /** + * Sets eshop_price + * + * @param float|null $eshop_price Τιμή eshop + * + * @return self + */ + public function setEshopPrice($eshop_price) + { + if (is_null($eshop_price)) { + throw new \InvalidArgumentException('non-nullable eshop_price cannot be null'); + } + $this->container['eshop_price'] = $eshop_price; + + return $this; + } + + /** + * Gets ref_price + * + * @return float|null + */ + public function getRefPrice() + { + return $this->container['ref_price']; + } + + /** + * Sets ref_price + * + * @param float|null $ref_price Τιμή Αναφοράς - Για φάρμακα + * + * @return self + */ + public function setRefPrice($ref_price) + { + if (is_null($ref_price)) { + throw new \InvalidArgumentException('non-nullable ref_price cannot be null'); + } + $this->container['ref_price'] = $ref_price; + + return $this; + } + + /** + * Gets eshop_discount + * + * @return float|null + */ + public function getEshopDiscount() + { + return $this->container['eshop_discount']; + } + + /** + * Sets eshop_discount + * + * @param float|null $eshop_discount + * + * @return self + */ + public function setEshopDiscount($eshop_discount) + { + if (is_null($eshop_discount)) { + throw new \InvalidArgumentException('non-nullable eshop_discount cannot be null'); + } + $this->container['eshop_discount'] = $eshop_discount; + + return $this; + } + + /** + * Gets stock + * + * @return float|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param float|null $stock Απόθεμα Φαρμακείου + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + throw new \InvalidArgumentException('non-nullable stock cannot be null'); + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets reserved_stock + * + * @return float|null + */ + public function getReservedStock() + { + return $this->container['reserved_stock']; + } + + /** + * Sets reserved_stock + * + * @param float|null $reserved_stock Δεσμευμένο απόθεμα + * + * @return self + */ + public function setReservedStock($reserved_stock) + { + if (is_null($reserved_stock)) { + throw new \InvalidArgumentException('non-nullable reserved_stock cannot be null'); + } + $this->container['reserved_stock'] = $reserved_stock; + + return $this; + } + + /** + * Gets available_stock + * + * @return float|null + */ + public function getAvailableStock() + { + return $this->container['available_stock']; + } + + /** + * Sets available_stock + * + * @param float|null $available_stock Διαθέσιμο Απόθεμα + * + * @return self + */ + public function setAvailableStock($available_stock) + { + if (is_null($available_stock)) { + throw new \InvalidArgumentException('non-nullable available_stock cannot be null'); + } + $this->container['available_stock'] = $available_stock; + + return $this; + } + + /** + * Gets robot_stock + * + * @return float|null + */ + public function getRobotStock() + { + return $this->container['robot_stock']; + } + + /** + * Sets robot_stock + * + * @param float|null $robot_stock robot_stock + * + * @return self + */ + public function setRobotStock($robot_stock) + { + if (is_null($robot_stock)) { + throw new \InvalidArgumentException('non-nullable robot_stock cannot be null'); + } + $this->container['robot_stock'] = $robot_stock; + + return $this; + } + + /** + * Gets barcode + * + * @return string|null + */ + public function getBarcode() + { + return $this->container['barcode']; + } + + /** + * Sets barcode + * + * @param string|null $barcode barcode + * + * @return self + */ + public function setBarcode($barcode) + { + if (is_null($barcode)) { + array_push($this->openAPINullablesSetToNull, 'barcode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('barcode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['barcode'] = $barcode; + + return $this; + } + + /** + * Gets barcode_list + * + * @return string[]|null + */ + public function getBarcodeList() + { + return $this->container['barcode_list']; + } + + /** + * Sets barcode_list + * + * @param string[]|null $barcode_list barcode_list + * + * @return self + */ + public function setBarcodeList($barcode_list) + { + if (is_null($barcode_list)) { + array_push($this->openAPINullablesSetToNull, 'barcode_list'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('barcode_list', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['barcode_list'] = $barcode_list; + + return $this; + } + + /** + * Gets oikos_id + * + * @return string|null + */ + public function getOikosId() + { + return $this->container['oikos_id']; + } + + /** + * Sets oikos_id + * + * @param string|null $oikos_id Τιμή καταλόγου + * + * @return self + */ + public function setOikosId($oikos_id) + { + if (is_null($oikos_id)) { + array_push($this->openAPINullablesSetToNull, 'oikos_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('oikos_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['oikos_id'] = $oikos_id; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id owner_id + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + array_push($this->openAPINullablesSetToNull, 'owner_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('owner_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets main_categ_id + * + * @return string|null + */ + public function getMainCategId() + { + return $this->container['main_categ_id']; + } + + /** + * Sets main_categ_id + * + * @param string|null $main_categ_id main_categ_id + * + * @return self + */ + public function setMainCategId($main_categ_id) + { + if (is_null($main_categ_id)) { + array_push($this->openAPINullablesSetToNull, 'main_categ_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('main_categ_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['main_categ_id'] = $main_categ_id; + + return $this; + } + + /** + * Gets categ_id + * + * @return string|null + */ + public function getCategId() + { + return $this->container['categ_id']; + } + + /** + * Sets categ_id + * + * @param string|null $categ_id categ_id + * + * @return self + */ + public function setCategId($categ_id) + { + if (is_null($categ_id)) { + array_push($this->openAPINullablesSetToNull, 'categ_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categ_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categ_id'] = $categ_id; + + return $this; + } + + /** + * Gets sub_categ_id + * + * @return string|null + */ + public function getSubCategId() + { + return $this->container['sub_categ_id']; + } + + /** + * Sets sub_categ_id + * + * @param string|null $sub_categ_id sub_categ_id + * + * @return self + */ + public function setSubCategId($sub_categ_id) + { + if (is_null($sub_categ_id)) { + array_push($this->openAPINullablesSetToNull, 'sub_categ_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sub_categ_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sub_categ_id'] = $sub_categ_id; + + return $this; + } + + /** + * Gets per_cat_id + * + * @return string|null + */ + public function getPerCatId() + { + return $this->container['per_cat_id']; + } + + /** + * Sets per_cat_id + * + * @param string|null $per_cat_id per_cat_id + * + * @return self + */ + public function setPerCatId($per_cat_id) + { + if (is_null($per_cat_id)) { + array_push($this->openAPINullablesSetToNull, 'per_cat_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('per_cat_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['per_cat_id'] = $per_cat_id; + + return $this; + } + + /** + * Gets per_cat2_id + * + * @return string|null + */ + public function getPerCat2Id() + { + return $this->container['per_cat2_id']; + } + + /** + * Sets per_cat2_id + * + * @param string|null $per_cat2_id per_cat2_id + * + * @return self + */ + public function setPerCat2Id($per_cat2_id) + { + if (is_null($per_cat2_id)) { + array_push($this->openAPINullablesSetToNull, 'per_cat2_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('per_cat2_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['per_cat2_id'] = $per_cat2_id; + + return $this; + } + + /** + * Gets per_cat3_id + * + * @return string|null + */ + public function getPerCat3Id() + { + return $this->container['per_cat3_id']; + } + + /** + * Sets per_cat3_id + * + * @param string|null $per_cat3_id per_cat3_id + * + * @return self + */ + public function setPerCat3Id($per_cat3_id) + { + if (is_null($per_cat3_id)) { + array_push($this->openAPINullablesSetToNull, 'per_cat3_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('per_cat3_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['per_cat3_id'] = $per_cat3_id; + + return $this; + } + + /** + * Gets mock_id + * + * @return string|null + */ + public function getMockId() + { + return $this->container['mock_id']; + } + + /** + * Sets mock_id + * + * @param string|null $mock_id Κωδικός Παραλλαγής + * + * @return self + */ + public function setMockId($mock_id) + { + if (is_null($mock_id)) { + array_push($this->openAPINullablesSetToNull, 'mock_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mock_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mock_id'] = $mock_id; + + return $this; + } + + /** + * Gets mock_name + * + * @return string|null + */ + public function getMockName() + { + return $this->container['mock_name']; + } + + /** + * Sets mock_name + * + * @param string|null $mock_name Όνομα Παραλλαγής + * + * @return self + */ + public function setMockName($mock_name) + { + if (is_null($mock_name)) { + array_push($this->openAPINullablesSetToNull, 'mock_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mock_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mock_name'] = $mock_name; + + return $this; + } + + /** + * Gets measurement_unit + * + * @return string|null + */ + public function getMeasurementUnit() + { + return $this->container['measurement_unit']; + } + + /** + * Sets measurement_unit + * + * @param string|null $measurement_unit { \"\", \"\"}, { \"Size\", \"Μέγεθος\" } , {\"Mass\" , \"Όγκος (ml)\" }, {\"Pieces\" , \"Τεμάχια\" }, { \"Weight\", \"Βάρος (kg)\" } + * + * @return self + */ + public function setMeasurementUnit($measurement_unit) + { + if (is_null($measurement_unit)) { + array_push($this->openAPINullablesSetToNull, 'measurement_unit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('measurement_unit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['measurement_unit'] = $measurement_unit; + + return $this; + } + + /** + * Gets measurement_value + * + * @return string|null + */ + public function getMeasurementValue() + { + return $this->container['measurement_value']; + } + + /** + * Sets measurement_value + * + * @param string|null $measurement_value + * + * @return self + */ + public function setMeasurementValue($measurement_value) + { + if (is_null($measurement_value)) { + array_push($this->openAPINullablesSetToNull, 'measurement_value'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('measurement_value', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['measurement_value'] = $measurement_value; + + return $this; + } + + /** + * Gets weight + * + * @return float|null + */ + public function getWeight() + { + return $this->container['weight']; + } + + /** + * Sets weight + * + * @param float|null $weight Βάρος + * + * @return self + */ + public function setWeight($weight) + { + if (is_null($weight)) { + throw new \InvalidArgumentException('non-nullable weight cannot be null'); + } + $this->container['weight'] = $weight; + + return $this; + } + + /** + * Gets color + * + * @return string|null + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param string|null $color Χρώμα + * + * @return self + */ + public function setColor($color) + { + if (is_null($color)) { + array_push($this->openAPINullablesSetToNull, 'color'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('color', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['color'] = $color; + + return $this; + } + + /** + * Gets shelf + * + * @return string|null + */ + public function getShelf() + { + return $this->container['shelf']; + } + + /** + * Sets shelf + * + * @param string|null $shelf Ράφι + * + * @return self + */ + public function setShelf($shelf) + { + if (is_null($shelf)) { + array_push($this->openAPINullablesSetToNull, 'shelf'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('shelf', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['shelf'] = $shelf; + + return $this; + } + + /** + * Gets position + * + * @return string|null + */ + public function getPosition() + { + return $this->container['position']; + } + + /** + * Sets position + * + * @param string|null $position Θέση + * + * @return self + */ + public function setPosition($position) + { + if (is_null($position)) { + array_push($this->openAPINullablesSetToNull, 'position'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('position', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['position'] = $position; + + return $this; + } + + /** + * Gets last_supplier + * + * @return string|null + */ + public function getLastSupplier() + { + return $this->container['last_supplier']; + } + + /** + * Sets last_supplier + * + * @param string|null $last_supplier last_supplier + * + * @return self + */ + public function setLastSupplier($last_supplier) + { + if (is_null($last_supplier)) { + array_push($this->openAPINullablesSetToNull, 'last_supplier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_supplier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['last_supplier'] = $last_supplier; + + return $this; + } + + /** + * Gets web_visible + * + * @return bool|null + */ + public function getWebVisible() + { + return $this->container['web_visible']; + } + + /** + * Sets web_visible + * + * @param bool|null $web_visible Αν θα εμφανίζεται το site + * + * @return self + */ + public function setWebVisible($web_visible) + { + if (is_null($web_visible)) { + throw new \InvalidArgumentException('non-nullable web_visible cannot be null'); + } + $this->container['web_visible'] = $web_visible; + + return $this; + } + + /** + * Gets img_url + * + * @return string|null + */ + public function getImgUrl() + { + return $this->container['img_url']; + } + + /** + * Sets img_url + * + * @param string|null $img_url img_url + * + * @return self + */ + public function setImgUrl($img_url) + { + if (is_null($img_url)) { + array_push($this->openAPINullablesSetToNull, 'img_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('img_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['img_url'] = $img_url; + + return $this; + } + + /** + * Gets is_med + * + * @return bool|null + */ + public function getIsMed() + { + return $this->container['is_med']; + } + + /** + * Sets is_med + * + * @param bool|null $is_med is_med + * + * @return self + */ + public function setIsMed($is_med) + { + if (is_null($is_med)) { + throw new \InvalidArgumentException('non-nullable is_med cannot be null'); + } + $this->container['is_med'] = $is_med; + + return $this; + } + + /** + * Gets last_upd + * + * @return \DateTime|null + */ + public function getLastUpd() + { + return $this->container['last_upd']; + } + + /** + * Sets last_upd + * + * @param \DateTime|null $last_upd last_upd + * + * @return self + */ + public function setLastUpd($last_upd) + { + if (is_null($last_upd)) { + throw new \InvalidArgumentException('non-nullable last_upd cannot be null'); + } + $this->container['last_upd'] = $last_upd; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ProductDtoPagedResponse.php b/lib/Model/ProductDtoPagedResponse.php new file mode 100644 index 0000000..8c9538c --- /dev/null +++ b/lib/Model/ProductDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class ProductDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\ProductDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\ProductDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\ProductDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Shipping.php b/lib/Model/Shipping.php new file mode 100644 index 0000000..ac305af --- /dev/null +++ b/lib/Model/Shipping.php @@ -0,0 +1,929 @@ + + */ +class Shipping implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'shipping'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'last_name' => 'string', + 'first_name' => 'string', + 'address' => 'string', + 'city' => 'string', + 'postcode' => 'string', + 'state' => 'string', + 'country' => 'string', + 'country_code' => 'string', + 'phone' => 'string', + 'cellphone' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'last_name' => null, + 'first_name' => null, + 'address' => null, + 'city' => null, + 'postcode' => null, + 'state' => null, + 'country' => null, + 'country_code' => null, + 'phone' => null, + 'cellphone' => null, + 'email' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'last_name' => true, + 'first_name' => true, + 'address' => true, + 'city' => true, + 'postcode' => true, + 'state' => true, + 'country' => true, + 'country_code' => true, + 'phone' => true, + 'cellphone' => true, + 'email' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'last_name' => 'lastName', + 'first_name' => 'firstName', + 'address' => 'address', + 'city' => 'city', + 'postcode' => 'postcode', + 'state' => 'state', + 'country' => 'country', + 'country_code' => 'countryCode', + 'phone' => 'phone', + 'cellphone' => 'cellphone', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'last_name' => 'setLastName', + 'first_name' => 'setFirstName', + 'address' => 'setAddress', + 'city' => 'setCity', + 'postcode' => 'setPostcode', + 'state' => 'setState', + 'country' => 'setCountry', + 'country_code' => 'setCountryCode', + 'phone' => 'setPhone', + 'cellphone' => 'setCellphone', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'last_name' => 'getLastName', + 'first_name' => 'getFirstName', + 'address' => 'getAddress', + 'city' => 'getCity', + 'postcode' => 'getPostcode', + 'state' => 'getState', + 'country' => 'getCountry', + 'country_code' => 'getCountryCode', + 'phone' => 'getPhone', + 'cellphone' => 'getCellphone', + 'email' => 'getEmail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('postcode', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('country_code', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('cellphone', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) > 60)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) < 1)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) > 60)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) < 1)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['address']) && (mb_strlen($this->container['address']) > 120)) { + $invalidProperties[] = "invalid value for 'address', the character length must be smaller than or equal to 120."; + } + + if (!is_null($this->container['city']) && (mb_strlen($this->container['city']) > 60)) { + $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['postcode']) && (mb_strlen($this->container['postcode']) > 10)) { + $invalidProperties[] = "invalid value for 'postcode', the character length must be smaller than or equal to 10."; + } + + if (!is_null($this->container['state']) && (mb_strlen($this->container['state']) > 60)) { + $invalidProperties[] = "invalid value for 'state', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['country']) && (mb_strlen($this->container['country']) > 20)) { + $invalidProperties[] = "invalid value for 'country', the character length must be smaller than or equal to 20."; + } + + if (!is_null($this->container['country_code']) && (mb_strlen($this->container['country_code']) > 2)) { + $invalidProperties[] = "invalid value for 'country_code', the character length must be smaller than or equal to 2."; + } + + if (!is_null($this->container['phone']) && (mb_strlen($this->container['phone']) > 15)) { + $invalidProperties[] = "invalid value for 'phone', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['cellphone']) && (mb_strlen($this->container['cellphone']) > 15)) { + $invalidProperties[] = "invalid value for 'cellphone', the character length must be smaller than or equal to 15."; + } + + if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 60)) { + $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 60."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name last_name + * + * @return self + */ + public function setLastName($last_name) + { + if (is_null($last_name)) { + array_push($this->openAPINullablesSetToNull, 'last_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($last_name) && (mb_strlen($last_name) > 60)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling Shipping., must be smaller than or equal to 60.'); + } + if (!is_null($last_name) && (mb_strlen($last_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling Shipping., must be bigger than or equal to 1.'); + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name first_name + * + * @return self + */ + public function setFirstName($first_name) + { + if (is_null($first_name)) { + array_push($this->openAPINullablesSetToNull, 'first_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('first_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($first_name) && (mb_strlen($first_name) > 60)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling Shipping., must be smaller than or equal to 60.'); + } + if (!is_null($first_name) && (mb_strlen($first_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling Shipping., must be bigger than or equal to 1.'); + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($address) && (mb_strlen($address) > 120)) { + throw new \InvalidArgumentException('invalid length for $address when calling Shipping., must be smaller than or equal to 120.'); + } + + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($city) && (mb_strlen($city) > 60)) { + throw new \InvalidArgumentException('invalid length for $city when calling Shipping., must be smaller than or equal to 60.'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets postcode + * + * @return string|null + */ + public function getPostcode() + { + return $this->container['postcode']; + } + + /** + * Sets postcode + * + * @param string|null $postcode postcode + * + * @return self + */ + public function setPostcode($postcode) + { + if (is_null($postcode)) { + array_push($this->openAPINullablesSetToNull, 'postcode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postcode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($postcode) && (mb_strlen($postcode) > 10)) { + throw new \InvalidArgumentException('invalid length for $postcode when calling Shipping., must be smaller than or equal to 10.'); + } + + $this->container['postcode'] = $postcode; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state state + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($state) && (mb_strlen($state) > 60)) { + throw new \InvalidArgumentException('invalid length for $state when calling Shipping., must be smaller than or equal to 60.'); + } + + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($country) && (mb_strlen($country) > 20)) { + throw new \InvalidArgumentException('invalid length for $country when calling Shipping., must be smaller than or equal to 20.'); + } + + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets country_code + * + * @return string|null + */ + public function getCountryCode() + { + return $this->container['country_code']; + } + + /** + * Sets country_code + * + * @param string|null $country_code country_code + * + * @return self + */ + public function setCountryCode($country_code) + { + if (is_null($country_code)) { + array_push($this->openAPINullablesSetToNull, 'country_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($country_code) && (mb_strlen($country_code) > 2)) { + throw new \InvalidArgumentException('invalid length for $country_code when calling Shipping., must be smaller than or equal to 2.'); + } + + $this->container['country_code'] = $country_code; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone phone + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($phone) && (mb_strlen($phone) > 15)) { + throw new \InvalidArgumentException('invalid length for $phone when calling Shipping., must be smaller than or equal to 15.'); + } + + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets cellphone + * + * @return string|null + */ + public function getCellphone() + { + return $this->container['cellphone']; + } + + /** + * Sets cellphone + * + * @param string|null $cellphone cellphone + * + * @return self + */ + public function setCellphone($cellphone) + { + if (is_null($cellphone)) { + array_push($this->openAPINullablesSetToNull, 'cellphone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cellphone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($cellphone) && (mb_strlen($cellphone) > 15)) { + throw new \InvalidArgumentException('invalid length for $cellphone when calling Shipping., must be smaller than or equal to 15.'); + } + + $this->container['cellphone'] = $cellphone; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($email) && (mb_strlen($email) > 60)) { + throw new \InvalidArgumentException('invalid length for $email when calling Shipping., must be smaller than or equal to 60.'); + } + + $this->container['email'] = $email; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SubCategoryDto.php b/lib/Model/SubCategoryDto.php new file mode 100644 index 0000000..3d9652f --- /dev/null +++ b/lib/Model/SubCategoryDto.php @@ -0,0 +1,499 @@ + + */ +class SubCategoryDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SubCategoryDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sc_id' => 'string', + 'sc_desc' => 'string', + 'ca_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sc_id' => null, + 'sc_desc' => null, + 'ca_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sc_id' => true, + 'sc_desc' => true, + 'ca_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sc_id' => 'scId', + 'sc_desc' => 'scDesc', + 'ca_id' => 'caId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sc_id' => 'setScId', + 'sc_desc' => 'setScDesc', + 'ca_id' => 'setCaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sc_id' => 'getScId', + 'sc_desc' => 'getScDesc', + 'ca_id' => 'getCaId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('sc_id', $data ?? [], null); + $this->setIfExists('sc_desc', $data ?? [], null); + $this->setIfExists('ca_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sc_id + * + * @return string|null + */ + public function getScId() + { + return $this->container['sc_id']; + } + + /** + * Sets sc_id + * + * @param string|null $sc_id sc_id + * + * @return self + */ + public function setScId($sc_id) + { + if (is_null($sc_id)) { + array_push($this->openAPINullablesSetToNull, 'sc_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sc_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sc_id'] = $sc_id; + + return $this; + } + + /** + * Gets sc_desc + * + * @return string|null + */ + public function getScDesc() + { + return $this->container['sc_desc']; + } + + /** + * Sets sc_desc + * + * @param string|null $sc_desc sc_desc + * + * @return self + */ + public function setScDesc($sc_desc) + { + if (is_null($sc_desc)) { + array_push($this->openAPINullablesSetToNull, 'sc_desc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sc_desc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sc_desc'] = $sc_desc; + + return $this; + } + + /** + * Gets ca_id + * + * @return string|null + */ + public function getCaId() + { + return $this->container['ca_id']; + } + + /** + * Sets ca_id + * + * @param string|null $ca_id ca_id + * + * @return self + */ + public function setCaId($ca_id) + { + if (is_null($ca_id)) { + array_push($this->openAPINullablesSetToNull, 'ca_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ca_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ca_id'] = $ca_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SubCategoryDtoPagedResponse.php b/lib/Model/SubCategoryDtoPagedResponse.php new file mode 100644 index 0000000..9c80522 --- /dev/null +++ b/lib/Model/SubCategoryDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class SubCategoryDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SubCategoryDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\SubCategoryDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\SubCategoryDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\SubCategoryDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/VatCategoryDto.php b/lib/Model/VatCategoryDto.php new file mode 100644 index 0000000..68d1b5c --- /dev/null +++ b/lib/Model/VatCategoryDto.php @@ -0,0 +1,485 @@ + + */ +class VatCategoryDto implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VatCategoryDto'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vat_code' => 'int', + 'vat_value' => 'float', + 'vat_desc' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vat_code' => 'int32', + 'vat_value' => 'double', + 'vat_desc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vat_code' => false, + 'vat_value' => false, + 'vat_desc' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vat_code' => 'vatCode', + 'vat_value' => 'vatValue', + 'vat_desc' => 'vatDesc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vat_code' => 'setVatCode', + 'vat_value' => 'setVatValue', + 'vat_desc' => 'setVatDesc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vat_code' => 'getVatCode', + 'vat_value' => 'getVatValue', + 'vat_desc' => 'getVatDesc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('vat_code', $data ?? [], null); + $this->setIfExists('vat_value', $data ?? [], null); + $this->setIfExists('vat_desc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vat_code + * + * @return int|null + */ + public function getVatCode() + { + return $this->container['vat_code']; + } + + /** + * Sets vat_code + * + * @param int|null $vat_code vat_code + * + * @return self + */ + public function setVatCode($vat_code) + { + if (is_null($vat_code)) { + throw new \InvalidArgumentException('non-nullable vat_code cannot be null'); + } + $this->container['vat_code'] = $vat_code; + + return $this; + } + + /** + * Gets vat_value + * + * @return float|null + */ + public function getVatValue() + { + return $this->container['vat_value']; + } + + /** + * Sets vat_value + * + * @param float|null $vat_value vat_value + * + * @return self + */ + public function setVatValue($vat_value) + { + if (is_null($vat_value)) { + throw new \InvalidArgumentException('non-nullable vat_value cannot be null'); + } + $this->container['vat_value'] = $vat_value; + + return $this; + } + + /** + * Gets vat_desc + * + * @return string|null + */ + public function getVatDesc() + { + return $this->container['vat_desc']; + } + + /** + * Sets vat_desc + * + * @param string|null $vat_desc vat_desc + * + * @return self + */ + public function setVatDesc($vat_desc) + { + if (is_null($vat_desc)) { + array_push($this->openAPINullablesSetToNull, 'vat_desc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vat_desc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vat_desc'] = $vat_desc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/VatCategoryDtoPagedResponse.php b/lib/Model/VatCategoryDtoPagedResponse.php new file mode 100644 index 0000000..04f5658 --- /dev/null +++ b/lib/Model/VatCategoryDtoPagedResponse.php @@ -0,0 +1,730 @@ + + */ +class VatCategoryDtoPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VatCategoryDtoPagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'time_stamp' => '\DateTime', + 'page_number' => 'int', + 'page_size' => 'int', + 'total_items' => 'int', + 'total_pages' => 'int', + 'last_page' => 'bool', + 'data_size' => 'int', + 'is_success' => 'bool', + 'errors' => 'string[]', + 'data' => '\Europharmacy\EuromedicaClient\Model\VatCategoryDto[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'time_stamp' => 'date-time', + 'page_number' => 'int32', + 'page_size' => 'int32', + 'total_items' => 'int32', + 'total_pages' => 'int32', + 'last_page' => null, + 'data_size' => 'int32', + 'is_success' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'time_stamp' => false, + 'page_number' => false, + 'page_size' => false, + 'total_items' => false, + 'total_pages' => false, + 'last_page' => false, + 'data_size' => false, + 'is_success' => false, + 'errors' => true, + 'data' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time_stamp' => 'timeStamp', + 'page_number' => 'pageNumber', + 'page_size' => 'pageSize', + 'total_items' => 'totalItems', + 'total_pages' => 'totalPages', + 'last_page' => 'lastPage', + 'data_size' => 'dataSize', + 'is_success' => 'isSuccess', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time_stamp' => 'setTimeStamp', + 'page_number' => 'setPageNumber', + 'page_size' => 'setPageSize', + 'total_items' => 'setTotalItems', + 'total_pages' => 'setTotalPages', + 'last_page' => 'setLastPage', + 'data_size' => 'setDataSize', + 'is_success' => 'setIsSuccess', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time_stamp' => 'getTimeStamp', + 'page_number' => 'getPageNumber', + 'page_size' => 'getPageSize', + 'total_items' => 'getTotalItems', + 'total_pages' => 'getTotalPages', + 'last_page' => 'getLastPage', + 'data_size' => 'getDataSize', + 'is_success' => 'getIsSuccess', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time_stamp', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('last_page', $data ?? [], null); + $this->setIfExists('data_size', $data ?? [], null); + $this->setIfExists('is_success', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time_stamp + * + * @return \DateTime|null + */ + public function getTimeStamp() + { + return $this->container['time_stamp']; + } + + /** + * Sets time_stamp + * + * @param \DateTime|null $time_stamp time_stamp + * + * @return self + */ + public function setTimeStamp($time_stamp) + { + if (is_null($time_stamp)) { + throw new \InvalidArgumentException('non-nullable time_stamp cannot be null'); + } + $this->container['time_stamp'] = $time_stamp; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber() + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number page_number + * + * @return self + */ + public function setPageNumber($page_number) + { + if (is_null($page_number)) { + throw new \InvalidArgumentException('non-nullable page_number cannot be null'); + } + $this->container['page_number'] = $page_number; + + return $this; + } + + /** + * Gets page_size + * + * @return int|null + */ + public function getPageSize() + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int|null $page_size page_size + * + * @return self + */ + public function setPageSize($page_size) + { + if (is_null($page_size)) { + throw new \InvalidArgumentException('non-nullable page_size cannot be null'); + } + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages() + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages total_pages + * + * @return self + */ + public function setTotalPages($total_pages) + { + if (is_null($total_pages)) { + throw new \InvalidArgumentException('non-nullable total_pages cannot be null'); + } + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets last_page + * + * @return bool|null + */ + public function getLastPage() + { + return $this->container['last_page']; + } + + /** + * Sets last_page + * + * @param bool|null $last_page last_page + * + * @return self + */ + public function setLastPage($last_page) + { + if (is_null($last_page)) { + throw new \InvalidArgumentException('non-nullable last_page cannot be null'); + } + $this->container['last_page'] = $last_page; + + return $this; + } + + /** + * Gets data_size + * + * @return int|null + */ + public function getDataSize() + { + return $this->container['data_size']; + } + + /** + * Sets data_size + * + * @param int|null $data_size data_size + * + * @return self + */ + public function setDataSize($data_size) + { + if (is_null($data_size)) { + throw new \InvalidArgumentException('non-nullable data_size cannot be null'); + } + $this->container['data_size'] = $data_size; + + return $this; + } + + /** + * Gets is_success + * + * @return bool|null + */ + public function getIsSuccess() + { + return $this->container['is_success']; + } + + /** + * Sets is_success + * + * @param bool|null $is_success is_success + * + * @return self + */ + public function setIsSuccess($is_success) + { + if (is_null($is_success)) { + throw new \InvalidArgumentException('non-nullable is_success cannot be null'); + } + $this->container['is_success'] = $is_success; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + array_push($this->openAPINullablesSetToNull, 'errors'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('errors', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Europharmacy\EuromedicaClient\Model\VatCategoryDto[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Europharmacy\EuromedicaClient\Model\VatCategoryDto[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php new file mode 100644 index 0000000..07daefb --- /dev/null +++ b/lib/ObjectSerializer.php @@ -0,0 +1,618 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For string values, '' is considered empty. + case 'string': + return $value === ''; + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param float|int|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Europharmacy\EuromedicaClient\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..485899a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./lib/Api + ./lib/Model + + + + + ./test/Api + ./test/Model + + + + + + diff --git a/test/Api/CustomersApiTest.php b/test/Api/CustomersApiTest.php new file mode 100644 index 0000000..aff5371 --- /dev/null +++ b/test/Api/CustomersApiTest.php @@ -0,0 +1,110 @@ +